A Comprehensive Guide on How to Install Discourse in Ubuntu 22.04

Introduction

Discourse is a powerful platform for building online communities and forums. In this comprehensive guide, we will learn How to Install Discourse in Ubuntu.

Prerequisite

Before we dive into the process of how to Install Discourse in Ubuntu installation, it’s essential to ensure that your Ubuntu server is ready. In this chapter, we’ll cover the prerequisites and preparations you need to make to ensure a smooth installation process.

From updating your system to installing necessary dependencies, we’ve got you covered. The below things are required before installation.

  • Create Ubuntu server
  • Preparing Your Domain Name
  • Preparing Your SMTP

Step 1: Create Ubuntu server

Install Discourse in Ubuntu,we need a Ubuntu server because Ubuntu is a popular open-source operating system, offers a world of possibilities. Among its many features, one gem stands out. To begin, create your new cloud server, for instance, on a platform like DigitalOcean. Here’s what you need to do:

  1. Choose the default option of the current supported LTS release of Ubuntu Server. A 64-bit Linux OS with a modern kernel version is the minimum requirement.
  2. For small Discourse communities, the default 1 GB RAM is sufficient. However, we recommend using 2 GB RAM for larger communities to ensure optimal performance.
  3. When selecting a region for your server, the default location of India is a good choice for most audiences in the India. Alternatively, choose a region that is geographically closer to your target audience.
  4. Enter your domain, such as discourse.developernoob.com, as the Droplet name.
  5. Create your new Droplet. You may receive an email with the root password, but we strongly advise setting up SSH keys for enhanced security.
  6. For setup digital ocean account with ubuntu sever you can follow this tutorial.

Step 2 : Preparing Your Domain Name

Discourse requires a domain name, such as developernoob.com, to function properly. If you already own a domain name, that’s fantastic.

  1. You can select a subdomain like discourse.developernoob.com, talk.developernoob.com, or discussion.developernoob.com for your Discourse installation.
  2. If you don’t have a domain name yet, it’s time to get one. We recommend services like NameCheap, but there are many other reputable domain name registrars to choose from.
  3. To configure your Discourse setup, you’ll need access to your domain name’s DNS controls, which are typically provided by the registrar where you purchased your domain.
  4. This is where you will create a DNS A record for the hostname discourse.developernoob.com, once you know the IP address of the cloud server where you’re installing Discourse. Additionally, you’ll need to enter your SPF and DKIM records for email security.

Step 3 : Preparing Your SMTP Server

Email functionality is of utmost importance for account creation and notifications within Discourse. It’s crucial to configure email correctly before proceeding, as an incorrect setup can lead to a non-functional site.

  1. Please note that when we mention email here, we are referring to Transactional Email, not the typical email services like Gmail, Outlook, or Yahoo.
  2. If you already have a mail server, that’s excellent. You can use the credentials from your existing mail server. However, please be aware that free email services like Gmail, Outlook, and Yahoo do not support transactional emails.
  3. To ensure that your emails reach their destination, you must add valid SPF and DKIM records to your DNS settings. You’ll also need the SMTP credentials from your email provider, which typically include an SMTP username and password.
  4. To find these credentials, log in to your email provider’s account, navigate to the SMTP settings or Email API section, and locate or generate the unique SMTP credentials.
  5. Keep these credentials secure, as you’ll need them during the Discourse configuration process. Refer to your email provider’s instructions for specific details.
  6. But you can use gmail SMTP as your SMTP server for test purpose.

How to Install Discourse in Ubuntu?

Step 1: Login to Server and update server

To Install Discourse in Ubuntu you need to access your cloud server, follow these steps:

  1. Connect to your server using SSH. If you’re on Windows, you can use a tool like Putty.
  2. You can either use the root password provided in the email from DigitalOcean when the server was set up, or if you’ve configured a valid SSH key on your local machine, use that for authentication.
  3. Use the following command to initiate an SSH connection, replacing “192.168.1.1” with the actual IP address of your server:
#Replace your IP
ssh [email protected]

Begin your journey by ensuring your server is up to date. Open your terminal and execute the following command:

sudo apt update 
sudo apt upgrade -y

Step 2: Install Discourse in Ubuntu

Clone the Official Discourse Docker Image into /var/discourse

Open a terminal and switch to the root user with the following command one by one/

sudo -s

Clone the Discourse Docker image repository by running the following command:

git clone https://github.com/discourse/discourse_docker.git /var/discourse

Change your working directory to /var/discourse:

cd /var/discourse

Ensure proper permissions for the containers directory:

chmod 700 containers

Step 3: Configure Discourse

Launch the setup tool at

./discourse-setup

Please provide your questions, and I’ll be happy to answer them.

Hostname for your Discourse? [discourse.developernoob.com]: 
Email address for admin account(s)? [[email protected]]: 
SMTP server address? [smtp.example.com]: 
SMTP port? [587]: 
SMTP user name? [yoursmtpusername]: 
SMTP password? [yoursmtpuserpassword]: 
Let's Encrypt account email? (ENTER to skip) [[email protected]]: 
Optional Maxmind License key () [xxxxxxxxxxxxxxxx]:

Sometimes, automated configuration may fail due to invalid settings. In such cases, you can choose to set up the configuration manually by providing the installation details

#Go to the discourse directory
cd /var/discourse

#Edit the configuration
sudo nano containers/app.yml

Please review the format below and provide the necessary information based on your domain and SMTP details.

  ## on initial signup example '[email protected],[email protected]'
  DISCOURSE_DEVELOPER_EMAILS: '[email protected]'

  ## TODO: The SMTP mail server used to validate new accounts and send notifica>
  # SMTP ADDRESS, username, and password are required
  # WARNING the char '#' in SMTP password can cause problems!
  DISCOURSE_SMTP_ADDRESS: smtp.gmail.com #you can use any smtp service provider
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: [email protected]
  DISCOURSE_SMTP_PASSWORD: yoursmtppassword
  DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)
  DISCOURSE_SMTP_DOMAIN: discourse.developernoob.com #your domain name
  DISCOURSE_NOTIFICATION_EMAIL: [email protected]

Save the file using ‘ctrl+x’ and confirm with ‘Y.’ Then, rebuild the app using the following command

./launcher rebuild app

Sometimes the SMTP server may not be functioning correctly, causing you not to receive emails. You can verify the settings using the command below.

./discourse-doctor

If you face error regarding SMTP then check the official doc for How to Install Discourse in Ubuntu by Here

Step 4: Start Discourse

Wait for sometime ,it will takes 10-15 mins,then go to your domain name you will see discourse installed successfully.

Step 5: Creating a New Account and Attaining Administrator Status, Click on register and complete the signup process

You will get the an email from discoursse to confirm your account

Follow the registration process

Congratulations! You’ve now successfully installed Discourse on your Ubuntu server and configured it to your liking.

FAQs

What is Discourse?

Discourse is an open-source discussion platform designed for creating dynamic, engaging online communities and forums.

What kind of support does Digital Ocean offer?

Digital Ocean provides a robust knowledge base and community forum, and you can opt for premium support if needed.

How can I back up my droplet’s data?

Digital Ocean offers both automated backups and manual snapshots for data protection.

Conclusion

.Your digital community is ready to flourish, connecting people, ideas, and discussions. Discourse offers a user-friendly, feature-rich experience, making it the perfect platform to create your online haven.

So, what are you waiting for? Dive in and start building your thriving digital community today with Discourse on Ubuntu!

Leave a Comment