ERPNext Installation on Linux
ERPNext is a comprehensive, open-source enterprise resource planning (ERP) system built on the Frappe framework. It provides integrated modules for accounting, inventory, manufacturing, human resources, and sales management. This guide covers Frappe bench installation, MariaDB configuration, Node.js setup, Nginx deployment, and production configuration.
Table of Contents
- Prerequisites
- System Requirements
- Python and Git Installation
- Node.js Setup
- MariaDB Installation
- Frappe Bench Installation
- ERPNext Setup
- Nginx Configuration
- SSL Certificate Setup
- Production Configuration
- Backup Strategy
- Conclusion
Prerequisites
Ensure you have:
- Ubuntu 20.04 LTS or later
- Root or sudo access
- A registered domain name
- Minimum 4GB RAM (8GB+ recommended)
- 40GB available disk space
- Basic Linux administration knowledge
Update system:
sudo apt update && sudo apt upgrade -y
System Requirements
Verify system specifications:
Check OS version:
cat /etc/os-release
uname -m
Check available resources:
free -h
df -h
Install required packages:
sudo apt install -y build-essential python3 python3-dev python3-pip python3-venv libffi-dev libssl-dev curl wget git
Python and Git Installation
Install Python 3.8+:
sudo apt install -y python3 python3-pip
Verify Python:
python3 --version
pip3 --version
Install Git:
sudo apt install -y git
Verify Git:
git --version
Node.js Setup
Add NodeSource repository:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
Install Node.js:
sudo apt install -y nodejs
Verify installation:
node --version
npm --version
MariaDB Installation
Install MariaDB Server:
sudo apt install -y mariadb-server
Start and secure MariaDB:
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
Create MariaDB user for Frappe:
sudo mysql -u root -p << EOF
CREATE USER 'frappe'@'localhost' IDENTIFIED BY 'FrappePassword123!';
GRANT ALL PRIVILEGES ON *.* TO 'frappe'@'localhost' IDENTIFIED BY 'FrappePassword123!' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
EOF
Frappe Bench Installation
Create frappe user:
sudo useradd -m -s /bin/bash frappe
sudo usermod -aG sudo frappe
Create installation directory:
sudo mkdir -p /opt/frappe
sudo chown -R frappe:frappe /opt/frappe
Switch to frappe user:
sudo su - frappe
cd /opt/frappe
Create Python virtual environment:
python3 -m venv env
source env/bin/activate
Install Frappe Bench:
pip install --upgrade pip
pip install frappe-bench
bench --version
Initialize bench:
bench init erpnext
cd erpnext
Configure bench:
nano common_site_config.json
Add configuration:
{
"db_name": "erpnext",
"db_password": "FrappePassword123!",
"developer_mode": 0,
"socketio_port": 9000,
"file_watcher_port": 6787
}
ERPNext Setup
Download ERPNext:
bench get-app erpnext https://github.com/frappe/erpnext.git
Create site:
bench new-site erpnext.example.com --db-name erpnext --db-password FrappePassword123! --admin-password AdminPassword123!
Install ERPNext app:
bench --site erpnext.example.com install-app erpnext
bench --site erpnext.example.com set-config developer_mode 0
Enable development tools:
bench setup requirements
Test installation:
bench start
Access at http://localhost:8000
Press Ctrl+C to stop.
Nginx Configuration
Install Nginx:
sudo apt install -y nginx
Configure Nginx for Frappe:
Exit frappe user session:
exit
Create Nginx configuration:
sudo nano /etc/nginx/sites-available/erpnext
Add configuration:
upstream frappe-bench {
server 127.0.0.1:8000;
}
upstream socketio-node {
server 127.0.0.1:9000;
}
server {
listen 80;
listen [::]:80;
server_name erpnext.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name erpnext.example.com;
ssl_certificate /etc/letsencrypt/live/erpnext.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/erpnext.example.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 100M;
location / {
proxy_pass http://frappe-bench;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /socket.io {
proxy_pass http://socketio-node;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
Enable site:
sudo ln -s /etc/nginx/sites-available/erpnext /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl start nginx
sudo systemctl enable nginx
SSL Certificate Setup
Install Certbot:
sudo apt install -y certbot python3-certbot-nginx
Obtain SSL certificate:
sudo certbot certonly --standalone -d erpnext.example.com
Verify certificate:
sudo openssl x509 -in /etc/letsencrypt/live/erpnext.example.com/fullchain.pem -noout -dates
Set up auto-renewal:
sudo systemctl enable certbot.timer
sudo systemctl start certbot.timer
Production Configuration
Create systemd service:
sudo nano /etc/systemd/system/erpnext.service
Add:
[Unit]
Description=ERPNext Bench
After=network.target mariadb.service
[Service]
Type=simple
User=frappe
Group=frappe
WorkingDirectory=/opt/frappe/erpnext
ExecStart=/opt/frappe/erpnext/env/bin/bench start
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
Enable and start service:
sudo systemctl daemon-reload
sudo systemctl enable erpnext
sudo systemctl start erpnext
Verify service:
sudo systemctl status erpnext
Backup Strategy
Create backup script:
sudo nano /usr/local/bin/erpnext-backup.sh
Add:
#!/bin/bash
BACKUP_DIR="/backups/erpnext"
FRAPPE_DIR="/opt/frappe/erpnext"
DATE=$(date +%Y%m%d_%H%M%S)
mkdir -p $BACKUP_DIR
# Run Frappe backup
cd $FRAPPE_DIR
source env/bin/activate
bench --site erpnext.example.com backup
# Copy backup
cp sites/erpnext.example.com/private/backups/* "$BACKUP_DIR/"
# Keep only 30 days
find $BACKUP_DIR -type f -mtime +30 -delete
echo "Backup completed: $DATE"
Make executable:
sudo chmod +x /usr/local/bin/erpnext-backup.sh
Schedule daily backups:
sudo crontab -e
Add:
0 2 * * * /usr/local/bin/erpnext-backup.sh >> /var/log/erpnext-backup.log 2>&1
Access ERPNext:
Navigate to https://erpnext.example.com
Login with admin credentials created during setup.
Configure modules:
- Click "Setup" → "Customize"
- Enable required modules:
- Accounting
- Inventory
- CRM
- Human Resources
Conclusion
ERPNext is now fully installed and configured as an enterprise resource planning system. With Frappe framework, MariaDB database, Nginx web server, and SSL encryption, you have a powerful business management platform. Configure modules, create users, and establish business processes. Monitor system performance and schedule regular backups. ERPNext's flexibility enables customization for specific organizational needs.


