Step-by-Step Guide: How to Host ERPNext on Your Own VPS
Choosing the Right VPS Specs for a Smooth ERPNext Experience
Successfully planning to host ERPNext on VPS requires a foundational understanding of server specifications. ERPNext, being a comprehensive enterprise resource planning system built on the Frappe framework, demands adequate resources to ensure optimal performance, especially as your business scales. Skimping on VPS specs can lead to frustrating slowdowns, data processing lags, and a poor user experience, undermining the very benefits ERPNext aims to provide.
When selecting a Virtual Private Server (VPS), consider not just the immediate needs but also potential growth. Key metrics include CPU cores, RAM, storage type (SSD is crucial), and network bandwidth. For a small team (1-5 users) primarily using core modules like CRM and accounting, an entry-level VPS might suffice. However, businesses with more users, complex workflows, or integrating multiple modules (e.g., manufacturing, HR, project management) will quickly outgrow such minimal setups. We at WovLab always recommend prioritizing SSD storage for I/O performance, which is a common bottleneck for database-intensive applications like ERPNext.
Here's a comparison table to guide your VPS selection:
| User Count / Usage | Recommended CPU Cores | Recommended RAM | Recommended Storage (SSD) | Notes |
|---|---|---|---|---|
| Small Business (1-5 users) - Basic ERP | 2 vCPU | 4 GB | 80-100 GB | Suitable for light usage, core accounting, CRM. |
| Medium Business (5-20 users) - Growing ERP | 4 vCPU | 8 GB | 150-200 GB | Good for moderate usage, multiple modules, initial integrations. |
| Large Business (20-50+ users) - Heavy ERP | 8+ vCPU | 16+ GB | 300+ GB | Recommended for high concurrency, complex manufacturing, e-commerce, integrations. |
Remember, these are starting points. Monitoring your ERPNext instance's resource usage over time will inform future scaling decisions. Choosing a reputable VPS provider with good uptime guarantees and customer support is also paramount.
Key Insight: "For optimal ERPNext performance, always prioritize SSD storage. I/O operations are frequent, and a fast disk significantly reduces database query times and overall system responsiveness."
Initial Server Setup: Essential Configuration for Ubuntu 22.04
Before you can begin to host ERPNext on VPS, your server needs a robust and secure foundation. We'll focus on Ubuntu 22.04 LTS, a popular and stable choice for server deployments. The initial setup involves several critical steps: updating system packages, creating a non-root sudo user, securing SSH access, and configuring a basic firewall.
- Update System Packages:
After logging into your VPS as the root user, the very first step is to ensure all existing packages are up to date. This provides access to the latest security patches and software versions, which is crucial for stability.
sudo apt updatesudo apt upgrade -y - Create a New Sudo User:
Operating as the root user directly is a security risk. Create a new user with sudo privileges and switch to it for daily operations.
sudo adduser erpadmin(Replace 'erpadmin' with your desired username)sudo usermod -aG sudo erpadminLog out of root and log back in as 'erpadmin'.
- Secure SSH Access:
Enhance SSH security by disabling root login and password authentication, preferring SSH keys instead. This significantly reduces the attack surface.
First, copy your public SSH key to the server:
ssh-copy-id erpadmin@your_vps_ip(Run this from your local machine)Then, edit the SSH daemon configuration:
sudo nano /etc/ssh/sshd_configFind and modify these lines:
PermitRootLogin noPasswordAuthentication noRestart the SSH service:
sudo systemctl reload sshd - Configure UFW Firewall:
UFW (Uncomplicated Firewall) provides a user-friendly interface to manage iptables. Allow essential services like SSH, HTTP, and HTTPS.
sudo ufw allow OpenSSHsudo ufw allow httpsudo ufw allow httpssudo ufw enablesudo ufw status(Verify the rules)
These initial steps establish a secure and up-to-date environment, paving the way for the ERPNext installation.
Installing Frappe Bench: The Foundation of Your ERPNext System
Frappe Bench is the command-line interface (CLI) tool that manages Frappe applications, including ERPNext. It handles everything from setting up your development environment to configuring production servers, making it indispensable for anyone looking to host ERPNext on VPS. This section will guide you through installing the necessary dependencies and setting up Frappe Bench itself on your Ubuntu 22.04 server.
Before installing Frappe Bench, several critical system dependencies must be in place. These include Python 3, Node.js, MariaDB (as the database backend), Redis (for caching and background jobs), and Nginx (as the web server).
- Install Essential Dependencies:
Start by installing git, curl, and build-essential:
sudo apt install -y git curl build-essential python3-dev python3-pip - Install MariaDB Database:
ERPNext requires a robust SQL database. MariaDB is the recommended choice.
sudo apt install -y mariadb-server mariadb-clientRun the secure installation script:
sudo mysql_secure_installationFollow the prompts. It's recommended to set a root password, remove anonymous users, disallow remote root login, and remove the test database.
- Install Redis Server:
Redis is used by Frappe for caching and real-time updates.
sudo apt install -y redis-server - Install Node.js and Yarn:
ERPNext frontend components rely on Node.js and Yarn for asset compilation.
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -sudo apt install -y nodejssudo npm install -g yarn - Install Nginx:
Nginx will serve as the reverse proxy for your ERPNext application.
sudo apt install -y nginx - Install Frappe Bench:
Now, install Frappe Bench using pip, and then initialize a new bench directory.
sudo pip3 install frappe-benchCreate a directory for your bench and initialize it. It's good practice to create a dedicated user and directory for this, e.g., 'frappe'.
sudo mkdir /home/frappesudo chown -R erpadmin:erpadmin /home/frappe(Grant ownership to your sudo user)cd /home/frappebench init frappe-bench --python python3(This creates a new bench environment)cd frappe-benchThis process downloads and configures the core Frappe framework, preparing the ground for your ERPNext application. It might take a few minutes depending on your internet speed and VPS performance.
Expert Tip: "Always use the designated 'bench' command for Frappe-related operations. It abstracts away complexities and ensures your ERPNext installation is consistent and manageable."
Creating a New Site and Installing the ERPNext App
With Frappe Bench successfully installed, the next logical step to host ERPNext on VPS is to create a new site within your bench and then install the ERPNext application onto that site. A "site" in Frappe terminology is essentially an independent ERPNext instance, complete with its own database and file system, allowing you to run multiple instances on a single bench if needed. For most deployments, a single site is sufficient.
- Create a New Frappe Site:
Navigate into your bench directory and use the
bench new-sitecommand. You'll need to provide a site name, which is typically your domain name (e.g.,erp.yourcompany.com).cd /home/frappe/frappe-benchbench new-site erp.yourcompany.comYou will be prompted for a MariaDB root password (if you set one during
mysql_secure_installation), and then to set a strong administrator password for the new ERPNext site. Make sure to remember this password! - Get the ERPNext Application:
The Frappe Bench allows you to easily "get" (download) applications from the Frappe ecosystem. We need the ERPNext application.
bench get-app erpnextThis command clones the ERPNext repository into your bench's apps directory.
- Install the ERPNext Application on Your Site:
Once downloaded, the ERPNext app needs to be installed onto your newly created site. This step sets up the database schema, default configurations, and initial data for ERPNext.
bench --site erp.yourcompany.com install-app erpnextThis process can take several minutes as it applies database migrations and sets up all ERPNext modules.
- Start the Bench in Development Mode (Optional Test):
To quickly verify your installation before configuring for production, you can start the bench in development mode. This will run a small web server, typically on port 8000.
bench startYou can then access ERPNext via your browser at
http://your_vps_ip:8000. Remember to allow port 8000 in your UFW firewall temporarily if you're testing this:sudo ufw allow 8000Once you've verified, stop the development server by pressing Ctrl+C in the terminal, and then remove the temporary firewall rule:
sudo ufw delete allow 8000
These steps complete the core installation of ERPNext. Your system is now ready for production configuration, which involves setting up Nginx for web serving and Supervisor for process management.
Configuring for Production: Nginx, Supervisor, and DNS Setup
To ensure your ERPNext instance is accessible, secure, and runs reliably, production configuration is essential when you host ERPNext on VPS. This involves setting up Nginx as a reverse proxy, Supervisor for process management, and configuring your domain's DNS. A critical final step is securing your application with an SSL certificate using Let's Encrypt.
- Configure Frappe Bench for Production:
Frappe Bench simplifies the production setup by generating Nginx and Supervisor configurations automatically.
cd /home/frappe/frappe-benchbench setup production erpadmin(Replace 'erpadmin' with your sudo username)This command performs several actions:
- Creates Supervisor configuration files to manage Frappe processes (worker, schedule, web).
- Configures Nginx to serve your ERPNext site.
- Enables the Nginx configuration.
- Sets up log rotation.
Restart Nginx to apply changes:
sudo systemctl reload nginx - Configure DNS Records:
For users to access your ERPNext site via a domain name (e.g.,
erp.yourcompany.com), you need to update your DNS records. Log in to your domain registrar or DNS management panel and create an A record:- Type: A
- Host/Name:
erp(or your chosen subdomain) - Value/Points to: Your VPS's public IP address
- TTL: Default (usually 3600 seconds)
DNS changes can take some time to propagate globally (up to 24-48 hours, though often faster).
- Install SSL Certificate with Let's Encrypt:
Security is paramount. Installing an SSL certificate encrypts traffic between your users and the server, protecting sensitive business data. Let's Encrypt provides free SSL certificates.
First, ensure Certbot is installed:
sudo snap install core; sudo snap refresh coresudo snap install --classic certbotsudo ln -s /snap/bin/certbot /usr/bin/certbotThen, generate and install the SSL certificate for your ERPNext site:
sudo certbot --nginx -d erp.yourcompany.comFollow the prompts, providing an email for urgent renewals and agreeing to the terms of service. Certbot will automatically configure Nginx and set up automatic renewals.
- Verify Service Status:
After all configurations, ensure Nginx and Supervisor are running correctly:
sudo systemctl status nginxsudo supervisorctl statusYou should see Nginx as 'active (running)' and Frappe processes (web, worker, schedule) in 'RUNNING' state.
Your ERPNext instance should now be accessible securely via your domain name (https://erp.yourcompany.com), ready for your team to use.
WovLab Insight: "Reliable production deployment for ERPNext goes beyond initial setup. We emphasize proactive monitoring, regular backups, and timely updates to ensure business continuity and data integrity."
Secure and Scale Your ERPNext with WovLab's Expert Help
Successfully deploying ERPNext on your own VPS is a significant achievement, granting you unparalleled control and cost efficiency. However, the journey doesn't end with initial setup. Maintaining a secure, performant, and scalable ERPNext environment requires ongoing vigilance and expertise. At WovLab, a premier digital agency from India, we understand the intricacies of self-hosting ERPNext and offer specialized services to ensure your system not only runs smoothly but also evolves with your business needs.
Security Best Practices:
- Regular Backups: Implement automated daily or hourly backups of your database and site files. Store them off-site for disaster recovery.
- System Updates: Keep your Ubuntu OS, Frappe Bench, and ERPNext applications updated to patch vulnerabilities and leverage new features.
- Monitoring: Set up monitoring tools for CPU, RAM, disk I/O, and network usage to proactively identify bottlenecks.
- Access Control: Strictly manage user roles and permissions within ERPNext and secure SSH access to your VPS.
- WAF & IDS: Consider integrating a Web Application Firewall (WAF) and Intrusion Detection Systems (IDS) for enhanced protection against sophisticated attacks.
Scaling Strategies:
- Vertical Scaling: Upgrade your VPS plan (more CPU, RAM, disk) as your user base and data grow.
- Horizontal Scaling: For very large deployments, distribute components across multiple servers (e.g., separate database server, dedicated Redis server). Frappe Bench supports this architecture.
- Caching Optimization: Fine-tune Redis caching settings for better performance.
- Code Optimization: If you have custom apps, ensure they are written efficiently to minimize resource consumption.
At WovLab, we bring extensive experience in ERP implementations and cloud infrastructure management. Whether you need assistance to host ERPNext on VPS from scratch, optimize an existing instance, or require ongoing maintenance and security audits, our team is equipped to help. Our services extend to comprehensive cloud management, ensuring your ERPNext infrastructure is robust, scalable, and cost-effective. We specialize in:
- ERPNext Consulting & Implementation: Tailored solutions for your business processes.
- Cloud Infrastructure Management: Expert setup and maintenance of your VPS, ensuring high availability and performance.
- DevOps & Automation: Streamlining deployment, monitoring, and scaling of your ERPNext instance.
- Security Audits & Hardening: Proactive measures to protect your critical business data.
- Custom Development & Integrations: Extending ERPNext functionality to meet unique requirements.
Don't let the complexities of server management detract from your business goals. Partner with WovLab to unlock the full potential of ERPNext on your own VPS. Visit wovlab.com or contact us today for a consultation on how we can secure, scale, and support your ERPNext journey.
Ready to Get Started?
Let WovLab handle it for you — zero hassle, expert execution.
💬 Chat on WhatsApp