How to install Flarum via SSH on Your Web Hosting or Server
Tags: flarum, tutorial, forum, todayilearned
Published: 2023-07-20 16:07:58

**Flarum** is a lightweight and powerful open-source forum software that offers a modern and enjoyable user experience. To install Flarum on your web hosting or server via SSH, follow this step-by-step guide to help you accomplish this task.

**Prerequisites for Flarum**
Before starting the Flarum installation, make sure your web server meets the following prerequisites:

**Web Server:** You need a web server such as Apache or Nginx to host your Flarum forum.
**PHP:** Flarum requires PHP 8.1.18 or later with the following PHP extensions enabled:
pdo_mysql
openssl
mbstring
json
ctype
zip
**Database:** Make sure you have access to a MySQL or MariaDB database to store your forum data.
**SSH Access:** You must have SSH access to your hosting to perform the installation via the command line.
With the prerequisites verified, you are now ready to start the Flarum installation.

## Step 1: SSH Connection to Your Hosting
Use an SSH client to connect to your web hosting. Open a terminal or command prompt and enter the following command:

```
ssh user@your-domain.com
```

Replace "user" with your username and "your-domain.com" with your hosting's URL.

## Step 2: Flarum Installation
Once connected via SSH, you will be in your default home directory. Now, navigate to the desired directory to install Flarum using the `cd` command. For example, if you want to install Flarum in the "forum" folder of your hosting, use the following command:

```
cd path/to/your/forum/directory
```

Once in the desired directory, execute the following command to install Flarum:

```
composer create-project flarum/flarum .
```

## Step 3: Flarum Installation
We will proceed with the actual installation. Make sure you are in the Flarum project directory before executing the following command:

```
php flarum install
```

This command will start the Flarum installation process. You will be guided through different steps to configure your forum:

**Language Selection:** Choose the language you want to use for the forum interface. If the language option does not appear, you can install the French language pack using the following command:

```
composer require flarum-lang/french
```

**Database Configuration:** Enter the database information you created earlier. You will need to provide the database name, username, and password.
**Site URL:** Provide the complete URL of your forum (e.g., 'your-domain.com').
**Administrator Email:** Enter the email address you want to associate with the Flarum administrator account.
**Administrator Account Creation:** Choose a username and password for the Flarum administrator account. This account will have administrative privileges on the forum.
**Forum Configuration:** You can configure the forum title and description here. This information will be displayed on the forum's homepage.
Once you have filled in all this information, the php flarum install command will create the database tables, configure the forum settings, and perform the necessary adjustments to make your forum operational.

## Step 4: Installation Link Configuration
After the installation, you can configure the installation URL to be 'your-domain.com' by creating a '.htaccess' file in your Flarum installation directory and adding the following rule:

```
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
```

This rule will redirect requests to the 'public' subdirectory of your Flarum installation.

## Step 5: Verification and Debugging
After completing all the steps, check your site by accessing the main URL ('your-domain.com'). If you encounter errors, check error logs, file permissions, database configuration, clear Flarum cache, verify installed extensions and themes, etc.

![Forum Website](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bwx3d4n25nhxzj6cnnfv.png)

## Step 6: Installation Verification
To check the details of your Flarum installation, follow these steps:

1. Open your terminal or command prompt.

2. Navigate to your Flarum installation directory using the cd command. 
3. Once in the Flarum installation directory, enter the following command to display important information about your installation:

```
php flarum info
```

![Flarum Info](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kt5kgh740aolmbwr3qll.png)
This command will show essential details such as the installed Flarum version, activated extensions, configuration settings, etc. Review this information to ensure that your installation is correct and all essential elements are in place.

If everything is in order, congratulations 👏🏿! Your Flarum installation is successful, and you can now start using your forum!

If you encounter any issues or errors during this verification, make sure to check error logs, file permissions, database configuration, clear Flarum cache, and verify installed extensions and themes to troubleshoot any potential problems.

Remember to consult the [official Flarum documentation](https://docs.flarum.org/install) for additional information on installation, configuration, and troubleshooting. This summary provides a general overview of the installation process, but adjustments may be needed based on your specific configuration.

In conclusion, this article provides a detailed and comprehensive guide for installing Flarum, an open-source forum software, on your web hosting or server using SSH. It covers all the necessary prerequisites, including having a suitable web server, PHP version, and database access.

The step-by-step instructions are easy to follow, making the installation process straightforward for both beginners and experienced users. From establishing an SSH connection to configuring the database and site settings, the article guides you through each stage with clarity and precision.