Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
No Result
View All Result
Home Google Cloud

How to Install LAMP Stack Apache MySQL/MariaDB PHP on CentOS 8

by Cloudbooklet
4 years ago
in Google Cloud, Compute Engine
How To Install Lamp Stack Apache Mysql/Mariadb Php On Centos 8
ShareTweetSendShare
Readers like you help support Cloudbooklet. When you make a purchase using links on our site, we may earn an affiliate commission.

How to Install LAMP Stack Apache MySQL/MariaDB PHP on CentOS 8. In this guide you are going to learn how to install and setup Apache, PHP, MySQL on CentOS 8. This setup is tested on Google Cloud and it works the same on AWS, DigitalOcean or any cloud hosting services or any VPS or Dedicated […]

ADVERTISEMENT

How to Install LAMP Stack Apache MySQL/MariaDB PHP on CentOS 8. In this guide you are going to learn how to install and setup Apache, PHP, MySQL on CentOS 8.

This setup is tested on Google Cloud and it works the same on AWS, DigitalOcean or any cloud hosting services or any VPS or Dedicated servers.

Prerequisites

If you are using Google Cloud you can follow these setps otherwise you can skip them.

ADVERTISEMENT
  1. Your Compute Engine Instance running.
  2. For setting up Compute Engine, see the Setting up Compute Engine Instance with CentOS 8

Step 1: Update Software Packages

You can start the setup by updating the packages to the latest versions using the following command.

You might also like

How To Setup Ssh Keys On Ubuntu

How to Setup SSH Keys on Ubuntu 20.04

4 months ago
Draggan Ai Editing Tool Install And Use Draggan Photo Editor

DragGAN AI Editing Tool Install and Use DragGAN Photo Editor

4 months ago
sudo yum update

Step 2: Install Apache on CentOS 8

Installing Apache in CentOS is pretty straight forward which is known as httpd. Run the following command to install.

sudo yum install httpd

Once the installation is completed, enable and start the Apache service.

ADVERTISEMENT
sudo systemctl enable httpd
sudo systemctl start httpd

Step 3: Configure Firewall

If your server is protected by the firewall and you haven’t opened the HTTP and HTTPS ports. Enable them with the following command.

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

Now you can verify Apache installation. Every process in Apache is managed with the systemctl command. Verify the installation of Apache with the following command.

ADVERTISEMENT
sudo systemctl status httpd
● httpd.service - The Apache HTTP Server
    Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
    Active: active (running) since Mon 2019-11-11 09:41:12 UTC; 5s ago
      Docs: man:httpd.service(8)
  Main PID: 19440 (httpd)
    Status: "Started, listening on: port 80"
     Tasks: 213 (limit: 9584)
    Memory: 24.5M
    CGroup: /system.slice/httpd.service
            ├─19440 /usr/sbin/httpd -DFOREGROUND
            ├─19441 /usr/sbin/httpd -DFOREGROUND
            ├─19442 /usr/sbin/httpd -DFOREGROUND
            ├─19443 /usr/sbin/httpd -DFOREGROUND
            └─19444 /usr/sbin/httpd -DFOREGROUND
 Nov 11 09:41:12 instance-1 systemd[1]: Starting The Apache HTTP Server…
 Nov 11 09:41:12 instance-1 httpd[19440]: Server configured, listening on: port 80
 Nov 11 09:41:12 instance-1 systemd[1]: Started The Apache HTTP Server.

Step 4: Install MySQL/MariaDB Database on CentOS 8

MariaDB is a better alternative for MySQL, so we can use MariaDB instead of MySQL.

sudo yum install mariadb-server mariadb -y
sudo systemctl enable mariadb
sudo systemctl start mariadb

You can verify the status of MariaDB installation using the following command.

ADVERTISEMENT
sudo systemctl status mariadb
● mariadb.service - MariaDB 10.3 database server
    Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
    Active: active (running) since Mon 2019-11-11 09:42:45 UTC; 47s ago
      Docs: man:mysqld(8)
            https://mariadb.com/kb/en/library/systemd/
   Process: 22519 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
   Process: 22385 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS)
   Process: 22361 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
  Main PID: 22487 (mysqld)
    Status: "Taking your SQL requests now…"
     Tasks: 30 (limit: 9584)
    Memory: 86.3M
    CGroup: /system.slice/mariadb.service
            └─22487 /usr/libexec/mysqld --basedir=/usr

Secure the MariaDB server with the mysql_secure_installation command.

mysql_secure_installation
Mysql Secure Installation

Follow the prompts and create a new password for the root user and complete the process.

ADVERTISEMENT

Step 5: Install PHP on CentOS 8

Finally you can install PHP, by default CentOS ships with PHP 7.2. So you can install PHP using the following command.

sudo yum install -y php php-mysqlnd

Restart Apache.

sudo systemctl restart httpd

Step 6: Verify the LAMP setup

Create a new file to output the PHP info.

Install the nano editor which is the easy editor to create and edit a new file.

sudo yum install nano -y

Create a new file with the name info.php

sudo nano /var/www/html/info.php

Paste the following code in the editor and save the file.

<?php phpinfo();

Hit CTRL + X followed by Y and Enter to save and exit the file.

Now open your browser and point it to your external IP address of your server followed by info.php in the URL.

http://IP_Address/info.php
Lamp Setup On Centos 8

You will see the PHP information which indicates you have installed and configured Apache, MariaDB and PHP on your CentOS 8 server.

Prepare yourself for a role working as an Information Technology Professional with Linux operating system

Conclusion

Now you have learned how to install Apache, MySQL and PHP LAMP stack on CentOS 8.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Tags: CentOSCompute EnginePHP
Share2Tweet1SendShare
Cloudbooklet

Cloudbooklet

Leave a Reply Cancel reply

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

Related Posts

Set Up Deep Learning With Nvidia, Cuda, Cudnn On Ubuntu

How to Set Up Deep Learning with Nvidia, CUDA, cuDNN on Ubuntu 22.04

7 months ago
How To Install Or Upgrade Php 8.2 On Ubuntu 22.04

How to Install or Upgrade PHP 8.2 on Ubuntu 22.04

9 months ago
How To Change Timezone On Ubuntu 22.04

How to Change Timezone on Ubuntu 22.04

1 year ago
How To Install Ansible On Ubuntu 22.04

How to Install Ansible on Ubuntu 22.04

1 year ago

Follow Us

Trending Articles

Google Bard Extension

Google Bard Extensions: How to Link Your Gmail, Docs, Maps, and More to an AI Chatbot

September 21, 2023

5 Best Fantasy Minecraft Servers in 2023

Microsoft Unveils New Disc-Less Xbox Series X with Lift-to-Wake Controller

10 Best AI Song Generator in 2023 (Free and Paid)

AI Statistics and Trends: What You Need to Know in 2023

10 Best Minecraft Server Hosting Providers in 2023

Popular Articles

Create Your Own Vpn

How to Create Your Own VPN

September 11, 2023

Create a Professional Website with Wix AI Website Builder

Create High Quality AI Cover Song with Covers AI

Validator AI: The AI Powered Business Idea Validator

How to Install Waifu Diffusion – Step-by-Step Guide

Best 5 AI Illustration Generators for All Your Creative Needs

Subscribe Now

loader

Subscribe to our mailing list to receives daily updates!

Email Address*

Name

Cloudbooklet Logo

Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.

  • About
  • Contact
  • Disclaimer
  • Privacy Policy

Cloudbooklet © 2023 All rights reserved.

No Result
View All Result
  • News
  • Artificial Intelligence
  • Applications
  • Linux

Cloudbooklet © 2023 All rights reserved.