Installing LAMP on Ubuntu 14.04 64 VPS

Installing LAMP on Ubuntu 14.04 64-bit

LAMP refers to Linux, Apache, MySQL, PHP, one of the most popular combinations to serve up web content. If you just installed a bare bones server image, and need instructions, you came to the right place.

The instructions were verified on InterServer`s OpenVZ VPS Hosting service, utilizing Ubuntu 14.04 64-bit minimal version.


  • InterServer’s OpenVZ VPS Hosting with Ubuntu 14.04 64-bit (instructions are for minimal distribution, but should work for regular distribution as well).
  • Putty or similar SSH client
  • root login and password or an account capable of sudo
  • nano or similar text editor installed on the server.

Install Apache

  • sudo apt-get update
  • sudo apt-get install apache2

Verify the server installed
Using your web browser, type the URL or IP Address of your server. If your site does not come up with the name, this could indicate a DNS issue, so try the IP address that was listed in your welcome email from Interserve, instead.

You should see this screen:

Install MySQL

  • sudo apt-get install mysql-server

Note: The mysql-server install caused us some problems, which were resolved by running apt-get install bsdutils, then sudo apt-get --reinstall install mysql-server.

Additionally, if you receive a "Failed to Fork" arror message, stop Apache and try again (sudo service apache2 stop) and try reinstalling (sudo apt-get --reinstall install mysql-server).

Check Mysql's status sudo service mysql status

We can now install the php5-mysql module to connect php to mysql. Normally, this is done in conjunction with MySQL, however, because of the problems we experienced, we are doing it separately, to better isolate any problems.

  • sudo apt-get install php5-mysql

Now, will allow mysql to create the database structure:

  • sudo mysql_install_db

Secure your mysql installation by removing unnecessary elements:

  • sudo mysql_secure_installation

Install PHP

Will install php5, along with a few popular php modules.

  • sudo apt-get install php5 php-pear php5-gd php5-mcrypt php5-curl

Back to Apache

Will need to modify the dir.conf file, to let Apache prioritize php files over html. In other words, index.php will be given priority over index.html, when no file is mentioned (

  • sudo nano /etc/apache2/mods-enabled/dir.conf

The line we are seeking within the file looks like this:

DirectoryIndex index.html index.cgi index.php index.xhtml index.htm

Change it to this:

DirectoryIndex index.php index.cgi index.html index.xhtml index.htm

Restart Apache, so the changes take effect:

sudo service apache2 restart

Let’s test, to make sure everything is working:

sudo nano /var/www/html/test.php

Will use phpinfo() to show our configuration. Write the following line:

  • <?php phpinfo(); ?>
  • Close out and save Ctrl-X and y

Use your browser to view test.php (, or yourip/test.php)

  • If you received the same page as the picture above, your LAMP server is ready.

Let’s clean up the file we created for testing:

  • sudo rm /var/www/html/test.php

Your LAMP installation is finished. You may need to install additional modules in the future, according to your needs (check requirements for any php scripts you may be installing).

This website is supported by our affiliation with web hosting companies. We encourage you to visit our friends at Interserver. They really do offer $6 per month VPS Hosting. Linux, windows and cpanel available, have super fast service, and they care about their customers!

See more articles in: Instructions, InterServer, Ubuntu

comments powered by Disqus