Installation Bot

Nacht123 edited this page Apr 18, 2016 · 17 revisions

Installation Guide for pajbot

The instructions below are tested with pajbot 2.7.4 (commit #1387)

  • Ubuntu 14.04.4 LTS *no guide for uWSGI and nginx
  • Ubuntu 15.10
  • Debian 8.3

Default-Guide Setup

(make sure to change them, if you use a different setup)

  • Log Folder = /var/log/pajbot
  • Project config = /srv/pajbot/configs/pajbot.ini
  • Project Folder = /srv/pajbot
  • OS group = www-data
  • OS user = ubuntu
  • Text-Editor = subl


pajbot Required Tested Version
GIT Yes 2.5.0
gulp Yes CLI 1.2.1
MySQL Yes 5.6
nginx No 1.9.14
Node Yes 5.10.1
NPM Yes 3.8.6
PM2 No 1.1.1
Python Yes 3.4
Redis Yes 3.0.7
uWSGI No 2.0.12

If you stuck at some point, checkout this video.

1. Create a Project Folder

# Debian (Allow the user ubuntu, to execute sudo)
adduser ubuntu sudo

# You maybe need to restart Debian
# create a folder for pajbot in /srv/
sudo mkdir /srv/pajbot
sudo chown ubuntu:www-data /srv/pajbot
cd /srv/pajbot

2. GIT

# Install git
sudo apt-get install git

clone pajbot

# in /srv/pajbot
git clone .

or if you Fork it

# in /srv/pajbot
git clone .
git remote add upstream

3. MySQL (Guide)

Install MySQL

sudo apt-get install mysql-server

Login to MySQL & Create a MySQL Database

mysql -u root -p

CREATE DATABASE pajbot CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON pajbot.* TO 'pajbot'@'localhost' IDENTIFIED BY 'password';


4. Python Requirements

4.1.1 For Python venv (Guide)

sudo apt-get install python3.4-venv python3-dev

4.1.2 For cryptography module (Guide)

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

4.1.3 For pillow module (Guide)

# Ubuntu 14.04 LTS, Ubuntu 15.10, Debian 8
sudo apt-get install libtiff5-dev zlib1g-dev \
    libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev \
    python-tk python3-tk


# Ubuntu 14.04 LTS, Ubuntu 15.10,
sudo apt-get install libjpeg8-dev 
# Debian 8
sudo apt-get install libjpeg62-turbo-dev

4.1.4 For PyAV module (Guide)

Packages required for thumbnail-generation

sudo apt-get install \
    libavformat-dev libavcodec-dev libavdevice-dev \
    libavutil-dev libswscale-dev libavresample-dev

4.2 Install a virtual environment

remove the # if you want to use the pip module

configure pip-requirements.txt

# in /srv/pajbot

5. Redis-server (Quickstart)

Debian 8 Jessie (Guide)

# add these two lines to your /etc/apt/sources.list file
deb jessie all
deb-src jessie all

sudo apt-key add dotdeb.gpg

sudo apt-get update
sudo apt-get install redis-server

Ubuntu 15.10

sudo add-apt-repository ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get install redis-server

6. RUN pajbot - Bot

6.1 Create a config file according to the specifications in wiki and save it in configs/pajbot.ini

# Start myvenv
source myvenv/bin/activate
# Start the bot
# or if your config file is in configs/pajbot.ini
./ --config configs/pajbot.ini

7. NODE (Guide)


curl -sL | sudo -E bash -
sudo apt-get install -y nodejs

8. NPM (Guide)


Node comes with npm installed so you should have a version of npm.
However, npm gets updated more frequently than Node does, so you'll want to make sure it's the latest version.

sudo npm install npm -g

9. gulp (Guide)


sudo npm install --global gulp-cli


# in /srv/pajbot
npm install

Semantic Install


gulp build

# in /srv/pajbot

11. RUN pajbot - website

# Start myvenv
source myvenv/bin/activate
# Start the website
# or if your config file is in configs/pajbot.ini
./ --config configs/pajbot.ini

12. PM2 (Guide) (optional)


sudo npm install pm2 -g

Create a log folder

sudo mkdir /var/log/pajbot
sudo chown ubuntu:www-data /var/log/pajbot

Run PM2

# Start myvenv
source myvenv/bin/activate

./ pajbot

13. uWSGI (Guide) (optional)

(This Guide for uWSGI doesn't work for Ubuntu 14.04)


# Start myvenv
source myvenv/bin/activate
# Install uWSGI
pip install uwsgi

uWSGI config

  • Example for /srv/pajbot/pajbot.ini
  • Example for /etc/systemd/system/uwsgi.pajbot.service
# Create a uWSGI config file
subl /srv/pajbot/uwsgiconfigs/pajbot.ini
# Create a uwsgi service file
sudo subl /etc/systemd/system/uwsgi.pajbot.service
# Start uWSGI service
sudo systemctl enable uwsgi.pajbot.service
sudo systemctl start uwsgi.pajbot.service

14. Nginx (optional)

Install Mainline version 1.9.14 (Guide)

You can use a different Version, but i tested it with 1.9.14

sudo apt-key add nginx_signing.key
rm nginx_signing.key

# change this file
sudo subl /etc/apt/sources.list

for Debian 8.4 Jessie /etc/apt/sources.list file
deb jessie nginx
deb-src jessie nginx

for Ubuntu 15.10 Wily /etc/apt/sources.list file
deb wily nginx
deb-src wily nginx

sudo apt-get update
sudo apt-get install nginx

Nginx config (Guide)

You can use this Example, to run it.
Change and update the config for your own domain settings.

sudo subl /etc/nginx/conf.d/default.conf

15. GO (optional)

Ubuntu (Guide)

sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable
sudo apt-get update
sudo apt-get install golang


sudo apt-get install golang

mkdir $HOME/go
export GOPATH=$HOME/go

16. Relaybroker (optional)

# in /srv
git clone
cd relaybroker/

configure config.example and rename it to config.go

go get
go build

configure your config file from pajbot

;if you want to use
relay_host =
relay_password = test

Start Relaybroker

# If you use PM2
pm2 start ./relaybroker --output="/var/log/pajbot/relaybroker.log" --error="/var/log/pajbot/relaybroker.err"