Warning
This repository and the global npm / bare-metal installation method are deprecated. Starting with n8n v3.0, self-hosted n8n exclusively requires a Docker-based deployment (e.g. Docker Compose), and running via npm or npx is no longer supported. For self-hosting n8n, please refer to the official n8n Docker Deployment Guide.
This script was designed to automate the installation of n8n as a systemd service on a Linux server, running under a dedicated system user n8n for enhanced security.
- Checks for Node.js (supported versions: v18–v22)
- Installs Node.js 21.x if needed
- Installs
n8nglobally vianpm - Creates system user
n8n - Generates
.envfile in/home/n8n/.n8n/.env - Creates systemd service
n8n.service - Starts the service and enables autostart on system boot
# 1. Clone the repository
git clone https://github.com/ChornyiDev/n8n-install.git ~/n8n-install
# 2. Change directory
cd ~/n8n-install
# 3. Run script as root or via sudo
sudo bash install-n8n.sh
⚠️ The script must be run with root privileges as it creates a user, installs packages, and configures the service.
- n8n will be running as a system service
- Running under the
n8nuser - Configuration file:
/home/n8n/.n8n/.env - System service file:
/etc/systemd/system/n8n.service
# Check status
sudo systemctl status n8n
# Restart service
sudo systemctl restart n8n
# Stop service
sudo systemctl stop n8n
# Enable autostart
sudo systemctl enable n8n
# Disable autostart
sudo systemctl disable n8n
# View logs in real-time
sudo journalctl -u n8n -f
# Edit configuration
nano /home/n8n/.n8n/.envAfter startup, n8n will be available at:
http://your-ip:5678
If you're using a reverse proxy or changing the configuration — update the
.envfile.
The repository includes a separate script update-n8n.sh that:
- checks the current n8n version
- updates via
npm - restarts the service only if the version has changed
sudo bash update-n8n.shTo set up automatic updates every Sunday at 12:00 via Crontab:
(crontab -l 2>/dev/null; echo "0 12 * * 0 /full/path/to/update-n8n.sh 2>> /var/log/n8n-update.log") | crontab -Note: The log only records errors (stderr) in
/var/log/n8n-update.log
~/n8n-install/
├── install-n8n.sh # main installation script
├── update-n8n.sh # update script
├── example.env # configuration example
├── README.md # documentation
└── nginx/
└── n8n.conf # initial nginx configuration
MIT — use, modify, distribute.