ERPNext Instaleation 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.
Tabla de contenidos
- Prerequisites
- System Requirements
- Python and Git Instaleation
- Node.js Setup
- MariaDB Instaleation
- Frappe Bench Instaleation
- ERPNext Setup
- Nginx Configuration
- SSL Certificate Setup
- Production Configuration
- Backup Strategy
- Conclusion
Requisitos previos
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
Requisitos del sistema
Verifique las especificaciones del sistema:
Check OS version:
cat /etc/os-release
uname -m
Check available resources:
free -h
df -h
Instale 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 Instaleation
Instale Python 3.8+:
sudo apt install -y python3 python3-pip
Verifique Python:
python3 --version
pip3 --version
Instale Git:
sudo apt install -y git
Verifique Git:
git --version
Node.js Setup
Add NodeSource repository:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
Instale Node.js:
sudo apt install -y nodejs
Verifique installation:
node --version
npm --version
MariaDB Instaleation
Instale MariaDB Server:
sudo apt install -y mariadb-server
Start and secure MariaDB:
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
Cree 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 Instaleation
Cree frappe user:
sudo useradd -m -s /bin/bash frappe
sudo usermod -aG sudo frappe
Cree installation directory:
sudo mkdir -p /opt/frappe
sudo chown -R frappe:frappe /opt/frappe
Switch to frappe user:
sudo su - frappe
cd /opt/frappe
Cree Python virtual environment:
python3 -m venv env
source env/bin/activate
Instale 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
Descargue ERPNext:
bench get-app erpnext https://github.com/frappe/erpnext.git
Cree site:
bench new-site erpnext.example.com --db-name erpnext --db-password FrappePassword123! --admin-password AdminPassword123!
Instale 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.
Configuración de Nginx
Instale Nginx:
sudo apt install -y nginx
Configure Nginx for Frappe:
Exit frappe user session:
exit
Cree 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
Configuración del certificado SSL
Instale Certbot:
sudo apt install -y certbot python3-certbot-nginx
Obtain SSL certificate:
sudo certbot certonly --standalone -d erpnext.example.com
Verifique certificate:
sudo openssl x509 -in /etc/letsencrypt/live/erpnext.example.com/fullchain.pem -noout -dates
Configure auto-renewal:
sudo systemctl enable certbot.timer
sudo systemctl start certbot.timer
Production Configuration
Cree 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
Verifique service:
sudo systemctl status erpnext
Backup Strategy
Cree 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
Conclusión
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.


