MyBB is free and open source forum application. It is written in PHP and uses MySQL or SQLite to store its data. The application is very tiny yet powerful and can be installed on servers with few resources available.
MyBB is a very popular forum application and it is powering numerous community forums. It is very simple to use and its interface is kept clean for ease of use. It provides many administration tools for moderation of the forum so that you can keep it clean from spammers. MyBB is highly customizable and many plugins are also available to extend the features of the forum.
Requirements
MyBB does not have any special hardware requirements. It can be installed on servers with a small amount of RAM. All the required dependencies will be installed throughout the tutorial. You will need a minimal installation of CentOS 7 with root access on it. If you are logged in as a non-root user, you can run sudo -i
to switch to root user.
Installing MyBB
Before installing any package it is recommended that you update the packages and repository using the following command.
yum -y update
Once you have your system updated, you can proceed to install the LAMP stack. Start the LAMP installation by installing Apache web server and MariaDB, which is a fork of MySQL using the following command.
yum -y install httpd mariadb-server mariadb
MyBB can be installed on any version of PHP > 5.2. To install PHP and the required modules run the following command.
yum -y install php php-curl php-gd php-mysql php-xml php-mbstring
The above command will install PHP 5.4 along with the required modules. To check the PHP version, run the following command.
php -v
You will likely see the following output.
[root@ip-172-31-25-44 ~]# php -v
PHP 5.4.16 (cli) (built: Nov 6 2016 00:29:02)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
Now start the Apache web server and enable it to start at boot time using the following command.
systemctl start httpd
systemctl enable httpd
To start MariaDB and enable it to start at boot time using the following commands.
systemctl start mariadb
systemctl enable mariadb
Now run the following commands to secure your MySQL or MariaDB installation.
mysql_secure_installation
It will run a small script which asks you to set a root password for your MariaDB installation. Most of the questions are self-explanatory and you should answer yes to all the questions.
As we have all the dependencies ready we can now create a database to store the data of MyBB. MyBB can also use an SQLite database to store its data. Using SQLite is not recommended when you have the option to use MySQL database as SQLite database is stored in the file system as a file, hence it affects the speed of the application. It is recommended to use MySQL/MariaDB to store MyBB data. To create a database we will need to login to MySQL command line first. Run the following command for same.
mysql -u root -p
This will prompt you for the password, provide the root password of MySQL which you have set earlier. Now run the following query to create a new database for your MyBB installation.
CREATE DATABASE mybb_data;
The above query will create a database named mybb_data
. For the database, you can use any name you prefer in the place of mybb_data
. Make sure that you use semicolon at the end of each query as the query always ends with a semicolon. Once the database is created you can create a new user and grant all the permissions to the user for the database. Using root user is not recommended for the databases. To create a new database user, run the following query.
CREATE USER 'mybb_user'@'localhost' IDENTIFIED BY 'StrongPassword';
The above query will create a user with username mybb_user
. You can use any preferred username instead of mybb_user
. Replace StrongPassword
with a strong password. Now provide the appropriate privileges to your database user over the database you have created. Run the following command.
GRANT ALL PRIVILEGES ON mybb_data.* TO 'mybb_user'@'localhost';
Now run the following command to immediately apply the changes on the database privileges.
FLUSH PRIVILEGES;
Exit from MySQL prompt using exit
command.
As we have all the dependencies ready, we can now download the install package from MyBB site.
cd /var/www/html
wget https://resources.mybb.com/downloads/mybb_1809.zip -O mybb.zip
The above command will download the installer archive and store it as mybb.zip
file. You can always look for the latest release by going to the MyBB download page.
Extract the archive using the following command.
unzip mybb.zip
If you don’t have unzip
installed, you can run yum -y install unzip
. The above command will extract the archive in two folders, one is Documentation folder, another is Upload folder. All the installer files are stored in Upload
folder. To move all the files from Upload
folder to the default web root directory, use the following command.
mv /var/www/html/Upload/* /var/www/html
Remove the zip file as it is not required now.
rm mybb.zip
Now you will need to disable your SELinux because MyBB does not work with SELinux policies. To temporary disable SELinux, run the following command.
setenforce 0
To completely disable the SELinux you will need to edit /etc/selinux/config file.
nano /etc/selinux/config
If you don’t have nano installed, you can install it using yum -y install nano Find the following line:
SELINUX=enforcing
Change it to:
SELINUX=disabled
Now you will need to reboot your server so that the new configuration can take effect. Once the server is rebooted, you will need to provide the ownership of the application to web server user using the following command.
chown -R apache:apache /var/www/html
Now you will need to start the browser installation, go to the following link using your favorite web browser.
http://YourServerIP/
You will see the welcome interface, you can choose the installer language here.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/22805380.png” alt=”” />
Click Next to proceed further. The system will now check for the system requirements. If you have followed the tutorial correctly you will have all the system requirements conditions met.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/959621806.png” alt=”” />
Click Next to proceed further. Now the installer will show you the license agreement which you will need to accept to install the software further.
Now you will need to provide the database details for storing the MyBB data.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1518700746.png” alt=”” />
Choose database engine as MySQL improved, and leave the default value in database host. Provide the username and password of the database which we have created earlier to store MyBB data. Provide the database name also. Leave default value of Table Prefix. This is used when we have multiple installations of MyBB on the same database. Also, leave the default value of Table Encoding.
You can also choose the database engine as SQLite3 instead of MySQL if you like, but it is strongly recommended to use MySQL only. Provide the path to store the database and leave the default value of table prefix. Click Next to proceed further.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/2110936700.png” alt=”” />
If the database credentials are correct then the installer will automatically create the tables into the database. If the installer shows any error in connectivity of the database, please recheck the database credentials provided. Click Next button to continue to the interface on which installer is ready to write the data into the tables which are created.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1373504668.png” alt=”” />
Click Next button and the installer will insert the default data into the tables. Further in the next interface, it will install the theme into the MyBB forum.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/430154468.png” alt=”” />
In next interface, you will need to provide some basic information about your forum. Provide a name and URL for your forum. You can provide your server IP address here if you do not have a domain name setup. Make sure that you do not put any slash or \
at the end of the URL.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/485645755.png” alt=”” />
Now, provide your main website details. This is optional settings, enter the name and URL of your website. This information is shown in the footer of the forum. Furthermore, in Cookie Domain and Path settings, leave the default value. If you provide any wrong value here, the login and registration feature might not work properly. Provide the email address of server admin and set a PIN for ACP or Administrator Control Panel login. This provides an additional layer of security to the admin control panel. ACP PIN is optional, leave the field blank if you don’t want to set the PIN now.
In next interface, you will need to provide the administrator credentials. Set a username and password for admin user. Also provide the email of the administrator.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/2118686125.png” alt=”” />
Once done, click Next button and you will see that installer has completed the installation of MyBB application.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/161679461.png” alt=”” />
You can go to the following URL to browse the front end of the site.
http://YourServerIP
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1114055331.png” alt=”” />
To access the administrative panel, go to the following URL.
http://YourServerIP/admin
Login using your admin username, password and ACP pin and your dashboard will look like this.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1805699576.png” alt=”” />
Conclusion
In this tutorial, we have learned how to install MyBB on CentOS 7. You can now easily install MyBB to create a forum for your community. Using MyBB is very easy, you can now brand the forum with your logo and other settings.