Fast steps to install Frappe/ERPNext v13/v14 on Clean Ubuntu 22.04 Production/Develop

Fast steps to install Frappe/ERPNext v13/v14 on Clean Ubuntu 22.04 Production/Develop

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install software-properties-common \
git curl python3-pip python3-dev \
python3-venv redis-server mariadb-server \
mariadb-client xvfb libfontconfig xfonts-75dpi

get wkhtmltopdf qt patched

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb

config mariadb

sudo nano /etc/mysql/my.cnf

and add the following at the bottom then save

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

[mysql]
default-character-set = utf8mb4

now lets restart mariadb

sudo service mariadb restart
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

now close and open your terminal then

nvm install 14

add node & npm link to /usr/bin to avoid supervisor.conf not having node entry and therefore socketio io not working

sudo ln -s $(which node) /usr/bin/node
sudo ln -s $(which npm) /usr/bin/npm
npm install -g yarn

dont choose Y for: “Switch to unix_socket authentication”

sudo mysql_secure_installation
sudo pip3 install frappe-bench

you can choose erpnext 13 by changing version-14 to version-13

bench init frappe-bench --version version-14 --verbose --install-app erpnext
cd frappe-bench && bench get-app payments

We are done now for the development phase, we can use bench start. To setup Production mode please continue the steps below

bench new-site my-site-name.local --install-app erpnext
sudo bench setup production $USER
sudo sed -i '6i chown='"$USER"':'"$USER"'' /etc/supervisor/supervisord.conf
sudo service supervisor restart
sudo bench setup production $USER
bench restart

fix permissions issue in Ubuntu 22.04, where page loads with missing styles

sudo chmod 755 /home/$(echo $USER)

DONE, Happy Frappe Drinking!

6 Likes

Hello PyJumper

I have now a new installed clean Ubuntu 22.04.1 LTS server.
apt get update && apt dist-upgrade is done.

Than i uws your tutorial with copy & paste

npm install -g yarn
Command 'npm' not found, but can be installed with:
sudo apt install npm

sudo apt install npm
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 npm : Depends: node-abbrev but it is not going to be installed
       Depends: node-agent-base but it is not going to be installed
       Depends: node-ansistyles but it is not going to be installed
       Depends: node-aproba but it is not going to be installed
       Depends: node-archy but it is not going to be installed
       Depends: node-asap but it is not going to be installed
       Depends: node-cacache but it is not going to be installed
       Depends: node-chalk but it is not going to be installed
       Depends: node-chownr but it is not going to be installed
       Depends: node-cli-table3
       Depends: node-colors but it is not going to be installed
       Depends: node-columnify but it is not going to be installed
       Depends: node-debug but it is not going to be installed
       Depends: node-depd but it is not going to be installed
       Depends: node-emoji-regex
       Depends: node-encoding but it is not going to be installed
       Depends: node-glob but it is not going to be installed
       Depends: node-got but it is not going to be installed
       Depends: node-graceful-fs but it is not going to be installed
       Depends: node-gyp but it is not going to be installed
       Depends: node-hosted-git-info but it is not going to be installed
       Depends: node-https-proxy-agent but it is not going to be installed
       Depends: node-ini but it is not going to be installed
       Depends: node-ip but it is not going to be installed
       Depends: node-ip-regex but it is not going to be installed
       Depends: node-json-parse-better-errors but it is not going to be installed
       Depends: node-jsonparse but it is not going to be installed
       Depends: node-lru-cache but it is not going to be installed
       Depends: node-minimatch but it is not going to be installed
       Depends: node-minipass but it is not going to be installed
       Depends: node-mkdirp but it is not going to be installed
       Depends: node-ms but it is not going to be installed
       Depends: node-negotiator but it is not going to be installed
       Depends: node-nopt but it is not going to be installed
       Depends: node-normalize-package-data but it is not going to be installed
       Depends: node-npm-bundled but it is not going to be installed
       Depends: node-npm-package-arg but it is not going to be installed
       Depends: node-npmlog but it is not going to be installed
       Depends: node-once but it is not going to be installed
       Depends: node-promise-retry but it is not going to be installed
       Depends: node-promzard but it is not going to be installed
       Depends: node-read but it is not going to be installed
       Depends: node-read-package-json but it is not going to be installed
       Depends: node-rimraf but it is not going to be installed
       Depends: node-semver but it is not going to be installed
       Depends: node-ssri but it is not going to be installed
       Depends: node-string-width but it is not going to be installed
       Depends: node-strip-ansi but it is not going to be installed
       Depends: node-tar but it is not going to be installed
       Depends: node-text-table but it is not going to be installed
       Depends: node-validate-npm-package-license but it is not going to be installed
       Depends: node-validate-npm-package-name but it is not going to be installed
       Depends: node-which but it is not going to be installed
       Depends: node-wrappy but it is not going to be installed
       Depends: node-write-file-atomic but it is not going to be installed
       Depends: node-yallist but it is not going to be installed
       Depends: nodejs:any (>= 10)
       Recommends: node-tap but it is not going to be installed
 wkhtmltox : Depends: fontconfig but it is not going to be installed
             Depends: libxrender1 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
sudo apt --fix-broken install

sudo apt install npm
npm install -g yarn
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:

cat  /home/jannis/.npm/_logs/2023-01-14T11_26_35_326Z-debug-0.log
0 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', '-g', 'yarn' ]
1 info using npm@8.5.1
2 info using node@v12.22.9
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/usr/share/nodejs/npm/npmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:/home/jannis/.npmrc Completed in 1ms
11 timing config:load:user Completed in 1ms
12 timing config:load:file:/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:validate Completed in 0ms
15 timing config:load:credentials Completed in 8ms
16 timing config:load:setEnvs Completed in 1ms
17 timing config:load Completed in 18ms
18 timing npm:load:configload Completed in 18ms
19 timing npm:load:setTitle Completed in 0ms
20 timing config:load:flatten Completed in 3ms
21 timing npm:load:display Completed in 6ms
22 verbose logfile /home/jannis/.npm/_logs/2023-01-14T11_26_35_326Z-debug-0.log
23 timing npm:load:logFile Completed in 6ms
24 timing npm:load:timers Completed in 0ms
25 timing npm:load:configScope Completed in 0ms
26 timing npm:load Completed in 31ms
27 timing arborist:ctor Completed in 0ms
28 timing idealTree:init Completed in 8ms
29 timing idealTree:userRequests Completed in 4ms
30 silly idealTree buildDeps
31 silly fetch manifest yarn@*
32 http fetch GET 200 https://registry.npmjs.org/yarn 375ms (cache miss)
33 silly placeDep ROOT yarn@1.22.19 OK for:  want: *
34 timing idealTree:#root Completed in 389ms
35 timing idealTree:node_modules/yarn Completed in 0ms
36 timing idealTree:buildDeps Completed in 391ms
37 timing idealTree:fixDepFlags Completed in 1ms
38 timing idealTree Completed in 405ms
39 timing reify:loadTrees Completed in 408ms
40 timing reify:diffTrees Completed in 2ms
41 silly reify moves {}
42 timing reify:retireShallow Completed in 1ms
43 timing reify:rollback:createSparse Completed in 0ms
44 timing reify:rollback:retireShallow Completed in 0ms
45 timing command:install Completed in 431ms
46 verbose stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'
47 verbose cwd /home/jannis
48 verbose Linux 5.15.0-58-generic
49 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "yarn"
50 verbose node v12.22.9
51 verbose npm  v8.5.1
52 error code EACCES
53 error syscall mkdir
54 error path /usr/local/lib/node_modules
55 error errno -13
56 error [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'] {
56 error   errno: -13,
56 error   code: 'EACCES',
56 error   syscall: 'mkdir',
56 error   path: '/usr/local/lib/node_modules'
56 error }
57 error
57 error The operation was rejected by your operating system.
57 error It is likely you do not have the permissions to access this file as the current user
57 error
57 error If you believe this might be a permissions issue, please double-check the
57 error permissions of the file and its containing directories, or try running
57 error the command again as root/Administrator.
58 verbose exit -13
59 timing npm Completed in 674ms
60 verbose unfinished npm timer reify 1673695595560
61 verbose unfinished npm timer reify:createSparse 1673695595986
62 verbose code -13
63 error A complete log of this run can be found in:
63 error     /home/jannis/.npm/_logs/2023-01-14T11_26_35_326Z-debug-0.log

I need “sudo”

sudo npm install -g yarn

added 1 package, and audited 2 packages in 2s

found 0 vulnerabilities

sudo mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

My choice ERPNext 13 because ERPNext 14 is at this time buggy.

bench init frappe-bench --version version-13 --verbose --install-app erpnext
sudo bench setup production $USER
Setting Up prerequisites...
Setting Up supervisor...
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Setting Up NGINX...
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Port configuration list:

Site my-site-name.local assigned port: 80
Setting Up symlinks and reloading services...
$ /usr/bin/supervisorctl reread
frappe-bench-redis: available
frappe-bench-web: available
frappe-bench-workers: available
$ /usr/bin/supervisorctl update
frappe-bench-redis: added process group
frappe-bench-web: added process group
frappe-bench-workers: added process group
$ sudo /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ sudo systemctl reload nginx

First Login: ADMINISTRATOR
Password: in my case sudo-user-password

3 Likes

@PyJumper

Hello PyJunger, you are the best. :slight_smile: :slight_smile:

Very good first clas tutorial.

Greets
jannis

1 Like

Hello @PyJumper ,

did you a tutorial for:

Fast steps to install Frappe/ERPNext v13/v14 with Docker on Clean Ubuntu 22.04 Production/Develop

Or did you have good working link for me?

My problem: ERPNext 13 Docker - Ubuntu 22.04 - AMD based Compute VMs with 1/8 OCPU and 1 GB memory - amd64 CPU

j

welcome, glad that this guide was useful for you, sadly i dont have experience with docker but maybe soon i will look into it :smiley:

1 Like

i tried it multiple times in different device’s and it worked eveey time .

i think this is one of the best installation tutorial out there , good job :raised_hands:

1 Like