Step-by-Step Guide to Installing ElkArte Forum on Ubuntu 22.04

ElkArte is a free and open-source forum software, created using the PHP scripting language. It’s derived from the Simple Machines
Forum and its goal is to help you effortlessly design and manage a community forum. Over time, it’s evolved into a contemporary and feature-rich forum platform that caters to the modern-day forum user. Additionally, ElkArte benefits from a variety of community-crafted Themes and Addons designed to extend its functionality.

This tutorial will guide you through the installation of ElkArte on Ubuntu 22.04 with Let’s Encrypt SSL.

Prerequisites

  • An instance running Ubuntu 22.04.
  • A registered domain name correctly pointing to your server.
  • Administrator (root) access configured on your server.

Install Apache, PHP, and MariaDB

ElkArte requires a web server and uses PHP alongside MariaDB as its database backend. You’ll first need to install Apache and the
MariaDB server.

Run the following command:

apt install apache2 mariadb-server

Since Ubuntu 22.04 defaults to PHP 8.1, you’ll need to add the Ondrej PHP repository to install PHP 7.4 and its necessary extensions.

apt install software-properties-common -y
add-apt-repository ppa:ondrej/php -y

Once added, install PHP 7.4 and the required PHP extensions:

apt install php7.4 libapache2-mod-php7.4 php7.4-common php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-mysql php7.4-gd php7.4-pgsql php7.4-xml php7.4-cli php7.4-imagick php7.4-bcmath php7.4-gmp php7.4-zip unzip -y

Modify the `/etc/php/7.4/apache2/php.ini` file to update default settings:

nano /etc/php/7.4/apache2/php.ini

Update these lines:

  memory_limit = 256M
  upload_max_filesize = 100M
  max_execution_time = 360
  date.timezone = Asia/Kolkata

Save the changes and restart Apache to apply them:

systemctl restart apache2

Configure MariaDB Database

Secure your MariaDB installation and set the root password.

mysql_secure_installation

Provide answers to these prompts:

  Enter current password for root (enter for none):
  Set root password? [Y/n] Y
  New password:
  Re-enter new password:
  Remove anonymous users? [Y/n] Y
  Disallow root login remotely? [Y/n] Y
  Remove test database and access to it? [Y/n] Y
  Reload privilege tables now? [Y/n] Y

Next, create a database and user for ElkArte:

mysql -u root -p
MariaDB [(none)]> CREATE DATABASE elkdb;
MariaDB [(none)]> CREATE USER 'elk'@'localhost' IDENTIFIED BY 'password';

Grant all privileges to the user:

MariaDB [(none)]> GRANT ALL ON elkdb.* TO 'elk'@'localhost' WITH GRANT OPTION;

Flush privileges and exit:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Download ElkArte

Use the following command to download ElkArte:

wget https://github.com/elkarte/Elkarte/releases/download/v1.1.8/ElkArte_v1-1-8_install.zip

Unzip the downloaded file to the Apache web root:

unzip ElkArte_v1-1-8_install.zip -d /var/www/html/elkarte

Set proper permissions for the directory:

chown -R www-data:www-data /var/www/html/elkarte/
chmod -R 755 /var/www/html/elkarte/

Configure Apache for ElkArte

Create a new Apache virtual host configuration file:

nano /etc/apache2/sites-available/elkarte.conf

Add the following:

  <VirtualHost *:80>
       ServerAdmin admin@example.com
       ServerName elk.linuxbuz.com
       DocumentRoot /var/www/html/elkarte
  
       <Directory /var/www/html/elkarte/>
            Options FollowSymlinks
            AllowOverride All
            Require all granted
       </Directory>
  
       ErrorLog ${APACHE_LOG_DIR}/error.log
       CustomLog ${APACHE_LOG_DIR}/access.log combined
      
  </VirtualHost>

Enable the virtual host and the rewrite module:

a2ensite elkarte.conf
a2enmod rewrite

Restart Apache:

systemctl restart apache2

Access ElkArte Web Interface

Open a web browser and navigate to https://elk.linuxbuz.com.

Your ElkArte welcome page should appear:

Follow the on-screen instructions to complete the setup, including database and admin account configuration.

Secure ElkArte with Let’s Encrypt SSL

Install Certbot for SSL management:

apt-get install certbot python3-certbot-apache -y

Execute the following command to set up SSL:

certbot --apache -d elk.linuxbuz.com

Follow the on-screen instructions to complete the SSL installation and choose to redirect HTTP traffic to HTTPS.

Conclusion

Congratulations! You have successfully set up ElkArte with Let’s Encrypt SSL on Ubuntu 22.04. Your community forum is now ready for use. For any queries, feel free to reach out.

FAQ

1. Can I install a different version of PHP?

Yes, you can install different PHP versions, but ElkArte requires compatible PHP versions like 7.4 for smooth functionality. Ensure to
check ElkArte’s documentation for compatibility.

2. How do I update ElkArte?

ElkArte updates can be managed through the Admin panel or by downloading the latest packages from their repository. Ensure to back up
your forum and database before performing any updates.

3. What should I do if I lose access to my database?

You will need root access to your server to reset or recover your database credentials. Use the `mysql_secure_installation` to reset
the root password if needed.

4. Can I change the domain for ElkArte after installation?

Yes, but you’ll need to update your Apache configuration and ElkArte settings to reflect the new domain. Ensure DNS records
also point to your server.