Installing LAMP (Apache/MySQL/PHP) stack on Ubuntu
LAMP or Linux, Apache, MySQL, and PHP is the default software stack most PHP+MySQL based applications use, it's the easiest and quickest way to get your PHP+MySQL application online. A LAMP stack can be installed on your Ubuntu install with the following commands.
Updating the system
We first update the system to make sure that all our installed packages are upto date. Your Ubuntu system can be updated easily with the following command,
apt-get update && apt-get upgrade
Install Apache
Apache can be installed with the following command, usually Apache comes pre-installed on the default Ubuntu images we have but if your VPS has been installed with a minimal OS image, then it won't come with Apache pre-installed.
apt-get install apache2
Once the install finishes, start Apache with the following command,
service apache2 start
Install PHP
Here we install PHP and the PHP-mysql plugin for PHP to communicate with your MySQL server.
apt-get install php php-mysql
Restart Apache so that Apache detects PHP and enables it,
service apache2 restart
Install MySQL
MySQL can be installed with the following command,
apt-get install mysql-server
Setup MySQL with a root password
/usr/bin/mysql_secure_installation
Start MySQL once the above step is complete,
service mysql start
Set Apache/MySQL services to start on boot
update-rc.d apache2 enable
update-rc.d mysql enable
Done! Load your VPSes IP address in the browser and it should display the default Apache page!
All your files to be displayed go into the default web-root at
/var/www/