v13 : installation steps : manual setup on Ubuntu 20 - ashish-greycube/help GitHub Wiki

Referenece

https://www.digitalocean.com/community/tutorials/how-to-install-an-erpnext-stack-on-ubuntu-20-04#introduction
https://larrydevops.com/erpnext/how-to-install-frappe-framework-bench-on-ubuntu-20-04-lts-focal-fossa/
https://github.com/jigneshpshah/greycube_helpmanual/wiki/SSL-installation-via-certbot

Secure

sudo ufw allow 22,25,143,80,443,3306,8000/tcp
sudo ufw enable

Locale

sudo apt update && apt upgrade -y && shutdown -r now
sudo localectl set-keymap us && sudo localectl set-locale LANG=en_US.utf8
sudo nano /etc/environment
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LANG=en_US.UTF-8
sudo reboot

Python and add user

sudo apt install python3-minimal build-essential python3-setuptools

MariaDB setup

mysql root user name is root

sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo apt install software-properties-common
sudo add-apt-repository 'deb [arch=amd64] http://mariadb.mirror.globo.tech/repo/10.5/ubuntu focal main'
sudo apt update -y
sudo apt install mariadb-server mariadb-client -y
sudo mysql_secure_installation

image

sudo nano /etc/mysql/mariadb.conf.d/mariadb.cnf

Maridb.cnf example

[innodb-buffer-pool-size = 5462M Default 128M is very low. Expert opinion is that it should be 70-80% of total memory $htop for 16GB = 12806M for 8GB = 6144M for 4GB = 3436M for 2GB = 1638M]

sudo systemctl restart mariadb
sudo systemctl enable mariadb
adduser frappe
usermod  -aG sudo frappe
su - frappe

Install all required packages

sudo DEBIAN_FRONTEND=noninteractive apt install -y curl build-essential python3-minimal python3-distutils python3-testresources python3-setuptools python3-dev libffi-dev python3-pip libcurl4 dnsmasq fontconfig git htop libcrypto++-dev libfreetype6-dev liblcms2-dev libwebp-dev libxext6 libxrender1 libxslt1-dev libxslt1.1 libffi-dev ntpdate postfix python3-dev python-tk screen vim xfonts-75dpi xfonts-base zlib1g-dev apt-transport-https libsasl2-dev libldap2-dev libcups2-dev pv libjpeg8-dev libtiff5-dev tcl8.6-dev tk8.6-dev libdate-manip-perl logwatch libssl-dev redis-server nginx

sudo -H python3 -m pip install --upgrade setuptools cryptography psutil

NVM and yarn


curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.bashrc
nvm install 14
node -v
sudo apt-get update \
  && sudo apt-get install npm \
  && sudo npm install -g yarn

PDF

cd /tmp
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo cp /usr/local/bin/wkhtmlto* /usr/bin/
sudo chmod a+x /usr/bin/wk*
cd ..

bench and frappe

sudo apt-get install virtualenv
sudo apt install python3.8-venv
sudo systemctl enable redis-server
sudo chown frappe -R /home/frappe
sudo -H pip3 install -I frappe-bench
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
bench init /home/frappe/frappe-bench --frappe-path https://github.com/frappe/frappe --frappe-branch version-13 --python python3
cd /home/frappe/frappe-bench
./env/bin/pip install numpy==1.22.2 && ./env/bin/pip install pandas==1.1.5
bench get-app erpnext https://github.com/frappe/erpnext --branch version-13
bench new-site sitename --admin-password adminpwd  --mariadb-root-password mariadbpwd --db-name dbname --install-app erpnext

Production setup

cd /home/frappe/frappe-bench
sudo bench setup production frappe
sudo bench setup sudoers $(whoami)
sudo supervisorctl stop all
sudo supervisorctl start all

bench config dns_multitenant on

***
only if required
sudo bench setup production frappe
sudo nano /etc/supervisor/supervisord.conf
(Add these lines under [unix_http_server])
chmod=0760
chown=frappe:frappe

sudo supervisorctl stop all
sudo supervisorctl start all
bench restart

SSL Setup SSL Steps

bench restart

cd /home/frappe/frappe-bench supervisorctl restart frappe-bench-workers: frappe-bench-web:

site restore

bench --site g13.greycube.in  restore 20220324_173712-greycube_in-database.sql.gz --with-public-files 20220324_173712-greycube_in-files.tar --with-private-files 20220324_173712-greycube_in-private-files.tar

error

[Errno 13] Permission denied: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py

link

error

nginx error
sudo nano /etc/nginx/nginx.conf

after default_type application/octet-stream;

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

link


X509_V_FLAG_CB_ISSUER_CHECK

link

sudo nano /usr/lib/python3/dist-packages/OpenSSL/crypto.py

ctrl+shift+- 1573 <-- comment out <--- not required

sudo rm -rf /usr/lib/python3/dist-packages/OpenSSL
sudo pip3 install pyopenssl
sudo pip3 install pyopenssl --upgrade