Help Center> Relational Database Service> Best Practices> RDS for MySQL> Using RDS for MySQL to Set Up Discuz!
Updated on 2024-01-17 GMT+08:00

Using RDS for MySQL to Set Up Discuz!

Crossday Discuz! Board (Discuz! for short) is a universal community forum software system. You can set up a customized forum with comprehensive functions and strong load capability on the Internet through simple installation and settings. This section describes how to set up Discuz! in the LAMP environment using Huawei Cloud VPC, ECS, and RDS for MySQL.

  1. Configuring Network Information
  2. Creating an ECS
  3. Setting Up the LAMP Environment
  4. Buying and Configuring an RDS DB Instance
  5. Installing Discuz!

Preparations

During the setup, you will use the following services or tools:

  • Cloud services: ECS and RDS on Huawei Cloud
  • PuTTY: a remote login tool
  • Installation packages
    • Apache Http Server 2.4.6
    • MySQL 5.4.16
    • PHP 5.4.16

The previous software is provided by third-party websites. The information is just for your reference and not for commercial use.

Configuring Network Information

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Choose Networking > Virtual Private Cloud.
  4. On the displayed page, click Create VPC to create a VPC, such as vpc-01.
  5. On the displayed page, enter a VPC name, set IPv4 CIDR Block to 192.168, select an AZ as required, and add a subnet. Retain the default settings for other parameters. Then, click Create Now. After the VPC is created, return to the network console.
  6. On the network console, choose Access Control > Security Groups and click Create Security Group. The following uses sg-01 as an example.
  7. On the Security Groups page, locate the target security group and click Manage Rule in the Operation column.
  8. On the Inbound Rules page, click Allow Common Ports to enable common ports and network protocols.

    Allow Common Ports: All inbound ICMP traffic and inbound traffic on ports 22, 80, 443, and 3389 are allowed by default. This option is suitable for cloud servers used in remote login, public network connection, and website services.
    Figure 1 Adding a security group rule

Buying an ECS

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Choose Compute > Elastic Cloud Server. The Elastic Cloud Server page is displayed.
  4. On the ECS console, buy an ECS.

    1. Configure basic settings: Select the pay-per-use billing mode, a region, and an image. Retain the default settings for other parameters.
      The public image CentOS7.4 64bit for P2v(40GB) is used as an example, as shown in Figure 2.
      Figure 2 Selecting an image
    2. Configure network: Select a VPC and security group, and purchase an EIP. Retain the default settings for other parameters.
      1. Select the created VPC vpc-01.
      2. Select the created security group sg-01.
      3. Select Auto assign for EIP.
    3. Configure advanced settings: Enter an ECS name and password, and click Next: Confirm.
      1. Enter an ECS name, such as ecs-01.
      2. Enter a password.
    4. Confirm: Confirm the information and click Next.

  5. After the ECS is created, view and manage it on the ECS console.

Setting Up the LAMP Environment

  1. Download the PuTTY client.
  2. Decompress the package, locate putty from the extracted files and double-click it.
  3. In the displayed PuTTY configuration dialog box, choose Session and specify basic options for your PuTTY session in the right pane. Then, click Open as shown in Figure 3.

    1. Enter the EIP of your ECS in the Host Name (or IP address) text box.
    1. Enter a session name in the Saved Sessions text box and click Save. Discuz is used as an example. Retain the default settings for other parameters.
      Figure 3 Configuring PuTTY

  4. In the displayed login window, enter the ECS username and password to log in to ECS.
  5. Install Apache, MySQL, PHP and other software.

    Obtain the root permissions so that you can enter commands in PuTTY.

    Enter commands to install software. For example, run the following command to install PHP:

    yum install -y httpd php php-fpm php-server php-mysql mysql

    The installation is complete if the following command output is displayed:
    Complete

  6. After the installation is complete, start related services in sequence.

    systemctl start httpd.service

    systemctl start php-fpm.service

Buying and Configuring an RDS DB Instance

  1. Buy a DB instance as required.

    • DB instance rds-01 is used as an example. Select MySQL 5.6 or 5.7.
    • Ensure that the RDS DB instance uses the same security group as the ECS so that you can access the RDS DB instance through the ECS.
    • Set the root user password and keep the password secure. The system cannot retrieve your password.

  2. After the RDS DB instance is created, view or manage it on the management console.

Installing Discuz!

  1. Download the Discuz! installation package.
  2. Upload the installation package to the ECS using a data transfer tool.

    1. Run the following command to decompress the Discuz! installation package:

      unzip Discuz_X3.3_SC_UTF8.zip

    2. Run the following command to copy all files in upload to /var/www/html/.

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

    3. Run the following command to grant write permissions to other users.

      chmod -R 777 /var/www/html

  3. Enter http://EIP/install in the address box in a local Windows browser and install Discuz! following the guidance.

    In the preceding URL, EIP indicates the EIP automatically assigned when you purchase the ECS in Buying an ECS. The install must be lowercase.
    1. Confirm the agreement and click I Agree.
    2. After the installation starts, check the installation environment and click Next.
    3. Set the running environment and click Next.
    4. Enter the database information and click Next to complete the installation.

      • The database address is the floating IP address of DB instance rds-01.
      • The database password is the root user password of DB instance rds-01.
      • Enter administrator information.

  4. After Discuz! is installed, enter http://EIP/forum.php in the browser address bar. If the forum homepage is displayed, the website is successfully built.