How to install erpnext from A-Z

@sebinmichael helped compile a better manual installation notes, from the discussion points on Unable to Install ERPNext 12 (Easy Install Script) - #15 by sebinmichael

He graciously shared them with me offline for me to work on it further … Here is the code

apt-get update && apt-get upgrade -y
adduser USER
usermod -aG sudo USER
apt install build-essential software-properties-common -y
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
apt install dirmngr curl -y
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository "deb [arch=amd64,arm64,i386,ppc64el] http://ftp.cc.uoc.gr/mirrors/mariadb/repo/10.4/ubuntu xenial main"
sudo apt update
apt install mariadb-client mariadb-server -y

----- Configuration MariaDb -----

nano /etc/mysql/my.cnf

===== Edit MariaDb configuration =====
==> search for this line and add #

#skip-external-locking

==> search for this line and change 127.0.0.1 to 0.0.0.0

bind-address = 0.0.0.0

==> under [mysqld] add this lines, in the end of [mysql]

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

==>under [mysql] add this line

default-character-set = utf8mb4

systemctl restart mariadb
systemctl enable mariadb
mysql_secure_installation

==>put Y for all the question, the script will ask you for mysql root password


MariaDB Credentials
mysql-user: root
mysql-pass: MYSQLPASS

*** Test MariaDb ***

mysql -u root -p
\q

*** Test MariaDb with FRAPPE USER ***

su - USER
mysql -u root -p

----- create database ERPNEXT with Frappe user-----

create database erpnext;
show databases;
\q

----- installation nginx -----

sudo su
apt install nginx -y
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
apt install nodejs -y
npm install npm -g

------- installation yarn -------
NB: make sure that the installation is good

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && apt-get update && apt-get install yarn
apt install redis-server wkhtmltopdf git-core python-pip -y
pip install --upgrade setuptools
apt-get install python2.7-dev libmysqlclient-dev -y
pip install MySQL-python --no-use-wheel
pip install python-dateutil==2.1
apt install supervisor -y

The next step is a creation of a swap file which was very useful in my case since I was using a VPS with just 1 GB of RAM. If you have more RAM, you can ignore this for now. If not, do it, because otherwise the next step of bench init will stall due to lack of memory and you’ll keep wondering why it’s taking so long

fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

==> now we will use lower user

su - USER
cd
git clone https://github.com/frappe/bench bench-repo
sudo pip install -e bench-repo
bench init --frappe-branch version-12 --python /usr/bin/python2.7 frappe-bench && cd frappe-bench

==> now you should open two SSH sesion, one for the installation and the other one for starting bench
==> in ssh sesion two

su - USER
cd
cd frappe-bench
bench start

==> in the sesion one you should be in frappe-bench directory

bench get-app erpnext https://github.com/frappe/erpnext

==> MYERPNEXT.LOCAL is the name of your site
==> erpnext is the name of the database
==> MYSQLPASS is the password you tape it after mysql_secure_installation
==> ERPNEXTPASS is your admin password, you will use it in the browser

bench new-site MYERPNEXT.LOCAL --db-name erpnext --mariadb-root-password MYSQLPASS --admin-password ERPNEXTPASS --install-app erpnext --verbose --force
sudo bench setup production USER
sudo systemctl reload nginx
sudo reboot

su - USER
sudo supervisorctl stop all
sudo supervisorctl start all
pip install -U pyopenssl
bench config dns_multitenant on
sudo nano /home/USER/frappe-bench/sites/currentsite.txt

DELETE ALL CONTENTS FOR DNS MULTITENANCY

sudo bench setup lets-encrypt MYERPNEXT.LOCAL
bench setup nginx
sudo service nginx reload

Don’t forget to access website settings and disable signups, etc.
That’s about it. Now you should have a production ERPNext 12 running with https and you’re ready to do business

However, I still kee[ getting errors with permissions for mysql or redis

1 Like