If you’re a beginner looking to set up n8n, the powerful workflow automation tool, this blog post is made for you. We’ll walk you through the complete setup on a Bitnami Linux server, with all the commands included—just copy and paste.
System Requirements & Prerequisites
Bitnami server with LAMP stack (Ubuntu/Debian)
Domain name pointed to server IP
SSL certificate (Let’s Encrypt or Bitnami bncert-tool)
SSH access (e.g., using PuTTY)
Node.js and npm
Install Node.js
Check if Node.js is already installed:
node -v
npm -v
If not installed:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash –
sudo apt-get install -y nodejs
Install n8n and PM2
Install n8n:
sudo npm install -g n8n
Install PM2:
sudo npm install -g pm2
Verify PM2 installation:
pm2 –version
Configure Apache (Proxy + SSL)
Edit Apache config file:
sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf
Inside <VirtualHost *:443>
, add:
SetEnvIf X-Forwarded-Proto https HTTPS=on
<VirtualHost :443>
ServerName example.com
ServerAlias www.example.com
SSLEngine on
SSLCertificateFile “/opt/bitnami/apache2/conf/your-domain.crt”
SSLCertificateKeyFile “/opt/bitnami/apache2/conf/your-domain.key”
ProxyPreserveHost On
ProxyRequests Off
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.) ws://127.0.0.1:5678/$1 [P,L]
ProxyPass / http://127.0.0.1:5678/
ProxyPassReverse / http://127.0.0.1:5678/
ErrorLog “/opt/bitnami/apache2/logs/error_log”
CustomLog “/opt/bitnami/apache2/logs/access_log” combined
</VirtualHost>
Set Up .env File for n8n
Create or edit the .env file:
nano ~/.n8n/.env
Example content:
DB_TYPE=sqlite
DB_SQLITE_DATABASE=/home/bitnami/.n8n/database.sqlite
N8N_USER_MANAGEMENT_DISABLED=False
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=admin@example.com
N8N_BASIC_AUTH_PASSWORD=Admin@123
N8N_PORT=5678
N8N_PROTOCOL=https
N8N_HOST=yourdomain.com
WEBHOOK_URL=https://yourdomain.com/
N8N_LISTEN_ADDRESS=0.0.0.0
Start n8n with PM2
Start n8n:
pm2 start “bash -c ‘source ~/.n8n/.env && n8n start'” –name n8n
Enable auto-start on boot:
pm2 startup
pm2 save
Apache Server Management Commands
Check Apache status:
sudo /opt/bitnami/ctlscript.sh status
Start Apache:
sudo /opt/bitnami/ctlscript.sh start apache
Restart Apache:
sudo /opt/bitnami/ctlscript.sh restart apache
Stop Apache:
sudo /opt/bitnami/ctlscript.sh stop apache
Find Apache PID:
ps aux | grep apache
cat /opt/bitnami/apache2/logs/httpd.pid
Force stop Apache:
sudo kill -9 <PID>
Reset MySQL Root Password (Optional)
Stop MySQL:
sudo /opt/bitnami/ctlscript.sh stop mysql
Start in safe mode:
sudo /opt/bitnami/mysql/bin/mysqld_safe –skip-grant-tables –skip-networking &
Access MySQL:
mysql -u root
Reset password inside MySQL:
USE mysql;
UPDATE user SET authentication_string=PASSWORD(‘NewPassword’) WHERE User=’root’;
FLUSH PRIVILEGES;
EXIT;
Restart MySQL:
sudo /opt/bitnami/ctlscript.sh stop mysql
sudo /opt/bitnami/ctlscript.sh start mysql
Login to test:
mysql -u root -p
Fix OAuth Redirect Issue (localhost:5678)
Ensure your .env
contains:
N8N_PROTOCOL=https
N8N_HOST=yourdomain.com
WEBHOOK_URL=https://yourdomain.com/
Create a startup script:
nano ~/n8n-start.sh
Paste this:
#!/bin/bash
export $(cat /home/bitnami/.n8n/.env | grep -v ‘^#’ | xargs)
n8n
Make it executable:
chmod +x ~/n8n-start.sh
Restart n8n via PM2:
pm2 delete n8n
pm2 start ~/n8n-start.sh –name n8n
pm2 save
Enable on reboot:
pm2 startup
pm2 save
Common Errors & Solutions
ENOENT Error – Check .env and SSL paths
WebSocket Connection Lost – Add Rewrite rules in Apache
Index of / – Remove or comment out , <Directory> block
SSL Protocol Error – Add listen 443 to httpd.conf
PM2 Multiple Instances – Use pm2 delete all and restart clean
OAuth URL showing localhost – Fix .env with correct protocol and host
MySQL Password Not Visible – PuTTY hides input (normal)
Reset MySQL Password – Use safe mode commands
Apache Not Starting – Kill PID manually using ps sux | grep apache
.env Not Loading on Reboot – Use shell script to export vars
Additional Notes
Linux terminal hides typed password (expected)
Back up your Apache and .env files before changes
Restart Apache after any config edit
Conclusion
You now have a fully running n8n instance on your own server!
Tested and deployed by Kuvira Cybernetics.
Need assistance? Email us at info@kuviracybernetics.com