[Build a personal forum on the cloud based on ECS]

Build a personal forum on the cloud based on ECS

本场景演示了在 ECS云服务器(CentOS7)的环境下,通过部署 LAMP环境并安装 Discuz 快速搭建个人论坛。
Ali study notes


foreword

提示:这里可以添加本文要记录的大概内容:

Before starting an experiment, you need to create resources related to the experiment. url
On the lab page, click Create Resource.
(Optional) In the left navigation bar of the lab page, click the cloud product resource list to view information related to the lab resources (such as IP addresses, user information, etc.)



The resource is created successfully, and you can view the relevant resource information and RAM sub-account information in the resource card on the left
insert image description here

LAMP is the abbreviation of Linux, Apache, MySQL and PHP, and it is the basic operating environment that the Discuz forum system relies on. Let's start by preparing the LAMP environment.

On the right side of the lab page, click insert image description here
the icon to switch to the Web Terminal.
insert image description here

Supplement: If the Web Terminal interface is not displayed, you can enter the command input interface through the LX terminal on the desktop of the experimental scene.
Execute the following command to switch and connect to this experiment resource. (The public network address replaces the public network address provided in the cost scenario).
ssh root@ECS public network address

insert image description here

1. Operation experience of ECS cloud server

After connecting, you need to enter the login password. Note that the pasted password will not be displayed. After pasting, press Enter directly to enter the experimental environment.

Install and configure MySQL

(1) Execute the following command to update the YUM source.

rpm -Uvh  http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

(2) Execute the following command to install MySQL.

yum -y install mysql-community-server --nogpgcheck

(3) Execute the following command to view the MySQL version number.

mysql -V

The following results are returned, indicating that you have successfully installed MySQL.
insert image description here

(4) Execute the following command to start the MySQL service.

systemctl start mysqld

(5) Execute the following command to set the MySQL service to start automatically.

systemctl enable mysqld

(6) Configure the MySQL root user password.
--------Execute the following command to view the /var/log/mysqld.log file to obtain the initial password of the root user.

grep 'temporary password' /var/log/mysqld.log

The returned results are as follows, and you can view the initial password of the root user.insert image description here

Run the following command to log in to the database as user root.

mysql -uroot -p

The returned result is as follows. Enter the initial password of the root user. (The entered password will not be displayed)
insert image description here

Run the following command to change the initial password of the MySQL root user.

	
	set global validate_password_policy=0;  #修改密码安全策略为低(只校验密码长度,至少8位))
	
	ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678';

Run the following command to grant remote management permission to the root user.

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345678';
在这里插入代码片

(7) Enter exit to exit the database.

insert image description here

2. Apache + MySQL + PHP deployment experience


1. Install Apache components

(1) Install Apache components using yum:

yum install httpd -y

(2) After installation, start the httpd process:

service httpd start

(3) Set httpd to start automatically at boot:

chkconfig httpd on

2. Install PHP

(1) Install PHP using yum:

yum install php php-fpm php-mysql -y

(2) After installation, start the PHP-FPM process:

service php-fpm start

(3) After startup, you can use the following command to check which port the PHP-FPM process listens on

netstat -nlpt | grep php-fpm

(4) Set PHP-FPM to start automatically at boot:

chkconfig php-fpm on

3. Install Discuz

(1) There is no yum source of Discuz, so we need to download a Discuz compressed package:

`wget https://labfileapp.oss-cn-`hangzhou.aliyuncs.com/PracticalTrain/Discuz_X3.2_SC_UTF8.zip

(2) Download the decompression tool unzip

yum install unzip

(3) After the download is complete, unzip the compressed package

unzip Discuz_X3.2_SC_UTF8.zip

(4) After decompression, you can see the source code of discuz in the upload folder

4. Configure Discuz

(1) Since PHP accesses the /var/www/html/ folder by default, we need to copy all the files in the upload folder to the /var/www/html/ folder.

cp -r upload/* /var/www/html/

(2) Give permissions to the /var/www/html directory and its subdirectories

chmod -R 777 /var/www/html

(3) Restart Apache

service httpd restart

3. Installation experience of Discuz forum program

Install and log in to Discuz by IP address

insert image description here

  1. Switch to the desktop, open the browser and enter the IP address to enter the Discuz installation interface
http://“你的ECS服务器IP地址”/install
---

insert image description here
insert image description here

insert image description here
insert image description here
Enter database password, administrator password
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/qq_42700796/article/details/129299177