ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Guide: Manual Install ERPNext on Ubuntu 16.xx & Debian v8 & 9

installation

#44

i choose 16MB


#45

for which part?
innodb_buffer_pool_size=512M -> this should be about 50% of your total RAM
innodb_log_file_size=128M -> this is 0.25 of the innodb_buffer_pool_size
innodb_log_buffer_size=64M -> this is 0.5 of the innodb_log_file_size

The above numbers would be OK for a 1GB RAM installation


#46

this is what i add

 [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

    innodb_buffer_pool_size=512M
    innodb_log_file_size=128M
    innodb_log_buffer_size=64M
    max_allowed_packet=64M

    [mysql]
    default-character-set = utf8mb4

the error is

Failed to restart mysqls.service: Unit mysqls.service failed to load: No such file or directory.


#47

It’s just a typing error… mysqld instead of mysqls

systemctl restart mysqld


#48

bench new-site site1.local

And set my password MySQL password ***********
Then this;
u"Access denied for user ‘root’@‘localhost’ (using password: YES)")

How to reset password?

Thanks


#49

hans this is widely available on stackoverflow with detailed steps. please do a google search


#50

just solved sorry

only no connection to the 10.0.1.***:8000 nothing then errors i have re-installed the bench several times.
frappe/app.py", line 58, in application
14:19:37 web.1 | init_request(request)
14:19:37 web.1 | File “/home/frappe/frappe-bench/frappe-bench/frappe-bench/apps/frappe/frappe/app.py”, line 109, in init_request
14:19:37 web.1 | frappe.init(site=site, sites_path=_sites_path)
14:19:37 web.1 | File “/home/frappe/frappe-bench/frappe-bench/frappe-bench/apps/frappe/frappe/init.py”, line 138, in init
14:19:37 web.1 | local.conf = _dict(get_site_config())
14:19:37 web.1 | File “/home/frappe/frappe-bench/frappe-bench/frappe-bench/apps/frappe/frappe/init.py”, line 207, in get_site_config
14:19:37 web.1 | sys.exit(1)
14:19:37 web.1 | SystemExit: 1

And what about a easy install script? Where to find?


#51

hey no need to be sorry about it ! thats alright


#52

I have also problems with installation.
I am installing on Ubuntu 16.04 via AWS ec2
i have followed the instructions using manual installation.
however, if i get into the part of
bench new-site newsitename
it always prompt to set the my.cnf with
[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

I have already done this part and rebooted the server.
Anything I have missed?

Also: I have tried adding the config to other config file as mentioned from other forums, but I still get the same notification.


#53

Manual and Easy Install official docs https://github.com/frappe/bench


#54

Perhaps the edits are being applied via the wrong file. I don’t know the AWS layout, but the default of /etc/mysql/my.cnf might not be correct.
You need to confirm the location of the file and edit the right one, and then restart mysqld/mariadb


#55

find my solution

edit /etc/mysql/mariadb.conf.d/50-server.cnf

sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf

after the [mariadb] place the config vars

like
[mariadb]
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


#56

How to Install ERPNext Open Source ERP on Ubuntu 17.04
Published on: Mon, Jan 8, 2018 at 1:35 pm EST
Server Apps System Admin Ubuntu Web Servers
This article is a port of “How to Install ERPNext Open Source ERP on CentOS 7” for Ubuntu 17.04
ERP or Enterprise Resource Planning is an enterprise application suite used to manage core business processes. ERPNext is a free and open source, self-hosted ERP application written in Python. It uses Node.js for the front end and MariaDB to store its data. ERPNext provides an easy-to-use web interface that allows businesses to manage day to day tasks. It contains modules for accounting, CRM, HRM, manufacturing, POS, project management, purchasing, sales management, warehouse management, and more. ERPNext can be used to manage different industries such as service providers, manufacturing, retail and schools.
Prerequisites
• A Vultr Ubuntu 17.04 server instance.
• A sudo user.
Note: For this tutorial, we will use erp.example.com as the domain name pointed to the server. Please make sure to replace all occurrences of erp.example.com with your actual domain name.
Before we begin, make sure your server is up-to-date.
sudo apt update
sudo apt -y upgrade
Install Development Tools
ERPNext needs Python version 2.7 to work. Install Python 2.7.
sudo apt -y install python-minimal
You should be able to verify its version.
python -V
You will see the following output.
user@vultr:~$ python -V
Python 2.7.13
Install a few more dependencies.
sudo apt -y install git build-essential python-setuptools python-dev libffi-dev libssl-dev
Install Python’s pip tool. Pip is the dependency manager for Python packages.
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
Ensure that you have the latest version of pip and setuptools.
sudo -H pip install --upgrade pip setuptools
Install Ansible using Pip. Ansible automates software provisioning, configuration management, and application deployment.
sudo -H pip install ansible

Install yarn On Debian or Ubuntu Linux, you can install Yarn via our Debian package repository. You will first need to configure the repository
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo “deb https://dl.yarnpkg.com/debian/ stable main” | sudo tee /etc/apt/sources.list.d/yarn.list

Then you can simply
sudo apt-get update && sudo apt-get install yarn

Install MariaDB Server
Add the MariaDB repository into the system.
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository ‘deb [arch=amd64,i386,ppc64el] http://mirror.nodesdirect.com/mariadb/repo/10.2/ubuntu xenial main’
Install MariaDB.
sudo apt update
sudo apt -y install mariadb-server libmysqlclient-dev
Provide a strong password for the MariaDB root user when asked.
The Barracuda storage engine is required for the creation of ERPNext databases, so you will need to configure MariaDB to use the Barracuda storage engine. Edit the default MariaDB configuration file my.cnf.
sudo nano /etc/mysql/my.cnf
Add the following lines under the [mysqld] line.
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
Also, add the following line under the [mysql] line.
default-character-set = utf8mb4
Restart MariaDB and enable it to automatically start at boot time.
sudo systemctl restart mariadb
sudo systemctl enable mariadb
Before configuring the database, you will need to secure MariaDB. You can secure it by running the mysql_secure_installation script.
sudo mysql_secure_installation
You will be asked for the current MariaDB root password. Provide the password you have set during the installation. You will be asked if you wish to change the existing password of the root user of your MariaDB server. You can skip setting a new password, as you have already provided a strong password during installation. Answer “Y” to all of the other questions that are asked.
Install Nginx, Node.js and Redis
Add the Nodesource repository for Node.js 8.x.
sudo curl --silent --location https://deb.nodesource.com/setup_8.x | sudo bash -
Install Nginx, Node.js and Redis.
sudo apt -y install nginx nodejs redis-server
Start Nginx and enable it to start at boot time.
sudo systemctl start nginx
sudo systemctl enable nginx
Start Redis and enable it to start at boot time.
sudo systemctl start redis-server
sudo systemctl enable redis-server
Install PDF Converter
The wkhtmltopdf program is a command line tool that converts HTML into PDF using the QT Webkit rendering engine. Install the required dependencies.
sudo apt -y install libxrender1 libxext6 xfonts-75dpi xfonts-base
Download the latest version of wkhtmltopdf.
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
Extract the archive.
sudo tar -xf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz -C /opt
The above command will extract the archive to /opt/wkhtmltox. Create a softlink so that wkhtmltopdf and wkhtmltoimage can be executed globally as a command.
sudo ln -s /opt/wkhtmltox/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
sudo ln -s /opt/wkhtmltox/bin/wkhtmltoimage /usr/bin/wkhtmltoimage
You can now run wkhtmltopdf -V to check if it is working, you will see this.
user@vultr:~$ wkhtmltopdf -V
wkhtmltopdf 0.12.4 (with patched qt)
At this point, we have all the required dependencies installed. You can now proceed to install Bench.
Install Bench
Bench is a command line utility provided by Frappe to install and manage the ERPNext application on a Unix-based system for both development and production purposes. Bench can also create and manage Nginx and supervisor configurations.
Create a new user to run Bench processes in the isolated environment.
sudo adduser bench --home /opt/bench
Provide sudo permissions to the bench user.
sudo usermod -aG sudo bench
Login as the newly created bench user.
sudo su - bench
Clone the Bench repository in /opt/bench.
cd /opt/bench
git clone https://github.com/frappe/bench bench-repo
Install Bench using pip.
sudo -H pip install -e bench-repo
Once Bench is installed, proceed further to install ERPNext using Bench.
Install ERPNext using Bench
Initialize a bench directory with frappe framework installed. To keep everything tidy, we will work under the /opt/bench directory. Bench will also setup regular backups and auto updates once a day.
cd /opt/bench
bench init erpnext && cd erpnext
Create a new Frappe site.
bench new-site erp.example.com
The above command will prompt you for the MySQL root password. Provide the password which you have set for the MySQL root user earlier. It will also ask you to set a new password for the administrator account. You will need this password later to log into the administrator dashboard. If you have errors with root password for MariaDB, look at the end of this guide for workarounds.
Download ERPNext installation files from the remote git repository using Bench.
bench get-app erpnext https://github.com/frappe/erpnext
Install ERPNext on your newly created site.
bench --site erp.example.com install-app erpnext
You can start the application immediately to check if the application installed successfully.
bench start
However, you should stop the execution and proceed further to set up the application for production use.
Press CTRL+C to stop bench execution.
Setup Supervisor and Nginx
By default, the ERPNext application listens on port 8000, not the standard HTTP port 80. Also, running the built in web server for production use is not recommended as we will be exposing the server to the world. You should use a production web server as a reverse proxy such as Apache or Nginx. We will use Nginx as a reverse proxy as it can be automatically configured using Bench. Bench can automatically generate and install the configuration according to the ERPNext setup.
Although we can start the application using the ‘bench start’ command, the execution of ERPNext will stop as soon as you close the terminal. To overcome this issue, you should use Supervisor, which is very helpful in running the application continuously in a production environment. Supervisor is a process control system that enables you to monitor and control a number of processes on Linux operating systems. Once Supervisor is configured, it will automatically start the application at boot time as well as on failures. Bench can automatically configure Supervisor for the ERPNext application.
Install Supervisor.
sudo apt -y install supervisor
Start Supervisor and enable it to automatically start at boot time.
sudo systemctl start supervisor
sudo systemctl enable supervisor
Setup Bench for production use.
sudo bench setup production bench
The above command may prompt you before replacing the existing Supervisor default configuration file with a new one. Choose y to proceed. Bench adds a number of processes to the Supervisor configuration file. The above command will also ask you if you wish to replace the current Nginx configuration with a new one. Enter y to proceed. Once Bench has finished installing the configuration, provide other users to execute the files in your home directory of the Bench user.
chmod o+x /opt/bench/
You can now access the site on http://erp.example.com.
Ensure Port 80 has been opened in your firewall (sudo ufw allow 80 & 443)
You can check the status of the processes by running.
sudo supervisorctl status all
You should see the following output.
bench@vultr:~/erpnext$ sudo supervisorctl status all
erpnext-redis:erpnext-redis-cache RUNNING pid 13852, uptime 0:00:54
erpnext-redis:erpnext-redis-queue RUNNING pid 13851, uptime 0:00:54
erpnext-redis:erpnext-redis-socketio RUNNING pid 13853, uptime 0:00:54
erpnext-web:erpnext-frappe-web RUNNING pid 13856, uptime 0:00:54
erpnext-web:erpnext-node-socketio RUNNING pid 13855, uptime 0:00:54
erpnext-workers:erpnext-frappe-default-worker-0 RUNNING pid 13862, uptime 0:00:54
erpnext-workers:erpnext-frappe-long-worker-0 RUNNING pid 13870, uptime 0:00:54
erpnext-workers:erpnext-frappe-schedule RUNNING pid 13869, uptime 0:00:54
erpnext-workers:erpnext-frappe-short-worker-0 RUNNING pid 13875, uptime 0:00:54
To stop all of the ERPNext processes.
sudo supervisorctl stop all
To start all the ERPNext processes.
sudo supervisorctl start all
Setting Up SSL using Let’s Encrypt
Let’s Encrypt provides free SSL certificates to the users. SSL can be installed manually or automatically through Bench. Bench can automatically install the Let’s Encrypt client and obtain the certificates. Additionally, it automatically updates the Nginx configuration to use the certificates.
The domain name which you are using to obtain the certificates from the Let’s Encrypt CA must be pointed towards the server. The client verifies the domain authority before issuing the certificates.
Enable DNS multi-tenancy for the ERPNext application.
bench config dns_multitenant on
Run Bench to set up Let’s Encrypt on your site.
sudo bench setup lets-encrypt erp.example.com
During the execution of the script, the Let’s Encrypt client will ask you to temporarily stop the Nginx web server. It will automatically install the required packages and the Let’s Encrypt client. The client will prompt you for your email address. You will also need to accept the terms and conditions. Once the certificates have been generated, Bench will also generate the new configuration for Nginx which uses the SSL certificates. You will be asked before replacing the existing configuration. Bench also creates a crontab entry to automatically renew the certificates every month.
Finally, enable scheduler to automatically run the scheduled jobs.
bench enable-scheduler
You should see this output.
bench@vultr:~/erpnext$ bench enable-scheduler
Enabled for erp.example.com
Conclusion
Once the process has finished, you can access your application at https://erp.example.com. Login with the username Administrator and the password you have set during installation. You will be taken to the desk where you will need to provide information to set ERPNext ERP according to your company. You can now use the application to manage your company.
Congratulations, you have a fully working ERPNext application installed on your Ubuntu 17.04 server.
FIX MARIADB LOGIN ISSUES
FOLLOW THESE STEPS FOR MARIADB AUTHENTICATION
https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost
The reason is that recent Ubuntu installation (maybe others also), mysql is using by default the UNIX auth_socket plugin.
Basically means that: db_users using it, will be “auth” by the system user credentias. You can see if your root user is set up like this by doing the following:
$ sudo mysql -u root # I had to use “sudo” since is new installation

mysql> USE mysql;
mysql> SELECT User, Host, plugin FROM mysql.user;

±-----------------±----------------------+
| User | plugin |
±-----------------±----------------------+
| root | auth_socket |
| mysql.sys | mysql_native_password |
| debian-sys-maint | mysql_native_password |
±-----------------±----------------------+
As you can see in the query, the root user is using the auth_socket plugin
There are 2 ways to solve this:

  1. You can set the root user to use the mysql_native_password plugin
  2. You can create a new db_user with you system_user (recommended)
    Option 1:
    $ sudo mysql -u root # I had to use “sudo” since is new installation

mysql> USE mysql;
mysql> UPDATE user SET plugin=‘mysql_native_password’ WHERE User=‘root’;
mysql> FLUSH PRIVILEGES;
mysql> exit;

$ service mysql restart
Option 2: (replace YOUR_SYSTEM_USER with the username you have)
$ sudo mysql -u root # I had to use “sudo” since is new installation

mysql> USE mysql;
mysql> CREATE USER ‘YOUR_SYSTEM_USER’@‘localhost’ IDENTIFIED BY ‘’;
mysql> GRANT ALL PRIVILEGES ON . TO ‘YOUR_SYSTEM_USER’@‘localhost’;
mysql> UPDATE user SET plugin=‘auth_socket’ WHERE User=‘YOUR_SYSTEM_USER’;
mysql> FLUSH PRIVILEGES;
mysql> exit;

$ service mysql restart
Remember that if you use option #2 you’ll have to connect to mysql as your system username (mysql -u YOUR_SYSTEM_USER)
Note: On some systems (e.g., Debian stretch) ‘auth_socket’ plugin is called ‘unix_socket’, so the corresponding SQL command should be: UPDATE user SET plugin=‘unix_socket’ WHERE User=‘YOUR_SYSTEM_USER’;


#57

I have allowed myself to put your how-to (which I have can confirm to work for an installation in a proxmox container (ubuntu 16.04.)) into a little better readable format. I hope u do not mind and it may be better to follow like this


How to Install ERPNext Open Source ERP on Ubuntu 17.04

by @Jermaine_Gray

Server Apps System Admin Ubuntu Web Servers
This article is a port of “How to Install ERPNext Open Source ERP on CentOS 7” for Ubuntu 17.04

Prerequisites

• A Vultr Ubuntu 17.04 server instance.
• A sudo user.

Note: For this tutorial, we will use erp.example.com as the domain name pointed to the server. Please make sure to replace all occurrences of erp.example.com with your actual domain name.

Before we begin, make sure your server is up-to-date.

sudo apt update
sudo apt -y upgrade

Install Development Tools

  • ERPNext needs Python version 2.7 to work. Install Python 2.7.

sudo apt -y install python-minimal
You should be able to verify its version.
python -V
You will see the following output.
user@vultr:~$ python -V
Python 2.7.13

  • Install a few more dependencies.
    sudo apt -y install git build-essential python-setuptools python-dev libffi-dev libssl-dev

  • Install Python’s pip tool. Pip is the dependency manager for Python packages.
    wget https://bootstrap.pypa.io/get-pip.py
    sudo python get-pip.py

  • Ensure that you have the latest version of pip and setuptools.
    sudo -H pip install --upgrade pip setuptools

  • Install Ansible using Pip. Ansible automates software provisioning, configuration management, and application deployment.
    sudo -H pip install ansible

  • Install yarn On Debian or Ubuntu Linux, you can install Yarn via our Debian package repository. You will first need to configure the repository
    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
    echo “deb https://dl.yarnpkg.com/debian/ stable main” | sudo tee /etc/apt/sources.list.d/yarn.list

Then you can simply
sudo apt-get update && sudo apt-get install yarn

  • Install MariaDB Server
    Add the MariaDB repository into the system.
    sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
    sudo apt-get install software-properties-common
    sudo add-apt-repository "deb [arch=amd64,i386,ppc64el] http://mirror.nodesdirect.com/mariadb/repo/10.2/ubuntu xenial main"

Install MariaDB.

sudo apt update
sudo apt -y install mariadb-server libmysqlclient-dev

Provide a strong password for the MariaDB root user when asked.
The Barracuda storage engine is required for the creation of ERPNext databases, so you will need to configure MariaDB to use the Barracuda storage engine. Edit the default MariaDB configuration file my.cnf.

sudo nano /etc/mysql/my.cnf
Add the following lines under the [mysqld] line.

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

Also, add the following line under the [mysql] line.
default-character-set = utf8mb4
Restart MariaDB and enable it to automatically start at boot time.
sudo systemctl restart mariadb
sudo systemctl enable mariadb
Before configuring the database, you will need to secure MariaDB. You can secure it by running the mysql_secure_installation script.
sudo mysql_secure_installation
You will be asked for the current MariaDB root password. Provide the password you have set during the installation. You will be asked if you wish to change the existing password of the root user of your MariaDB server. You can skip setting a new password, as you have already provided a strong password during installation. Answer “Y” to all of the other questions that are asked.

  • Install Nginx, Node.js and Redis
    Add the Nodesource repository for Node.js 8.x.
    sudo curl --silent --location https://deb.nodesource.com/setup_8.x | sudo bash -
  • Install Nginx, Node.js and Redis.
    sudo apt -y install nginx nodejs redis-server
  • Start Nginx and enable it to start at boot time.
    sudo systemctl start nginx
    sudo systemctl enable nginx
    -Start Redis and enable it to start at boot time.
    sudo systemctl start redis-server
    sudo systemctl enable redis-server
  • Install PDF Converter
    The wkhtmltopdf program is a command line tool that converts HTML into PDF using the QT Webkit rendering engine. Install the required dependencies.
    sudo apt -y install libxrender1 libxext6 xfonts-75dpi xfonts-base
    Download the latest version of wkhtmltopdf.
    wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
    Extract the archive.
    sudo tar -xf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz -C /opt
    The above command will extract the archive to /opt/wkhtmltox. Create a softlink so that wkhtmltopdf and wkhtmltoimage can be executed globally as a command.
    sudo ln -s /opt/wkhtmltox/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
    sudo ln -s /opt/wkhtmltox/bin/wkhtmltoimage /usr/bin/wkhtmltoimage
    You can now run wkhtmltopdf -V to check if it is working, you will see this.
wkhtmltopdf 0.12.4 (with patched qt)

At this point, we have all the required dependencies installed. You can now proceed to install Bench.

Install Bench

  • Create a new user to run Bench processes in the isolated environment.
    sudo adduser bench --home /opt/bench

  • Provide sudo permissions to the bench user.
    sudo usermod -aG sudo bench

  • Login as the newly created bench user.
    sudo su - bench

  • Clone the Bench repository in /opt/bench.
    cd /opt/bench
    git clone https://github.com/frappe/bench bench-repo

  • Install Bench using pip.
    sudo -H pip install -e bench-repo

  • Once Bench is installed, proceed further to install ERPNext using Bench.

Install ERPNext using Bench

Initialize a bench directory with frappe framework installed. To keep everything tidy, we will work under the /opt/bench directory. Bench will also setup regular backups and auto updates once a day.
cd /opt/bench
bench init erpnext && cd erpnext

  • Create a new Frappe site.
    bench new-site [erp.example.com](http://erp.example.com)
    The above command will prompt you for the MySQL root password. Provide the password which you have set for the MySQL root user earlier. It will also ask you to set a new password for the administrator account. You will need this password later to log into the administrator dashboard. If you have errors with root password for MariaDB, look at the end of this guide for workarounds.

  • Download ERPNext installation files from the remote git repository using Bench.
    bench get-app erpnext https://github.com/frappe/erpnext

  • Install ERPNext on your newly created site.
    bench --site [erp.example.com](http://erp.example.com) install-app erpnext

  • You can start the application immediately to check if the application installed successfully.
    bench start

  • However, you should stop the execution and proceed further to set up the application for production use.
    Press CTRL+C to stop bench execution.

  • Setup Supervisor and Nginx
    By default, the ERPNext application listens on port 8000, not the standard HTTP port 80. Also, running the built in web server for production use is not recommended as we will be exposing the server to the world. You should use a production web server as a reverse proxy such as Apache or Nginx. We will use Nginx as a reverse proxy as it can be automatically configured using Bench. Bench can automatically generate and install the configuration according to the ERPNext setup.
    Although we can start the application using the ‘bench start’ command, the execution of ERPNext will stop as soon as you close the terminal. To overcome this issue, you should use Supervisor, which is very helpful in running the application continuously in a production environment. Supervisor is a process control system that enables you to monitor and control a number of processes on Linux operating systems. Once Supervisor is configured, it will automatically start the application at boot time as well as on failures. Bench can automatically configure Supervisor for the ERPNext application.

  • Install Supervisor.
    sudo apt -y install supervisor

  • Start Supervisor and enable it to automatically start at boot time.
    sudo systemctl start supervisor
    sudo systemctl enable supervisor

  • Setup Bench for production use.
    sudo bench setup production bench
    The above command may prompt you before replacing the existing Supervisor default configuration file with a new one. Choose y to proceed. Bench adds a number of processes to the Supervisor configuration file. The above command will also ask you if you wish to replace the current Nginx configuration with a new one. Enter y to proceed. Once Bench has finished installing the configuration, provide other users to execute the files in your home directory of the Bench user.
    chmod o+x /opt/bench/

You can now access the site on http://erp.example.com !


  • Ensure Port 80 has been opened in your firewall
    sudo ufw allow 80 & 443
    You can check the status of the processes by running.
    sudo supervisorctl status all
    You should see the following output.
    bench@vultr:~/erpnext$ sudo supervisorctl status all
    erpnext-redis:erpnext-redis-cache RUNNING pid 13852, uptime 0:00:54
    erpnext-redis:erpnext-redis-queue RUNNING pid 13851, uptime 0:00:54
    erpnext-redis:erpnext-redis-socketio RUNNING pid 13853, uptime 0:00:54
    erpnext-web:erpnext-frappe-web RUNNING pid 13856, uptime 0:00:54
    erpnext-web:erpnext-node-socketio RUNNING pid 13855, uptime 0:00:54
    erpnext-workers:erpnext-frappe-default-worker-0 RUNNING pid 13862, uptime 0:00:54
    erpnext-workers:erpnext-frappe-long-worker-0 RUNNING pid 13870, uptime 0:00:54
    erpnext-workers:erpnext-frappe-schedule RUNNING pid 13869, uptime 0:00:54
    erpnext-workers:erpnext-frappe-short-worker-0 RUNNING pid 13875, uptime 0:00:54

  • To stop all of the ERPNext processes.
    sudo supervisorctl stop all
    -To start all the ERPNext processes.
    sudo supervisorctl start all

Setting Up SSL using Let’s Encrypt

Let’s Encrypt provides free SSL certificates to the users. SSL can be installed manually or automatically through Bench. Bench can automatically install the Let’s Encrypt client and obtain the certificates. Additionally, it automatically updates the Nginx configuration to use the certificates.
The domain name which you are using to obtain the certificates from the Let’s Encrypt CA must be pointed towards the server. The client verifies the domain authority before issuing the certificates.

  • Enable DNS multi-tenancy for the ERPNext application.
    bench config dns_multitenant on
  • Run Bench to set up Let’s Encrypt on your site.
    sudo bench setup lets-encrypt [erp.example.com](http://erp.example.com)
    During the execution of the script, the Let’s Encrypt client will ask you to temporarily stop the Nginx web server. It will automatically install the required packages and the Let’s Encrypt client. The client will prompt you for your email address. You will also need to accept the terms and conditions. Once the certificates have been generated, Bench will also generate the new configuration for Nginx which uses the SSL certificates. You will be asked before replacing the existing configuration. Bench also creates a crontab entry to automatically renew the certificates every month.
  • Finally, enable scheduler to automatically run the scheduled jobs.
    bench enable-scheduler
    You should see this output.
bench@vultr:~/erpnext$ bench enable-scheduler
Enabled for [erp.example.com](http://erp.example.com)

Conclusion

Once the process has finished, you can access your application at https://erp.example.com. Login with the username Administrator and the password you have set during installation. You will be taken to the desk where you will need to provide information to set ERPNext ERP according to your company. You can now use the application to manage your company.
Congratulations, you have a fully working ERPNext application installed on your Ubuntu 17.04 server.


FIX MARIADB LOGIN ISSUES

FOLLOW THESE STEPS FOR MARIADB AUTHENTICATION


The reason is that recent Ubuntu installation (maybe others also), mysql is using by default the UNIX auth_socket plugin.
Basically means that: db_users using it, will be “auth” by the system user credentias. You can see if your root user is set up like this by doing the following:
$ sudo mysql -u root # I had to use “sudo” since is new installation

mysql> USE mysql;
mysql> SELECT User, Host, plugin FROM mysql.user;

±------------------±-----------------------+
| User             | plugin                |
±------------------±-----------------------+
| root             | auth_socket           |
| mysql.sys        | mysql_native_password |
| debian-sys-maint | mysql_native_password |
±------------------±-----------------------+

As you can see in the query, the root user is using the auth_socket plugin
There are 2 ways to solve this:

  1. You can set the root user to use the mysql_native_password plugin
  2. You can create a new db_user with you system_user (recommended)

Option 1:

$ sudo mysql -u root # I had to use “sudo” since is new installation

mysql; USE mysql;
mysql; UPDATE user SET plugin=‘mysql_native_password’ WHERE User=‘root’;
mysql; FLUSH PRIVILEGES;
mysql; exit;

$ service mysql restart

Option 2:

(replace YOUR_SYSTEM_USER with the username you have)

$ sudo mysql -u root # I had to use “sudo” since is new installation

mysql; USE mysql;
mysql; CREATE USER ‘YOUR_SYSTEM_USER’@‘localhost’ IDENTIFIED BY ‘’;
mysql; GRANT ALL PRIVILEGES ON *.* TO ‘YOUR_SYSTEM_USER’@‘localhost’;
mysql; UPDATE user SET plugin=‘auth_socket’ WHERE User=‘YOUR_SYSTEM_USER’;
mysql; FLUSH PRIVILEGES;
mysql; exit;

$ service mysql restart
Remember that if you use option #2 you’ll have to connect to mysql as your system username (mysql -u YOUR_SYSTEM_USER)

Note: On some systems (e.g., Debian stretch) ‘auth_socket’ plugin is called ‘unix_socket’, so the corresponding SQL command should be: UPDATE user SET plugin=‘unix_socket’ WHERE User=‘YOUR_SYSTEM_USER’;


Best way to install stable version of ErpNext
#58

Thank you very much. Let keep maintaining it so we can continue to help others. In fact, I want to make one for Bench Update soon


#59

This did not run on Debian 9 after days of finding all the errors listed as solid working in this article. I am trying a combination of easy script and manual install steps, hopefully can get it up. I am sure this works for many people, just not in my setup for some reason.

I am noob!


#61

Sorry it did not help you. If you find anything that will improve the quality of the article please feel free to create a new version. In the true spirit of open source I ask for us to be more mind full of other people work, especially when the work was done to solve a specific problem on with a specific used case. We are here to help each other not to bash each other, work in any way shape or form. My suggestion is to post your error message and see if someone can help you.


#62

Thanks for your help. After 60 hours still wont run on Debian 9, tried easy and manual multiple times, just doesnt run for me. I am just going to keep running through it until it starts!

I do appreciate your help, just hitting the wall and need to take a break, come back to it


#63

Thanks Jermaine, for your hard work!


#64

Here is the error I get using easy install:

PLAY RECAP ********************************************************************************************************************
localhost : ok=75 changed=14 unreachable=0 failed=1

Passwords saved at ~/passwords.txt
Traceback (most recent call last):
File “install.py”, line 420, in
install_bench(args)
File “install.py”, line 122, in install_bench
run_playbook(‘site.yml’, sudo=True, extra_vars=extra_vars)
File “install.py”, line 338, in run_playbook
success = subprocess.check_call(args, cwd=os.path.join(cwd, ‘playbooks’))
File “/usr/lib/python2.7/subprocess.py”, line 186, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-e’, ‘@/tmp/extra_vars.json’, ‘-vvvv’, ‘–become’, ‘–become-user=erpnext’]’ returned non-zero exit status 2