Install Saleor/Ubuntu 18/Nginx


Installation Saleor for Linux

Located origin guideline at:


If you prefer using containers or have problems with configuring PostgreSQL, Redis and Elasticsearch, try Using Docker for Development instructions.


Before you are ready to run Saleor you will need additional software installed on your computer.

Python 3

Saleor requires Python 3.5 or later. A compatible version comes preinstalled with most current Linux systems. If that is not the case consult your distribution for instructions on how to install Python 3.6 or 3.7.


Version 10 or later is required. See the installation instructions.


Saleor needs PostgreSQL version 9.4 or above to work. Use the PostgreSQL download page to get instructions for your distribution.


Some features like PDF creation require that additional system libraries are present.

Debian / Ubuntu

Debian 9.0 Stretch or newer, Ubuntu 16.04 Xenial or newer:

$ sudo apt-get install build-essential python3-dev python3-pip python3-cffi libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info


$ sudo yum install redhat-rpm-config python-devel python-pip python-cffi libffi-devel cairo pango gdk-pixbuf2


$ sudo pacman -S python-pip cairo pango gdk-pixbuf2 libffi pkg-config


$ emerge pip cairo pango gdk-pixbuf cffi


  1. Clone the repository (or use your own fork):

adduser: saleor

git clone

  1. Enter the directory:

cd saleor/

  1. Install all dependencies:We strongly recommend creating a virtual environment before installing any Python packages.

apt install virtualenv virtualenvwrapper

virtualenv ./venv

source ./venv/bin/activate

sudo pip3 install -r requirements.txt


pip3 install -r requirements.txt


python3 -m pip install -r requirements.txt

if pip3 command do not work

  1. Set SECRET_KEY environment variable.We try to provide usable default values for all of the settings. We’ve decided not to provide a default for SECRET_KEY as we fear someone would inevitably ship a project with the default value left in code.

export SECRET_KEY= mysecretkey

Warning: Secret key should be a unique string only your team knows. Running code with a known  `SECRET_KEY`  defeats many of Django’s security protections, and can lead to privilege escalation and remote code execution vulnerabilities. Consult [Django’s documentation]( for details.
  1. Create a PostgreSQL user:See PostgreSQL’s createuser command for details.
Note: You need to create the user to use within your project. Username and password are extracted from the  `DATABASE_URL`  environmental variable. If absent they both default to  `saleor` .

Warning: While creating the database Django will need to create some PostgreSQL extensions if not already present in the database. This requires a superuser privilege.

For local development you can grant your database user the  `SUPERUSER`  privilege. For publicly available systems we recommend using a separate privileged user to perform database migrations.
  1. Create a PostgreSQL databaseSee PostgreSQL’s createdb command for details.
Note: Database name is extracted from the  `DATABASE_URL`  environment variable. If absent it defaults to  `saleor` .
  1. Prepare the database: Edit /saleor/saleor/ to add your user/passwd of PostgreSQL
    'default': dj_database_url.config(

$ python3 migrate

  • In this case need grand saleor user on PostgreSQL a superuser privilege

sudo su - postgres


“postgres password”

\du; for see the user on db select the user that do you want be superuser and:

ALTER USER “saleor” with superuser;

Warning: This command will need to be able to create database extensions. If you get an error related to the  `CREATE EXTENSION`  command please review the notes from the user creation step.
  1. Install front-end dependencies:

$ npm install

Note: If this step fails go back and make sure you’re using new enough version of Node.js. Run the below command to upgrade nodejs

npm audit fix

npm install -g npm

  1. Prepare front-end assets:

$ npm run build-assets

  1. Compile e-mails:

npm run build-emails

Run demo store information with below command:

python3 populatedb

  1. Start the development server:

Create store superuser by:

python3 createsuperuser

Run demo server by this command:

$ python3 runserver

you will need to add or your FDNS host to /saleor/saleor/ located at

ALLOWED_HOSTS = get_list(
    os.environ.get('ALLOWED_HOSTS', 'localhost,,'))
  1. Create init.d script to start runserver at boot

touch /etc/init.d/saleor

add below code to this file:

#! /bin/sh                                                                                          
### BEGIN INIT INFO                                                                                 
# Provides:          Django-Server                                                                  
# Required-Start:    $all                                                                           
# Required-Stop:                                                                                    
# Default-Start:     2 3 4 5                                                                        
# Default-Stop:      0 1 6                                                                          
# Short-Description: Django Server                                                                  
### END INIT INFO                                                                                   

# If you need to source some other scripts, do it here                                              

case "$1" in                                                                                        
    log_begin_msg "Starting Saleor Server"                                                          
    python3 "/home/USER/saleor/" runserver  --insecure &      
    log_end_msg $?                                                                                  
    exit 0                                                                                          
    log_begin_msg "Stopping Saleor Server"                                                          

    # do something to kill the service or cleanup or nothing                                        

    log_end_msg $?                                                                                  
    exit 0                                                                                          
    echo "Usage: /etc/init.d/saleor {start|stop}"                                            
    exit 1                                                                                          

Run below command to start this script by default

chmod +x /etc/init.d/saleor

update-rc.d /etc/init.d/saleor defaults

  1. Nginx config
    Create new Nginx config file located at:

vi /etc/nginx/conf.d/saleor.conf

and add below line to this file

# this is the nginx config for saleor

upstream saleor {

server {

    # replace 'localhost' with your fqdn if you want to use saleor from remote

    root /home/USER/saleor;

    access_log /var/log/nginx/saleor.access.log;
    error_log  /var/log/nginx/saleor.error.log;

    client_max_body_size 500M;

    location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico) {
        expires max;

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header CLIENT_IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 300;
        proxy_pass http://saleor;

        gzip on;
        gzip_types text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript application/json application/xml;
        gzip_proxied any;


server {
    if ($host = {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    return 404; # managed by Certbot


nginx -t

Test to make sure syntax is ok

sudo certbot --nginx

To creat SSL for your site with certbot

For this guilde please make sure that your server already with: Python3, postgreSQL, Nodejs, Nginx, Certbot, installed before to do this job, try to “Google” for detail how to install both of them on your Ubuntu 18.