Manually deploy a Discuz! forum

Updated at:

Discuz! is a general-purpose community forum software built on a PHP and MySQL architecture that provides an efficient forum solution. This topic describes how to deploy a Discuz! X3.5 forum on an ECS instance.

Prerequisites

  1. You have created a Linux ECS instance that meets the following requirements:

    • Network Type: VPC.

    • Operating System: Alibaba Cloud Linux 3/2, CentOS 7/8, or Ubuntu 22/20/18.

    • IP Address: The instance has a public IPv4 address.

    • Security Group: You have added inbound rules to the security group to allow traffic on ports 22, 80, and 3306. For more information, see Add a security group rule.

  2. You have deployed a LAMP (Linux, Apache, MySQL, PHP) environment. For more information, see Manually deploy a LAMP environment.

    Discuz! has version requirements for Nginx and MySQL. For a detailed compatibility matrix, see the Discuz! official website.

Procedure

  1. Run the following command to verify the installed PHP XML libraries.

    php -m | grep xml

    The command returns the following output. If your output shows only libxml, you must install the PHP XML extensions. For more information, see Install PHP XML extensions.

    $ php -m | grep xml
    libxml
    xml
    xmlreader
    xmlwriter
  2. Run the following command to create and enter a directory, for example, /www.

    sudo mkdir /www
    cd /www
  3. Download the Discuz! installation package and upload it to the /www directory.

    This example uses the Discuz_X3.5_SC_UTF8_20231001.zip.

  4. Run the following commands to unzip the Discuz! installation package.

    • Alibaba Cloud Linux 3/2, CentOS 7/8

      sudo yum -y install unzip      
      sudo unzip Discuz_X3.5_SC_UTF8_20231001.zip
    • Ubuntu 22/20/18

      sudo apt install -y unzip
      sudo unzip Discuz_X3.5_SC_UTF8_20231001.zip
  5. Run the following command to copy all files from the upload folder to the Apache default root directory /var/www/html/.

    sudo cp -r upload/* /var/www/html/
  6. Run the following command to grant full read, write, and execute permissions to all users for the /var/www/html directory.

    sudo chmod -R 777 /var/www/html
  7. Install Discuz!.

    1. Obtain the public IP address of the ECS instance.

      1. Log on to the ECS console.

      2. In the left-side navigation pane, choose Instances & Images > Instance.

      3. Find your instance and copy its public IP address from the IP Address column.

    2. In the address bar of your web browser, enter http://<public_ip_address_of_your_ECS_instance>.

      The Discuz! installation wizard opens, displaying the license agreement.

    3. Read the agreement and click I Agree to continue.

    4. The wizard checks your server environment, including the operating system, PHP version, required libraries, and file permissions. A green checkmark indicates that a requirement is met. After you review the results, click Next.

    5. Select an installation method for UCenter Server and click Next.

      UCenter Server is the user management center for your website. UCenter Server allows you to centralize user registration and sign-in, and exchange data with other community components. For more information, visit the Discuz! official website.

      For this tutorial, select Install Discuz! X and UCenter Server. On the Set up the running environment page, ensure Install Discuz! X and UCenter Server is selected, and then click Next.

    6. Enter the database and administrator details, and then click Next. In the Database Information section, use the following example values: set Database Server Address to 127.0.0.1, Database Name to Discuz!, Database Username to root, Database Password to Ecs@test1, Table Prefix to pre_, and System Email to admin@admin.com.

      The following table describes the key parameters.

      Parameter

      Description

      Database Server Address

      Enter the database connection address.

      Database Name

      Enter the database name. Example: Discuz!.

      Database Username

      Enter the database username. The default is root.

      Database Password

      Enter the database password.

      Table Prefix

      This is a prefix for all Discuz! table names. To avoid conflicts when sharing a database, we recommend changing the default value of pre_.

      Administrator Account

      Set the administrator username for logging in to the website backend. The default is admin.

      Administrator Password

      Set the initial password for the administrator to log in to the website backend.

    7. After the installation is complete, click Visit Your Site Now to access your forum.

Next steps

Using a public IP address to access your forum is insecure and not recommended for production. To enhance security and present a professional image, you should use a custom domain name. Follow these steps to set up a domain name for your forum.

  1. Register a domain name.

    For more information, see Domain name registration.

  2. Complete the ICP filing.

    If your domain name points to a website hosted on an Alibaba Cloud server in a Chinese mainland node, you must complete an ICP filing. For more information about the procedure, see ICP filing process.

  3. Resolve the domain name.

    You must point the domain name to the public IP address of the instance.

    DNS resolution is required to access your website by domain name. For more information, see Public DNS resolution.

FAQ

What should I do if running php -m | grep xml returns only libxml?

If the php -m | grep xml command returns only libxml, it means the required PHP XML extensions are not installed or have not been loaded correctly.

Alibaba Cloud Linux 3/2, CentOS 7/8

  1. Update the package list.

    sudo yum update
  2. Install the PHP XML extension.

    sudo yum install php-xml
  3. Restart the web server.

    sudo systemctl restart httpd

Ubuntu 22/20/18

  1. Update the package list.

    sudo apt-get update
  2. Install the PHP XML extension.

    sudo apt-get install php-xml
  3. Restart the web server.

    sudo systemctl restart apache2