Install Apache
sudo apt-get update
sudo apt-get install apache2
vim /etc/apache2/httpd.conf
Add this line: ServerName localhost
To check if Apache is installed, direct your browser to your server’s IP address (eg. http://12.34.56.789). The page should display the words “It works!”
Install MySQL
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
During the installation, MySQL will ask you to set a root password.
Once you have installed MySQL, we should activate it with this command:
sudo mysql_install_db
Finish up by running the MySQL set up script:
sudo /usr/bin/mysql_secure_installation
It’s easiest just to say Yes to all the options. At the end, MySQL will reload and implement the new changes.
Create a new database for your site.
mysqladmin -u root -p create commerce
Install PHP
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
sudo apt-get install php5-gd
sudo apt-get install php5-curl