Recommended VPS Complete list of best VPS hosting providers.

How to Build LAMP Server on CentOS 6.4

I’ve explained how to build a LAMP server (Linux, Apache, MySQL, PHP) on CentOS but this page will focus mainly on CentOS 6.4. The whole steps are basically similar but I will show it again in shorter way assuming you knew some basic skills already. So read on!

Some FYIs:

How to Install Apache, MySQL, PHP on CentOS 6.4 Server

Step 1 – Add Remi repository (optional but you better do this):

The command syntax for CentOS 6.4 on 32bit server:

rpm -Uvh
rpm -Uvh

The command syntax for CentOS 6.4 on 64bit server:

rpm -Uvh
rpm -Uvh

Step 2 – It’s time to use the magic spell: a single command syntax to install Apache, MySQL5 and PHP5 on CentOS 6.4:

yum --enablerepo=remi,remi-test install httpd mysql mysql-server php php-common

Step 3 – Install some necessary PHP modules (I’ve explained it already in most of my tutorials). Use this command to check all available modules:

yum search php

In my example I will install:

  1. MySQL (php-mysql) – A extension for PHP applications that use MySQL databases.
  2. PostgreSQL (php-pgsql) – A extension for PostgreSQL database for PHP.
  3. MongoDB (php-pecl-mongo) – A driver for MongoDB database.
  4. SQLite (php-sqlite) – Extension for SQLite Database Engine.
  5. Memcache (php-pecl-memcache) – Memcached caching daemon.
  6. Memcached (php-pecl-memcached) – Memcached caching daemon.
  7. GD (php-gd) – GD extension for PHP application to serve graphics.
  8. XML (php-xml) – XML Parser for PHP applications.
  9. MBString (php-mbstring) – Mbstring extension is used to handle multi-byte string in PHP applications.
  10. MCrypt (php-mcrypt) – A Mcrypt library for PHP scripts.
  11. APC (php-pecl-apc) – APC module used to optimize and cache PHP code.
  12. CLI (php-cli) – Command-line interface for PHP.
  13. PEAR (php-pear) – Application Repository framework for PHP.
  14. PDO (php-pdo) – Database access module for PHP applications.

So the final command syntax looks like this:

yum --enablerepo=remi,remi-test install php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo

Step 4 – You have to also configure your system to start Apache and MySQL service at boot time:

chkconfig --levels 235 httpd on
chkconfig --levels 235 mysqld on

Step 5 – Fire up Apache (start it to run at the very first time):

/etc/init.d/httpd start

Step 6 – Also start MySQL service:

/etc/init.d/mysqld start

That’s it. Catch all tutorials about CentOS here.

Further reading:

  1. Top Most Common Basic MySQL Commands
  2. How To Zip (Compress) and Unzip (Extract) Files
  3. How To Move Website From cPanel-based Hosting To Your Server
  4. Using SFTP To Upload and Manage Files On Your Server


Add a Comment

Your email address will not be published. Required fields are marked *

Get more stuff like this
in your inbox

Subscribe and get interesting stuff plus faster updates to your email.