Introduction
Discourse is a free and open-source Internet forum software. Features include support for threading, categorization and tagging of discussions, configurable access control, live updates, expanding link previews, infinite scrolling, and real-time notifications. It allows for high customizability via its plugin architecture and theming system.
In this article, we will show you how to Install Discourse on Ubuntu 20.04.
Prerequisites
- The server must be running on Ubuntu 20.04 with 2 GB of RAM or more.
Securing the server
- Updating the security updates.
$ sudo dpkg-reconfigure -plow unattended-upgrades
- Setup a firewall with
ufw
.
$ sudo apt-get install ufw
$ sudo ufw default allow outgoing
$ sudo ufw default deny incoming
$ sudo ufw allow 22
$ sudo ufw allow http
$ sudo ufw allow https
$ sudo ufw enable - Installing
fail2ban
to secure your server.
$ sudo apt install fail2ban
Configurefail2ban
to useufw
- Copy the main configuration to
/etc/fail2ban/jail.local
file.
$ sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
- Edit the configuration
/etc/fail2ban/jail.local
file.
$ sudo nano /etc/fail2ban/jail.local
- Search the
banaction
,banaction_allports
configurations and change toufw
in the/etc/fail2ban/jail.local
file.
banaction = ufw banaction_allports = ufw
Installing Docker
- Uninstall old versions such as
docker
,docker.io
, ordocker-engine
if present in your system.
$ sudo apt-get remove docker docker-engine docker.io containerd runc
- Update the package index.
$ sudo apt-get update
- Install the ca-certificate.
$ sudo apt-get install ca-certificates curl gnupg lsb-release
- Setting up the repository.
$ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- Make sure the package is updated after the installation of the docker repository.
$ sudo apt update
- Installing the latest version of docker engine.
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Install Discourse
- Create a 'discourse' folder in the
/var
directory withmkdir
command.
$ sudo mkdir /var/discourse
- Clone the official discourse git repository in
/var/discourse
.
$ sudo git clone https://github.com/discourse/discourse_docker.git /var/discourse
- Change to the discourse directory.
cd /var/discourse
- Launch the setup tool.
./discourse-setup
- The following questions are prompted when setting up the discourse.
Note: Please wait until the installation gets complete after entering all the details and if you want to edit the values again. Run thea. Hostname for your Discourse?: The hostname of your Discourse platform should be entered here. [Example: test.discourse.com]
b. Email address for the admin account(s)?: Enter your Discourse administrator's email address of your choice.
c. SMTP server address?: Enter your SMTP server address.[Example: smtp.sendgrid.net]
d. SMTP port?: Enter your SMTP port. [Example:25
]
e. SMTP user name?: Enter your SMTP username.
f. SMTP password?: enter your SMTP user password.
g. Notification email address? [noreply@test.discourse.com]:[Example: test@example.com]
h. Optional email address for Let's Encrypt warnings? (ENTER to skip) [me@example.com]: Press 'ENTER' key
i. Optional Maxmind License key (ENTER to continue without MAXMIND GeoLite2 geolocation database) [1234567890123456]: Press 'ENTER' key./discourse-setup
again.
Output
Verify Discourse installation
To access your Discourse instance, you can just open a web browser and enter the domain name used when setting up the discourse.
You will see the welcome page with the 'Register' button and fill in the necessary steps to access the discourse dashboard page.