Install LAMP on CentOS 6 (MySQL 5.5, PHP 5.6)

This brief guide will show you how to successfully install a LAMP stack (Linux, Apache, MySQL, PhpMyAdmin) on CentOS 6 with MySQL 5.5 and PHP 5.6. First update all of your current system packages and install some prerequisites.

yum update -y
yum install -y zip unzip wget nano

Install and start Apache.

yum install -y httpd
service httpd start

Now go to your web browser and navigate to http://your_server_ip, if all if well, it will connect with an apache test page. If it times out, you may need to add proper firewall rules to allow port 80 access, try using the command below.

iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
service iptables save

Now we can install the MySQL server and PHP. To install the newest versions we will be using the webtatic RPM.

rpm -Uvh

Now lets install both and remove the old MySQL libs:

yum remove mysql-libs* -y
yum install -y mysql55w-server
yum install -y php56w php56w-mbstring php56w-mysql php56w-sqlite php56w-gd php56w-xml php56w-cli

Now start MySQL and run the secure installation, with this you can set a root password and change a few options.

service mysqld start

You should get the following output:

Enter current password for root (enter for none): **Press enter here then enter in your desired root password and press enter again**
Remove anonymous users? [Y/n] y
Disable root lo gin remotely? [Y/n] y
Remove test database and access to it? [Y/n] yReload privilege tables now? [Y/n]

Now we need to edit the httpd.conf to change "AllowOverride" option for our public web directory. This is optional but may help with scripts that use an .htaccess file. We will use nano to edit the file.

nano /etc/httpd/conf/httpd.conf

Now press CTRL + W to search the file, search for "AllowOverride", when it finds the first result, press CTRL + W again and search "AllowOverride" one more time. This will bring you to the /var/www/html section. Now change "AllowOverride None" to "AllowOverride All"

Now restart Apache to finalize the changes.

service httpd restart

Lets go ahead and make both run at boot.

chkconfig httpd on
chkconfig mysqld on

Lets setup PhpMyAdmin now. This can be done easily with a few commands.

unzip php*
rm -rf
mv php* phpmyadmin
mv phpmyadmin /var/www/html/phpmyadmin
mv /var/www/html/phpmyadmin/ /var/www/html/phpmyadmin/

We also recommend disabling SELinux as it may cause permissions related issues with Apache. Run the following command:

setenforce 0

Then edit the SELinux configuration file and change "SELINUX=permissive" to "SELINUX=disabled" and save the changes.

nano /etc/selinux/config

All done!
  • 13 Users Found This Useful
Was this answer helpful?

Related Articles

Install ownCloud on CentOS 6

We will be setting up ownCloud on a fresh CentOS 6.6 64-bit installation. ownCloud is an open...

Install PPTP / PPP Proxy Server on CentOS 6

PPTP Proxy is an easy to setup proxy server that can be used as an OpenVPN alternative, and many...

Install VNC Server and Desktop on CentOS 6

Install the desktop environment that we will use:yum groupinstall Desktop -yInstall the TigerVNC...

Install Multicraft 2.0 on CentOS 6

Run a Minecraft server? Multicraft is the most commonly used management control panel for...

Setup Teamspeak 3 Server on Linux (CentOS)

If you run a gaming community, a Teamspeak 3 server is probably a popular choice for you to have...

Powered by WHMCompleteSolution