NOTE:
1). Clean install on Ubuntu
2). User is bench with sudo privileges
3). Installed on Virtualbox Virtual machines
Login to your Local User
Prerequisites
Ubuntu 17.XX or 18.XX server instance.
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
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 for Python Pakages."
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 pip install --upgrade pip setuptools
Install Ansible using Pip. Ansible automates software provisioning, configuration management, and application deployment.
sudo 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
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 -V
Result 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 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 site1.local
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.
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.