Installation tutorial

frappe installation tutorial , for
Ubuntu 22.04
frappe bench 5.24.1
frappe framework v15.66.1

update system

sudo apt update
sudo apt upgrade -y

install system dependencies

sudo apt install -y \
  git \
  python3.10 \
  python3.10-dev \
  python3.10-venv \
  python3-pip \
  pkg-config \
  software-properties-common \
  libfontconfig1 \
  xvfb

install redis

sudo apt install redis-server
# do not start the redis server the bench script will start it on its own 

install mariadb

sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo add-apt-repository 'deb [arch=amd64] http://mirror.mariadb.org/repo/10.6/ubuntu jammy main'
sudo apt update
sudo apt install -y mariadb-server-10.6 mariadb-client-10.6 libmariadb-dev
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
sudo cp /etc/mysql/mariadb.conf.d/50-server.cnf /etc/mysql/mariadb.conf.d/50-server.cnf.bak
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

[server]
user = mysql
pid-file = /run/mysqld/mysqld.pid
socket = /run/mysqld/mysqld.sock
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
bind-address = 127.0.0.1
query_cache_size = 16M
log_error = /var/log/mysql/error.log
    
[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci      
     
[mysql]
default-character-set = utf8mb4

sudo systemctl restart mariadb

install the pdf thing

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
sudo apt install -y ./wkhtmltox_0.12.6-1.focal_amd64.deb
wkhtmltopdf --version

install nvm

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

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

nvm install 18.15.0
npm install -g yarn@1.22.19

install frappe

python3 -m pip install --upgrade pip==25.0.1
pip3 install frappe-bench==5.24.1
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

bench init frappe-bench --frappe-branch v15.66.1

create bench

bench new-app appname
bench new-site sub.domain.com
# make it exactly the same as your domain , do not use anything else (setup for a seperate name is different )
bench use sub.domain.com
bench --site sub.domain.com install-app appname

hear your bench start should start working , and all the other bench related commands

but for a production setup you need something that can run in the background
hence the below production setup , once you configure that bench start should stop working and bench restart should work

production

sudo apt -y install supervisor
sudo bench setup production <user name for linux>

sudo apt-get install supervisor
bench setup supervisor
sudo ln -s `pwd`/config/supervisor.conf /etc/supervisor/conf.d/frappe-bench.conf
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl status
sudo nano /etc/supervisor/supervisord.conf

[unix_http_server]
file=/var/tmp/supervisord.sock
chmod=0700
chown=<user name for linux>:<user name for linux>

faced multiple problems with supervisor and nginx so uninstall script for nginx and supervisor

sudo systemctl stop supervisor
sudo apt-get purge supervisor
sudo rm -rf /etc/supervisor

sudo systemctl stop nginx
sudo apt-get purge nginx nginx-common nginx-full
sudo rm -rf /etc/nginx
sudo rm -rf /var/log/nginx
sudo rm -rf /var/www/html
sudo apt-get autoremove
sudo apt-get clean

also delete script for deleting database when faced problems with app

sudo mysql -u root -p
SHOW DATABASES;
DROP DATABASE _fb4b895ec24305ae;

nginx config


upstream frappe-bench-frappe {
        server 127.0.0.1:8000 fail_timeout=0;
}

upstream frappe-bench-socketio-server {
        server 127.0.0.1:9000 fail_timeout=0;
}


server {
    listen 80;
    listen [::]:80;
    server_name
                erpnext.gseven.in
                ;
     return 301 https://$host$request_uri;

}
server {
    listen 443 ssl;
    listen [::]:443 ssl;


        server_name
                erpnext.gseven.in
                ;

		ssl_certificate /etc/ssl/wildcardssl/fullchain.pem;
        ssl_certificate_key /etc/ssl/wildcardssl/privkey.pem;
        root /home/i2k2-admin/frappe-bench/sites;



        proxy_buffer_size 128k;
        proxy_buffers 4 256k;
        proxy_busy_buffers_size 256k;


        add_header X-Frame-Options "SAMEORIGIN";
        add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
        add_header X-Content-Type-Options nosniff;
        add_header X-XSS-Protection "1; mode=block";
        add_header Referrer-Policy "same-origin, strict-origin-when-cross-origin";

        location /assets {
                try_files $uri =404;
                add_header Cache-Control "max-age=31536000";
        }

        location ~ ^/protected/(.*) {
                internal;
                try_files /erpnext.gseven.in/$1 =404;
        }

        location /socket.io {
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header X-Frappe-Site-Name erpnext.gseven.in;
                proxy_set_header Origin $scheme://$http_host;
                proxy_set_header Host $host;

                proxy_pass http://frappe-bench-socketio-server;
        }

        location / {

                rewrite ^(.+)/$ $1 permanent;
                rewrite ^(.+)/index\.html$ $1 permanent;
                rewrite ^(.+)\.html$ $1 permanent;

                location ~* ^/files/.*.(htm|html|svg|xml) {
                        add_header Content-disposition "attachment";
                        try_files /erpnext.gseven.in/public/$uri @webserver;
                }

                try_files /erpnext.gseven.in/public/$uri @webserver;
        }

        location @webserver {
                proxy_http_version 1.1;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Frappe-Site-Name erpnext.gseven.in;
                proxy_set_header Host $host;
                proxy_set_header X-Use-X-Accel-Redirect True;
                proxy_read_timeout 120;
                proxy_redirect off;

                proxy_pass  http://frappe-bench-frappe;
        }
        # error pages
        error_page 502 /502.html;
        location /502.html {
                root /home/i2k2-admin/.local/lib/python3.10/site-packages/bench/config/templates;
                internal;
        }

        #access_log  /var/log/nginx/access.log main;
        #error_log  /var/log/nginx/error.log;

        # optimizations
        sendfile on;
        keepalive_timeout 15;
        client_max_body_size 50m;
        client_body_buffer_size 16K;
        client_header_buffer_size 1k;

        # enable gzip compresion
        # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge
        gzip on;
        gzip_http_version 1.1;
        gzip_comp_level 5;
        gzip_min_length 256;
        gzip_proxied any;
        gzip_vary on;
        gzip_types
                application/atom+xml
                application/javascript
                application/json
                application/rss+xml
                application/vnd.ms-fontobject
                application/x-font-ttf
                application/font-woff
                application/x-web-app-manifest+json
                application/xhtml+xml
                application/xml
                font/opentype
                image/svg+xml
                image/x-icon
                text/css
                text/plain
                text/x-component
                ;
                # text/html is always compressed by HttpGzipModule
}

is windows can? and how tutorial to install in windows pls

To run Frappe on Windows, you cannot install it natively due to compatibility issues. Instead, you need to use one of the following methods: Windows Subsystem for Linux (WSL), a virtual machine (Install Ubuntu on it), or Docker.

1 Like

Okay, thank you very much. I have used Docker before and it worked, but I have a problem where the assets from my custom app are not detected in this Docker, even though I have already run bench build. Is there a solution?

docker exec -it <redis-container-name> redis-cli FLUSHALL
Flush the Redis cache inside your Docker environment.

i already run this, is this correct?

but the result is still

or i need to run bench build?

Enter the container running your Frappe/ERPNext site
docker exec -it <container_name> bash

And Inside the container, run:


bench build
bench clear-website-cache
bench restart

Try this

Sorry, I think it still doesn’t work. I have tried building the bench, clearing the site cache, and also restarting all the containers,

frappe@38c8639d9d6e:~/frappe-bench$ bench build
Assets for Release /bin/sh: 1: Syntax error: "(" unexpected don't exist
βœ” Application Assets Linked                                                                                                            

yarn run v1.22.22
$ node esbuild --production --run-build-command
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
File                                                        Size

erpnext/dist/js/
β”œβ”€ bank-reconciliation-tool.bundle.FPQRAOXF.js              17.25 Kb
β”œβ”€ erpnext-web.bundle.J4A2DQB4.js                           0.29 Kb
β”œβ”€ erpnext.bundle.CFFYGZ3N.js                               231.34 Kb
β”œβ”€ item-dashboard.bundle.PPNECB5K.js                        10.38 Kb
β”œβ”€ point-of-sale.bundle.7VEM74JQ.js                         97.59 Kb
└─ bom_configurator.bundle.EPDHTEL3.js                      9.29 Kb

frappe/dist/js/
β”œβ”€ billing.bundle.TQHLK7UT.js                               4.44 Kb
β”œβ”€ bootstrap-4-web.bundle.FOZOVELL.js                       1.73 Kb
β”œβ”€ controls.bundle.IIQRAQRW.js                              874.02 Kb
β”œβ”€ data_import_tools.bundle.GJL3D5RM.js                     127.48 Kb
β”œβ”€ desk.bundle.PWIAF7YM.js                                  1349.89 Kb
β”œβ”€ dialog.bundle.FWWX2X6K.js                                57.48 Kb
β”œβ”€ form.bundle.IWQ54OUB.js                                  169.39 Kb
β”œβ”€ frappe-web.bundle.UASKDUCM.js                            830.23 Kb
β”œβ”€ libs.bundle.TIV7ZGVY.js                                  556.25 Kb
β”œβ”€ list.bundle.MH7JA5ZP.js                                  199.28 Kb
β”œβ”€ logtypes.bundle.EKN7LWKW.js                              0.73 Kb
β”œβ”€ onboarding_tours.bundle.RAUR6X4Z.js                      7.60 Kb
β”œβ”€ report.bundle.RTW7DMAI.js                                200.26 Kb
β”œβ”€ sentry.bundle.AX44GVWW.js                                74.42 Kb
β”œβ”€ telemetry.bundle.LKEZCADB.js                             2.59 Kb
β”œβ”€ user_profile_controller.bundle.TPZWXYWN.js               11.97 Kb
β”œβ”€ video_player.bundle.DUYYLSFO.js                          120.67 Kb
β”œβ”€ web_form.bundle.LLDQ5XNF.js                              1065.94 Kb
β”œβ”€ form_builder.bundle.CYK52TRC.js                          798.65 Kb
β”œβ”€ form_builder.bundle.2JQOQVZM.css                         23.19 Kb
β”œβ”€ print_format_builder.bundle.3YCNST3U.js                  685.24 Kb
β”œβ”€ print_format_builder.bundle.FFVPBPB6.css                 5.54 Kb
β”œβ”€ workflow_builder.bundle.3GDVTW3J.js                      351.84 Kb
β”œβ”€ workflow_builder.bundle.NCYHBU52.css                     11.02 Kb
β”œβ”€ build_events.bundle.BCX32TWL.js                          105.71 Kb
β”œβ”€ build_events.bundle.CZHNP7YC.css                         1.29 Kb
β”œβ”€ file_uploader.bundle.ZDBEQI7G.js                         202.16 Kb
β”œβ”€ file_uploader.bundle.WV4MAVCJ.css                        6.53 Kb
└─ kanban_board.bundle.FBBHCLAN.js                          578.16 Kb

erpnext/dist/css/
β”œβ”€ erpnext-web.bundle.GHU5PXJE.css                          2.86 Kb
β”œβ”€ erpnext.bundle.QVSR4IWN.css                              44.63 Kb
└─ erpnext_email.bundle.VU3U4B2O.css                        0.56 Kb

frappe/dist/css/
β”œβ”€ desk.bundle.FWJYMEAG.css                                 594.90 Kb
β”œβ”€ email.bundle.2CHKDLTB.css                                5.97 Kb
β”œβ”€ login.bundle.M45V6H2X.css                                32.29 Kb
β”œβ”€ print.bundle.6CPWIO4S.css                                206.71 Kb
β”œβ”€ print_format.bundle.764KNUOW.css                         186.11 Kb
β”œβ”€ report.bundle.2BQCI5CC.css                               5.51 Kb
β”œβ”€ web_form.bundle.2NITK7PY.css                             14.86 Kb
└─ website.bundle.RR7K3E52.css                              446.74 Kb

erpnext/dist/css-rtl/
β”œβ”€ erpnext-web.bundle.GLCFSBXH.css                          2.87 Kb
β”œβ”€ erpnext.bundle.Q6KXCAYM.css                              44.61 Kb
└─ erpnext_email.bundle.RHP5BYTD.css                        0.56 Kb

frappe/dist/css-rtl/
β”œβ”€ desk.bundle.RT7K77R3.css                                 595.40 Kb
β”œβ”€ email.bundle.KYOVTPU3.css                                5.98 Kb
β”œβ”€ login.bundle.RE4U4NL6.css                                32.29 Kb
β”œβ”€ print.bundle.PUDYK6TZ.css                                206.87 Kb
β”œβ”€ print_format.bundle.G3V6ICFU.css                         186.24 Kb
β”œβ”€ report.bundle.GRJNBK3T.css                               5.50 Kb
β”œβ”€ web_form.bundle.YYGWDBRZ.css                             14.85 Kb
└─ website.bundle.2FNMFG7C.css                              446.89 Kb

 DONE  Total Build Time: 29.132s

Done in 31.60s.
Compiling translations for frappe
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/es/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/pl/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/fa/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/eo/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/ru/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/bs/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/ar/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/pt/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/hu/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/fr/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/pt_BR/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/sv/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/zh/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/tr/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/sr_CS/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/de/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/hr/LC_MESSAGES/frappe.mo
MO file already up to date at /home/frappe/frappe-bench/sites/assets/locale/th/LC_MESSAGES/frappe.mo
Compiling translations for erpnext
frappe@38c8639d9d6e:~/frappe-bench$ bench clear-website-cache

but the result is still like this.

  • Is it in a shell script you wrote (e.g., myscript.sh)?
  • Is it in a RUN command in your Dockerfile?
  • Is it in a command you are running directly in the terminal?

Error occur reason? (Bracket Error, I thought it is problem the bench build not work properly
)