LAMP Package Setup

Here's a job you'll get often as a systems administrator: install and configure a new server with LAMP software package: Apache + MySQL/MariaDB + PHP, including apache mod_ruid2.
To be honest with you, it's not very exciting but let's dig in anyway.

Let’s assume that we have freshly installed CentOS 6 server that needs to be configured.
You probably want to run the updater first and wait for it to finish:

[root@ServerSuitTest ~]# yum update

Then we need to install apache2 package:

[root@ServerSuitTest ~]# yum install httpd

Let’s add ServerName directive to the Apache config file, allow Apache daemon launch at server boot and start it immediately:

[root@ServerSuitTest ~]# chkconfig httpd on
[root@ServerSuitTest ~]# echo ServerName *:80 >> /etc/httpd/conf/httpd.conf
[root@ServerSuitTest ~]# service httpd start

If you try to open the default Apache page right now, however, you'll likely see a connection error page in your browser. The problem is that CentOS's default iptables configuration restricts any connections to the server except SSH connections and ICMP protocol packages.
So you need to add iptables rule for HTTP protocol and save iptables config:

[root@ServerSuitTest ~]# iptables -A INPUT 1 -p tcp --dport 80 -j ACCEPT
[root@ServerSuitTest ~]# iptables-save > /etc/sysconfig/iptables

We also need to install apache mod_ruid2 package, which requires some prerequisite packages itself:

[root@ServerSuitTest ~]# yum install httpd-devel gcc libcap-devel

After that, download the latest version of Apache mod_ruid2 from, compile and install it:

[root@ServerSuitTest ~]# tar xvf mod_ruid2-0.9.8.tar.bz2
[root@ServerSuitTest ~]# cd mod_ruid2-0.9.8
[root@ServerSuitTest mod_ruid2-0.9.8]# apxs -a -i -l cap -c mod_ruid2.c 

That's the end of the setup; mod_ruid is compiled and will be loaded after Apache2 restarts.
You should now check to make sure it's configured correctly by running the commands shown below:

[root@ServerSuitTest ~]# cat /etc/httpd/conf/httpd.conf | grep ruid2
LoadModule ruid2_module /usr/lib64/httpd/modules/ 

[root@ServerSuitTest ~]# service httpd restart 
Stopping httpd: [ OK ] 
Starting httpd: [ OK ]

Now, let’s install MariaDB server:
We’ll need to add a MariaDB repository first, by editing the file /etc/yum.repos.d/MariaDB.repo and adding in following lines to it:

[root@ServerSuitTest ~]# nano /etc/yum.repos.d/MariaDB.repo

name = MariaDB
baseurl =

[root@ServerSuitTest ~]# yum install MariaDB-server MariaDB-client

Just as we did with Apache daemon, we need to allow MariaDB server to start at boot. We also need to manually start it up the first time we run it:

[root@ServerSuitTest ~]# chkconfig mysql on
[root@ServerSuitTest ~]# service mysql start

And finally install PHP:

[root@ServerSuitTest ~]# yum install php php-mysql php-common php-mcrypt \
php-xml php-gd php-devel

Then we’ll need to restart Apache daemon so our changes takes effect:

[root@ServerSuitTest ~]# service httpd restart

Now you can test that it’s working:

[root@ServerSuitTest ~]# echo "<?php phpinfo(); ?>" > /var/www/html/index.php

You can go to http://<your server IP address>/index.php and see PHP configuration info page:

PHP Version 5.3.3 preview ServerSuit

Basic installation and configuration of LAMP is complete.
I really hope this was more fun for you than it was for me.

You can go through these steps everytime you need to setup LAMP.  I got to let you know, though, that ServerSuit has the whole LAMP stack pre-configured!

Once you add your server to the dashboard, you just need to select the LAMP package, and click install. Does it make it more fun? Unlikely, but it does make it faster and easier, which is still a win for everyone.

ServerSuit server administration dashboard preview

Go to ‘Software’ tab, choose ’LAMP package’, and click to ‘Install LAMP Package’ button.
That’s it.

Within minutes, depending of your server bandwidth, you’ll have completely configured LAMP server. Don't forget to follow us @serversuit to keep up with new articles and updates.

March 01 2016

Add or review comments

Please leave your comment

Existing comments

Comments 4

Joe Bonamassa is a famous country singer, so don't miss the possibility to visit [url=]Joe Bonamassa Davenport tickets [/url]
Looking for the best app to watch free movies on your Android phone? Then your should check Showbox Application. This is the most famous app today that has a big library of tv shows and movies. This app is also available for pc users. But your need to download it first to enjoy free tv-shows [url=][/url]
Looking for the best app to watch free movies on your iOS phone? Then your should check Showbox app. This is the most famous app today that has a big library of shows and films. This app is also available for Mac users. But your need to download it first to enjoy free films [url=]Showbox[/url]
Elton John is my favourite piano musician of the world. I’m encouraged to present for you this tour schedule. Check [url=]Elton John tickets Canada tour[/url] website to get your best ticket for the retirement Elton John tour 2019.

Get notified about new publications and product updates.
Please note we do not share information to anyone.