How to Install LAMP on VPS CentOS 6, 7 32 or 64 bit


After you purchase a VPS and successfully run a Remote Server via SSH Putty. Next install the LAMP. LAMP is a term that stands for Linux, Apache, MySQL and Perl/PHP/Python. Is a free software package that is used to run an application.


The components of the LAMP:

  • Operating system Linux
  • Apache HTTP Server –
  • Web server
  • MariaDB or MySQL database system
  • PHP or Perl or Python programming languages used

A. Install LAMP

open it and run the Program Putty (how to use putty). Log in as root.

Update system

yum update

B. How to Install LAMP in CentOS VPS

  1. How to Install Apachetype the following code:
yum -y install httpd

Press Enter, and then type the following code in order to service the apache server running when the system reboots.

chkconfig --levels 235 httpd on

2. How to Install MySql

Install the MySQL Server with the following code:

yum -y install mysql mysql-server

Make sure the service is running when the system is rebooted:

chkconfig --levels 235 mysqld on

Start The MySQL Server

/etc/init.d/mysqld start

MySQL security setup, type the following code and follow the step by step.


When you are prompted to enter a password the first time disregard it directly press enter. Then if there is a question of creating a password select Y then enter and type the password you want. The next question and answer with Y until installation is complete/successful:

3. How to Install PHP

the following code will automatically install the php and php-mysql

yum -y install php
yum -y install php-mysql

4. How to Install PHP Modules

Next to install the PHP module module most used in building the website. Here’s the code to install the php module:

yum -y install php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy curl curl-devel

Install APC to chacing and optimize the performance of php scripts.

yum -y install php-pecl-apc

5. How to Start/Restart Apache Server

To start and restart apache code as follows:

/etc/init.d/httpd start
/etc/init.d/httpd restart

6. how to Check the Apache Server

Test whether apache runs perfect. Open your browser and type the IP address of your VPS.

Example :

7. How to Check PHP Modules & Check the PHP Info and any Module is active:

vi /var/www/html/info.php

Press the letter i on the keyboard and type

<?php phpinfo();

then Ctrl + C > type: wq to save and exit the editor vim.  See in browser:




This site uses Akismet to reduce spam. Learn how your comment data is processed.