Installing ERPNext version 13 on Ubuntu 20.10 ( 20+ or 21+ )

ERPNext 13 released, and here the updated installation document. As CentOS dead ( or killed by IBM), Ubuntu becomes the de-facto OS for ERPNext hosting. These are the steps to install Frappe and ERPNe

 · 2 min read


Updated document on ERPNext 14 is available on this link ( https://cloud.erpgulf.com/blog/support-forum/installing-erpnext-version-14-on-ubuntu-22+ )


apt-get update -y
init 6  ( will restart )



apt-get install libffi-dev python3-pip python3-dev  python3-testresources libssl-dev wkhtmltopdf gcc g++ make -y


curl -sL https://deb.nodesource.com/setup_14.x | bash -


apt-get install nodejs redis-server -y

apt-get install cron git -y


npm install -g yarn


apt-get install mariadb-server mariadb-client -y



mysql_secure_installation


Enter current password for root (enter for none): Press your [Enter] key, there is no password set by default
Set root password? [Y/n] Y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y




mysql -u root -p


MariaDB [(none)]>USE mysql;
MariaDB [(none)]>UPDATE user SET plugin='mysql_native_password' WHERE User='root';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;


vim /etc/mysql/mariadb.conf.d/erpnext.cnf

Add these lines
[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]
default-character-set = utf8mb4


systemctl restart mariadb


useradd -m -s /bin/bash erpnext


passwd erpnext


usermod -aG sudo erpnext


su - erpnext


vim ~/.bashrc
add this line
PATH=$PATH:~/.local/bin/


source ~/.bashrc


su - erpnext
sudo mkdir /opt/bench


sudo chown -R erpnext:erpnext /opt/bench


cd /opt/bench
yarn add node-sass
sudo apt install python3.8-venv


pip3 install --user frappe-bench
 bench init frappe-bench --frappe-branch version-13


cd frappe-bench
 sed -i '/web:/ s/$/ --noreload/' Procfile
 bench start >/tmp/bench_log &


bench new-site yourhost.example.com


At this point we have a frappe site running - bench start and you will get the website on port 8000. But ERPNext not yet installed. Let's continue


bench get-app erpnext --branch version-13
 bench install-app erpnext  ( if you have more than one site mention site name like " bench --site site1.local install-app erpnext "


bench start


Now you have ERPNext on port 8000. ( http://yourhost.example.com:8000 )

You can run the setup-wizard on the browser. ( Setup-wizard often fail. Restart it again and again. This issue has been there since ages and yet to be fixed )


----- NOW deploy it in production mode - on nginx server -------



sudo apt install nginx supervisor
sudo vim /etc/supervisor/supervisord.conf
Under [unix_http_server] section and also under [supervisord]
uncomment or add chown=erpnext:erpnext
bench setup supervisor --yes
 bench setup nginx


sudo ln -s `pwd`/config/supervisor.conf /etc/supervisor/conf.d/frappe-bench.conf
 sudo ln -s `pwd`/config/nginx.conf /etc/nginx/conf.d/frappe-bench.conf


sudo systemctl enable supervisor
 sudo systemctl enable nginx


-----------------------------


Make changes on site_config.json ( inside site/site_name folder )
To make it non-development mode
 "developer_mode": 0,
To reflect the hostname and port

sample below.
{
"db_name": "_7beb69e70202137e",
"db_password": "GiZeZxy4GPxfTzFA",
"db_type": "mariadb",
"developer_mode": 0,
"encryption_key": "iVahvGBPKPWWYQwqyxxxxxx7dMazzSX4SEClEtDzdQ=",
"user_type_doctype_limit": {
 "employee_self_service": 10
},
 "host_name": "https://mysite.erpgulf.com:1203"
}


--------------------


restart the system - init 6 


--------------

Now Letsencrypt and SSL

--------------------------

It's explained here https://erpgulf.com/blog/support-forum/letsencrypt-on-ubuntu-version-20-for-erpnext


Team ERPGulf

The team behind ERPGulf blogs here, expresses their thoughts, shares the experience, often show the frustrations. Contact us on support@ERPGulf.com

3 comments
Eddy June 19, 2023

Hi, how to setup production mode. When I "sudo bench setup production 'user"" come with error "sudo: bench: not found"

Peter October 27, 2022

Thank you!!! This is an excellent install routine and is really helpful.

Chris July 28, 2022

First tut to actually work correctly.

Needed addition of apt install python3.10-venv

Add Comment