Install Frappe and ERPNext 14 on ubuntu 22.04 (Python 3.10 Fix)

  1. apt update && apt upgrade -y

  2. curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -

  3. apt install nodejs

  4. sudo apt-get install gcc g++ make

  5. curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null

  6. echo “deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main” | sudo tee /etc/apt/sources.list.d/yarn.list

  7. sudo apt-get update && sudo apt-get install yarn

  8. sudo apt install -y mariadb-server redis-server nginx

Python 3.10 install and its dependencies

sudo apt install software-properties-common -y

  1. sudo add-apt-repository ppa:deadsnakes/ppa

  2. sudo apt update

  3. apt list | grep python3.10

  4. sudo apt install python3.10

These 3 next steps work when installing on ubuntu 20.04 LTS, you can ignore for 22.04LTS

  1. sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1

  2. sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2

  3. sudo update-alternatives --config python3 (Choose the selection corresponding to Python3.10)

python3 --version (to check if Python now on lastest)

Fix pip

  1. sudo apt remove --purge python3-apt

  2. sudo apt autoclean

  3. sudo apt install python3-apt

  4. sudo apt install python3.10-distutils

  5. curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

  6. sudo python3.10 get-pip.py

  7. sudo apt install python3.10-venv

  8. pip3 install psycopg2-binary

  9. sudo apt-get install git

  10. pip install markupsafe==2.0.1

  11. apt install cython3

  12. npm install socket.io

Add New User

  1. adduser USERNAME (enter password and others details and press y)

  2. usermod -aG sudo USERNAME

Mariadb Config

  1. nano /etc/mysql/my.cnf and add these lines to the end of file and save it

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]
default-character-set = utf8mb4

  1. service mysql restart

  2. mysql_secure_installation (Do not change to Unix socket)

Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

  1. mysql -u root -p (use password set on previous step)

USE mysql;
CREATE USER newuser@localhost IDENTIFIED BY ‘1234567890’;
GRANT ALL PRIVILEGES ON mysql.* TO newuser@localhost WITH GRANT OPTION;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mysql.* TO newuser@localhost;
FLUSH PRIVILEGES;
exit

  1. node -v && npm -v && python3 -V && pip3 -V && yarn -v (check if all the version are correct)

  2. su USERNAME

  3. cd /home/USERNAME

  4. pip3 install frappe-bench

  5. sudo pip3 install frappe-bench

  6. bench init --frappe-branch version-14-beta myfrappe

  7. cd myfrappe

  8. bench new-site mysite (enter mysql root password previous step) and enter new password

  9. bench get-app --branch version-14-beta erpnext

  10. bench --site mysite install-app erpnext

  11. sudo bench setup production USERNAME

  12. click y if asked

  13. bench build

  14. sudo service nginx restart

  15. sudo supervisorctl reload

  16. goto your ip erpnext and fill in wizard

  17. bench --site all enable-scheduler

  18. YOU ARE DONE! (in some case I had to do bench start)

5 Likes

I’ve followed this 3 times and each time on a fresh install i get " Sorry!
We will be back soon.

Don’t panic. It’s not you, it’s us.
Most likely, our engineers are updating the code, and it should take a minute for the new code to load into memory.

Try refreshing after a minute or two."

any ideas?

What worked for me I ran “bench start” and refreshed the browser and it worked,

bench start is for development use not production. I was able to get it to start after running

sudo bench setup production USERNAME twice but now the pages CSS is gone well at least its somthing.

Maybe try this too

sudo bench setup production [BENCH USER]

sudo supervisorctl restart all

If you are successful, your instance should be in production mode.

If this didn’t work for you, follow the following steps:

First, change the user to your bench user and install Supervisor and Nginx with the following command:

su - erpnext sudo apt-get -y install supervisor nginx

Next, install the frappe-bench add-on with the following command:

sudo pip3 install frappe-bench

Next, run the following command to configure ERPNext for a production environment:

sudo /home/erpnext/.local/bin/bench setup production erpnext

I was able to get it to start into production mode but the entire website lacks CSS of any kind. It is on its own bench user and I just wiped this machine and reinstalled as per the instructions and it gives the same result of not having any CSS.

What enviroment are you running your instance on and I also try it my end. I tested on 2 different VPS machines with;
4 vCPU Cores
8 GB RAM
50 GB NVMe and 200 GB SSD
all on Ubuntu 22.04 LTS

Nearly the exact same setup, I’m running this inside of one of my proxmox hosts,
4 vCpus
8GB RAM
32GB NVME ssd
Ubuntu 22.04 LTS downloaded it again before the last reinstall to make sure it wasn’t something weird with my ISO.

I appreciate your help with this!

1 Like

I even made a VM on my desktop with VMware and it still fails the same way.

I did alot more trouble shooting and no matter what guide I follow they all fail to install or have issues with no CSS on page etc.

EDIT
I’m going to be honest, I have no idea how I fixed it. I reinstalled it on the same instance 12 times through various methods but it could be due to these two commands being repeatedly used until it no longer created errors.

bench update --reset
bench reinstall
best of luck to those who see this in the future, hopefully it will be fixed by then!

1 Like

It will take 50 steps to install… I’m sure ERPNext is really good, but to get it working was not an easy job.

I had odoo setup in several minutes and it worked in the first go.

However, I have been trying to install ERPNext on K8s for several days. I’m getting there, but still no avail.

The helm installation looked a bit easier compared to 50 steps.

Are you using Kubernetes because single VM install takes 50 steps?

Try these steps for quick docker setup:

Download pwd.yml:

wget https://raw.githubusercontent.com/frappe/frappe_docker/main/pwd.yml

Start containers

docker compose -p pwd -f pwd.yml up -d

Check the site creation

docker logs pwd-create-site-1 -f

Output:

wait-for-it: waiting 120 seconds for db:3306
wait-for-it: db:3306 is available after 9 seconds
wait-for-it: waiting 120 seconds for redis-cache:6379
wait-for-it: redis-cache:6379 is available after 0 seconds
wait-for-it: waiting 120 seconds for redis-queue:6379
wait-for-it: redis-queue:6379 is available after 0 seconds
wait-for-it: waiting 120 seconds for redis-socketio:6379
wait-for-it: redis-socketio:6379 is available after 0 seconds
common_site_config.json found

Installing frappe...
Updating DocTypes for frappe        : [========================================] 100%
Updating country info               : [========================================] 100%

Installing erpnext...
Updating DocTypes for erpnext       : [========================================] 100%
Updating customizations for Address
Updating customizations for Contact
*** Scheduler is disabled ***
Current Site set to frontend

Visit http://127.0.0.1:8080 to access the site. Login as Administrator with password admin.

To tear down:

docker compose -p pwd -f pwd.yml stop
docker compose -p pwd -f pwd.yml rm -f
docker volume prune -f

Refer site-operations for more bench / site operations: frappe_docker/docs/site-operations.md at main · frappe/frappe_docker · GitHub

Disclaimer

  • I’m afraid of the upcoming frappe_docker questions now. Hope someone helps me answer them. My generic answer: “tests pass, pwd works, works for me, can’t reproduce issue, closing”
  • First few questions will be, bash: command not found: docker or errors related to prerequisites not installed. :man_facepalming:
  • As you feel you deserve answers from me for free, I feel I deserve help from community to manage frappe_docker for free
3 Likes

I plan to run different apps on a single VM to have the maximum cost efficiency. My applications are not mission critical so I can tolerate the single point of failure.

Using containers is a must for the resource isolation, there could be multiple applications using different versions of the same sdk.

I wanted to use K8s rather than the naked Docker because I think K8s gives better control when orchestrating multiple applications in a single cluster. ERPNext properly will have the most focus on K8s too for deployment.

Thanks for the detailed Docker tips.

I will try these.

It worked for me, thank you.

try this one

Dear @charleyarnold ,

I appreciate what you have done, it’s good to work.

But I have faced this problem:

$ supervisorctl restart frappe:
error: <class 'PermissionError'>, [Errno 13] Permission denied: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py line: 560
ERROR:
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/cli.py", line 127, in cli
    bench_command()
  File "/home/frappe/.local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/.local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/frappe/.local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/.local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/.local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/commands/make.py", line 159, in get_app
    get_app(
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/app.py", line 432, in get_app
    app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/app.py", line 230, in install
    install_app(
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/app.py", line 577, in install_app
    bench.reload()
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/bench.py", line 150, in reload
    restart_supervisor_processes(bench_path=self.name, web_workers=web)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/utils/bench.py", line 304, in restart_supervisor_processes
    bench.run(f"{sudo}supervisorctl restart {group}")
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/bench.py", line 47, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/utils/__init__.py", line 155, in exec_cmd
    raise CommandFailedError
bench.exceptions.CommandFailedError

Please any help, thank you in advance

@charleyarnold any update

Hi let me go through this, I have been offline lately

Hi @charleyarnold

I solved the error:

**error: <class ‘PermissionError’>, [Errno 13] Permission denied: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py line: 560**

by going to:

sudo nano /etc/supervisor/supervisord.conf

(Add these lines under [unix_http_server])

chmod=0760
chown=frappe:frappe

than

chmod -R o+rx /home/frappe
2 Likes

Ahh great let me also try it out