How to Install Chatwoot Messaging Platform on Debian 11
Follow this step-by-step guide to install the Chatwoot messaging platform on your Debian 11 server.
Step 1: Update Your System
Before installing any software, it’s important to update your system packages:
sudo apt update && sudo apt upgrade -y
Step 2: Install Dependencies
Chatwoot requires several dependencies to run. Use the following commands to install them:
sudo apt install -y git curl apt-transport-https gnupg2 redis-server postgresql postgresql-contrib libpq-dev build-essential nodejs
Step 3: Install Yarn
Yarn is required for managing JavaScript packages. Install it using these commands:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install yarn
Step 4: Install Chatwoot
Clone the Chatwoot repository to your server:
git clone https://github.com/chatwoot/chatwoot.git --branch stable
Navigate to the Chatwoot directory and install the required gems and packages:
cd chatwoot
bundle install
yarn install
Step 5: Configure Database
Setup the PostgreSQL database:
sudo -u postgres psql
CREATE USER chatwoot WITH PASSWORD 'password';
ALTER ROLE chatwoot SUPERUSER;
CREATE DATABASE chatwoot_production OWNER chatwoot;
\q
Now, run the database migrations:
RAILS_ENV=production bundle exec rails db:setup
Step 6: Precompile Assets
Precompile the assets required for Chatwoot:
RAILS_ENV=production bundle exec rails assets:precompile
Step 7: Start Chatwoot
Start the Chatwoot application using the following commands:
RAILS_ENV=production bundle exec rails s
Step 8: Configure Nginx as Reverse Proxy
To serve Chatwoot over a domain, configure Nginx as a reverse proxy. Install Nginx:
sudo apt install nginx
Create an Nginx configuration file for Chatwoot:
sudo nano /etc/nginx/sites-available/chatwoot
Enter the following content:
server {
listen 80;
server_name yourdomain.com;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Enable the configuration and restart Nginx:
sudo ln -s /etc/nginx/sites-available/chatwoot /etc/nginx/sites-enabled/
sudo systemctl restart nginx
Conclusion
You have successfully installed Chatwoot on your Debian 11 server. You can now access the platform via your domain and start using it for customer messaging.