How To Install Linux, Apache, MySQL, PHP (LAMP) stack On CentOS 7.

Prerequisites

Before you begin with this guide, setup a initial server setup for CentOS 7.

Step 1: Install Apache Server

[root@www Rajat]#sudo yum install httpd

Since we are using a sudo command, these operations get executed with root privileges. It will ask you for your regular user’s password to verify your intentions.

Afterwards, your web server is installed.

Once it installs, you can start Apache

[root@www Rajat]# service httpd status
Redirecting to /bin/systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:httpd.service(8)

[root@www Rajat]# service httpd start
Redirecting to /bin/systemctl start httpd.service

[root@www Rajat]# service httpd status
Redirecting to /bin/systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2019-02-14 17:46:51 IST; 14s ago
Docs: man:httpd.service(8)
Main PID: 20799 (httpd)
Status: "Running, listening on: port 80"
Tasks: 213 (limit: 4915)
Memory: 20.8M
CGroup: /system.slice/httpd.service
├─20799 /usr/sbin/httpd -DFOREGROUND
├─20800 /usr/sbin/httpd -DFOREGROUND
├─20802 /usr/sbin/httpd -DFOREGROUND
├─20803 /usr/sbin/httpd -DFOREGROUND
└─20807 /usr/sbin/httpd -DFOREGROUND

Feb 14 17:46:50 www.linuxbooth1.com systemd[1]: Starting The Apache HTTP Server...
Feb 14 17:46:51 www.linuxbooth1.com httpd[20799]: Server configured, listening on: port 80
Feb 14 17:46:51 www.linuxbooth1.com systemd[1]: Started The Apache HTTP Server.

You can do a spot check right away to verify that everything went as planned by visiting your server IP Address in your web browser

               http://your_server_IP_address/

The last thing you will want to do is enable Apache to start on boot. Use the following command to do so:

[root@www Rajat]# chkconfig httpd on
Note: Forwarding request to 'systemctl enable httpd.service'.
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service

One thought on “How To Install Linux, Apache, MySQL, PHP (LAMP) stack On CentOS 7

Leave a Reply

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