How to install Linux, Apache, MariaDB, PHP (LAMP) on CentOS 7

How to install Linux, Apache, MariaDB, PHP (LAMP) on CentOS 7
In this tutorial we will show you how to install Linux, Apache, MySQL, PHP (LAMP) on CentOS 7 VPS.


The acronym LAMP refers to first letters of the four components of a solution stack, composed entirely of free and open-source software, suitable for building high-availability heavy-duty dynamic web sites, and capable of serving tens of thousands of requests simultaneously.

The meaning of the LAMP acronym depends on which specific components are used as part of the actual bundle:

  • Linux, the operating system (i.e. not just the Linux kernel, but also glibc and some other essential components of an operating system)Apache HTTP Server, the web server
  • MySQL or MariaDB, the database management system
  • PHP, Perl, or Python, the scripting languages (respectively programming languages) used for dynamic web pages and web development.


The Apache HTTP Server is one of the most popular, free and powerful web server in the world. It is easy to use and you can administer it with ease and flexibility.

Installing Apache on a CentOS VPS is pretty easy and straight forward procedure.


First, you will need to log in to your VPS as ROOT via SSH. Once you are in you can clean-up yum (this is not a necessary step but it won’t hurt). To do that just type:

yum clean all

Another step that you can take and it is always a good practice is to update your packages. To do that just type:

yum -y update

Now, we can install Apache. To do that just type:

yum -y install httpd

And’t that’s it. To start the Apache service type:

systemctl start httpd


MariaDB is a community-developed fork of the MySQL relational database management system intended to remain free under the GNU GPL. Being a fork of a leading open source software system, it is notable for being led by the original developers of MySQL, who forked it due to concerns over its acquisition by Oracle.

To install MariaDB simply type:

yum install mariadb-server

Once the installation is done you can start the MariaDB service with the following command:

systemctl start mariadb.service

Also, you may want to execute:


The above command will walk you through the process of setting up your root password and some basic security.


PHP is a recursive acronym for PHP: Hypertext Preprocessor. PHP is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. It is also easy to learn and use. All the popular web applications like WordPress, Joomla and many more  are written in PHP. If you want to be able to develop your websites using PHP, you must first install it first.

To install PHP just type:

yum install php php-pear php-mysql

Please note that you must restart the Apache serivce for the changes to take effects. To do that just type:

systemctl restart httpd

If you’re one of our Linux VPS Hosting customers we can help you install and configure the LAMP stack on your virtual server for you free of charge. Just contact us and some of our experts will complete your request immediately.