How do I install LAMP on my new basic server?

Important Notes:

This guide will show you how to install Apache, mySQL, and PHP from the Linux command line.

Getting Started:

  1. Log into your server using SSH

  2. First, we'll install apache. Issue the following command to install apache:


      [root@server] yum install httpd mysql-server php mysql php-mysql

  3. Next, we need to make sure that the firewall is configured to save its settings when stopped or restarted:

    Edit /etc/sysconfig/iptables-config and make sure following variables are set to “yes”:



  1. Finally, we need to add the firewall rules allowing access to the HTTP and HTTPS ports and set SELinux to be permissive:

[root@server] iptables -I INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 80 -j ACCEPT
[root@server] iptables -I INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 443 -j ACCEPT
[root@server] service iptables restart
[root@server] echo 0 >/selinux/enforce

The LAMP stack should now be fully functional and accessible on your server.

This article has been provided by Codero Hosting, the leading provider of reliable dedicated, managed and cloud hosting services. Need more information on this topic or to learn more about Codero’s hosting services please visit www.codero.comchat with us online or give us a call at 866-2-CODERO.

Posted in
Last update:
2015-12-03 20:39
Average rating:0 (0 Votes)