Basic installation (ZENLIX 3.5)

To get started, we need the following resources:

  • 1Gb RAM

  • 10Gb HDD

  • 1 Core CPU

If you use DigitalOcean, then the most minimal droplet is suitable for a small number of users (up to 20).


We will use, as an example, Ubuntu 18.04


  1. You must update the package tree
    $ sudo apt-get update


  2. Install the support package
    $ sudo apt install -y build-essential


  3. Install nginx $ sudo apt install nginx



  4. Install MySQL $ sudo apt install mysql-server 4.1 Start configuration $ sudo mysql_secure_installation In the process, the script asks about the configuration of VALIDATE PASSWORD PLUGIN, which can be answered negatively (at your discretion) Next, set the password for the root user. In MySQL 5.7 and higher, the default is to use the auth_socket plugin. If you plan to connect as root from a terminal, then you need to change the auth_socket authentication method to mysql_native_password. 4.2 Change authorization type
    $ sudo mysql -u root -p mysql> ALTER USER 'root' @ 'localhost' IDENTIFIED WITH mysql_native_password BY 'password' ; mysql> FLUSH PRIVILEGES;

    4.3 Create a Database mysql> create database zenlix; mysql> exit;

  5. Install PHP and all the necessary modules $ sudo apt install -y php-fpm php-mysql php-mcrypt mcrypt php-zip php-curl php-gd php-ldap php-imap php-mbstring




  6. Let's proceed to configuring nginx: $ sudo nano /etc/nginx/sites-enabled/default

server {

listen 80 default_server;

listen [::]:80 default_server;


#root /var/www/html;

root /home/zenlix/zenlix/public;

# Add index.php to the list if you are using PHP

index index.html index.htm index.nginx-debian.html index.php;


server_name _;


location / {

# First attempt to serve request as file, then

# as directory, then fall back to displaying a 404.

try_files $uri $uri/ /index.php?$query_string;

}

location /socket.io {

    proxy_set_header Upgrade $http_upgrade;

    proxy_set_header Connection "upgrade";

    proxy_http_version 1.1;

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_set_header Host $host;

    proxy_pass http://127.0.0.1:3001/socket.io/;

  }



location ~ \.php$ {

               include snippets/fastcgi-php.conf;

               fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;

       }


}


Define the user under which nginx runs: $ sudo nano /etc/nginx/nginx.conf

user zenlix;


$ sudo nano /etc/php/7.2/fpm/pool.d/www.conf

user = zenlix

group = zenlix

listen.owner = zenlix

listen.group = zenlix $ sudo nginx -t $ sudo systemctl reload nginx $ sudo service php-fpm restart

  1. Install REDIS $ wget http://download.redis.io/releases/redis-stable.tar.gz

$ tar xzf redis-stable.tar.gz

$ cd redis-stable

$ make

$ sudo make install

$ cd utils

$ sudo ./install_server.sh

$ sudo update-rc.d redis_6379 defaults



  1. Install NodeJS $ sudo apt install -y nodejs npm $ sudo ln -s / usr / bin / nodejs / usr / bin / node


  1. Install ZENLIX $ cd ~/ $ mkdir zenlix $ cd zenlix $ git init. $ git pull "http://<LOGIN>:<PASSWORD>@git.zenlix.com/snisar/zenlix35.git" master $ chmod -R + w ./storage/* $ chmod -R + w ./bootstrap/ * $ chmod -R + w ./nodejs/* $ php artisan zenlix: install


  1. Configure NodeJS microservice and run zenserver $ sudo npm install dotenv - save -g

$ sudo npm install pm2 -g

$ sudo npm install socket.io ioredis dotenv $ sudo pm2 start server.js -n zenserver --watch

$ sudo pm2 startup

$ sudo pm2 save

$ sudo pm2 install pm2-logrotate


  1. Add a task to Cron $ (crontab -l; echo "* * * * * /usr/bin/php /home/zenlix/zenlix/artisan schedule: run >> / dev / null 2> & 1") | crontab -



  2. Install and configure supervisor


$ sudo apt install supervisor $ echo "

[program: zenlix-worker]

process_name =% (program_name) s _% (process_num) 02d

command = /usr/bin/php /home/zenlix/zenlix/artisan queue: work --sleep = 3 --tries = 3 --daemon

autostart = true

autorestart = true

user = zenlix

numprocs = 8

"| sudo tee --append /etc/supervisor/conf.d/zenlix-worker.conf


$ sudo supervisorctl reread

$ sudo supervisorctl update

$ sudo supervisorctl start zenlix-worker: *



Done!