Focus on cloud service provider activities
Notes on website operation and maintenance

Record the process of installing the LAMP Web environment in CentOS9

LAMP, A common combination of software we use to install the EB environment on the ECS, which consists of the Linux system, Apache engine, MySQL (MariaDB) database and PHP programming language. In this article, we record the process of installing LAMP on CentOS 9.

1. Update Software Source

 yum update

After logging in to CentOS SSH, enter the script update to update the source.

2. Install Apache

 yum install httpd

Of course, it is already in the CentOS image. We can directly enter the script to install Apache.

 systemctl start httpd.service

After installation, we set the startup.

 systemctl status httpd

And setting startup. This will start automatically even when the server is restarted.

 Record the process of installing the LAMP Web environment in CentOS9 - Sheet 1

3. Install Database

 yum install mysql-server -y

Enter the command to install the MySQL database that we are familiar with.

 # systemctl start mysqld  # systemctl enable mysqld

Here we need to start the database and set it to start.

 systemctl status mysqld

Check the status of the database.

PS: Here, if we need to install the MariaDB database input command

 # yum remove mysql-server -y  # yum rm -rf /var/lib/mysql  # yum install mariadb-server -y

Database setup started.

 # systemctl start mariadb  # systemctl enable mariadb

Check the status of the database:

 # systemctl status mariadb

4. Database Settings

 # mysql_secure_installation

Initial database settings are required for the first time. Set the account information and initialization of the database according to the prompt.

 mysql -u root -p

Create database tables after logging in to the database.

5. Install PHP version

 # yum install php -y

The PHP installed here is based on the version of the system. If you need to install the version we specified.

 # yum install php-<package name>

This sub installation can install the specified version.

 # yum nstall php-mysqlnd php-gd php-curl php-ftp php-fpm -y

Of course, we can also install necessary components here.

 # php -v

We check the current version of php.

 # systemctl restart httpd

Restart the server's engine for it to take effect.

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

Here we create a demo file to check whether PHP works.

 <? php  phpinfo ();  ?> Save and exit the fi

Open this page in a browser. We can see the default page and version information of PHP.

Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( zero )
Do not reprint without permission: Lao Zuo's Notes » Record the process of installing the LAMP Web environment in CentOS9


Scan the code to follow the official account

Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge