How to Self-Host Dolibarr on a VPS (Complete Guide)
Dolibarr is an open-source ERP and CRM suite that simplifies business management for small to mid-sized enterprises. Self-hosting it on a VPS ensures you have full control over your data, improves privacy, and can often result in cost savings over time. This guide will walk you through the steps required to self-host Dolibarr on a VPS.
Why Choose a VPS for Dolibarr?
Using a VPS allows for better performance and customization compared to shared hosting. It also provides the freedom to install necessary software, configure security settings, and scale resources according to your needs.
VPS Provider Comparison
When selecting a VPS for hosting Dolibarr, consider the following options:
| Provider | Monthly Price (EUR/USD) | CPU | RAM | Storage |
|---|---|---|---|---|
| Contabo VPS | 5.99 EUR | 1 | 4GB | 200GB |
| Hetzner Cloud | 4.15 EUR | 1 | 2GB | 20GB |
| DigitalOcean | 6 USD | 1 | 1GB | 25GB |
| Vultr | 6 USD | 1 | 1GB | 25GB |
| Linode (Akamai Cloud) | 5 USD | 1 | 1GB | 25GB |
All options are suitable for hosting Dolibarr, but for better performance, Contabo VPS is recommended due to its larger RAM and storage capacity. Check out our full VPS comparison for more details.
Prerequisites
Before proceeding with the installation, ensure that you have:
- A VPS set up with SSH access.
- A domain name pointed to your VPS (optional but recommended).
- A basic understanding of Linux commands.
Step 1: Setting Up Your VPS
-
Connect to Your VPS: Use SSH to access your VPS terminal:
ssh root@your_vps_ip -
Update your system: This ensures all packages are up to date.
apt-get update && apt-get upgrade -y
Step 2: Install Required Packages
Install Apache, MySQL, and PHP. Dolibarr requires these services to function properly.
apt-get install apache2 mysql-server php php-mysql libapache2-mod-php -y
Step 3: Download Dolibarr
Navigate to the directory where you want to install Dolibarr:
cd /var/www/html
Download the latest version of Dolibarr:
wget https://sourceforge.net/projects/dolibarr/files/latest/download -O dolibarr.zip
Unzip the downloaded file:
unzip dolibarr.zip
Step 4: Configure MySQL Database
-
Log into MySQL:
mysql -u root -p -
Create a database for Dolibarr:
CREATE DATABASE dolibarr; CREATE USER 'dolibarruser'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON dolibarr.* TO 'dolibarruser'@'localhost'; FLUSH PRIVILEGES; EXIT;
Step 5: Configure Apache
-
Create an Apache configuration file for Dolibarr:
nano /etc/apache2/sites-available/dolibarr.conf -
Add the following configuration:
<VirtualHost *:80> DocumentRoot /var/www/html/dolibarr/htdocs ServerName your_domain.com <Directory /var/www/html/dolibarr/htdocs> AllowOverride All </Directory> </VirtualHost> -
Enable the new site and rewrite module:
a2ensite dolibarr.conf a2enmod rewrite systemctl restart apache2
Step 6: Complete the Installation
Open your web browser and navigate to http://your_domain.com/install. Follow the web-based installer instructions. Use the database credentials you set up earlier.
Step 7: Secure Your Installation
Once installed, take the following precautions:
-
Remove the installation folder:
rm -rf /var/www/html/dolibarr/htdocs/install -
Set file permissions:
chown -R www-data:www-data /var/www/html/dolibarr/htdocs -
Secure MySQL:
Run
mysql_secure_installationto remove test users and databases.
Step 8: Optional - Docker Installation
If you prefer using Docker for self-hosting Dolibarr, you can follow these steps:
-
Install Docker:
apt-get install docker.io docker-compose -y -
Create a
docker-compose.yml:version: '3' services: db: image: mysql:5.7 environment: MYSQL_DATABASE: dolibarr MYSQL_USER: dolibarruser MYSQL_PASSWORD: your_password MYSQL_ROOT_PASSWORD: root_password dolibarr: image: dolibarr/dolibarr environment: - DB_HOST=db - DB_USER=dolibarruser - DB_PASS=your_password ports: - "80:80" -
Run Dolibarr:
docker-compose up -d
Congratulations! You now have Dolibarr self-hosted on your VPS.
FAQs
1. Is self-hosting Dolibarr safe?
Self-hosting Dolibarr provides enhanced data control and privacy. However, you need to take steps to secure your server, including setting up firewalls, using secure passwords, and regularly updating software. Also, consider implementing SSL for your web server to encrypt the data transmitted.
2. Can I install Dolibarr on a low-spec VPS?
Yes, Dolibarr can run on low-spec VPS, but performance may be affected as user load increases. For minimal installations, options like Hetzner Cloud ($4.15 EUR/mo) can be sufficient for testing. If you expect high usage, opt for a provider like Contabo VPS ($5.99 EUR/mo) for better performance.
3. What are the benefits of using Docker for self-hosting Dolibarr?
Using Docker simplifies the setup and management of Dolibarr, allowing you to run it in isolated containers. This can make it easier to manage dependencies and updates. Additionally, Docker can simplify scaling and migrating your application.
By following this guide, you can successfully self-host Dolibarr on a VPS and manage your business effectively. For more resources, check out r/selfhosted and the awesome-selfhosted list for additional tools and applications.