The guys at ERPNext have done a great job on creating an installation script that install the full functional system in one easy step. But my initial attempts to install it on the Centos 7 by following easy installation procedure was a failure. I think this was mainly because the script has been developed and tested mainly for Ubuntu. You might be lucky enough to have your system set up exactly as the script expects but if that is not the case there will be a lot of trials and errors and re-builds and head scratches.
For main installation guides refer to: http://frappe.github.io/frappe/user/en/bench/guides/
To save you (and myself on the future deploys) some time on installation process, I listed full steps I took to install and run it successfully in my fresh Centos 7 minimal virtual machine.
All the details and screenshots are correct for below:
OS: Centos 7 ( Linux 3.10.0-327.4.5.el7.x86_64)
Frappe Framework: 6.27.17
Database: MariaDB 10.0.25
After installing Centos make sure you update it. You also will need
wget package to download the script (it is not part of minimal package). I also use vim as my default editor so will install that too.
yum install vim wget open-vm-tools yum update
By default, in Centos7 installation SELinux is set to enforce. You need to disable this during the installation.
sudo vim /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
Change the value in the 7th line from enforcing to disabled.
Also by default firewall is enabled and blocking all the incoming ports. I simply add my ports to the default public zone.
sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-port=8000/tcp sudo firewall-cmd --reload
To make sure the ports have been added properly run below command and check the result:
Result should include the ports and services we added to the zone:
[saeed@erpnext ~]$ firewall-cmd --list-all
public (default, active)
services: dhcpv6-client http ssh
Then do a reboot and system should be ready to download and install the ERPNext.
Download and set up ERPNext
If you run the installation script with your admin user and
sudo, it will use your current user as frappe user. But if you run the script as
root it will create a new user called
frappe and use it for the next steps of maintenance and updates. I would prefer to have a new dedicated user for this service so will run my script as
su - mkdir /opt/erpnext cd /opt/erpnext wget https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh bash setup_frappe.sh --setup-production
[root@erpnext erpnext]# bash setup_frappe.sh --setup-production
Installing for centos 7 amd64
In case you encounter an error, you can post on https://discuss.frappe.io
Adding centos mariadb repo
Installing packages for centos. This might take time...
Configuring CentOS services
Adding frappe user
Setting up first site
Frappe/ERPNext is installed successfully and is running on port 80.
Frappe password: HuCXVjhA3HDvIdvL
MariaDB root password: Rd6dvmRmURYD1xZQ
Administrator password: FQWdxe8sLtMWUzw2
The passwords are also stored at ~/frappe_passwords.txt
You can remove this file after making a note of the passwords.
All the next steps will be done under frappe user. So have the password handy or change it to something easier to remember. Also you will need
sudo privileged in some stages so add it to wheel group.
usermod -aG wheel frappe
The installation process is not very verbose. It shows very few information about what is happening in the background and involves a lot of waiting in some of the steps. Just sit back and make make sure you give enough time for it to finish the job.
When finished installing. Make a note of the three passwords on the screen. You also can find them in
~/frappe_passwords.txt under the
Set up your ERPNext site
By default a site called site1.local is created. You can either use that or create your own new site. To avoid creating another new database I use that same site just rename it to whatever I want.
su frappe cd ~/frappe-bench mv sites/site1.local sites/mysite.domain bench --site mysite.domain install-app erpnext sudo bench setup production frappe exit
[frappe@erpnext frappe-bench]$ sudo bench setup production frappe
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
That should be all you need to do on the server.
Remove frappe user from
sudo usermod -G "" frappe
Access to website
To get to the website from another machine, you need to add the site ip to your dns server and access to the server. It won’t work with ip address in web browser (can’t figure out why at this stage).
I am using a Windows machine as client, so just locally add the ip address to my hosts file. You can do it by editing
hosts file in:
Open the file in Notepad (or any other text editor) as Administrator and add a line for the website and save it.
That should be it. Enjoy ERPNexting.
Migrate cloud database to local server
If you have a current database on erpnext.com and want to have a local copy of it. Follow below steps:
First make a backup of the online server.
Go to Setup > Download Backups and select the most recent backup.
Transfer the .sql file to your server. (i use pscp from putty)
On the server that you have the new ERPNext installation follow below steps:
gunzip 20160528_72912243_database.sql.gz mysql -u root -p erpnext-db-name < 20160528_72912243_database.sql cd ~/frappe-bench bench --site mysite.domain remove-from-installed-apps frappe_subscription bench --site mysite.domain remove-from-installed-apps mandrill_integration bench --site mysite.domain remove-from-installed-apps knowledge_base bench --site mysite.domain migrate
There is a bench command for the restore as well but I couldn’t get it working. So will use mysql command instead.
There are few apps that is installed in online version and i don’t have them in local version. So need to remove them before the site can work.