Guide to Install Frappe ERPNext in Windows ArchLinux WSL - LynX-gh/Frappe_Guides GitHub Wiki

Guide-to-Install-Frappe-ERPNext-in-Windows

A complete Guide to Install Frappe Bench in Windows and install Frappe/ERPNext Application

Pre-requisites

  Windows 11
  WSL2

STEP 1 Enable and Install WSL

  • Enable WSL from Windows Features
  • Restart your System.

STEP 2 Create .wslconfig

  • Open Windows File Explorer and enter %UserProfile% in the address bar.
  • Create a .wslconfig text file here.

And add this configuration:

wsl2
memory=8GB # Limits VM memory in WSL 2 to 4 GB
processors=4 # Makes the WSL 2 VM use two virtual processors
localhostForwarding=true

STEP 3 Install Arch in WSL

wsl --install -d archlinux

STEP 4 Update and Upgrade through pacman

cd ~
pacman -Syu

STEP 5 Install Sudo, Vim

pacman -Sy sudo, vim

STEP 6 Setup a new User and add to /etc/Sudoers

useradd -m archie
passwd archie
visudo

Step 7 Setup Locales

export LANG=C.UTF-8
locale-gen

STEP 8 Install Dependencies

pacman -S mariadb redis python-pip python-pipx git gcc npm nginx openssl nano supervisor cronie which openssl-1.1 pkg-config

STEP 9 Install nvm and Node

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

After nvm is installed, you may have to close your terminal and open another one. Now run the following command to install node.

nvm install 18 --lts
nvm use 18

Finally, install yarn using npm

npm install -g yarn

STEP 10 Configure MariaDB

mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
systemctl enable mariadb --now
mysql_secure_installation

NOTE: Only run it if you're not prompted the password during setup.

Follow the Commands as given below:

Switch to unix_socket authentication [Y/n] y
Change the 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

It is really important that you remember this password, since it'll be useful later on. You'll also need the MySQL database development files.

Now, edit the MariaDB configuration file.

cd ~
sudo nano /etc/my.cnf

And add this configuration:

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

[mysql]
default-character-set = utf8mb4

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

systemctl restart mariadb

STEP 11 Install wkhtmltopdf

pacman -S wget
cd /tmp
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-3/wkhtmltox-0.12.6-3.archlinux-x86_64.pkg.tar.xz
pacman -U wkhtmltox-0.12.6-3.archlinux-x86_64.pkg.tar.xz

STEP 12 Install Bench CLI

pipx install frappe-bench honcho

After bench is installed, you may have to close your terminal and open another one. Now run the following command to install node.

Create your bench folder

cd ~
bench init frappe-bench
cd frappe-bench

STEP 13 Change Default Ports (Optional)

NOTE: Only perform this step if you want to run in parallel with a docker bench setup.

bench set-config -g file_watcher_port 6797
bench set-config -g socketio_port 9010
bench set-config -g webserver_port 8010

Change the config files by running the following commands

bench setup socketio
bench setup procfile

STEP 14 Create a New Site

bench new-site your-site-name.localhost

STEP 15 Set bench developer mode on the new site

bench --site your-site-name.localhost set-config developer_mode 1
bench --site your-site-name.localhost clear-cache

STEP 16 Install ERPNext

bench get-app --resolve-deps erpnext
bench --site your-site-name.localhost install-app erpnext

STEP 17 Start Frappe bench

bench start

You can now login with user Administrator and the password you choose when creating the site.

Your website will now be accessible at location your-site-name.localhost:8000

If you performed Step 10 your website will be accessible at location your-site-name.localhost:8010