Guide to Install Frappe ERPNext in Windows - 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 Ubuntu in WSl

wsl --install -d Ubuntu

Enter Username and Password for your Ubuntu Distro.

STEP 4 Update and Upgrade Ubuntu package manager

sudo apt update -y && sudo apt upgrade -y

STEP 5 Install git, python, and redis

sudo apt install git python3 python3-pip python3-venv pipx redis-server

STEP 6 Install MariaDB

sudo apt install software-properties-common
sudo apt-get update
sudo apt-get install mariadb-server

During this installation you'll be prompted to set the MySQL root password. If you are not prompted, you'll have to initialize the MySQL server setup yourself. You can do that by running the command:

sudo 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.

sudo apt-get install mariadb-client

Now, edit the MariaDB configuration file.

cd ~
sudo nano /etc/mysql/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.

sudo service mysql restart

STEP 7 Install 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 8 Install wkhtmltopdf

sudo apt-get install xvfb libfontconfig wkhtmltopdf

STEP 9 Install Bench CLI

pipx install frappe-bench
pipx install 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 10 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 11 Create a New Site

bench new-site your-site-name.localhost

STEP 12 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 13 Install ERPNext

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

STEP 14 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