Script to install LAMP (PHP 7) on CentOS 7

Share this post to your friends !

WriteBash - 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-01 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-02 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-03 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.

If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.


Share this post to your friends !
If you appreciate what we share in this blog, you can support us by:
  1. Stay connected to: Facebook | Twitter | Google Plus | YouTube
  2. Subscribe email to recieve new posts from us: Sign up now.
  3. Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
  4. Become a Supporter - Make a contribution via PayPal.
  5. Support us by purchasing Ribbon Lite Child theme being using on this website.

We are thankful for your support.

single post bottom banner
«« »»

Got something to say? Join the discussion

Please keep in mind that all comments are subject to our Comment Policy. Your email address will not be published.
This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 Comments