Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (2024)

MyBB is a free and open-source, intuitive, and extensible forum program. MyBB is easy to use and extensible, with hundreds of plugins and themes that make adding new features or a new look easy.

The source code of MyBB is hosted on GitHub. This guide shows you how to install the MyBB forum software on the CentOS 8 system.

Requirements

MyBB 1.8 and the Merge System 1.8 have some minimum system requirements:

  • PHP, at least version 5.2. PHP 7.3 is strongly recommended.
  • MySQL, at least version 5.0, PostgreSQL, at least version 8.1, or SQLite, at least version 3. PostgreSQL 10.0 or MySQL 8.0 are strongly recommended.
  • Apache, Nginx, Lighttpd or IIS web server
  • The following PHP extensions are also required:
  • SimpleXML
  • mbstring
  • gd
  • The respective manufacturer-specific database PHP extension

NOTE: Replace all instances of example.com with your domain name.

Prerequisites

  • CentOS 8 as operating system.
  • A non-root user with sudo rights.

First steps

Check your CentOS version:

cat /etc/centos-release# CentOS Linux release 8.0.1905 (Core)

Set up the time zone:

timedatectl list-timezonessudo timedatectl set-timezone 'Region/City'

Update your operating system packages (software). This is an important first step because it ensures that you have the latest updates and security fixes for the standard software packages of your operating system:

sudo yum update -y

Install some important packages that are necessary for the basic management of the CentOS operating system:

sudo yum install -y curl wget vim gitunzip socat bash-completion epel-release

Step 1 - Install PHP and the required PHP extensions

Install PHP and the required PHP extensions:

sudo yum install -y php php-cli php-fpm php-gd php-mbstring php-xml php-mysql php-pgsql

To view PHP compiled into modules, you can:

php -m

ctype
curl
exif
fileinfo
. . .
. . .

Check the version:

php --version

# PHP 7.2.19 (cli) (built: Jun 2 2019 09:49:05) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Start and activate the PHP-FPM service:

sudo systemctl start php-fpm.servicesudo systemctl enable php-fpm.service

Step 2 - Install the acme.sh client and get a Let's Encrypt certificate (optional)

It is not necessary to secure your forum with HTTPS, but it is a good practice to protect the traffic on your site. To obtain a TLS certificate from Let's Encrypt, we will use the acme.sh client. Acme.sh is a simple UNIX shell software that allows you to obtain TLS certificates from Let's Encrypt without any dependencies.

Download and install acme.sh:

sudo su - rootgit clone https://github.com/Neilpang/acme.sh.gitcd acme.sh ./acme.sh --install --accountemail [emailprotected]source ~/.bashrccd ~

Check the version of acme.sh:

acme.sh --version# v2.8.2

Obtain RSA and ECC/ECDSA certificates for your domain/hostname:

# RSA 2048acme.sh --issue --standalone -d example.com --keylength 2048# ECDSAacme.sh --issue --standalone -d example.com --keylength ec-256

If you want fake certificates for testing, you can add the flag --staging to the above commands.

After you have executed the above commands, your certificates and keys will be located in:

  • For RSA: /home/username/example.com directory.
  • For ECC/ECDSA: /home/username/example.com_ecc directory.

To list your issued certificates, you can do the following:

acme.sh --list

Create a directory to store your certificates. We will use the /etc/letsencrypt directory.

mkdir -p /etc/letsecnrypt/example.com sudo mkdir -p /etc/letsencrypt/example.com_ecc

Install/copy the certificates to /etc/letsencrypt directory.

# RSAacme.sh --install-cert -d example.com --cert-file /etc/letsencrypt/example.com/cert.pem --key-file /etc/letsencrypt/example.com/private.key --fullchain-file /etc/letsencrypt/example.com/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"# ECC/ECDSAacme.sh --install-cert -d example.com --ecc --cert-file /etc/letsencrypt/example.com_ecc/cert.pem --key-file /etc/letsencrypt/example.com_ecc/private.key --fullchain-file /etc/letsencrypt/example.com_ecc/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"

All certificates are automatically renewed every 60 days.

After you have received the certificates, leave the root user and return to the normal sudo user:

exit

Step 3 - Install MariaDB and create a database for MyBB

Install the MariaDB database server:

sudo yum install -y mariadb-server

Check the MariaDB version:

mysql --version#mysql Ver 15.1 Distrib 10.3.11-MariaDB, for Linux (x86_64) using readline 5.1

Start and activate the MariaDB service:

sudo systemctl start mariadb.servicesudo systemctl enable mariadb.service

Execute the mysql_secure installation script to improve MariaDB security and enter the password for the MariaDB root user:

sudo mysql_secure_installation

Answer each of the questions:

Would you like to setup VALIDATE PASSWORD plugin? NNew password: your_secure_passwordRe-enter new password:your_secure_passwordRemove anonymous users? [Y/n] YDisallow root login remotely? [Y/n] YRemove test database and access to it? [Y/n] YReload privilege tables now? [Y/n] Y

Connect to the MariaDB shell as the root user:

sudo mysql -u root -p# Enter password

Create an empty MariaDB database and a user for the MyBB forum and memorize the login credentials:

mariadb>CREATE DATABASE dbname;mariadb>GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';mariadb>FLUSH PRIVILEGES;

Replace dbname, username and password in the above commands with your own names.

Exit MariaDB:

mariadb>exit

Step 4 - Install and configure Nginx

Download Nginx from the CentOS repository and install it:

sudo yum install -y nginx

Check the Nginx version:

sudo nginx -v# nginx version: nginx/1.14.2

Configure Nginx. Run sudo vim /etc/nginx/conf.d/mybb.conf and fill the file with the following information

server { listen 80; listen 443 ssl;ssl_certificate /etc/letsencrypt/example.com/fullchain.pem;ssl_certificate_key /etc/letsencrypt/example.com/private.key;ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.pem;ssl_certificate_key /etc/letsencrypt/example.com_ecc/private.key;server_name forum.example.com; root /var/www/mybb; location / { index index.php; } # Deny access to internal files. location ~ /(inc|uploads/avatars) { deny all; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }

CheckNGINX configuration for syntax errors:

sudo nginx -t

Reload Nginx:

sudo systemctl reload nginx.service

Step 5 - Install MyBB

Create a document root directory for MyBB:

sudo mkdir -p /var/www/mybb

Download the latest version of MyBB and unzip it:

cd /var/www/mybbsudo wget https://resources.mybb.com/downloads/mybb_1821.zipsudo unzip mybb_1821.zipsudo mv /var/www/mybb/Upload/* /var/www/mybb

Remove the downloaded file .zip:

sudo rm mybb_1821.zipsudo rmdir Upload

Change the owner of the /var/www/mybb directory to nginx:

sudo chown -R nginx:nginx /var/www/mybb

Run sudo vim /etc/php-fpm.d/www.conf and set the user and group to nginx. Initially they are set to apache:

sudo vi /etc/php-fpm.d/www.conf# user = nginx# group = nginx

Restart the PHP-FPM service:

sudo systemctl restart php-fpm.service

As a last step, open your domain and follow the installation wizard for MyBB. To call up the installation program, you must navigate to the /install directory of your website in your web browser. For example, if your domain is example.com and you have uploaded your MyBB files to the root directory, navigate to http://example.com/install. To access the MyBB admin, append /admin to the URL of your website. You have successfully installed your MyBB.

After installation, you should remove the /install directory from your server to prevent someone else from running the installation again.

sudo rm -rf /var/www/mybb/install/

Step 6 - Complete the MyBB setup

To access the installation program, you will need to navigate in your web browser to the install/ directory of your website in your web browser.

After opening the MyBB installation wizard, you should see a page like the one below. On this page, all you need to do is click "Next":

Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (1)

Check the MyBB license and click " Next":

Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (2)

This page will checkif your server meets the requirements to run MyBB. If this is not the case, you will be notified on this page. If everything is working correctly, all you have to do is click "Next" on this page.

Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (3)

This page is for configuring your database. Enter the desired database details and click on " Next".

Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (4)

In this step, the database tables are inserted. No user input is required on this page, so click on the button "Next" button when it appears.

Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (5)

In this step, the default data is inserted into the database tables created above. Click on " Next".

Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (6)

In this step, the theme data will be loaded into the forum. No user input is required on this page. Click on the "Next" button button when it appears.

Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (7)

Next, configure basic settings such as the forum name, URL, etc:

Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (8)

Create a MyBB administrator account. This account has permissions for all areas in the Admin Control Panel.

Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (9)

After creating the administrator account, you will see the "Finish Setup" page. This page indicates that the installation is complete:

Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (10)

To access the admin interface, append /admin to your URL:

Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (11)

The MyBB admin will look something like this:

Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (12)

And here is the screenshot of the MyBB frontend:

Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (13)

Congratulations! You have successfully installed your MyBB.

Links

Install MyBB Forum with Nginx and Let’s Encrypt on CentOS and Rocky Linux – VITUX (2024)
Top Articles
Latest Posts
Article information

Author: Manual Maggio

Last Updated:

Views: 5712

Rating: 4.9 / 5 (49 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Manual Maggio

Birthday: 1998-01-20

Address: 359 Kelvin Stream, Lake Eldonview, MT 33517-1242

Phone: +577037762465

Job: Product Hospitality Supervisor

Hobby: Gardening, Web surfing, Video gaming, Amateur radio, Flag Football, Reading, Table tennis

Introduction: My name is Manual Maggio, I am a thankful, tender, adventurous, delightful, fantastic, proud, graceful person who loves writing and wants to share my knowledge and understanding with you.