How to install erpnext from A-Z

This is exactly where I’m still stuck now :pensive: :disappointed: :confounded:. However, when I ping the server IP, it somehow displays the ERPNext login screen. I’m concerned whether to trust that the application went well (no hidden surprise later …) for a production environment.

@revant_one has developed a docker-based deployment/installation of ERPNext without the use of bench altogether …

Another gentleman @brian_pond is working on another alternative for bench, called Weavlo. Looks very ambitious and well thought of …

open two terminal
1- for Bench start
2- for bench install

Successfully completed these method. But I’m getting these.


Shouldn’t I get stable/master version?

I was able to install using the easy install script on GCP, AWS and DigitalOcean. But installation failed on Interserver due to permission issues. One consistent failure though across board is when i used the --user flag. It always failed when i did that so installing without the --user flag installs into a frappe user directory successfully.

I tried without user flag and failed on AWS EC2. Could you share your steps? Thanks

I have these following steps for installation erpnext on aws .Check if it is helpful for you.

Cloud Service: Amazon AWS
Instance Type: t2.micro
Instance OS: Ubuntu 18.04
Prerequisites: Installed virtual server in a Linux environment, preferable Ubuntu
visit Tutorial: Get started with Amazon EC2 Linux instances - Amazon Elastic Compute Cloud

Part 1: Installing the cloud instance
-this is shortly go through how to install the cloud instance

1) Log into Amazon AWS (console.aws.amazon.com)
2) Create an account if you have not already
3) Click EC2, this is the service we will be using
4) Under the Create Instance section click the Launch Instance button
5) Select the Ubuntu Server 18.04 LTS (HVM), SSD Volume Type or similar
6) Click Review and Launch
    *we are using the t2.medium which is default
    *customize the instance. the operating system is the important characteristic
7) Click Launch after reviewing the instance. Make sure it is as requested
8) A popup should come up titled Select an existing key pair or create a new key pair
    *choose an existing key pair. for this example, we will assume you do not have one. follow the following:
        1) Choose Create a new key pair from the first drop down menu
        2) Name the Key pair name pem_key
        3) IMPORTANT: Click Download Key Pair
            * without it we cannot login
        4) Click Launch Instances
5) Click View Instances after reviewing the Launch Status page
6) You should now be on the Instances tab on the EC2 Dashboard. Notice the table and specifically the Status Checks column
7) Wait until there is a green check in the Status Check column that indicated the instance is ready
* You have now created the virtual server for your site instance

Part 2: SSH Information
-this will go over how to use SSH with your new virtual server
Prerequisites: Completed Part 1, Linux environment. You can use puTTY for windows but the guide will use Ubuntu

1) Open up terminal (shortcut: ctrl + alt + t)
2) Navigate to where you downloaded the ssh key (enter ls to see current directory and cd [file] to access a file)
3) Open up the Amazon AWS EC2 Dashboard and make sure you are on the Instances tab
    -we will now get the connection string. for experienced users, you can skip this
    1) Click on the virtual instance you would like to use your site on
    2) On the top bar, there should be a button called Connect. Click Connect
    3) In the Example section there is a bold string, it should look like this:
        ssh -i "example_key.pem" ubuntu@ec2-52-24-43-53.us-west-2.compute.amazonaws.com
    4) Copy this string and go back to the terminal
4) Paste the string (Paste in terminal: Ctrl + Shift + Z)
5) Press enter to connect
    note: there may be an error that will say: WARNING UNPROTECTED PRIVATE KEY FILE, follow these steps to 'protect' it
    1) Type in the following command to change the permissions of our key file (YOUR_KEY.pem)
        chmod 400 YOUR_KEY.pem
        *note that the 400 is a strict case, a higher number will be more lenient
6) We have now connected to our virtual instance using ssh

Part 3: Create a User and use SFTP
-this will create a user for proper bench installation and make sure we can sftp into it for easier editing
Prerequisites: Part 1, 2 completed, SFTP client like FileZilla

1) Connect to instance via SSH
2) You might be the user ubuntu, we will now create a new user. go to root user by typing in the following command:
    sudo su -
3) Set root password by typing in the following command (makes instance less secure)
    passwd
4) Type in the following command where [name] is your name
    adduser [name]
5) The terminal will ask for a series of questions for log information.
6) Add the user into the sudoer group by entering the following command
    sudo adduser [name] sudo
7) Set the password to the new user by entering in the following command (makes instance less secure)
    sudo passwd [name]
8) Allow SSH Password Authentication by following these steps:
    1) Go to the root directoy of the OS (you can do this by entering the command "cd ..")
    2) Type in the following command to navigate to the correct directory:
        cd etc/ssh
    3) Edit the sshd_config file through the following steps
        1) enter the following command
            vi sshd_config
        2) type the following to go into the editor (works like a text edito)
            i
        3) find where it says PasswordAuthentication and change it so that it shows the following:
            PasswordAuthentication yes
        *) Also change PermitRootLogin without-password to 
            PermitRootLogin yes
        4) Click the Esc button to get out of edit mode
        5) Enter the following to write and save the changes
            :w
        6) Enter the following to exit the vi editor
            :q
9) Open up your SFTP Client and login using the new user you created. The following uses FileZilla:
    1) Open up the Site Manager by click File -> Site Manager
    2) Click New Site
    3) In the General Tab:
        1) Host is the Public DNS of your instance. This can be found by going to the EC2 Dashboard Instances Tab
        2) You can leave the port  and the comments blank
        3) The Protocol is SFTP
        4) The Logon Type is "Ask for password"
        5) The user is root
    4) Click Connect
    5) Enter in the password
        * If there is an unkown host key warning, you can ignore it

Part 4: Install ERPNext on instance
-this will install the ERPNext software on the virtual server which is what your site uses

1) Open up terminal and ssh into your instance, login to the new user by entering the following:
    su [name]
2) Type in the following command to download the source and execute

    wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
  1. Type in the following command to install
    For developer setup:
    sudo python install.py --develop
    For production setup:
    sudo python install.py --production

  2. Take note of the MariaDB, Frappe, and Administrator password

  3. Type in the following command
    bench new-site sitename

  4. Enter in the MariaDB Password when it asks for the MySQL password

  5. Type in the following command
    bench --site [YOUR SITE NAME] install-app erpnext

  6. Type in the following command for multitenant setup
    bench config dns_multitenant on
    bench new-site site2name(eg:example.com)
    bench setup nginx
    sudo service nginx reload
    *) Note : For “DNS based multitenancy”, currentsite.txt in frappe-bench/sites/ should be empty.
    *) Note that we are done if everything was operational, now we have to open up the port from amazon and for domain setup go to route53.
    9) Go to the Amazon EC2 Instance Page
    10) Click on your instance and on the Description tab on the bottom, take not of the Security Groups
    11) Click on the Security Groups on the left hand side
    12) Click on the Security Group for your instance
    13) Click on the Inbound tab for your instance
    14) Click Edit
    15) Add a Custom TCP Rule for Port 8000 and Source 0.0.0.0/0

1 Like

I guess You’d have to run these commands first.
sudo apt update && sudo apt upgrade
sudo apt-get install python-minimal
sudo apt-get install build-essential python-setuptools

Right?

There is no need to run those commands.
When we are running following script :-
wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py

I tried it without installing python minimal; got an error while running install.py --production, saying can not find install.py :open_mouth:

I think easy installation is fixed now!

Congrats!
how you installed?

Yeah I did. :frowning:

Facing a lots of issues after restoring my v10 database there though. But, the installation worked fine.

That step failed here on Ubuntu 18.04.

Solution was to install libssl-dev before:

apt install libssl-dev

After that, it worked.

2 Likes

apt install redis-server -y
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
alien at bc cups-bsd cups-client debhelper debugedit dh-autoreconf dh-strip-nondeterminism guile-2.0-libs intltool-debian
libarchive-cpio-perl libarchive-zip-perl libarchive13 libfile-stripnondeterminism-perl libgc1c2 libgsasl7 libkyotocabinet16v5
liblua5.2-0 liblzo2-2 libmail-sendmail-perl libntlm0 libpython2.7 librpm8 librpmbuild8 librpmio8 librpmsign8
libsys-hostname-long-perl lsb-security mailutils-common pax po-debconf rpm rpm-common rpm2cpio
Use ‘sudo apt autoremove’ to remove them.
The following additional packages will be installed:
libjemalloc1 redis-tools
Suggested packages:
ruby-redis
The following NEW packages will be installed:
libjemalloc1 redis-server redis-tools
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 634 kB of archives.
After this operation, 3,012 kB of additional disk space will be used.
Get:1 http://sg.mirrors.cloud.aliyuncs.com/ubuntu bionic/universe amd64 libjemalloc1 amd64 3.6.0-11 [82.4 kB]
Get:2 http://sg.mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/universe amd64 redis-tools amd64 5:4.0.9-1ubuntu0.2 [516 kB]
Get:3 http://sg.mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/universe amd64 redis-server amd64 5:4.0.9-1ubuntu0.2 [35.4 kB]
Fetched 634 kB in 0s (22.8 MB/s)
Selecting previously unselected package libjemalloc1.
(Reading database … 122952 files and directories currently installed.)
Preparing to unpack …/libjemalloc1_3.6.0-11_amd64.deb …
Unpacking libjemalloc1 (3.6.0-11) …
Selecting previously unselected package redis-tools.
Preparing to unpack …/redis-tools_5%3a4.0.9-1ubuntu0.2_amd64.deb …
Unpacking redis-tools (5:4.0.9-1ubuntu0.2) …
Selecting previously unselected package redis-server.
Preparing to unpack …/redis-server_5%3a4.0.9-1ubuntu0.2_amd64.deb …
Unpacking redis-server (5:4.0.9-1ubuntu0.2) …
Setting up libjemalloc1 (3.6.0-11) …
Setting up redis-tools (5:4.0.9-1ubuntu0.2) …
Setting up redis-server (5:4.0.9-1ubuntu0.2) …
Job for redis-server.service failed because a timeout was exceeded.
See “systemctl status redis-server.service” and “journalctl -xe” for details.
invoke-rc.d: initscript redis-server, action “start” failed.
● redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; disabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: timeout) since Tue 2019-12-17 15:56:12 CST; 16ms ago
Docs: https://redis.io/docs/,
man:redis-server(1)
Process: 9558 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
dpkg: error processing package redis-server (–configure):
installed redis-server package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.27-3ubuntu1) …
Processing triggers for systemd (237-3ubuntu10.33) …
Processing triggers for man-db (2.8.3-2ubuntu0.1) …
Processing triggers for ureadahead (0.100.0-21) …
Errors were encountered while processing:
redis-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Getting this error while installing redis server

Tried again in a fresh server. Got this error.

pip install MySQL-python --no-use-wheel
DEPRECATION: --no-use-wheel is deprecated and will be removed in the future. Please use --no-binary :all: instead.
Collecting MySQL-python
Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Skipping bdist_wheel for MySQL-python, due to binaries being disabled for it.
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python … error
Complete output from command /usr/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-LNPZZ6/MySQL-python/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-3T3TTg-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying mysql_exceptions.py → build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/init.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py → build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/init.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building 'mysql’ extension
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-5Z483E/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,2,5,‘final’,1) -D__version
=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-5Z483E/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-5Z483E/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-2.7/_mysql.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1

----------------------------------------

Command “/usr/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-LNPZZ6/MySQL-python/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-3T3TTg-record/install-record.txt --single-version-externally-managed --compile” failed with error code 1 in /tmp/pip-build-LNPZZ6/MySQL-python/

@Mestoof Hey Buddy,

Thanks for the guide. It Works fine, but regardless of setting up production by stating “sudo bench setup production frappe”, setup installs develop version only. (screenshot below)

How do i get to production version >???

please, help . i have got this error while installing erpnext on my wesbite

that’s the output
paulpaul@paul:~/frappe-bench$ bench new-site site5.local
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: pip install frappe-bench

MySQL root password:

Installing frappe…
Updating DocTypes for frappe : [========================================]
Updating country info : [========================================]
Set Administrator password:
Re-enter Administrator password:
*** Scheduler is disabled ***
paulpaul@paul:~/frappe-bench$ bench --site site5.local install-app erpnext
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: pip install frappe-bench

Installing erpnext…
Updating DocTypes for erpnext : [====================== ]Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/paulpaul/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/paulpaul/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/paulpaul/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/paulpaul/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/paulpaul/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/paulpaul/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/paulpaul/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/commands/site.py”, line 193, in install_app
_install_app(app, verbose=context.verbose)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/installer.py”, line 83, in install_app
sync_for(name, force=True, sync_everything=True, verbose=verbose, reset_permissions=True)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/model/sync.py”, line 56, in sync_for
reset_permissions=reset_permissions, for_sync=True)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 66, in import_file_by_path
ignore_version=ignore_version, reset_permissions=reset_permissions)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 106, in import_doc
doc = frappe.get_doc(docdict)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/init.py”, line 753, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/model/document.py”, line 71, in get_doc
return controller(*args, **kwargs)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/model/document.py”, line 115, in init
super(Document, self).init(kwargs)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 66, in init
self.update(d)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 89, in update
self.set(key, value)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 136, in set
self.extend(key, value)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 173, in extend
self.append(key, v)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 150, in append
value = self._init_child(value, key)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 185, in _init_child
value[“doctype”] = self.get_table_field_doctype(key)
File “/home/paulpaul/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 299, in get_table_field_doctype
return self.meta.get_field(fieldname).options
AttributeError: ‘NoneType’ object has no attribute ‘options’

any one help please ! al my work has stopped !

your steps was perfect but, a small edit that you should do .

i was facing problem installing erpnext app on the site . erpnext must be version 12 same bench . so i replaced it with this command and it worked very well for me .

$ bench get-app --branch version-12 erpnext https://github.com/frappe/erpnext

1 Like

i have problem after installation and every thing is fine i can not browse to my web site i think the problem in sites because i get this error when using create new site command :slight_smile:
OSError: [Errno 2] No such file or directory: ‘next.hu’ that is my site name

when i navigate to frappe@next:~/frappe-bench$ nano frappe-bench/sites/currentsite.txt