Инструменты пользователя

Инструменты сайта

en:installation_on_ubuntu:start

Installation on Ubuntu 16.04

In the instructions all commands are by default run under the root user.

OS update

apt-get update
apt-get upgrade

Install PostgreSQL

Custom locale is en_US

locale-gen en_US.UTF-8
dpkg-reconfigure locales

export LC_ALL="en_US.UTF-8"
apt-get install postgresql unzip

The installation process will create a new user postgres.

Switch to the postgres user

su postgres

Create a new user scuser - owner severcart database from shell psql

psql
CREATE USER scuser WITH PASSWORD '123456';

Create a database severcart

CREATE DATABASE severcart WITH ENCODING='UTF8' OWNER=scuser CONNECTION LIMIT=-1 template=template0;

To exit the psql shell recruited

\q

Go back to the root user

su -

Installable package virtualenv

apt-get install python-virtualenv

Create virtual environment

virtualenv --distribute -p /usr/bin/python3 /var/venv/

mkdir -p /var/venv/severcart/

Download and unpack the package severcart

The link to download latest version, copied from the official product website Download. The archive file has the extension *.zip.

cd /tmp

wget http://files.severcart.org/un/1_X_X.zip

Unpack the downloaded directory to /var/venv/severcart/

unzip 1_X_X.zip -d /var/venv/severcart

Installing dependencies

Activate the virtual environment

source /var/venv/bin/activate

Next, run the installer file.

python3 /var/venv/severcart/tkinstaller/install.py

The installation wizard prompts you to select the language to install. «en» select and press Enter.

During the installation will install the dependencies, migration of database schema, creation administrator severcart.

Install and configure Nginx

apt-get install nginx supervisor

Model the contents of the file /etc/nginx/sites-available/default the following:

server {
    listen 80;
    server_name 0.0.0.0; #либо ip, либо доменное имя
    access_log  /var/log/nginx/severcart_access.log;
    error_log  /var/log/nginx/severcart_error.log;

    location /static/ {
        root /var/venv/severcart/;
        expires 30d;
    }
    
    location /media/ {
        root /var/venv/severcart/;
        expires 30d;
    }

    location / {
        proxy_pass http://127.0.0.1:9000; 
        proxy_set_header Host $server_name;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Activate the autostart nginx and supervisord.

systemctl enable supervisor

systemctl enable nginx
chmod 755 -R /var/venv/severcart/
chown nobody:nogroup -R /var/venv/severcart/

So the app has started after any reboot, you must configure the supervisor. To do this, create the config

cd /etc/supervisor/conf.d/
touch severcart.conf

In the file severcart.conf writable

[program:severcart]
command=/var/venv/bin/gunicorn conf.wsgi_prod:application -c /var/venv/severcart/conf/gunicorn.conf.py
directory=/var/venv/severcart
user=nobody
autorestart=true
redirect_stderr=true

Activate the configuration

supervisorctl reread
supervisorctl update
supervisorctl status severcart
supervisorctl restart severcart

Disable the apache2 service and its startup

supervisorctl reread
supervisorctl update
supervisorctl status severcart
supervisorctl restart severcart

Disable the apache2 service and its startup

service apache2 stop
systemctl disable apache2

Restart your Nginx server

service nginx restart

Next, check the browser's opening page. If you see the prompt to enter a username and password, then the installation completed successfully.

Attention!!! After successfully installing the program the password of the PostgreSQL user scuser it is recommended to change to a more resistant.

 

Инструменты страницы