tencent cloud


Building Up a Discuz! Forum

Last updated: 2022-05-10 11:37:40


    Used by over 2 million websites, Discuz! is the world’s most sophisticated and predominant forum software. This document describes how to set up a forum website using Discuz! on Tencent Cloud CVM instance and deploy the LAMP (Linux, Apache, MariaDB, and PHP) runtime environment it needs.

    To manually set up a Discuz! website, you should be familiar with common Linux commands (see Installing Software via YUM under CentOS Environment), and understand the usage and version compatibility of the software to be installed.


    The following software versions are used to build a Discuz! website.

    • Linux: Linux operating system. This document uses CentOS 7.6 as an example.
    • Apache: Web server software. This document uses Apache 2.4.15 as an example.
    • MariaDB: database. This document uses MariaDB 5.5.60 as an example.
    • PHP: scripting language. This document uses PHP 5.4.16 as an example.
    • Discuz!: forum software. This document uses Discuz! X3.4 as an example.


    Step 1: log in to the CVM

    Log in to the Linux instance using standard login method. You can also use any of the following login methods you are comfortable with:

    Step 2: set up the LAMP environment

    Tencent Cloud hosts a software repository containing CentOS official releases, which provides the most stable version available currently. Use Yum to quickly install CentOS.

    Installing and configuring necessary software

    1. Run the following command to install Apache, MariaDB, PHP and Git:

      yum install httpd php php-fpm php-mysql mariadb mariadb-server git -y
    2. Run the following commands in sequence to start the services.

      systemctl start httpd
    systemctl start mariadb
    systemctl start php-fpm
    1. Run the following command to set a password for root and complete other basic configurations, so the root user can access the database.

      • Run the following command to set the password before your first login to MariaDB.
      • When you see the prompt to enter the root password, click Enter to set the password. Your password will not be displayed by default. Complete other basic configurations as prompted.
    2. Run the following command to log in to MariaDB. Enter the password you set in step 3 and click Enter.

      mysql -u root -p

    A successful login indicates that the configurations are correct, as shown below:

    5. Run the following command to exit MariaDB.


    Verifying the environment configuration

    Check whether the environment is set up properly as instructed below:

    1. Run the following command to create a test file test.php in the default root directory /var/www/html of Apache:

      vim /var/www/html/test.php
    2. Click i to switch to editing mode and enter the following content:

      echo "<title>Test Page</title>";
    3. Click Esc and enter :wq to save and close the file.

    4. Enter the following URL in a browser to access test.php to check whether the environment is properly configured.

      http://[Public IP address of the CVM]/test.php 

    If everything goes well, the following appears.

    Step 3: install and configure Discuz

    Downloading Discuz!

    Run the following command to download the installation package.

    git clone https://gitee.com/Discuz/DiscuzX.git

    Preparing for installation

    1. Run the following command to access the installation directory.

      cd DiscuzX
    2. Run the following command to copy all files under "upload" to /var/www/html/.

      cp -r upload/* /var/www/html/
    3. Run the following command to grant other users the write permission.

      chmod -R 777 /var/www/html

    Installing Discuz!

    1. Enter the IP address of your Discuz! site (the public IP address of your CVM instance) or the domain name obtained from Related Operations, and then you can see the Discuz! installation interface.

      This document only demonstrates the installation steps. If a security warning that the version is too low is reported, we recommend you use an image on a higher version.

    2. Click I agree and go to the environment check page.
    3. Check the items and click Next Step to go to the runtime environment setting page.
    4. Select "Clean Install" and click Next Step to go to the database creation page.
    5. Enter information as prompted to create a new database for Discuz!.
      • Use the root account and password set in Installing and configuring required software to connect to the database and set up a system email address and admin username, password, and email address.
      • Remember your admin username and password.
    6. Click Next to start the installation.
    7. After the installation, click Your forum has been installed successfully. Click here to access. to access your forum.

    You can use a domain name that is easy to remember rather than a complicated IP address to make your forum website easier to remember and access. If you set up this website just for the purpose of learning, you can use an IP address for temporary use, which is nevertheless not recommended.


    If you encounter a problem when using CVM, refer to the following documents for troubleshooting:

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support