4 easiest ways to install LAMP server on Ubuntu
In this guide I will show you the easiest way, how to install a LAMP server. LAMP stands for Linux, Apache, MySQL, PHP. There are many methods to install LAMP, for example the standart one see this howto for ubuntu: Howto: Install LAMP and phpMyAdmin on Ubuntu
Method One (using Terminal)
Under Terminal type command:
sudo tasksel
Select LAMP server and hit OK
If prompted, insert new root password for the MySQL
Method Two (using Terminal)
sudo tasksel install lamp-server
Method Three (using Terminal)
sudo apt-get install php5 apache2 mysql-server
Method Four (using Synaptic Package Manager)
Run System > Administration > Synaptic Package Manager and select Edit > Mark Packages by Task…
Select LAMP server
In the next step you can see packages, that would be installed
Enter new password for the MySQL root user
and that's it..
Testing Apache
Open a web browser and enter the address http://localhost. You should see a webpage displaying the text "It Works!"
Testing PHP
To test our PHP installation we need to create file called info.php in /var/www. Open Terminal and enter:
sudo gedit /var/www/info.php
Enter the line below, save the file, and exit the text editor.
<? phpinfo(); ?>
Restart apache
sudo /etc/init.d/apache2 restart
Now, open your browser and enter http://localhost/info.php. You should see a bunch of information about your version of PHP.
Optional
phpMyAdmin
This step is optional. To easy access MySQL databases use phpMyAdmin.
Under Terminal enter this command to install phpMyAdmin
sudo apt-get install phpmyadmin
If prompted, use the spacebar to mark apache2 and then hit Enter.
You will also be asked if you want to configure phpMyAdmin with a new database called dbconfig-common. Select Yes and press Enter.
Next you'll be prompted for the password for MySQL's administrator. Enter the MySQL root password that you created earlier in the installation. Select Yes and press Enter.
Next you'll be prompted to create an application password for phpMyAdmin to talk to MySQL. If you leave it blank, a random password will be generated for you.
After configuring the password, the installation should complete.
Testing MySQL (phpMyAdmin)
Open a web browser and enter the address http://localhost/phpmyadmin.You should see this page:
Login using the username root and the root password, that you created earlier.
The LAMP server is successfully installed.
binh
8 May, 2012
thanks a lot
Timothy Mwirabua
8 Oct, 2013
I used method 2
sudo tasksel install lamp-server, then what? HOW DO I RUN IT?????!!!
lukacavic
20 Oct, 2013
Hello, can you show how to autostart apache?
Liviu Varlam
9 Jun, 2015
info.php not opening anything. it just stands there with a white blank page. not even a 404 error. nothing. what’s wrong? is php installed properly?
enjoy
9 Jun, 2015
white page in php, also called white page of death, means you have some error in your info.php and you have turned off showing php errors. Check info.php first. Secondly look in your /var/log/ for apache or httpd error logs. And don’t forget to turn on showing errors in your vhost file.