# Installtion Frappe-ERPNext Version-15 in Ubuntu 22.04 LTS

### Frappe-ERPNext Version-15 in Ubuntu 22.04 LTS  
  


#### Steps to Install python 3.11.xx  
  
Note: If you are using ubuntu 23.xx or latest the default python version is 3.11.xx. So you can skip the python 3.11 installation steps  
  


#### install Python 3.11 by executing the following command in your terminal:

```
  sudo apt install python3.11

  python3 --version
```

#### STEP 1 Install git

```
sudo apt-get install git
```

#### STEP 2 install python-dev

```
sudo apt-get install python3-dev
```

#### STEP 3 Install setuptools and pip (Python's Package Manager).

```
sudo apt-get install python3-setuptools python3-pip

```

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" id="bkmrk-step-4-install-virtu"><div class="zeroclipboard-container"><span style="color: rgb(34, 34, 34); font-size: 1.666em; font-weight: 400;">STEP 4 Install virtualenv</span>  
<svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg></div></div>```
sudo apt install python3.11-venv
```

#### STEP 5 Install MariaDB

```
sudo apt-get install software-properties-common
sudo apt install mariadb-server
sudo mysql_secure_installation


  In order to log into MariaDB to secure it, we'll need the current
  password for the root user. If you've just installed MariaDB, and
  haven't set the root password yet, you should just press enter here.

  Enter current password for root (enter for none): # PRESS ENTER
  OK, successfully used password, moving on...
  
  
  Switch to unix_socket authentication [Y/n] Y
  Enabled successfully!
  Reloading privilege tables..
   ... Success!

  Change the root password? [Y/n] Y
  New password: 
  Re-enter new password: 
  Password updated successfully!
  Reloading privilege tables..
   ... Success!

  Remove anonymous users? [Y/n] Y
   ... Success!

   Disallow root login remotely? [Y/n] Y
   ... Success!

   Remove test database and access to it? [Y/n] Y
   - Dropping test database...
   ... Success!
   - Removing privileges on test database...
   ... Success!

   Reload privilege tables now? [Y/n] Y
   ... Success!
```

#### STEP 6 MySQL database development files

```
sudo apt-get install libmysqlclient-dev
```

#### STEP 7 Check DataBase Command  


```
sudo mysql -u root -p
```

**Now press (Ctrl-X) to exit**

```
sudo service mysql restart
```

#### STEP 8 install Redis

```
sudo apt-get install redis-server

```

Check node version using command -  **node -v** Check nvm version using command **- nvm -v** If your node version is less then 20 then -  
Go to --&gt; **[https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04](https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04)** Go to option no.3 and run command in terminal --&gt; **curl -o- [https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh](https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh)**

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash  
  
source ~/.bashrc  
  
nvm list-remote  
  
nvm install v20.17.0  
  
Now check node Version will be **v20.1710**

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" id="bkmrk-step-9-install-node."><div class="zeroclipboard-container"><svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg>  
</div></div><div class="snippet-clipboard-content notranslate position-relative overflow-auto" id="bkmrk-step-10-install-yarn"><div class="zeroclipboard-container"><span style="color: rgb(34, 34, 34); font-size: 1.666em; font-weight: 400;">STEP 9 install Yarn</span>  
<svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg></div></div>```
sudo apt-get install npm

sudo npm install -g yarn --force
```

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" id="bkmrk-step-11-install-wkht"><div class="zeroclipboard-container"><span style="color: rgb(34, 34, 34); font-size: 1.666em; font-weight: 400;">STEP 10 install wkhtmltopdf</span>  
<svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg></div></div>```
sudo apt-get install xvfb libfontconfig wkhtmltopdf

```

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" id="bkmrk-step-12-install-frap"><div class="zeroclipboard-container"><span style="color: rgb(34, 34, 34); font-size: 1.666em; font-weight: 400;">STEP 11 install frappe-bench</span>  
<svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg></div></div>```
sudo -H pip3 install frappe-bench

bench --version
```

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" id="bkmrk-step-13-initilise-th"><div class="zeroclipboard-container"><span style="color: rgb(34, 34, 34); font-size: 1.666em; font-weight: 400;">STEP 12 initilise the frappe bench &amp; install frappe latest version</span>  
<svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg></div></div>```
bench init frappe-bench --frappe-branch version-15 --python python3.11

cd frappe-bench/
bench start
```

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" id="bkmrk-step-14-create-a-sit"><div class="zeroclipboard-container"><span style="color: rgb(34, 34, 34); font-size: 1.666em; font-weight: 400;">STEP 13 Open New Terminal &amp; run this cmd to create a site in frappe bench</span>  
<svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"></svg></div></div>```
bench new-site dcode.com

bench get-app https://github.com/frappe/erpnext --branch version-15

bench --site dcode.com install-app erpnext

Note - if it gives you error erpnext is not installed then uninstall it by - bench --site dcode.com uninstall-app erpnext
and reinstall it by bench --site dcode.com install-app erpnext
```

<span style="color: rgb(34, 34, 34); font-size: 1.666em; font-weight: 400;">STEP 14 Check the site you have to run  
</span>

```
bench use dcode.com
```

<span style="color: rgb(34, 34, 34); font-size: 1.666em; font-weight: 400;">Now go to your previous terminal **exit** the bench by **ctrl + c** and run **bench start** cmd.  
  
When you have to stop the bench or redis server do not forgot to run below commands -  
<span style="color: rgb(224, 62, 45);">**Note - This command is not valid for Server**</span></span>

```
sudo systemctl stop redis

sudo service redis-server stop
```

#### Install apps according to your need from your github or gitlab repositories

bench get-app git@git.radixforce.com:enterprise/erpnext.git --branch erpnext  
bench --site radixsite.com install-app erpnext

bench get-app hrms git@git.radixforce.com:enterprise/hrms.git --branch hrms  
bench --site radixsite.com install-app hrms

**bench start**

### **SETUP PRODUCTION SERVER**

---

**1.1 Enable scheduler service**<button aria-label="copy code to clipboard" class="btn nohighlight copy-cmd"><svg class="fa d-icon d-icon-copy svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"></svg></button><button aria-label="show code in full screen" class="btn nohighlight fullscreen-cmd"><svg class="fa d-icon d-icon-discourse-expand svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"></svg></button>

```css
bench --site site1.local enable-scheduler
```

**1.2 Disable maintenance mode**<button aria-label="copy code to clipboard" class="btn nohighlight copy-cmd"><svg class="fa d-icon d-icon-copy svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"></svg></button><button aria-label="show code in full screen" class="btn nohighlight fullscreen-cmd"><svg class="fa d-icon d-icon-discourse-expand svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"></svg></button>

```cpp
bench --site site1.local set-maintenance-mode off
```

**1.3 Setup production config**<button aria-label="copy code to clipboard" class="btn nohighlight copy-cmd"><svg class="fa d-icon d-icon-copy svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"></svg></button><button aria-label="show code in full screen" class="btn nohighlight fullscreen-cmd"><svg class="fa d-icon d-icon-discourse-expand svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"></svg></button>

```css
sudo bench setup production [frappe-user]
```

**1.4 Setup NGINX web server**<button aria-label="copy code to clipboard" class="btn nohighlight copy-cmd"><svg class="fa d-icon d-icon-copy svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"></svg></button><button aria-label="show code in full screen" class="btn nohighlight fullscreen-cmd"><svg class="fa d-icon d-icon-discourse-expand svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"></svg></button>

```undefined
bench setup nginx
```

**1.5 Final server setup**<button aria-label="copy code to clipboard" class="btn nohighlight copy-cmd"><svg class="fa d-icon d-icon-copy svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"></svg></button><button aria-label="show code in full screen" class="btn nohighlight fullscreen-cmd"><svg class="fa d-icon d-icon-discourse-expand svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"></svg></button>

```css
sudo supervisorctl restart all
sudo bench setup production [frappe-user]
```

##### When prompted to save new/existing config files, hit “Y”  
  
[](https://discuss.frappe.io/t/guide-how-to-install-erpnext-v14-on-linux-ubuntu-step-by-step-instructions/92960#tada-ready-to-go-10)![:tada:](https://discuss.frappe.io/images/emoji/twitter/tada.png?v=12 ":tada:") **Ready to Go!**

You can now go to your server **\[IP-address\]:80** and you will have a fresh new installation of ERPNext ready to be configured!

If you are facing any issues with the ports, make sure to enable all the necessary ports on your firewall using the below commands;<button aria-label="copy code to clipboard" class="btn nohighlight copy-cmd"><svg class="fa d-icon d-icon-copy svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"></svg></button><button aria-label="show code in full screen" class="btn nohighlight fullscreen-cmd"><svg class="fa d-icon d-icon-discourse-expand svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"></svg></button>

```bash
sudo ufw allow 22,25,143,80,443,3306,3022,8000/tcp
sudo ufw enable
```

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" id="bkmrk--1"></div>