Atlantic.Net Blog

How to Install phpBB on Arch Linux

phpBB is a free, open-source, and flat-forum bulletin board software written in PHP scripting language. It is also known as a “PHP Bulletin Board” and is used to create a discussion forum where people can post topics and other people can reply to those topics. Compared to other forum software, phpBB is a popular and widely used open-source forum script found all over the web.

In this post, we will explain how to install the phpBB forum on Arch Linux.

Step 1 – Configure Repository

By default, the default repository is outdated in Arch Linux, so you will need to modify the default mirror list. You can do it by editing the mirror list configuration file:

nano  /etc/pacman.d/mirrorlist

Remove all lines and add the following lines:

## Score: 0.7, United States
Server = http://mirror.us.leaseweb.net/archlinux/$repo/os/$arch
## Score: 0.8, United States
Server = http://lug.mtu.edu/archlinux/$repo/os/$arch
Server = http://mirror.nl.leaseweb.net/archlinux/$repo/os/$arch
## Score: 0.9, United Kingdom
Server = http://mirror.bytemark.co.uk/archlinux/$repo/os/$arch
## Score: 1.5, United Kingdom
Server = http://mirrors.manchester.m247.com/arch-linux/$repo/os/$arch
Server = http://archlinux.dcc.fc.up.pt/$repo/os/$arch
## Score: 6.6, United States
Server = http://mirror.cs.pitt.edu/archlinux/$repo/os/$arch
## Score: 6.7, United States
Server = http://mirrors.acm.wpi.edu/archlinux/$repo/os/$arch
## Score: 6.8, United States
Server = http://ftp.osuosl.org/pub/archlinux/$repo/os/$arch
## Score: 7.1, India
Server = http://mirror.cse.iitk.ac.in/archlinux/$repo/os/$arch
## Score: 10.1, United States
Server = http://mirrors.xmission.com/archlinux/$repo/os/$arch

Save and close the file, then update all the package indexes with the following command:

pacman -Syu

Step 2 – Install Nginx Web Server

phpBB requires a web server to be installed on your server. If not installed, you can install Nginx with the following command.

pacman -S nginx-mainline

Next, start and enable the Nginx service with the following command.

systemctl start nginx
systemctl enable nginx

Step 3 – Install and Configure PHP

First, install the PHP, PHP-FPM, and other PHP extensions using the following command.

pacman -S php php-fpm php-gd unzip

After the successful installation, edit the PHP configuration file and change the necessary settings.

nano /etc/php/php.ini

Add/modify the following lines:

memory_limit = 512M
post_max_size =32M
upload_max_filesize = 32M
date.timezone = Asia/Kolkata

extension=gd
extension=json
extension=xml
extension=ldap
extension=mysqli
extension=imagemagick
extension=curl
extension=intl

Save and close the file, then start the PHP-FPM service and enable it to start at system reboot.

systemctl start php-fpm
systemctl enable php-fpm

Step 4 – Create a Database for phpBB

phpBB uses MariaDB as a database backend, so you will need to install MariaDB on your server.

pacman -S mariadb

After installing the MariaDB server, initialize the MariaDB database with the following command.

mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Next, start the MariaDB service and enable it to start at system reboot.

systemctl start mysqld
systemctl enable mysqld

Next, log into the MariaDB shell with the following command.

mysql

Next, create a database and user for phpBB using the following command.

CREATE DATABASE phpbb;
GRANT ALL ON phpbb.* TO phpbb@localhost IDENTIFIED BY 'securepassword';

Next, flush the privileges and exit from the MariaDB shell with the following command.
FLUSH PRIVILEGES;
EXIT;

Step 5 – Download phpBB

First, download the latest version of phpBB from their official download page.

wget https://download.phpbb.com/pub/release/3.3/3.3.10/phpBB-3.3.10.zip

Once the download is completed, unzip the downloaded file with the following command.

unzip phpBB-3.3.10.zip

Next, create a directory for phpBB and move the phpBB to this directory.

mkdir -p /var/www/html/
mv phpBB3 /var/www/html/phpbb

Next, change the ownership of the phpBB directory.

chown -R http:http /var/www/html/phpbb/

Step 6 – Create an Nginx Virtual Host for phpBB

Next, you will need to create an Nginx virtual host configuration file to host phpBB on Nginx.

First, create a directory to store Nginx virtual host.

mkdir /etc/nginx/sites-enabled

Next, create an Nginx configuration file for phpBB.

nano /etc/nginx/sites-enabled/phpbb.conf

Add the following configurations.

server {
	listen 80;
	server_name phpbb.example.com;
	root /var/www/html/phpbb;

	index index.php index.html index.htm;
	error_log /var/log/nginx/example.com.error.log warn;
	access_log /var/log/nginx/example.com.access.log;

	location / {
		try_files $uri $uri/ @rewriteapp;

		# Pass the php scripts to FastCGI server specified in upstream declaration.
		location ~ \.php(/|$) {
			include fastcgi.conf;
			fastcgi_split_path_info ^(.+\.php)(/.*)$;
			fastcgi_param PATH_INFO $fastcgi_path_info;
			fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
			fastcgi_param DOCUMENT_ROOT $realpath_root;
			try_files $uri $uri/ /app.php$is_args$args;
			fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;

		}

		# Deny access to internal phpbb files.
		location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
			deny all;
			# deny was ignored before 0.8.40 for connections over IPv6.
			# Use internal directive to prohibit access on older versions.
			internal;
		}
	}

	location @rewriteapp {
		rewrite ^(.*)$ /app.php/$1 last;
	}

	# Correctly pass scripts for installer
	location /install/ {
		try_files $uri $uri/ @rewrite_installapp =404;

		# Pass the php scripts to fastcgi server specified in upstream declaration.
		location ~ \.php(/|$) {
			include fastcgi.conf;
			fastcgi_split_path_info ^(.+\.php)(/.*)$;
			fastcgi_param PATH_INFO $fastcgi_path_info;
			fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
			fastcgi_param DOCUMENT_ROOT $realpath_root;
			try_files $uri $uri/ /install/app.php$is_args$args =404;
			fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;

		}
	}

	location @rewrite_installapp {
		rewrite ^(.*)$ /install/app.php/$1 last;
	}

	# Deny access to version control system directories.
	location ~ /\.svn|/\.git {
		deny all;
		internal;
	}
}

Save the file, then edit the Nginx main configuration file.

nano /etc/nginx/nginx.conf

Add the following lines after http{:

server_names_hash_bucket_size 64;
include sites-enabled/*;

Save the file, then verify the Nginx configuration using the following command.

nginx -t

You will get the following output.

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Finally, restart the Nginx service to apply the changes.

systemctl restart nginx

Step 7 – Access phpBB Web Installation

Now, open your web browser and type the URL http://phpbb.example.com/ to perform the phpBB web installation. You should see the following screen.
phpBB welcome Screen
Click on the INSTALL tab. You should see the phpBB welcome screen.
phpBB Install Screen
Click on the Install button. You should see the admin account configuration page.
phpBB admin creation Screen
Set your admin username, email, and password, and click on the Submit button. You should see the Database configuration page.
phpBB database creation Screen
Define your database configuration and click on the Submit button. You should see the server configuration page.
phpBB server configuration Screen
Define your server protocol, domain name, and port, and click on the Submit button. You should see the following page.
phpBB email configuration Screen
Provide all necessary settings and click on the Submit button. You should see the board configuration page.
phpBB board configuration Screen

Select your language, the title of the board, and the description and click on the Submit button. Once the phpBB is installed, you should see the following page.
phpBB installation done
Click on Take me to the ACP. You should see the phpBB dashboard on the following page.
phpBB dashboard

Conclusion

In this post, we explained how to install phpBB on Arch Linux with the Nginx web server. You can now use phpBB to create an online space to stay in touch with a group of people. You can test phpBB on dedicated server hosting from Atlantic.Net!

Get a $250 Credit and Access to Our Free Tier!

Free Tier includes:
G3.2GB Cloud VPS a Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year