Installing Frappe ERPnext15 on WSL ubuntu 22.04 LTS


Do not expect the same structure that you have seen in Node.js. Understanding Frappe’s structure will help you. Once you grasp it, the knowledge you gained from Node.js will start making sense again when you begin working on the front end in Frappe.
| Package | Details |
|---|---|
| Python 3.11+ | |
| Node.js 18+ | |
| Redis 5 | Caching and Real-time updates |
| MariaDB 10.3.x / Postgres 9.5.x | to run database-driven apps |
| yarn 1.12+ | js dependency manager |
| pip 20+ | py dependency manager |
| wkhtmltopdf 0.12.5+ | for pdf generation |
| cron | bench's scheduled jobs: automated certificate renewal, scheduled backups |
| NGINX | proxying multitenant sites in production |
| Package | Installation Code | Check Version |
|---|---|---|
| git | sudo apt-get install git | git --version |
| Package | Installation Code | Check Version |
|---|---|---|
| Python 3.11+ | `` | python3.11 --version |
| python3.11-venv | `` | dpkg -l python3.11-venv |
| python3.11-dev | `` | dpkg -l python3.11-dev |
| python3-pip | `` | dpkg -l python3-pip |
| python3-setuptools | `` | pip show setuptools |
| pip 20+ | `` | pip --version |
| Package | Installation Code | Check Version |
|---|---|---|
| nvm | `` | nvm --version |
| Node.js 18+ | nvm install 18 | node -v |
| npm | `` | npm -v |
| yarn 1.12+ | `` | yarn --version |
| Package | Installation Code | Check Version |
|---|---|---|
| Redis 5 | `` | redis-server --version |
| MariaDB 10.3.x / Postgres 9.5.x | `` | mysql --version |
| mariadb-server | `` | dpkg -l | grep mariadb-server |
| mariadb-client | `` | dpkg -l | grep mariadb-client |
| mysql | `` | `` |
| redis-server | sudo apt-get install redis-server | redis-server --version dpkg -l | grep redis-server |
| Package | Installation Code | Check Version |
|---|---|---|
| xvfb | sudo apt-get install xvfb | xvfb -version |
| libfontconfig | sudo apt-get install libfontconfig | dpkg -l | grep libfontconfig |
| wkhtmltopdf | sudo apt-get install wkhtmltopdf | wkhtmltopdf --version |
| curl | sudo apt install curl | curl --version It comes with Ubuntu by default |
| cron | `` | dpkg -l | grep cron It comes with Ubuntu by default |
| NGINX | sudo apt install -y nginx | nginx -v |
| Package | Installation Code | Check Version |
|---|---|---|
| Install Frappe Bench | sudo pip3 install [projName] bench init frappe-bench --python python3.11 --frappe-branch version-15 | bench --version |
| Activate virtual env | Inside the project folder, run source env/bin/activate | `` |
pipwindows Store and install Ubuntu 22.04Lts
123456 because this is easy to remember for development purposes
root and doesn’t contain any password too, you can run sudo -i or su to switch to the root user, this will ask for the current user password sab@DESKTOP-KA3O8IP:~$ sudo -i
[sudo] password for sab:
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.133.1-microsoft-standard-WSL2 x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
This message is shown once a day. To disable it please create the
/root/.hushlogin file.Once you switched the user to root, you can run passwd and set the password for the root
This is a highly recommended step root@DESKTOP-KA3O8IP:~# passwd
New password:
Retype new password:
passwd: password updated successfullyAlternatively, if you want to change the root password directly without switching to the root user, you can use: sudo passwd rootThis will prompt you to enter and confirm the new password for the root user. su sabsab is the username of another user account in Ubuntu, that we created earlier sab@DESKTOP-KA3O8IP:/root$ sudo usermod -aG sudo sab
[sudo] password for sab:
sab@DESKTOP-KA3O8IP:/root$If there is no return, it usually means, successful or true Open the file /etc/environment in a text editor and add the following lines at the end of the file:
sudo nano /etc/environmentAdd these data to environment
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LANG=en_US.UTF-8Then run
sudo locale-gen en_US.utf8sudo update-locale LANG=en_US.utf8This is what it should look like
sab@DESKTOP-KA3O8IP:/home$ sudo nano /etc/environment
[sudo] password for sab:
sab@DESKTOP-KA3O8IP:/home$ sudo locale-gen en_US.utf8
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Generating locales (this might take a while)...
en_US.UTF-8... done
Generation complete.
sab@DESKTOP-KA3O8IP:/home$ sudo update-locale LANG=en_US.utf8Let’s install git globally for the superuser
sudo apt-get install gitAfter installing git, you can simply run the git command to check if git is installed properly
Check the version of the python
sab@DESKTOP-KA3O8IP:/home$ python3 --version
Python 3.10.12
sab@DESKTOP-KA3O8IP:/home$As you can notice the default version is 3.10 but the required version must be Python 3.11+
To install Python 3.11 on Ubuntu 22.04 LTS, follow these steps:
sudo apt update
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa
Python 3.11
Now, install Python 3.11sudo apt update
sudo apt install python3.11 python3.11-venv python3.11-dev -y sab@DESKTOP-KA3O8IP:/home$ python3 --version
Python 3.10.12
sab@DESKTOP-KA3O8IP:/home$ which python3
/usr/bin/python3
sab@DESKTOP-KA3O8IP:/home$ which -a python
sab@DESKTOP-KA3O8IP:/home$ which -a python python2 python3
/usr/bin/python3
/bin/python3
sab@DESKTOP-KA3O8IP:/home$ whereis python3
python3: /usr/bin/python3 /usr/lib/python3 /etc/python3 /usr/share/python3 /usr/share/man/man1/python3.1.gz
If you want to set Python 3.11 as the default Python 3 version, you can update the update alternatives.
Add Python 3.11 to the alternatives:
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1Choose the default Python 3 version:
sudo update-alternatives --config python3
Select Python 3.11 from the list.
Python 3.11 is installed and set up correctly.python3.11 --versionYou should see the output. pip for Python 3.11Finally, install pip for Python 3.11curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11After completing these steps, you should have Python 3.11 installed on your WSL Ubuntu 22.04 LTS, and you can proceed with the ERPNext 15 installation. sudo apt update
sudo apt upgrade -y sudo apt install -y python3.11 python3.11-venv python3.11-dev libffi-dev mariadb-server libmariadb-dev libssl-dev wkhtmltopdf redis-server nginxNow update sourcesource ~/.profile.profile is a shell script executed whenever you log into your shell.It typically contains environment variable definitions, PATH modifications, and other initialization commands.nvm install 18Or
nvm install nodeTo install the latest version of the node, use nvm (node version manager)
curl https://get.volta.sh | bashThen
source ~/.profileFinally,
volta --versionvolta install nodevolta install yarnor
This will not install the latest version of yarn
sudo apt-get install -y yarnConfigure the Yarn repository:
First, you need to add the Yarn repository to your system's software sources:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.listUpdate your package list:
After adding the repository, update the package list:
sudo apt updateInstall Yarn:
Now, you can install Yarn, ensuring you're getting the latest version from the newly added repository:
sudo apt-get install yarnCheck the Yarn version:
To verify the installation and check the version of Yarn installed, you can use:
yarn --versionSoftware Properties Common will help in repository management.
sudo apt-get install software-properties-commonsudo apt install mariadb-server mariadb-clientsudo apt-get install redis-serversudo mysql_secure_installationWhen you run this command, the server will show the following prompts. Please follow the steps shown below to complete the setup correctly.
Enter current password for root: (Enter your SSH root user password)
| Options | Select |
|---|---|
| Switch to unix_socket authentication [Y/n]: | Y |
| Change the root password? [Y/n]: | Y |
| It will ask you to set a new MySQL root password at this step. This can be different from the SSH root user password: | 123456 |
| Remove anonymous users? [Y/n]: | Y |
| Disallow root login remotely? [Y/n]: | Y |
| Remove the test database and access it. [Y/n]: | Y |
| Reload privilege tables now? [Y/n]: | Y |
config fileBefore editing the default config file, check the mysql and mariadb version
Check mysql version
mysql --versionCheck the mariadb version too
dpkg -l | grep mariadb-server
dpkg -l | grep mariadb-clientsudo nano /etc/mysql/my.cnfAdd the following block of code exactly as is:
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci[mysql]
default-character-set = utf8mb4DO NOT DUPLICATE ANY ENTRY, OTHERWISE YOU WILL FACE CONTINUOUS ERRORS
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnfReplace all content 50-server.cnf file with the following configuration
[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 = utf8mb4Now press (Ctrl-X) to exit, then press y, followed by pressing the Enter key
Now check the mysql version
mysql --versionIf everything goes well you can see the mysql version, otherwise, you may have this type of error
sabbir@DESKTOP-KANOFJB:~$ mysql --version
mysql: unknown variable 'pid-file=/run/mysqld/mysqld.pid'Restart service
sudo service mysql restartERPNext functionality also relies on other packages we will install those in this step.
These command will load fonts, PDFs, and other resources to our instance
sudo apt-get install xvfb libfontconfig wkhtmltopdf
sudo apt-get install libmysqlclient-devhome/[userName]sudo -H pip3 install frappe-bench
bench --versionIf you face error like this
\
sudo: pip3: command not found
This means pip3 is installed locally for specific user
There are 2 solutions to this problem
Solution Temporary: The solution is to run the following command without sudo
pip3 install frappe-bench
bench --versionLong-Term Solution: Consider installing pip3 system-wide if you frequently need to use it with sudo
sudo apt update
sudo apt install python3-pipBefore going to next step check if the yarn version is correct
yarn --versionbench init [projectName] --frappe-branch version-15 --python python3.11
ls
cd [projectName]/
bench startOr, run the same command with the --verbose parameter to
bench init [projectName] --frappe-branch version-15 --python python3.11--verbose
ls
cd [projectName]/
bench startAt this point, if you visit the application with localhost, you can notice this

We can use the source command to activate the activate script located in the bin directory of our virtual environment.
source env/bin/activateCreate a site with the bench CLI
bench new-site [site-name]
bench use [site-name]Now run the bench again
bench startThis time you can access frappe for the first time.
The default username is administrator
And the password is provided by you a while ago
These commands will only download the repo from the default frappe repository on GitHub
You don’t have to maintain any order at this step
bench get-app --branch version-15 erpnext
bench get-app payments
bench get-app hrmsNow let’s install all the apps that we downloaded earlier, keep in mind we have to install these apps chronologically
bench --site [site-name] install-app erpnextIf this command fails, you can notice that Frappe will ask you to run a command at the end of the error return, which is to reinstall the site, the following command will also remove any entry that you have inserted
bench --site [sitename] reinstallThen, install the payments app
bench --site [site-name] install-app paymentsThen, install the hrms
bench --site [site-name] install-app hrmsBench get app
bench get-app --branch version-15 [git https repo url]