How to install LAMP stack on VPS ie UBUNTU (Linux, Apache, MySQL, PHP)

We provide a LAMP stack one click template based on Debian OS however we have received requests from our client for LAMP over Ubuntu – We are creating this tutorial to be short and simple… Thanks to Ubuntu Team for putting this together

To install Apache you must install the Metapackage apache2. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt-get install apache2

2. Install MySQL

To install MySQL you must install the Metapackage mysql-server. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt-get install mysql-server

3. Install PHP

To install PHP you must install the Metapackages php5 and libapache2-mod-php5. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt-get install php5 libapache2-mod-php5

4. Restart Server

Your server should restart Apache automatically after the installation of both MySQL and PHP. If it doesn’t, execute this command.

sudo /etc/init.d/apache2 restart

5. Check Apache

Open a web browser and navigate tohttp://localhost/. You should see a message saying It works! To find your server address :

ifconfig eth0 | grep inet | awk '{ print $2 }'

6. Check PHP

You can check your PHP by executing any PHP file from within /var/www/. Alternatively you can execute the following command, which will make PHP run the code without the need for creating a file .

php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";'

Congratulations, you have just Installed a Ubuntu based LAMP Server!

 

You can actually create this setup on our platform in few minutes utilizing our PCS (Private Cloud Solution) which allows you to have VPSie(s) on a private network – NAT – Port forward – traffic control for inbound and outbound – multiple gateway IPs which you could use for the load-balancing and failover.