HOWTO: Set up a local server on your Ubuntu Desktop
Setting up a server on your Ubuntu Desktop is essential for any web developer to know how to do. There are two ways to do this, using the Synaptic Packet Manager, or install through the command line. This blog will be doing the latter. First we need to update the package lists
~$ sudo apt-get updateThis will make sure our source lists are up to date with all the current packages availiable. Now, install all of the essentials
~$ sudo apt-get install apache2 mysql-client mysql-server php5 libapache2-mod-php5 php5-mysql phpmyadmin php5-gd
Everything is set for you to run your applications locally. Now create a web folder in your home directory and have it connected through by a symbolic link in the localhost directory. To do this, follow the commands below.
~$ cd ~$ mkdir www ~$ sudo ln -s /home/yourusername/www/ /var/www/yourusername ~$ echo "<h1>It Works</h1>" > www/index.html
Now open up your browser and enter the follwing URL into your location bar
http://localhost/yourusername
If you see It Works in big bold letters, then you have correctly set up your local server. I've included a shell script that runs all the commands listed above. Run it from your command line and it will do everything for you.
Download
Latest: localserver.sh.zipReleased: March 16, 2009
RSS