Skip to content

Commit 83e00af

Browse files
authored
Merge pull request #7941 from ovh/FB-install-n8n-vps
FB - Install N8N on a VPS
2 parents 04a946b + adb57d4 commit 83e00af

File tree

6 files changed

+538
-0
lines changed

6 files changed

+538
-0
lines changed
Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
---
2+
title: "How to install n8n on an OVHcloud VPS"
3+
excerpt: "Find out how to host the n8n automation platform on an OVHcloud VPS using Docker and Traefik"
4+
updated: 2025-08-25
5+
---
6+
7+
## Objective
8+
9+
This guide explains how to install and run [n8n](https://n8n.io), an open-source platform for workflow automation, on an OVHcloud VPS. The installation relies on [Docker](https://www.docker.com/), with the server [Traefik](https://doc.traefik.io/traefik/) to automatically manage SSL certificates.
10+
11+
## Requirements
12+
13+
- A [VPS](/links/bare-metal/vps) solution
14+
- A domain name
15+
- Administrative (sudo) access to your server via SSH
16+
17+
## Instructions
18+
19+
### Contents
20+
21+
- [Log in to your VPS](#step1)
22+
- [You are using a pre-installed OVHcloud image](#step2)
23+
- [You do not use a pre-installed OVHcloud image](#step3)
24+
- [DNS configuration](#step4)
25+
- [Access the n8n interface](#step5)
26+
- [Conclusion](#step6)
27+
28+
### Log in to your VPS <a name="step1"></a>
29+
30+
Open a terminal and connect to your VPS with the following command (replacing `IP_VPS` with the real IP):
31+
32+
```bash
33+
ssh <user>@IP_VPS
34+
```
35+
36+
### You are using a pre-installed OVHcloud image <a name="step2"></a>
37+
38+
If you have chosen an OVHcloud **VPS with the n8n image pre-installed**, **you do not need to install Docker or Docker Compose** : these tools are already present and configured.
39+
40+
Find all the necessary files (including `docker-compose.yml` and `.env`) in the `/debian/n8n/` folder on your VPS.
41+
42+
Edit the file `.env` located in this folder to enter the following information:
43+
44+
- `DOMAIN_NAME`: your domain name (e.g. `vps.ovh.net`).
45+
- `SUBDOMAIN`: the subdomain used to access n8n (e.g. `vps-xxxxxxx`).
46+
- `EMAIL`: the email address used to generate SSL certificates via Let’s Encrypt.
47+
48+
Once you have updated the file `.env`, run the following command from the directory `/root/n8n-traefik/`:
49+
50+
```bash
51+
docker compose up -d
52+
```
53+
54+
### You are not using an OVHcloud pre-installed image <a name="step3"></a>
55+
56+
#### Install Docker and Docker Compose
57+
58+
To deploy n8n via Docker on an OVHcloud VPS, Docker and Docker Compose must be installed. This method is compatible with the majority of distributions offered by OVHcloud (Debian 11, Debian 12, Ubuntu 22.04...).
59+
60+
#### Step 1 - Update the system
61+
62+
```bash
63+
sudo apt update && sudo apt upgrade -y
64+
```
65+
66+
#### Step 2 - Add the official Docker GPG key
67+
68+
```bash
69+
sudo apt install -y ca-certificates curl gnupg
70+
sudo install -m 0755 -d /etc/apt/keyrings
71+
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
72+
```
73+
74+
#### Step 3 - Add the Docker repository
75+
76+
For Debian (versions 11 and 12):
77+
78+
```bash
79+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
80+
```
81+
82+
For Ubuntu (version equal to or higher than 22.04):
83+
84+
```bash
85+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
86+
```
87+
88+
#### Step 4 - Install Docker Engine and Docker Compose Plugin
89+
90+
```bash
91+
sudo apt update
92+
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
93+
```
94+
95+
#### Step 5 - Verify that Docker and Docker Compose are working
96+
97+
```bash
98+
docker --version
99+
docker compose version
100+
```
101+
102+
#### Prepare the Traefik + n8n configuration
103+
104+
Create a project folder where the Docker stack will reside:
105+
106+
```bash
107+
mkdir n8n-traefik && cd n8n-traefik
108+
```
109+
110+
#### Create the configuration files
111+
112+
#### .env file
113+
114+
This file allows you to define the variables that are reused in the `docker-compose.yml` file.
115+
116+
Create the file:
117+
118+
```bash
119+
nano .env
120+
```
121+
122+
Paste the following content into it:
123+
124+
```console
125+
DOMAIN_NAME=example.com
126+
SUBDOMAIN=n8n
127+
128+
```
129+
130+
Replace `example.com` with your real domain name and `[email protected]` with the email of your choice.
131+
132+
> [!warning]
133+
>
134+
> If you do not have a domain name yet, order one from our [website](/links/web/domains).
135+
136+
##### docker-compose.yml file
137+
138+
This file contains the definition of the n8n and Traefik services. In particular, it configures:
139+
140+
- Reverse proxy and SSL management with Traefik.
141+
- Basic authentication to access n8n.
142+
143+
Create the file:
144+
145+
```bash
146+
nano docker-compose.yml
147+
```
148+
149+
Paste the following content:
150+
151+
```console
152+
services:
153+
traefik:
154+
image: traefik:v2.11
155+
container_name: traefik
156+
restart: always
157+
command:
158+
- "--api.insecure=true"
159+
- "--providers.docker=true"
160+
- "--entrypoints.web.address=:80"
161+
- "--entrypoints.websecure.address=:443"
162+
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
163+
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
164+
- "--certificatesresolvers.myresolver.acme.email=${EMAIL}"
165+
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
166+
ports:
167+
- "80:80"
168+
- "443:443"
169+
volumes:
170+
- "/var/run/docker.sock:/var/run/docker.sock:ro"
171+
- "./letsencrypt:/letsencrypt"
172+
labels:
173+
- "traefik.http.routers.http-catch.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)"
174+
- "traefik.http.routers.http-catch.entrypoints=web"
175+
- "traefik.http.routers.http-catch.middlewares=redirect-to-https"
176+
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
177+
178+
n8n:
179+
image: n8nio/n8n
180+
container_name: n8n
181+
restart: always
182+
environment:
183+
- N8N_BASIC_AUTH_ACTIVE=true
184+
- N8N_BASIC_AUTH_USER=admin
185+
- N8N_BASIC_AUTH_PASSWORD=admin123
186+
- N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
187+
- WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
188+
labels:
189+
- "traefik.enable=true"
190+
- "traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)"
191+
- "traefik.http.routers.n8n.entrypoints=websecure"
192+
- "traefik.http.routers.n8n.tls.certresolver=myresolver"
193+
- "traefik.http.services.n8n.loadbalancer.server.port=5678"
194+
volumes:
195+
- n8n_data:/home/node/.n8n
196+
197+
volumes:
198+
n8n_data:
199+
```
200+
201+
> [!warning]
202+
>
203+
> By default, the user and password are set to admin / admin123. This method is not enabled in all versions of n8n. If you would like to use it anyway, remember to change these values in the docker-compose.yml file before launching the stack, and use a strong password.
204+
205+
#### Prepare the SSL certificate folder
206+
207+
Traefik stores the certificates generated by Let's Encrypt in a file named `acme.json`. This file must exist before launch and have strict permissions.
208+
209+
Create the folder:
210+
211+
```bash
212+
mkdir letsencrypt
213+
```
214+
215+
Create the empty file:
216+
217+
```bash
218+
touch letsencrypt/acme.json
219+
chmod 600 letsencrypt/acme.json
220+
```
221+
222+
#### Start services
223+
224+
Launch the stack with Docker Compose:
225+
226+
```bash
227+
docker compose up -d
228+
```
229+
230+
### DNS configuration <a name="step4"></a>
231+
232+
Ensure that your subdomain (e.g. n8n.example.com) points to your VPS’s IP address in the DNS zone. For more details, please read our guide on [Editing an OVHcloud DNS zone](/pages/web_cloud/domains/dns_zone_edit) .
233+
234+
> [!warning]
235+
>
236+
> If you do not have a domain name yet, order one from our [website](/links/web/domains).
237+
238+
### Access the n8n interface <a name="step5"></a>
239+
240+
Access n8n in a browser via the URL `https://n8n.example.com/`. Replace `n8n.example.com` with the actual domain you have defined.
241+
242+
> [!warning]
243+
>
244+
> Since version 1.0 of n8n, you must create an administrator account when you first access your self-hosted instance, even if you already have an account on [n8n.cloud](https://n8n.cloud). The accounts are **specific to each instance**. An account created on your VPS cannot be used on another instance, even with the same email address.
245+
246+
> [!tabs]
247+
> First access
248+
>> A form for creating an account will appear. Complete it to configure the first admin user of your n8n instance.
249+
>>
250+
>>![Install n8n VPS](images/setup_n8n.png){.thumbnail}
251+
>>
252+
> Your n8n account is already created
253+
>> You are redirected to the login screen. Use the credentials defined above.
254+
>>
255+
>> ![Install n8n VPS](images/login_n8n.png){.thumbnail}
256+
257+
### Conclusion <a name="step6"></a>
258+
259+
You now have a secure, operational n8n instance on your OVHcloud VPS, with automatic SSL certificate management using Traefik. To go further, please refer to the [official n8n documentation](https://docs.n8n.io/) to create your first workflows.
260+
261+
## Go further
262+
263+
[Edit an OVHcloud DNS zone](/pages/web_cloud/domains/dns_zone_edit)
264+
265+
For specialized services (SEO, development, etc.), contact the [OVHcloud partners](/links/partner)
266+
267+
Join our [community of users](/links/community).

0 commit comments

Comments
 (0)