Installing Xampp-1.7.7 Web server in Ubuntu 11.10
If you are a web designer/developer, you need to have a running 
local server to test your website. Installing a full pledged server and 
all of its components manually is a very tedious task because you first 
need to install the actual server (like apache) then download all 
modules that you need (MYSql, PHP, etc) and configure them to make all 
the bits and pieces to work together. Thanks to folks at 
apachefriends.org,
 we can have a working server with all of the required modules (Apache, 
PHP, MYSql, etc) just by installing a single application called Xampp. 
In this post we will see how to install Xampp-1.7.7 on Ubuntu 11.10.
Download the package
Fire up the terminal and issue the following command to download the 
.tar.gz package
If the download is interrupted for some reason, fear not, because 
wget can resume interrupted downloads. Simply execute the following command
Observe the 
-c switch in the command, it tells 
wget to resume the previously interrupted download.
Extract Contents
After the downloading is finished, extract the tar package into 
/opt directory.
| 
 | 
 | 
 | sudotarxvfz xampp-1.7.7.tar.gz -C /opt |  |  | 
 
 
 
You need 
root password to run the following command.
Start the Server
If the above command executed with no errors, then, the server is 
correctly installed. Now to start the server, issue the following the 
command
| 1 | sudo/opt/lampp/lampp start | 
 
 
 
Point to note, 
xampp under linux is called 
lampp.
To check if the server is running open any web browser and type 
http://localhost in the address bar. You should see the following welcome screen.
Shutdown the Server
If you need to shut down the server, run the following command in the terminal
| 
 | sudo/opt/lampp/lampp stop | 
 
 
 
Adding Custom .html pages
Ok, you got server up and running, but where should you put your html
 files? By default Xampp (Apache) expects all your website related files
 inside 
/opt/lampp/htdocs folder. Let us create a test page, 
test.html, with the following contents,
| 
 | <h3>This is a test page</h3> | 
 
 
 
Now if you try to save the file in 
/opt/lampp/htdocs/ directory, you will get an error because of authentication problem. This is because, currently only root has access to 
/opt/lampp/htdocs/ directory
Authentication Issue
The following commands solves the authentication issues,
| 
 | sudoadduser USERNAME www-data | 
 
| 
 | sudochown-R USERNAME:www-data /opt/lampp/htdocs | 
 
| 
 | sudochmod-R g+rw /opt/lampp/htdoc | 
 
 
 
Replace 
USERNAME with your 
username. What the above commands actually does is
- It adds you (User) to www-data(Group)
- Changes the ownership of the /opt/lampp/htdocsdirectory so that you will be the owner.
- Issue read+writepermissions to the groupwww-data
Now, you can add the file, 
test.html, to 
/opt/lampp/htdocs folder. If everything is done correctly, you can view the file from browser by clicking this link 
http://localhost/test.html.
Create symbolic link [optional]
To make things simple, you can create a link in your home folder that points to 
/opt/lampp/htdocs folder
| 
 | sudoln-s /opt/lampp/htdocs /home/USERNAME/htdocs | 
 
 
 
So that’s it for now. In the next post, I will tell you how to host multiple websites in your local server…
 
 
No comments:
Post a Comment