how to install erpnext on ubuntu

This guide is based on https://github.com/frappe/bench, and is tested a couple of times against ubuntu 14.04/64.

      • Login as root with ssh.
      • Optionally:
        apt-get update
        
        apt-get upgrade
        
        dpkg-reconfigure tzdata
        
        apt-get install nano
        
      • Add a user (erpnext for our example).
adduser erpnext

Store password in a safe place for later use.

      • visudo (to grant erpnext user sudo privileges, by copying root record)

A nice article on user management: https://www.digitalocean.com/community/tutorials/how-to-add-and-delete-users-on-an-ubuntu-14-04-vps

  • Login as erpnext.
    su erpnext
  • Download script at home dir and execute it.
cd ~
wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
sudo python install.py --production --user erpnext

You will prompted for mysql and admin passwords.
Store both passwords in a safe place for later use.

The script is going to take some moments to complete depending on hardware, let’s say 5 or 10 minutes.

  • Restart web server, sudo service nginx restart.
  • Fire up your browser and point to your server’s IP (or hostname). If everything goes well you will see eprnext login screen. Use your stored admin pass to access web app. Eventually a nice setup wizard will show up at your browser.

You’re amost done. To increase security you should install ssl. We’ll use let’s encrypt for our example.

    • su erpnext
    • cd ~
    • cd frappe-bench
    • Important! Assuming your domain is example.com: mv sites/site1.local sites/example.com
    • nano sites/example.com/site_config.json
    • Add "host_name": "https://example.com",

Don’t forget commas separating json records.

  • Enable dns multitenancy: bench config dns_multitenant on
  • Regenerate nginx config: bench setup nginx
  • Reload nginx: sudo service nginx reload
  • Configure let’s encrypt: sudo -H bench setup lets-encrypt example.com

If errors occur, recheck all your steps. If https/ssl still fails, try the manual method below.

  • su root
  • cd /opt
  • wget https://certbot.eff.org/
  • sudo service nginx stop
  • ./opt/certbot-auto certonly --standalone
  • su erpnext
  • cd ~/frappe-bench/sites/example.com
  • nano sites/example.com/site_config.json
  • Add two lines, beware of the commas separating json records! "ssl_certificate": "/etc/letsencrypt/live/example.com/fullchain.pem",
    "ssl_certificate_key": "/etc/letsencrypt/live/example.com/privkey.pem"
    , save and exit nano
  • bench setup nginx, to regenerate cofig files.
  • sudo service nginx restart

Now, you should be ok with letsencrypt cert. Letsencrypt certificate expires every three months, so you’d better set up a cronjob that automatically renew certificate. It should be as easy as adding a crontab entry.

  • crontab -e
  • Add this: # renew letsencrypt certificates on 1st monday of every month and get an email if it gets executed
    MAILTO="mail@example.com"
    0 0 1-7 * * [ "$(date '+\%a')" = "Mon" ] && sudo service nginx stop && /opt/certbot-auto renew && sudo service nginx start

You’re done.

References

Official frappe documentation provides an article for https/ssl:
https://frappe.github.io/frappe/user/en/bench/guides/lets-encrypt-ssl-setup.html

If you want to install a second site on the same server see this:

how to add a second erpnext instance on ubuntu

One Reply to “how to install erpnext on ubuntu”

Leave a Reply

Your email address will not be published. Required fields are marked *

5 + 9 =