This article contains instructions to setup Apache web server, MySQL database server, and PHP scripting language on your Linux Cloud Server (LAMP).

If needed, configure your hostname and issue the following commands to confirm them:

hostname
hostname –f

Also make sure you have the latest package repositories. Use the following command to do this:

  • CentOS:
    yum update
  • Debian:
    apt-get update
    apt-get upgrade --show-upgraded
  • Ubuntu:
    pt-get update
    apt-get upgrade --show-upgraded
OS  Apache  MySQL PHP 
CentOS Install the current version of Apache web server:
yum install httpd
  1. Install the current version of MySQL database server:
    yum install mysql-server
    If you wish to have MySQL run by default when the system boots, run the following command after MySQL completes installing:
    /sbin/chkconfig –levels 235 mysqld on
  2. Start the mysql daemon:
    /etc/init.d/mysqld start
Install the included PHP from CentOS Packages:
yum install php php-pear php-mysql
Debian Install the current version of Apache web server:
apt-get install apache2

If you wish to make use of Apache’s mod_rewrite issue the following command:
a2enmod rewrite

  1. Install the current version of MySQL database server:
    apt-get install mysql-server
  2. Once completed, it is recommended that you run mysql_secure_installation to help secure the MySQL Server.
  1. Install the included PHP from Debian Packages:
    apt-get install php5 php-pear php5-mysql php5-suhosin
  2. Once you have completed the install, you will need to restart Apache:
    /etc/init.d/apache2 restart
Ubuntu Install the current version of Apache web server:
apt-get install apache2

If you wish to make use of Apache’s mod_rewrite issue the following command:
a2enmod rewrite

  1. Install the current version of MySQL database server:
    apt-get install mysql-server
  2. Once completed, it is recommended that you run mysql_secure_installation to help secure the MySQL Server.
  1. Install the included PHP from Debian Packages:
    apt-get install php5 php-pear php5-mysql php5-suhosin
  2. Once you have completed the install, you will need to restart Apache:
    service apache2 reload