LinuxTutorialsUbuntu

How To Install Chatwoot on Ubuntu 20.04 LTS

Install Chatwoot on Ubuntu 20.04

In this tutorial, we will show you how to install Chatwoot on Ubuntu 20.04 LTS. For those of you who didn’t know, Chatwoot is an open-source, real-time messaging platform that also provides simple and elegant live chat for your websites, collaborates with other agents and messaging apps, and more. This means that you can integrate your social media chat e.g Facebook, Twitter, email, WhatsApp e.t.c to one central place. This will effectively help you have eyes on all your platforms and respond to customer requests in real-time.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Chatwoot on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 20.04, 18.04, and any other Debian-based distribution like Linux Mint or elementary OS.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Chatwoot on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade

Step 2. Installing Chatwoot on Ubuntu 20.04.

Now we download the script that will be used to install Chatwoot:

cd /tmp
wget https://raw.githubusercontent.com/chatwoot/chatwoot/develop/deployment/setup_20.04.sh -O setup.sh

Next, make it executable and then install using the commands below:

sudo chmod 755 setup.sh
sudo ./setup.sh master

Once a successful installation, you should see a message similar to the one below:

Chatwoot server installation is complete
The server will be accessible at http://<server-ip>:3000
To configure a domain and SSL certificate, follow the guide at https://www.chatwoot.com/docs/deployment/deploy-chatwoot-in-linux-vm

Step 3. Install and Configure Nginx Web Server.

Now we need to install Nginx and use it as a reverse proxy for Chatwoot:

sudo apt update
sudo apt install nginx

After installing Nginx, run the command below to unlink the default Nginx configuration file:

sudo unlink /etc/nginx/sites-enabled/default

Next, create a new Nginx virtual host configuration:

cd /etc/nginx/sites-available
sudo nano chatwoot.conf

Add the following configuration in the conf file:

# server {
server_name chatwoot.idroot.us www.chatwoot.idroot.us;

# Point upstream to Chatwoot App Server
set $upstream 127.0.0.1:3000;

# Nginx strips out underscore in headers by default
# Chatwoot relies on underscore in headers for API
# Make sure that the config is turned on.
underscores_in_headers on;
location /.well-known {
alias /var/www/ssl-proof/chatwoot/.well-known;
}

location / {
proxy_pass_header Authorization;
proxy_pass http://$upstream;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Ssl on; # Optional

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_http_version 1.1;
proxy_set_header Connection “”;
proxy_buffering off;

client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
}
listen 80;
}

Save the configuration file and link it to /etc/nginx/sites-enabled:

sudo ln -s /etc/nginx/sites-available/chatwoot.conf /etc/nginx/sites-enabled/chatwoot.conf

Verify that your Nginx configuration is okay then restart the Nginx service:

sudo nginx -t
sudo systemctl reload nginx

Step 4. Installing and Configure Let’s Encrypt SSL.

We should enable a secure HTTPS connection on Chatwoot. We can obtain a free TLS certificate from Let’s Encrypt. Install Let’s Encrypt client (certbot) from Ubuntu 20.04 repository:

sudo add-apt-repository ppa:certbot/certbot

Now install Certbot:

sudo apt update
sudo apt install python-certbot-nginx

Run Let’s Encrypt using the following command:

sudo mkdir -p /var/www/ssl-proof/chatwoot/.well-known
sudo certbot --webroot -w /var/www/ssl-proof/chatwoot/ -d idroot.us -i nginx

Step 5. Accessing Chatwoot Web Interface.

Chatwoot will be available on HTTP port 80 by default. Open your favorite browser and navigate to https://idroot.us/ and complete the required steps to finish the installation. If you are using a firewall, please open port 80 to enable access to the control panel.

Install Chatwoot on Ubuntu 20.04

Step 6. Configure Chatwoot Environment.

First, log in as Chatwoot user and create an environment variable folder:

sudo -i -u chatwoot
cd chatwoot
nano .env

Now you can reference its variables page the add variable definitions in the file.

For example, to use the Facebook channel, you can add the lines below in the file:

FB_VERIFY_TOKEN=
FB_APP_SECRET=
FB_APP_ID=

To use Sendgrid, use the block below:

SMTP_ADDRESS=smtp.sendgrid.net
SMTP_AUTHENTICATION=plain
SMTP_DOMAIN=<your verified domain>
SMTP_ENABLE_STARTTLS_AUTO=true
SMTP_PORT=587
SMTP_USERNAME=apikey
SMTP_PASSWORD=<your Sendgrid API key>

After making changes to the environment file, run the commands below to restart Chatwoot:

sudo systemctl restart chatwoot.target

Congratulations! You have successfully installed Chatwoot. Thanks for using this tutorial for installing Chatwoot on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you check the official Chatwoot website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button