# Installing phpBB Forum/Bulletin Board on Debian

1. Log into the Debian device
2. Run the following commands in a terminal:
   # update repositories and install any available software updates
   sudo apt update
   sudo apt upgrade -y
   # install Apache HTTPD and MySQL
   sudo apt-get install apache2 mariadb-server mariadb-client curl
   # install PHP components
   sudo apt install php php-mysql php-cli php-json php-opcache php-gd php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
   # configure the MySQL database
   sudo su
   mysql_secure_installation
3. Press Enter to login as root
4. Type Y and press Enter to set a root password, type the password twice to confirm
5. Type Y and press Enter to remove anonymous users
6. Type Y and press Enter to disallow root login remotely
7. Type Y and press Enter to remove the test database
8. Type Y and press Enter to reload privilege tables
9. Run the following command to login into MySQL:
   mysql -u root -p
10. Authenticate with the root password set earlier
11. Run the following commands to create the phpbb database and database user
    CREATE DATABASE phpbb DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    GRANT ALL ON phpbb.* TO 'phpbb_rw'@'localhost' IDENTIFIED BY '!!phpBB##';
    FLUSH PRIVILEGES;
    EXIT;
    exit
12. Continue with the following commands to download and extract phpBB in the Apache webroot
    # download latest phpbb version
    sudo wget -O phpbb.tar.gz https://download.phpbb.com/pub/release/3.3/3.3.2/phpBB-3.3.2.tar.bz2
    # extract phpbb.tar.gz
    sudo tar xvf phpbb.tar.gz --directory /var/www
    # rename phpbb folder
    sudo mv /var/www/phpBB* /var/www/phpbb
    # create a new phpbb.conf file to configure the site
    sudo nano /etc/apache2/sites-available/phpbb.conf
13. Paste the following configuration into phpbb.conf

    Alias /phpbb "/var/www/phpbb/"
    <Directory /var/www/phpbb/>
    AllowOverride All
    </Directory>

14. Press CTRL+O, Enter, CTRL+X to write the changes to phpbb.conf
15. Continue with the following commands to enable the site and restart Apache:
    # enable the phpbb site and required PHP modules
    sudo a2ensite phpbb
    sudo a2enmod rewrite
    # set the owner of the new phpbb directory to www-data
    sudo chown -R www-data:www-data /var/www/phpbb
    # restart apache2 service
    sudo systemctl restart apache2
16. Open a web browser and navigate to http://DNSorIP/phpbb
17. The phpBB introduction screen should be displayed
18. Click the Install tab
19. Click the Install button
20. Input an administrator username, email address and password > Click Submit
21. Enter the database hostname, username, password and database name > Click Submit
22. Click the Submit button on the Server configuration page
23. Click the Submit button on the E-mail configuration page
24. Enter a title and short description on the Bulletin board configuration page > Click Submit
25. When the installation completes run the following command in terminal to delete the /install directory
    sudo rm /var/www/phpbb/install -r
26. In a web browser, navigate to http://DNSorIP/phpbb
27. Welcome to your very own, self-hosted forum with phpBB