•  Home
  •  Dashboard
  •  Company
    • About Us
    • Blog
    • Careers
    • Contact Us
    • Data Centers
    • Looking Glass
    • Network
    • Reseller
  •  Hosting Services
    • Backup
    • Content Delivery Network
    • Colocation Hosting
    • Dedicated Hosting
    • DDoS Mitigation
    • IP Transit
    • Private Cloud
    • Wavelength
  •  Solutions
    • Ecommerce
    • Finance
    • Gaming
    • Hosting
    • Management
    • Security
    • System Integrator
  •  Support
    • Community
    • Knowledge Base
    • Open A Ticket
  •  USA & Canada: 800-933-1517
  •  International: 626-549-2801
  •  Email: sales@psychz.net
  • Services
    • Dedicated Servers
    • Colocation
    • Private Cloud
    • DDos Protection
    • IP Transit
    • CDN
    • Backup
  • Solutions
    • Ecommerce
    • Security
    • Gaming
    • Hosting
    • Management
    • Finance
    • System Integrator
  • Dashboard

Installation of Lamp Stack on CentOS 7

Trusted By
25,000+ Customers (Since 2001)
  • Home
  • Client
  • Knowledgebase
  • Linux
  • Centos 7
  • Installation of Lamp Stack on CentOS 7

Table Of Content

Related Articles

  • How to configure IP's On Centos 7?
  • Installing MariaDB on Centos 7
  • How to install the GCC compiler in CentOS 7?
  • How to Install SSL Certificate On Centos 7
  • Linux Command Line Tutorial For Git
  • How To Install Git On Centos 7
  • Yum Update Not Working on Centos 7
  • Views: (5512)
  • Votes: (-10)
Was this article helpful?
VOTE

Installation of Lamp Stack on CentOS 7

Publisher: Psychz Networks,  January 24,2019

A LAMP (Linux, Apache, MySQL, PHP) stack is a common web stack used to prepare servers for hosting web content. Following steps will shows you how to install a LAMP stack on a Virtual Private Server (VPS). LAMP is an archetypal model of web service stacks. It stands for four open-source components: the Linux operating system, the Apache HTTP Server, the MySQL relational database management system (RDBMS), and the PHP programming language.

In this scenario the virtual private server is already running CentOS 7, the Linux part is taken care of. Here is how to install the rest.

Installation Steps:

The first and foremost task that we should perform is to update the latest packages. This can be achieved by an ‘update’ command that would take a few minutes to compile. ‘yum’ will automatically attempt to check all configured repositories to resolve all package dependencies during an installation/upgrade.


It is important to make sure that the latest software updates and bug fixes are installed. The command is as follows:

sudo yum update


Install Apache on a CentOS server

Type the following yum command to install Apache web-server:

sudo yum install httpd

 

The following output will be printed on screen

 

Start the httpd service on a CentOS 7

 sudo systemctl start httpd

Check the httpd service status on a CentOS 7

systemctl status httpd

 

Output:
Active: active (running) since Fri 2019-01-13 22:26:29 CEST; 1 weeks 0 days ago

 

Note: The default configuration file is stored in /etc/httpd/conf/ as httpd.conf. The default log files are stored in /var/log/httpd/{access_log,error_log}

 

Test Apache:

Open your web browser and navigate to http://localhost/ or http://Your.server-ip-address/.

 

Installation of MariaDB on CentOS 7 server

MariaDB is an enhanced replacement for MySQL server in CentOS 7 environment. MariaDB is developed by the community in true open source spirit. A secure and scalable database server for scale-up or scale-out deployments, built on a modern extensible architecture that supports innovation. 

The command to install MariaDB is as follows:

sudo yum install mariadb-server

Press y when prompted to proceed with the installation.

Use the following command to start MariaDB

sudo systemctl start mariadb

Securing MariaDB:

A secure installation can be performed in which the user can set a password for access to the database. It is done by the following command:

sudo /usr/bin/mysql_secure_installation

 

Accessing MariaDB:

MariaDB can be accessed using the following command:

mysql –u root –p

Note: The server will ask for a password, if not set it can be skipped by pressing the Enter key.

 

Installation of PHP on CentOS 7

PHP (Hypertext Preprocessor) commonly used open-source general purpose scripting language that is largely suited for web development. It can also be embedded into HTML.

The installation of PHP and its modules is done using the following command:

Sudo yum install php php-mysql php-gd php-pear


The output is as follows:

After the installation of PHP the httpd (Apache) service must be restarted.

The command for the following is:

sudo systemctl restart httpd

 

Test PHP on the server

After installation of PHP on the server we must test if it’s functioning properly. Following are the corresponding steps:

Create a file called /var/www/html/test.php

 

Append the following code:
<?php
   phpinfo(INFO_GENERAL);
?>

 


 

Save and close the file. Point your Web Browser to your server’s IP address such as http://xx.xx.xx.xx/test.php


 

Sample outputs:

 

Hosting Services
  • Dedicated Hosting
  • Colocation Hosting
  • Backup
  • IP Transit
  • DDoS Mitigation
Support
  • Portal Login
  • Knowledgebase
  • Community
Company
  • About Us
  • Contact Us
  • Network
  • Data Centers
  • Looking Glass
  • Affiliates
  • Reseller
  • Blog
Policies
  • Privacy Policy
  • Acceptable Usage Policy
  • Terms and Conditions
  • Service Level Agreement
Company
  • Psychz Networks,
    A Profuse Solutions Company
    611 Wilshire Blvd #300
    Los Angeles,California 90017
    USA
  • US/Canada: 800-933-1517
  • International: 626-549-2801
Subscribe to Our Mailing List
* indicates required
Copyright © 2022 Psychz Networks, A Profuse Solutions Inc Company