Installation of ERPNEXT 13 through Easy Install Script on Amazon EC2 instance and setup Let's Encrypt Certificate

Hey Guys,

I would like to share my installation steps which i took to install ERPNEXT on Amazon EC2 instance and also installed Let’s Encrypt certificate install.

This worked without flaw. Perhaps you can give it a try if you are failing to install ERPNEXT.

AWS EC2 Instance which i used:
AMI - Ubuntu Focal -20.04-amd64-server
Instance Type: t3a.large (2 vcpu - 8gb Memory) - Tried on free tier, but it never installed
SSD: 50GB

Installation Steps:

  1. created sudo user [newuser]

sudo adduser [newuser]

  1. changed root password:-

sudo passwd root

  1. Changed to “root” account

su

  1. Ran apt-get update and upgraded

apt-get update && apt-get upgrade

  1. Changed user to the newly created user

su - [newuser]

  1. Now the easy install script will be run under this newly created user account only.
    Please run following commands in terminal.

sudo localectl set-keymap us && sudo localectl set-locale LANG=en_US.utf8

  1. Below command will open a file in the nano editor.

sudo nano /etc/environment

  1. Now add following lines in the file which is opened by nano

LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LANG=en_US.UTF-8

  1. Now, Reboot!

sudo reboot

  1. Change to newly created user.

su - [newuser]

  1. From below commands, we will download easy script in to the folder of newly create user [newuser]

wget https://raw.githubusercontent.com/frappe/bench/develop/install.py

  1. Next command will install the ERPNEXT 13 in production mode.

sudo python3 install.py --verbose --production --user [newuser] --mariadb-version 10.5 --frappe-branch version-13 --erpnext-branch version-13

  1. Now, automated install will take place. It will ask for mysql root password & default admin password halfway down. Give input to machine when promted (and also save for future ref).

  2. If everything goes fine, bench will be installed in the production version.

  3. Bench will be installed with default site “site1.local” which you may want to change as you want to install erpnext on your subdomain (Website). To achieve this, follow below:-

mv sites/site1.local sites/erp.yourdomain.com
bench setup nginx
sudo service nginx reload

  1. Setup Multitenancy in order to use the letsencrypt

bench use examplesitename
bench config dns_multitenant on

  1. Now, point your subdomain to your public ip address of AWS EC2 instance (in short, add “A” record in your dns) like below:-
    Type: A
    Name: whatever subdomain as you like, for example: “erp”, “crm”, “mail”
    erp.thesourcerers.co (#this is what i used as i own domain thesourcerers.co)
    value: ip address of your ec2 instance
    TTL: 1 hour
    –DONE–

  2. Now, follow below instructions from Certbot for further configuration of letsencrypt. This will install https access to your website.

sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --nginx

Now, certificate has been installed on the given domain.

With this, you have installed ERPNEXT on Amazon EC2 instance and also installed https for your subdomain.

Notes:
If you want the bench to be installed in production version, follow below command from the ERPNEXT install directory.

bench set-config developer_mode 1

6 Likes

Much appreciate guide, brief and precise.
Unfortunately the script failed twice , with fatal error at

TASK [bench : python3 bench init for production] *****************
task path: /tmp/.bench/bench/playbooks/roles/bench/tasks/main.yml:44
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
<127.0.0.1> EXEC /bin/sh -c ‘echo ~root && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo /var/tmp”&& mkdir /var/tmp/ansible-tmp-1641986161.4809225-27947-19100
1696391721 && echo ansible-tmp-1641986161.4809225-27947-191001696391721=“echo /var/tmp/ansible-tmp-1641986161.4809225-27947-19100 1696391721” ) && sleep 0’
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/commands/command.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-24692j4f3dytp/tmpaou46c0k TO /var/tmp/ansible-tmp-1641986161.4809225-27947-1910016
96391721/AnsiballZ_command.py
<127.0.0.1> EXEC /bin/sh -c ‘setfacl -m ‘"’“‘u:[newuser]:r-x’”’“’ /var/tmp/ansible-tmp-1641986161.4809225-27947-191001696391721/ /v
ar/tmp/ansible-tmp-1641986161.4809225-27947-191001696391721/AnsiballZ_command.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘chmod u+x /var/tmp/ansible-tmp-1641986161.4809225-27947-191001696391721/ /var/tmp/ansible-tmp-16419861
61.4809225-27947-191001696391721/AnsiballZ_command.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c 'chown '”‘"’[newuser]‘"’“’ /var/tmp/ansible-tmp-1641986161.4809225-27947-191001696391721/ /var/tmp/ansi
ble-tmp-1641986161.4809225-27947-191001696391721/AnsiballZ_command.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n -u [newuser] /bin/sh -c '”‘“‘echo BECOME-SUCCESS-ajdbrdjdfocbzfsirfuebnfumggnjxed ; /us
r/bin/python3 /var/tmp/ansible-tmp-1641986161.4809225-27947-191001696391721/AnsiballZ_command.py’”’“’ && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘rm -f -r /var/tmp/ansible-tmp-1641986161.4809225-27947-191001696391721/ > /dev/null 2>&1 && sleep 0’
fatal: [localhost]: FAILED! => {
“changed”: true,
“cmd”: [
“bench”,
“init”,
“~[newuser]/frappe-bench”,
“–frappe-path”,
GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript”,
“–frappe-branch”,
“version-13”,
“–python”,
“python3”
],
“delta”: “0:00:00.239021”,
d”: true,
“cmd”: [
“bench”,
“init”,
“/home/miraj/frappe-bench”,
“–frappe-path”,
GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript”,
“–frappe-branch”,
“version-13”,
“–python”,
“python3”
],
“delta”: “0:00:00.300215”,
“end”: “2022-01-12 10:50:38.153296”,
“invocation”: {
“module_args”: {
“_raw_params”: “bench init /home/miraj/frappe-bench --frappe-path GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript --frappe-branch vers
ion-13 --python python3”,
“_uses_shell”: false,
“argv”: null,

any guide would be appreciated

Run the following commands

sudo pip3 uninstall setuptools
sudo pip3 install setuptools==59.6.0
sudo pip3 install -e /home/user/.bench/

Make sure to replace user with the username with which you are doing the installation
Once done, re-run the easy installation command.

Thanks

but i am facing some issues while installing
I am trying to install the ERPNext on ubunutu 20 but getting the below error and exiting without completing the installation process

[WARNING]: No inventory was parsed, only implicit localhost is available[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match ‘all’
Traceback (most recent call last):
File “install.py”, line 497, in
install_bench(args)
File “install.py”, line 278, in install_bench
run_playbook(‘site.yml’, sudo=True, extra_vars=extra_vars)
File “install.py”, line 413, in run_playbook
success = subprocess.check_call(args, cwd=playbooks_folder, stdout=log_stream, stderr=sys.stderr)
File “/usr/lib/python3.8/subprocess.py”, line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘@/tmp/extra_vars.json’, ‘–become’, ‘–become-user=frappe’]’ returned non-zero exit status 2.

I’m getting the exact same error!

Mannual installation is not that bad. I’ve installed it on 3 different systems without a single error.

1 Like

Yes since 2-3 years ago I relied on manual install

not same as my experience, lots of errors there, and couldn’t finally get it done :frowning:

may be you should give this a try.

1 Like