From a5a512e60bdf787d9d4b465fa9a49c9917c46690 Mon Sep 17 00:00:00 2001 From: yater Date: Sun, 20 Jun 2021 03:42:30 +0200 Subject: [PATCH] Update installation_on_freebsd.html just "markup" --- installation_on_freebsd.html | 613 +++++++++++++++++++++++------------ 1 file changed, 399 insertions(+), 214 deletions(-) diff --git a/installation_on_freebsd.html b/installation_on_freebsd.html index 4dc1509..cd00033 100644 --- a/installation_on_freebsd.html +++ b/installation_on_freebsd.html @@ -1,70 +1,155 @@ + - + + - Free Open-Source Hosting Platform «ClonOS» + +Free Open-Source Hosting Platform «ClonOS» + - + - + - + - - + + - + + - + + + + +
+
-

ClonOS

-

FreeBSD based distro for virtual hosting platform and appliance

+

+ClonOS +

+

+FreeBSD based distro for virtual hosting platform and appliance +

-
+
-

Installing ClonOS/CBSD WEB UI via PKG

-

ClonOS in pkg packages

-

Daniel Shafer prepared a Jenkins task to build ClonOS pkg package repo (at the moment FreeBSD 12 only)

-

To enable repository, just put the following lines in /usr/local/etc/pkg/repos/clonos-pkg.ircdriven.net.conf:

+

+Installing ClonOS/CBSD WEB UI via PKG +

+

+

+ClonOS in pkg packages +

+

+

+ +Daniel Shafer + + + +prepared + + a Jenkins task to build ClonOS + +pkg package repo + + (at the moment FreeBSD 12 only) +

+

+To enable repository, just put the following lines in + +/usr/local/etc/pkg/repos/clonos-pkg.ircdriven.net.conf + +: +

 ClonOS-pkg.ircdriven.net: {
         url: "https://pkg.ircdriven.net/packages/12amd64-clonos/",
@@ -72,251 +157,351 @@ ClonOS-pkg.ircdriven.net: {
         enabled: yes
 }
 				
-

Update pkg metafile and install it:

-
+				

+Update pkg metafile and install it: +

+
 pkg update -f
 pkg install clonos
-
+
-

Installing ClonOS/CBSD WEB UI on stock FreeBSD

-

Install ClonOS and dependencies

+

+ Installing ClonOS/CBSD WEB UI on stock FreeBSD +

+

+

+Install ClonOS and dependencies +

+

    -
  • Update ports tree first: -
    portsnap fetch extract
    +
  • +Update ports tree first: +
    +portsnap fetch extract
    +						
  • -
  • Install ClonOS dependencies: -
    pkg install -y net/libvncserver security/gnutls databases/sqlite3 shells/bash www/npm \
    +					
  • +Install ClonOS dependencies: +
    +pkg install -y net/libvncserver security/gnutls databases/sqlite3 shells/bash www/npm \
     www/nginx sysutils/py-supervisor sysutils/cbsd security/ca_root_nss \
     www/node security/sudo databases/sqlite3 net/beanstalkd devel/git devel/pkgconf www/nginx \
     lang/php73 www/php73-session archivers/php73-zip databases/php73-sqlite3 databases/php73-pdo_sqlite \
     www/php73-opcache devel/php73-json security/php73-hash lang/go
     						
  • -
  • Checkout ClonOS ports tree: -
    git clone https://github.com/clonos/clonos-ports-wip.git /tmp/clonos-ports
    +
  • +Checkout ClonOS ports tree: +
    +git clone https://github.com/clonos/clonos-ports-wip.git /tmp/clonos-ports
    +						
  • -
  • Merge ClonOS port with your ports tree:
  • -
    cp -a /tmp/clonos-ports/* /usr/ports/
    +
  • +Merge ClonOS port with your ports tree: +
    +cp -a /tmp/clonos-ports/* /usr/ports/
    +						
  • -
  • Build and install ClonOS
  • -
    env BATCH=no make -C /usr/ports/www/clonos install
    +
  • +Build and install ClonOS +
    +env BATCH=no make -C /usr/ports/www/clonos install
    +						
-

Follow post-message instruction

-

You must merge or copy working configuration files

+

+Follow post-message instruction +

+

+You must merge or copy working configuration files +

    -
  • Check for RACCT is enabled on the host, please add: +
  • +Check for RACCT is enabled on the host, please add:
    -  kern.racct.enable="1"
    +kern.racct.enable="1"
     						
    - into /boot/loader.conf and reboot host +into + +/boot/loader.conf + + and reboot host
  • - -
  • If CBSD still not initialized, do it first: -
    env workdir=/usr/jails /usr/local/cbsd/sudoexec/initenv
    -

    more about CBSD initialization: https://www.bsdstore.ru/en/installing_cbsd.html#initenv

    -
  • - -
  • Ensure CBSD is started: +
  • + If + +CBSD + + still not initialized, do it first:
    -  sysrc cbsdd_enable=YES
    -  service cbsdd status || service cbsdd start
    +env workdir=/usr/jails /usr/local/cbsd/sudoexec/initenv
    +						
    +

    +more about CBSD initialization: + +https://www.bsdstore.ru/en/installing_cbsd.html#initenv + +

    +
  • +
  • +Ensure CBSD is started: +
    +sysrc cbsdd_enable=YES
    +service cbsdd status || service cbsdd start
     						
  • - -
  • Configure and run beanstalkd: +
  • +Configure and run beanstalkd:
    -  sysrc beanstalkd_flags="-l 127.0.0.1 -p 11300"
    -  sysrc beanstalkd_enable=YES
    -  service beanstalkd restart
    +sysrc beanstalkd_flags="-l 127.0.0.1 -p 11300"
    +sysrc beanstalkd_enable=YES
    +service beanstalkd restart
     						
  • - -
  • Change in /usr/local/etc/php-fpm.conf events mechanism to BSD-specific. - To do this, uncomment and edit the events.mechanism parameter to: +
  • +Change in /usr/local/etc/php-fpm.conf events mechanism to BSD-specific. +To do this, uncomment and edit the events.mechanism parameter to:
    -  ..
    -  events.mechanism = kqueue
    -  ..
    +…
    +events.mechanism = kqueue
    +…
     						
    - Or copy: cp /usr/local/etc/php-fpm.conf.clonos.sample /usr/local/etc/php-fpm.conf -
  • - -
  • Uncomment and change in /usr/local/etc/php-fpm.d/www.conf port to Unix socket and - set's correct access permission: +Or copy:
    -  ..
    -  listen = /tmp/php-fpm.sock
    -  ..
    -  listen.backlog = -1
    -  ..
    -  listen.owner = www
    -  listen.group = www
    -  listen.mode = 0660
    -  ..
    +cp /usr/local/etc/php-fpm.conf.clonos.sample /usr/local/etc/php-fpm.conf
     						
    - Or copy: cp /usr/local/etc/php-fpm.d/www-php-fpm.conf.clonos.sample /usr/local/etc/php-fpm.d/www.conf
  • - -
  • Add "www" user to "cbsd" group: -
    pw groupmod cbsd -M www
    -
  • - -
  • To execute CBSD commands, let the www user run CBSD through sudo: - edit /usr/local/etc/sudoers.d/10_www: +
  • +Uncomment and change in + +/usr/local/etc/php-fpm.d/www.conf + + port to Unix socket and set's correct access permission:
    -  Defaults     env_keep += "workdir DIALOG NOCOLOR"
    -  Cmnd_Alias   WEB_CMD = /usr/local/bin/cbsd
    -  www   ALL=(ALL) NOPASSWD:SETENV: WEB_CMD
    +…
    +listen = /tmp/php-fpm.sock
    +…
    +listen.backlog = -1
    +…
    +listen.owner = www
    +listen.group = www
    +listen.mode = 0660
    +…
     						
    - And make sure the file permissions are safe: +Or copy:
    -  chown root:wheel /usr/local/etc/sudoers.d/10_www
    -  chmod 0440 /usr/local/etc/sudoers.d/10_www
    +cp /usr/local/etc/php-fpm.d/www-php-fpm.conf.clonos.sample /usr/local/etc/php-fpm.d/www.conf
     						
    - Or copy: cp /usr/local/etc/sudoers_10_www.clonos.sample /usr/local/etc/sudoers.d/10_www
  • - -
  • Change /usr/local/etc/supervisord.conf to: +
  • +Add "www" user to "cbsd" group:
    -  [unix_http_server]
    -  file=/var/run/supervisor.sock
    -  chmod=0777
    -  chown=nobody:nobody
    -  [supervisorctl]
    -  serverurl=unix:///var/run/supervisor.sock
    -  [supervisord]
    -  logfile=/var/log/supervisor/supervisord.log
    -  pidfile=/var/run/supervisor/supervisord.pid
    -  nodaemon=false
    -  minfds=1024
    -  minprocs=200
    -  umask=022
    -  strip_ansi=false
    -  [rpcinterface:supervisor]
    -  supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    -  [include]
    -  files=/usr/local/etc/supervisor.d/*.conf
    +pw groupmod cbsd -M www
     						
    - Or copy: cp /usr/local/etc/supervisord.conf.clonos.sample /usr/local/etc/supervisord.conf
  • - -
  • Make sure /usr/local/etc/supervisor.d/program_wsclonos.conf have correct - path to CBSD workdir. Please check that line "environment=PATH.." in - /usr/local/etc/supervisor.d/program_wsclonos.conf pointed to ~cbsd path - in 'cbsd_workdir': +
  • +To execute CBSD commands, let the www user run CBSD through sudo: +edit + +/usr/local/etc/sudoers.d/10_www + +:
    -  environment=PATH=[.skipp..],cbsd_workdir="/usr/jails"
    +Defaults     env_keep += "workdir DIALOG NOCOLOR"
    +Cmnd_Alias   WEB_CMD = /usr/local/bin/cbsd
    +www   ALL=(ALL) NOPASSWD:SETENV: WEB_CMD
    +						
    +And make sure the file permissions are safe: +
    +chown root:wheel /usr/local/etc/sudoers.d/10_www
    +chmod 0440 /usr/local/etc/sudoers.d/10_www
    +						
    +Or copy: +
    +cp /usr/local/etc/sudoers_10_www.clonos.sample /usr/local/etc/sudoers.d/10_www
    +						
    +
  • +
  • +Change + +/usr/local/etc/supervisord.conf + + to: +
    +[unix_http_server]
    +file=/var/run/supervisor.sock
    +chmod=0777
    +chown=nobody:nobody
    +[supervisorctl]
    +serverurl=unix:///var/run/supervisor.sock
    +[supervisord]
    +logfile=/var/log/supervisor/supervisord.log
    +pidfile=/var/run/supervisor/supervisord.pid
    +nodaemon=false
    +minfds=1024
    +minprocs=200
    +umask=022
    +strip_ansi=false
    +[rpcinterface:supervisor]
    +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    +[include]
    +files=/usr/local/etc/supervisor.d/*.conf
    +						
    +Or copy: +
    +cp /usr/local/etc/supervisord.conf.clonos.sample /usr/local/etc/supervisord.conf
    +						
    +
  • +
  • + Make sure + +/usr/local/etc/supervisor.d/program_wsclonos.conf + + have correct path to CBSD workdir. Please check that line "environment=PATH.." in + +/usr/local/etc/supervisor.d/program_wsclonos.conf + + pointed to ~cbsd path in 'cbsd_workdir': +
    +environment=PATH=[.skipp..],cbsd_workdir="/usr/jails"
                                                 ^^^^^^^^^^
     						
  • - -
  • Change /usr/local/etc/php.ini params:
  • +
  • + Change + +/usr/local/etc/php.ini + + params:
    -  ..
    -  memory_limit = 256M
    -  ..
    -  post_max_size = 12G
    -  ..
    -  upload_tmp_dir = /tmp
    -  ..
    -  upload_max_filesize = 16G
    -  ..
    -  opcache.enable=1
    +…
    +memory_limit = 256M
    +…
    +post_max_size = 12G
    +…
    +upload_tmp_dir = /tmp
    +…
    +upload_max_filesize = 16G
    +…
    +opcache.enable=1
     						
    - Or copy: cp /usr/local/etc/php.ini.clonos.sample /usr/local/etc/php.ini -
  • - -
  • Configure NGINX: make sure/merge this settings into - /usr/local/etc/nginx/nginx.conf: +Or copy:
    -  user www;
    -  load_module /usr/local/libexec/nginx/ngx_stream_module.so;
    -  events {
    -          use kqueue;
    -  }
    -  http {
    -          include       /usr/local/etc/nginx/mime.types;
    -          default_type  application/octet-stream;
    -          client_max_body_size    1m;
    -          include /usr/local/etc/nginx/sites-enabled/*.conf;
    -  }
    -  stream {
    -          include /usr/local/etc/nginx/conf.stream.d/*.conf;
    -          include /usr/local/etc/nginx/streams-enabled/*;
    -  }
    -						
    - Or copy: cp /usr/local/etc/nginx/nginx.conf.clonos.sample /usr/local/etc/nginx/nginx.conf -
  • - -
  • Enable nginx, php-fpm and supervisord to run at system startup: -
    -  sysrc nginx_enable="YES"
    -  sysrc php_fpm_enable="YES"
    -  sysrc supervisord_enable="YES"
    +cp /usr/local/etc/php.ini.clonos.sample /usr/local/etc/php.ini
     						
  • - -
  • Start nginx, php-fpm and supervisord to run at system startup: +
  • +Configure NGINX: make sure/merge this settings into + +/usr/local/etc/nginx/nginx.conf + +:
    -  service nginx restart
    -  service php-fpm restart
    -  service supervisord restart
    +user www;
    +load_module /usr/local/libexec/nginx/ngx_stream_module.so;
    +events {
    +        use kqueue;
    +}
    +http {
    +        include       /usr/local/etc/nginx/mime.types;
    +        default_type  application/octet-stream;
    +        client_max_body_size    1m;
    +        include /usr/local/etc/nginx/sites-enabled/*.conf;
    +}
    +stream {
    +        include /usr/local/etc/nginx/conf.stream.d/*.conf;
    +        include /usr/local/etc/nginx/streams-enabled/*;
    +}
    +						
    +Or copy: +
    +cp /usr/local/etc/nginx/nginx.conf.clonos.sample /usr/local/etc/nginx/nginx.conf
     						
  • - -
  • Configure CBSD: +
  • +Enable nginx, php-fpm and supervisord to run at system startup:
    -  1)
    -    ~cbsd/etc/modules.conf must have:
    -
    -    pkg.d
    -    bsdconf.d
    -    zfsinstall.d
    -    puppet.d
    -    convectix.d
    -    cbsd_queue.d
    -    vncterm.d
    -						
    - Or copy: cp /usr/local/etc/cbsd-modules.conf.clonos.sample ~cbsd/etc/modules.conf -
    -  2) Re-run CBSD initenv to init modules:
    -
    -    cbsd initenv
    -
    -  3) Init web user database:
    -
    -    sh /usr/local/cbsd/modules/forms.d/clonos_database/initforms.sh
    -
    -  4) Configure and run CBSD RACCT stats daemon:
    -
    -    sysrc cbsd_statsd_hoster_enable=YES
    -    sysrc cbsd_statsd_jail_enable=YES
    -    sysrc cbsd_statsd_bhyve_enable=YES
    -    service cbsd-statsd-hoster restart
    -    service cbsd-statsd-jail restart
    -    service cbsd-statsd-bhyve restart
    +sysrc nginx_enable="YES"
    +sysrc php_fpm_enable="YES"
    +sysrc supervisord_enable="YES"
     						
  • - -
  • Open ClonOS UI in your web browser. +
  • +Start nginx, php-fpm and supervisord to run at system startup:
    -  Default login: 'admin', default password: 'admin'
    +service nginx restart
    +service php-fpm restart
    +service supervisord restart
     						
  • - -
  • Enjoy the ClonOS !
  • +
  • +Configure CBSD: +

    +1) ~cbsd/etc/modules.conf must have: +

    +pkg.d
    +bsdconf.d
    +zfsinstall.d
    +puppet.d
    +convectix.d
    +cbsd_queue.d
    +vncterm.d
    +							
    +Or copy: +
    +cp /usr/local/etc/cbsd-modules.conf.clonos.sample ~cbsd/etc/modules.conf
    +							
    +

    +

    +2) Re-run CBSD initenv to init modules: +

    +cbsd initenv
    +							
    +

    +

    +3) Init web user database: +

    +sh /usr/local/cbsd/modules/forms.d/clonos_database/initforms.sh
    +							
    +

    +

    +4) Configure and run CBSD RACCT stats daemon: +

    +sysrc cbsd_statsd_hoster_enable=YES
    +sysrc cbsd_statsd_jail_enable=YES
    +sysrc cbsd_statsd_bhyve_enable=YES
    +service cbsd-statsd-hoster restart
    +service cbsd-statsd-jail restart
    +service cbsd-statsd-bhyve restart
    +							
    +

    +
  • +
  • +Open ClonOS UI in your web browser. +
    +Default login: 'admin', default password: 'admin'
    +						
    +
  • +
  • +Enjoy the ClonOS ! +
-
+
- - - + + + +