• Get In Touch
January 6, 2017

Install phpBB Forum on CentOS 7

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

phpBB is free and open source web-based forum application. It is written in PHP and supports almost all major database applications. phpBB is considered the most popular application for the forum and used by millions of users on daily basis. It is very secure and reliable system and has every feature included which is needed in a community forum.

Requirements

phpBB does not require any special hardwares. It can be installed on servers with very a minimal ammount 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 phpBB

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

phpBB can be installed on any version of PHP > 5.4. To install PHP and the required modules run the following command.

yum -y install php php-curl php-json php-gd php-mysql php-zlib php-ftp php-xml ImageMagick

The above command will install PHP 5.4 along with the required modules. To check 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

You will need to add the ImageMagick extension to PHP configuration file. Edit the configuration file located at /etc/php.ini using your favorite text editor.

nano /etc/php.ini

If you do not have nano installed, you can install it using yum -y install nano. Add the following line at the end of the file.

extension=imagick.so

Furthemore, you will need to enable Mod_rewrite in Apache web server by editing /etc/httpd/conf/httpd.conf using your favorite text editor.

nano /etc/httpd/conf/httpd.conf

Find the following line:

<Directory "/var/www/html">
AllowOverride None

Change it to AllowOverride All.

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 phpBB. phpBB 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 phpBB 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 phpBB installation.

CREATE DATABASE phpbb_data;

The above query will create a database named phpbb_data. For the database, you can use any name you prefer in the place of phpbb_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 'phpbb_user'@'localhost' IDENTIFIED BY 'StrongPassword';

The above query will create a user with username phpbb_user. You can use any preferred username instead of phpbb_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 phpbb_data.* TO 'phpbb_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 the phpBB site.

cd /var/www/html
wget https://www.phpbb.com/files/release/phpBB-3.1.10.zip -O phpBB.zip

The above command will download the installer archive and store it as phpBB.zip file. You can always look for the latest release by going to the phpBB download page.

Extract the archive using the following command.

unzip phpBB.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 the documentation folder, the other is the 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 including the hidden .htaccess file, use the following command.

mv /var/www/html/phpBB3/{.[!.],}* /var/www/html

Remove the zip file as it is not required now.

rm phpBB.zip

Now you will need to disable your SELinux because phpBB 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 Introduction interface.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/719704035.png” alt=”” />

Click on Install tab to proceed further.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1929000405.png” alt=”” />

Click Proceed to next step 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/1250388052.png” alt=”” />

Click Start install to proceed further. Now you will need to provide the database details for storing the phpBB data.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1210574589.png” alt=”” />

Choose database engine as MySQL with MySQLi extension, and fill localhost the default value in database host. You can leave the database port blank or you can enter 3306 in that. Provide database name and the username and password of the database which we have created earlier to store phpBB data. Leave default value of Table Prefix. This is used when we have multiple installations of phpBB on the same database. Click on Proceed to next step button to proceed further. If the database credentials are correct then the installer will show you the message that connection to the database is successful. If the installer shows any error in connectivity of the database, please recheck the database credentials provided.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1641957765.png” alt=”” />

Click on Proceed to next step button to proceed further. 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/2043418056.png” alt=”” />

Click Proceed to next step button and the installer will write the configuration file.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/121817038.png” alt=”” />

In the next interface, configure your email settings. Choose if you want to enable the emails or not. If you choose to disable the emails, then no emails will be sent to anyone from the board. Next choose if you want to use an SMTP server for sending emails. If you choose to enable SMTP than provide the hostname, port, email address and password. If you don’t want to use SMTP then the emails will be sent using Php Mail function.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1599326454.png” alt=”” />

Now, configure your server settings, choose if you want to enable cookie secure. If you enable this, then you will need to run SSL on your website. Choose No for Force server URL settings. Choose the Server protocol as http://, if you are using SSL then use https:// and enable cookie secure. Provide a domain name of your forum. If you don’t have a domain name ready, you can also use your server IP address. Leave the port 80 and choose the script path which is your subfolder.

Click Proceed to next step button, the installer will now write the data into the database and you will see the confirmation on the installer interface.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/133685546.png” alt=”” />

Once done, click Next button and you will see that installer has completed the installation of the phpBB application.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1577008240.png” alt=”” />

Before you start using the application, you will need to remove the install folder. You can do so by running the following command.

rm -rf /var/www/html/install

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/1476158337.png” alt=”” />

To browse the administrative panel, log in using your administrator credentials, and click on ACP link from the top menu.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/397673550.png” alt=”” />

Conclusion

In this tutorial, we have learned how to install phpBB on CentOS 7. You can now easily install phpBB to create a forum for your community. Using phpBB is very easy, you can now brand the forum with your logo and other settings.

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Share this Article!

Related Posts

Node.js Authentication – A Complete Guide with Passport and JWT

Node.js Authentication – A Complete Guide with Passport and JWT

Truth be told, it’s difficult for a web application that doesn’t have some kind of identification, even if you don’t see it as a security measure in and of itself. The Internet is a kind of lawless land, and even on free services like Google’s, authentication ensures that abuses will be avoided or at least […]

Node.js and MongoDB: How to Connect MongoDB With Node

Node.js and MongoDB: How to Connect MongoDB With Node

MongoDB is a document-oriented NoSQL database, which was born in 2007 in California as a service to be used within a larger project, but which soon became an independent and open-source product. It stores documents in JSON, a format based on JavaScript and simpler than XML, but still with good expressiveness. It is the dominant […]

Using MySQL with Node.js: A Complete Tutorial

Using MySQL with Node.js: A Complete Tutorial

Although data persistence is almost always a fundamental element of applications, Node.js has no native integration with databases. Everything is delegated to third-party libraries to be included manually, in addition to the standard APIs. Although MongoDB and other non-relational databases are the most common choice with Node because if you need to scale an application, […]

Node.Js Vs Django: Which Is the Best for Your Project

Node.Js Vs Django: Which Is the Best for Your Project

Django and NodeJs are two powerful technologies for web development, both have great functionality, versatile applications, and a great user interface. Both are open source and can be used for free. But which one fits your project best? NodeJs is based on JavaScript, while Django is written in Python. These are two equally popular technologies […]

Nodejs Vs PHP:  Which Works Best?

Nodejs Vs PHP: Which Works Best?

Before getting into the “battle” between Node.js and PHP we need to understand why the issue is still ongoing. It all started with the increased demand for smartphone applications, their success forcing developers to adapt to new back-end technologies that could handle a multitude of simultaneous requests. JavaScript has always been identified as a client-side […]