Elastic Cloud Server

Practical Guide

2025-12-10 09:21:34

Background

Discuz! is a general community forum software system, which uses an infrastructure that combines PHP and MySQL to provide efficient forum solutions.

Prerequisites

You have purchased an ECS instance that meets the following conditions:

1. The instance has been assigned a public IP address or bound with an elastic IP (EIP).

2. The operating system must be CentOS 7.x.

3. The inbound rules of the instance security group have allowed ports 22, 80, and 443.

Procedure

Apache have been installed

Apache is the world's number one web server software. It can run on almost all widely used computer platforms. Because it is compatible with many platforms and highly secure, it is widely used and is one of the most popular Web server software. It is fast, reliable and can be extended through simple APIs to compile interpreters such as Perl/Python into the server.

1. HTTPD installed

HTTPD is the main program of the Apache Hypertext Transfer Protocol (HTTP) server. Execute the following command:

yum install httpd -y

2. Start the main program HTTPD

Start the main program HTTPD to accept requests. Execute the following command:

service httpd start

3. Set HTTP to start automatically at boot

Automatic start of HTTPD at boot can ensure that the service can be started when the virtual machine (VM) is restarted. Execute the following command:

chkconfig httpd on

4. Install the PHP compiler

Install the PHP compiler to prepare for subsequent compilation. Execute the following command:

yum install php –y

5. Install the php-mysql plugin

Install the plug-in that links the PHP compiler and MySQL so that you can connect to the database. Execute the following command:

yum install php-mysql -y

Apache software installed.

Install MariaDB

MariaDB is a database, used for subsequent storage of forum data.

1. Install MariaDB

Execute the following command

yum install mariadb-server mariadb –y

2. Start MariaDB

Execute the following command:

systemctl start mariadb

3. Set MariaDB to start automatically at boot

Automatic start of MariaDB at boot can ensure that the service can be started when the VM is restarted. Execute the following command:

systemctl enable mariadb

4. Enter the mysql database

Execute the following command:

mysql

5. Create a database username and password

Create a username and password to access the database for authorization; for example, the following information needs to be created:

· Username: root

· Password: 123456

· Host: localhost (this server)

· Database Name: tianyi

The following command needs to be executed:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY ' 123456' WITH GRANT OPTION;CREATE DATABASE tianyi;flush privileges;

After the code is configured, enter ctrl+c to exit the database editing.

Install Discuz!

1. Install the download tool

Before downloading Discuz!, you need to download the wget tool first. Execute the following command:

yum install wget -y

2. Download the Discuz! source code package

Log in to the Gitee official website to obtain the download address for Discuz!:

Execute the following command:

wget https://gitee.com/Discuz/DiscuzX/attach_files/XXX/download

3. Unzip the Discuz! source code package

Execute the following command:

unzip -d ./Discuz ./Discuz_X3.3_SC_UTF8.zip

4. Move the Discuz! source code

Move Discuz! to the HTTPD start directory so that users can access the Discuz! website through HTTP.

Execute the following command:

mv ./Discuz/upload/* /var/www/html/

5. Modify Discuz! source code permissions

Modify the read-write permissions of source code so that the website can be read and written normally by all users. Execute the following command:

chmod -R 777 /var/www/html/*

6. Restart HTTPD

Restart HTTPD to make all the environment variables that have been set take effect. Execute the following command:

service httpd restart

7. Access Discuz! using a browser

Enter http://+the EIP address of the ECS to access the Discuz! forum website.

Demo experience

Now, let's install Discuz!. Follow the steps below.

1. Run Discuz! and click I agree.

2. Set the runtime environment and click Next.

3. Install the database and fill in the database information and administrator information.

4. Complete the installation and log in to the Discuz! forum website.

When the Discuz! forum website page appears, it indicates that the operation was successful. Now, a Discuz! forum website has been built on an eSurfing Cloud ECS instance.