Script to install LAMP (PHP 7) on CentOS 7

by Daniel Pham
Published: Updated:

How to install LAMP on CentOS 7 quickly? This article will guide you to use script to install LAMP (PHP 7) on CentOS 7 quickly. With just a few commands you have already installed the LAMP stack for yourself.

Server requirements

Please recheck your server resources before installation, here are the minimum recommend resources.

  • OS: CentOS 7.4.1708 (Core) 64bit
  • CPU: 1 vCPU
  • RAM: over 1 GB memory
  • HDD: over 5 GB free space
  • User: root
  • IP: set static ip, ex: 192.168.56.4

About script use to install LAMP

This script is used to install LAMP stack on CentOS 7 as quickly as possible. Normally, you will have to execute a lot of commands to install the LAMP stack successfully.

With this script, you only need to execute some short commands to install the LAMP stack on CentOS 7. This script will install the following software versions:

  • Apache: Apache/2.4.6 (CentOS)
  • MariaDB: 10.2.13
  • PHP 7: PHP 7.2.3

Use script to install LAMP on CentOS 7

First, you need to download the script from my public repository.

wget https://gitlab.com/Danny_Pham/WriteBash.com/raw/master/Install/06-Script_install_LAMP_PHP_7.2_on_CentOS_7.sh -O /home/install.sh

Next, you grant 700 permissions for the downloaded script.

chmod 700 /home/install.sh

And finally you execute the script with the command below. At first run, the script will check the SELinux status on the server and disable if status is enforcing.

bash /home/install.sh
Script to install LAMP (PHP 7) on CentOS 7
Download and execute script to install LAMP stack on CentOS 7.

After the server reboot, run the executable commands script again to proceed with the installation.

Script to install LAMP (PHP 7) on CentOS 7

If your installation is complete, the results shown in the image above, you have successfully installed the LAMP stack.

Check the LAMP stack

First, you visit the info.php page to see if PHP and Apache are working.

Script to install LAMP (PHP 7) on CentOS 7
Check out the info.php page to see if Apache and PHP are working.

Next, you can type the commands below to check the status of each service.

Check out the Apache service.

systemctl status httpd

To check the MariaDB service.

systemctl status mariadb

And you can type the commands below to check the currently running version of the software.

Check Apache version.

httpd -v

And check MariaDB version.

mysql -V

To see PHP version.

php -v

I have tested the script on success with a CentOS 7 virtual machine, hope you use the script and install successfully.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating

You may also like

Subscribe
Notify of
guest
4 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Alan Le
Guest
4 years ago

Love it

Douglas
Douglas
Guest
4 years ago

Thanks! It’s very practical.

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.

SUPPORT US

FOLLOW US

Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

0
Would love your thoughts, please comment.x
()
x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.