This tutorial should help you on your way with how you how to install LAMP on Ubuntu. This article was written based on Ubuntu 12.10 which included Apache 2.2.22, Mysql 5.5.31 and PHP 5.4.6-1. However, this article should work just fine on 12.04 as well.
Steps:
Before we begin it’s worth making sure your install is all up to date by running these commands:
Update your package index’s:
apt-get update
Update the packages you already have installed:
apt-get upgrade
Install Apache
Installing the Apache2 web server in Ubuntu is pretty straight forwards:
apt-get install apache2
Done. If you type the IP of your server into a web browser, you should see the page of joy that says “It works!”
Install MySQL
Installing the MySQL database server in Ubuntu is also fairly simple:
apt-get install mysql-server
During the install you will be asked to set a root user password. We strongly recommend doing this.
To test your installation is working and mysql has been started. Type the following which will connect to your MySQL and prompt you for your root password:
mysql -p
If you end up with mysql>
prompt then it’s been installed and has started.
Install PHP5
apt-get install php5 php5-mysql
To test that your LAMP stack is all working and installed correctlty we’ll make a very simple php page:
echo "<?php phpinfo(); ?>" >> /var/www/test.php
Then open http://<<your server ip>>>>/test.php in your favourtie web browser and you should get the php config page. For example http://192.168.0.1/test.php
That’s it, Ubuntu and LAMP (technically and AMP) all setup and ready to go.
If you need any further info, please let us know in comments.
Thanks for stopping by.