Ask a Question
Advertise on boostr.in
Setting Up a LAMP Server In Ubuntu
LAMP stands for Linux, Apache, MySQL and PHP. It is the most widely used combination for setting up a Web Server. By far, the easiest way to install LAMP server is simply installing the Ubuntu Server Edition itself. However, many of us have installed the Ubuntu Desktop edition, only to find that we need to set up a LAMP server later on. In the following tutorial, I am going to show you how to install and configure a LAMP server in your Ubuntu Hardy Heron in less than 10 minutes.
Installing Apache, Php and MySql
In your Ubuntu desktop, go to System->Administration->Synaptic Package Manager.
Scroll down the list to search for apache2. Check the box beside it and select â€˜Mark for installationâ€˜. This will also install other dependency packages. When prompted, click â€˜Markâ€˜.
Apache in Synaptic Package Manager
Next, scroll down the list and search for php5. Similarly, place a check beside the box and select â€˜Mark for installationâ€˜.
PHP5 in Synpatic Package Manager
Do the same for â€˜mysql-serverâ€˜ and â€˜phpmyadminâ€˜
MySQL in Synpatic Package Manager
phpmyadmin in Synpatic Package Manager
Once you are done, click â€˜Applyâ€˜ on the top icon bar.
The Synaptic Package Manager will now fetch all the files and install it in your Ubuntu.
When installing MySQL, you will be prompted to enter and reconfirm your password. Make sure that you enter a password that you can remember.
Setting mysql password
Also, the phpmyadmin will ask you which version of apache to use. Select apache2
Testing your installation
Once you have finished installing the LAMP, you will need to test if it is working.
Open your browser and point the URL to http://localhost
If you see the words â€˜It worksâ€™, then apache is working fine.
Next, you want to create a php file to test your php setting.
gksu gedit /var/www/testphp.php
paste the following line to the file
Save and close the file.
In your browser, point the URL to http://localhost/testphp.php. You should see all the php information on the browser. If it prompt you to download the file, then your php configuration is not successful. Go to Synaptic Package Manager and reinstall php5
Testing of phpmyadmin
On your browser, go to http://localhost/phpmyadmin. It should loads up the phpmyadmin login page. Log in with the user name root and the password you supplied when installing.
phpmyadmin login page
This will bring you to the main screen of phpmyadmin.
Putting it all together
To test if the apache, php5, MySQL and phpmyadmin are working together, we can test it out by installing WordPress.
Download WordPress here.
Extract the wordpress folder to your home folder.
Inside the folder, open up the wp-config-sample.php file. Edit the following information.
define(â€˜DB_NAMEâ€™, â€˜wordpressâ€™); Â Â Â // The name of the database
define(â€˜DB_USERâ€™, â€˜rootâ€™); Â Â Â Â // Your MySQL username
define(â€˜DB_PASSWORDâ€™, â€˜yourpasswordhereâ€™); // â€¦and password
Remember to change the â€˜yourpasswordhereâ€˜ to the password that you supplied during the MySQL installation.
Save the file as wp-config.php.
Next in your phpmyadmin, create a new database call wordpress.
Open a terminal, copy the wordpress folder to the apache working directory (the working directory is located at /var/www)
sudo cp -R wordpress /var/www/
Once done, on your browser, go to http://localhost/wordpress. The famous 5 minutes installation will show on screen. Follow the instructions. If is your LAMP configuration is good, your wordpress will be up in 1 minute.
Jun 9, 2015
to add a comment.
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please