Install ERPNext/Frappe on Ubuntu 22.04

Read: https://docs.frappe.io/framework/user/en/installation#debian-ubuntu

Update your system’s package index

if not exist, Install/update gitpython, and redis

Check:

Now, edit the MariaDB configuration file (this step is not required for Frappe v15.21.0 or above).

And add this configuration

Now, just restart the MariaDB service and you are good to go.

Check Node or Install Node if not exist

Use node > 18. use the stable version (v20..) instead

Check:

Finally, check/install yarn using npm

Install the libraries for wkhtmltopdf

Download and install wkhtmltopdf package from https://wkhtmltopdf.org/downloads.html, then run this command to install the package. As an example for Ubuntu 22.04 amd64 in Download directory

if you found this error: Package xfonts-75dpi is not installed. then run this to install the dependencies

Install Bench CLI
Install bench via pip (or pip3)
[codesyntax lang=”bash”]

[/codesyntax]

Note: WARNING: The script bench is installed in ‘/home/satria/.local/bin’ which is not on PATH.
So run –> THIS IS NOT SAVED BECAUSE WHEN I TRIED TO LOGIN AGAIN, THE PATH IS MISSING
[codesyntax lang=”bash”]

[/codesyntax]

 

Check ‘Bench’ version
[codesyntax lang=”bash”]

[/codesyntax]

Read: https://docs.frappe.io/framework/user/en/tutorial/install-and-setup-bench
Create frappe-bench directory
Let’s create our project folder which will contain our apps and sites. Run the following command: bench init frappe-bench in my projects directory
[codesyntax lang=”bash”]

[/codesyntax]
Note: make sure to use node > = v18…

Let’s fix the installation problem:
1. [codesyntax lang=”bash”]

[/codesyntax]
pls go to ‘apps/frappe’ directory (here is the complete path: /home/satria/Documents/projects/frappe-bench/apps/frappe) then run ‘npx update-browserslist-db@latest’
[codesyntax lang=”bash”]

[/codesyntax]
2. WARN Cannot connect to redis_cache to update assets_json

the redis service is running:
sudo systemctl status redis
[sudo] password for satria:
● redis-server.service – Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor >
Active: active (running) since Wed 2025-05-14 13:49:23 WIB; 16min ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Main PID: 1390 (redis-server)
Status: “Ready to accept connections”
Tasks: 5 (limit: 57560)
Memory: 5.2M
CPU: 1.714s
CGroup: /system.slice/redis-server.service
└─1390 “/usr/bin/redis-server 127.0.0.1:6379” “” “” “” “” “” “” “”>

Mei 14 13:49:23 teddy systemd[1]: Starting Advanced key-value store…
Mei 14 13:49:23 teddy systemd[1]: Started Advanced key-value store.

here is the content of sites/common_site_config.json:
{
“background_workers”: 1,
“file_watcher_port”: 6787,
“frappe_user”: “satria”,
“gunicorn_workers”: 17,
“live_reload”: true,
“rebase_on_pull”: false,
“redis_cache”: “redis://127.0.0.1:13000”,
“redis_queue”: “redis://127.0.0.1:11000”,
“redis_socketio”: “redis://127.0.0.1:13000”,
“restart_supervisor_on_update”: false,
“restart_systemd_on_update”: false,
“serve_default_site”: true,
“shallow_clone”: true,
“socketio_port”: 9000,
“use_redis_auth”: false,
“webserver_port”: 8000
}

SO the redis server used PORT 13000 instead of PORT 6379. CHANGED THE PORT FOR redis_cache, redis_queue and redis_socketio to port 6379 in sites/common_site_config.json. So now the content is:
[codesyntax lang=”text”]

[/codesyntax]

Test the redis server for 6379 port
[codesyntax lang=”bash”]

[/codesyntax]

Start the Bench Server
Now that we have created our frappe-bench directory, we can start the Frappe web server by running the following command: bench start

[codesyntax lang=”bash”]

[/codesyntax]

Note: Type CTRL+C to stop the bench engine

It can be opened on http://127.0.0.1:8000/ or http://192.168.1.23:8000
but the app still empty!

So Create an App
Read: https://docs.frappe.io/framework/user/en/tutorial/create-an-app
Case study: Library Management System

To create our Library Management app, run the new-app command:

You should get some prompts, and output like the following. You can enter information manually, or press enter to select the defaults

[codesyntax lang=”bash”]

[/codesyntax]

You will be prompted with details of your app, fill them up and an app named library_management will be created in the apps folder.

Create A Site
Read: https://docs.frappe.io/framework/user/en/tutorial/create-a-site

Run : bench new-site library.localhost
[codesyntax lang=”bash”]

[/codesyntax]
the admin password is Teddy@123

This command will create a new database, so you need to enter your MariaDB root password. It will also ask to set the password for the Administrator user, just set a password that you won’t forget. This will be useful later.

Now, you will have a new folder named library.localhost in the sites directory.

If site creation fails for any reason, you’ll be prompted to roll back the changes. This will delete the library.localhost or equivalent in your sites directory, and delete the database/user that was created. This will allow you to easily retry without having to manually cleanup the unusable site.

the new database (_5b0e23f4238e31a0), user and password can be seen in sites/library.localhost/site_config.json

Now you can open the site http://library.localhost:8000/ on your browser
Note: make sure to run ‘bench start’ first in the frappe-bench directory

The login page will be displayed:
username: Administrator
password: Teddy@123
This user also can be found in the database (tabUser table)

Then install app on site
[codesyntax lang=”bash”]

[/codesyntax]

To confirm if the app was installed, run the following command:
[codesyntax lang=”bash”]

[/codesyntax]

then run ‘bench start’ again!

I found some glitch on the frontend.
for example on http://library.localhost:8000/login, i found these errors related to css on the console:
Failed to load resource: the server responded with a status of 404 (NOT FOUND) -> http://library.localhost:8000/assets/frappe/dist/css/login.bundle.O2AXXQ4F.css
I can’t find the file but I found this file:
sites/assets/frappe/dist/css/login.bundle.M242FIII.css
–> NEED TO RESTART bench server (stop bench then run again bench start). then refresh the browser

but after the login, i found another frontend glitch:
GET http://library.localhost:8000/assets/frappe/dist/css/desk.bundle.5EPJH5Z3.css net::ERR_ABORTED 404 (NOT FOUND) -> http://library.localhost:8000/assets/frappe/dist/css/desk.bundle.5EPJH5Z3.css

GET http://library.localhost:8000/assets/frappe/dist/css/report.bundle.7F2GVCHL.css net::ERR_ABORTED 404 (NOT FOUND) -> http://library.localhost:8000/assets/frappe/dist/css/report.bundle.7F2GVCHL.css

–> READ THE WARNING MESSAGE:
WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect. –> So fix it as requested! then restart bench (bench start)
Open http://library.localhost:8000/app/ -> should be working and run the app install wizard
email: advcha@yahoo.com
pass: Teddy@123

Create a DocType
Read: https://docs.frappe.io/framework/user/en/tutorial/create-a-doctype
DocType is analogous to a Model in other frameworks. Apart from defining properties, it also defines the behavior of the Model.

Enable Developer Mode
Before we can create DocTypes, we need to enable developer mode on our bench. This will enable boilerplate creation when we create doctypes and we can track them into version control with our app.

Go to your terminal and quit the bench server if it’s already running then from the frappe-bench directory, run the following command:

Creating a DocType

While in Desk, navigate to the DocType List using the Awesomebar. This list will include DocTypes bundled with the framework, those that are a part of the installed Frappe apps and custom ones, which you can create specific to each site.

The first doctype we will create is Article. To create it, click on New.
-> http://library.localhost:8000/app/doctype/view/list then click ‘+Add DocType’ button on the top right

  1. Enter Name as Article
  2. Select Library Management in Module

Then click ‘Create & Continue’ button
then Go to http://library.localhost:8000/app/doctype
then select ‘Article’

  1. Add the following fields in the Fields table: (Better use ‘Form’ tab)
    1. Article Name (Data, Mandatory)
    2. Image (Attach Image)
    3. Author (Data)
    4. Description (Text Editor)
    5. ISBN (Data)
    6. Status (Select) – Enter two options: Issued and Available (Type Issued, hit enter, then type Available)
    7. Publisher (Data)

Refer the following images to check how it should be done:
Form tab

Naming tab

Setting tab

Field tab (usually populated from the Form tab entries)

After adding the fields, click on Save.

You will see a Go to Article List button at the top right of the form. Click on it to go to the Article List. Here you will see a blank list with no records because the table has no records.

Let’s create some records. But before that, we need to clear the Desk cache. Click on the Settings dropdown on the right side of the navbar and click on Reload.

Click ‘Go to Article List’ button (http://library.localhost:8000/app/article)
then click ‘Add Article’ button

The github gave me much headeache
[codesyntax lang=”bash”]

[/codesyntax]

Leave a Reply

Your email address will not be published. Required fields are marked *