Guys, I have no experience with Linux. I’m having trouble installing n8n on Ubuntu 2204 LTS. I had already successfully installed Docker, Node.js and NPM. I first tried with the Docker user, but it gave an error. The system advised me to use the root user. I’ve tried twice and it gives me the error in the attached printscreen. Thanks.
Welcome @Afonso_Campos ,
Jon from the n8n team mentioned a few weeks ago:
“Docker is the recommended option, we will be removing npm steps from the docs soon.”
Are you sure you want to use NPM?
If you’re new to Linux, using docker run
or Docker Compose is usually much simpler and more reliable. Docker Docs
With docker run
, n8n can often be started with a single command and is ready to use right away.
For more complex setups (e.g. with volumes, environment variables, or additional services), Docker Compose is the better choice.
Hi friend, thanks for the answer, I don’t know how to use and install n8n through docker, I only had an experience with docker desktop on windows 11, but on windows it’s easier to create a folder and put the files inside, on linux it’s more difficult for me, because I have more experience with basic access and visual basic on windows, could you provide me with a link or video that I could follow to install? thanks
Hey Afonso_Campos.
I installed last week with this steps:
Update system
sudo apt update && sudo apt upgrade -y
Install Node.js (n8n requires Node.js 18.x or later)
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
Install npm
sudo apt install -y npm
Install n8n globally
sudo npm install -g n8n
Install PM2 to manage n8n process
sudo npm install -g pm2
Start n8n with PM2
pm2 start n8n
Save PM2 process list
pm2 save
Enable PM2 to start on boot
pm2 startup systemd
sudo systemctl enable pm2-$USER
Open firewall port (default: 5678)
sudo ufw allow 5678
Check n8n status
pm2 status
Let me know if this helped you!
I tried with the docker user and the first command gave an error. Will I have to change the user’s permissions or do it with root? :
Last login: Sat Jun 28 05:42:30 2025 from 100.104.136.9
root@iZrj97lwnw8icduzt0p0miZ:~# su docker
docker@iZrj97lwnw8icduzt0p0miZ:/root$ apt-get update && apt-get upgrade
Reading package lists… Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
docker@iZrj97lwnw8icduzt0p0miZ:/root$
Excuse my ignorance, but wouldn’t it be better to remove npm and install through docker?
oh yes, sure. Using docker will be much easier!
Do you need help with it, or can you google - ask AI for the steps ?
I tested and docker and docker compose are installed, and I created the n8n folder and created the docker-compose.yml file inside the folder, but when I tried to apply the permissions I got the following error: root@iZrj97lwnw8icduzt0p0miZ:/# chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
chmod: cannot access ‘/cli-plugins/docker-compose’: No such file or directory
the error says there is no /cli-plugins/docker-compose file or directory.
Do you remember where you downloaded it?
Also I don’t understand why you’re using $DOCKER_CONFIG for the command. Use simply chmod +x /folder/file on the correct path.
I copied this command from Google’s artificial intelligence, I know almost nothing about Linux permissions, I think that’s why I can’t do it, I did it on Docker Desktop on Windows 11 without any problems, and it worked the first time, will I be able to use the same docker-compose.yml file from Windows on Linux? Thanks for your attention
Hello @Afonso_Campos ,
I think you container is in a reboot loop
Can you run:
docker d4a6a logs
And check for any errors
Okay that’s better now
Check if your firewall allows incoming connection to port 5678
Did you access the link? I already released the incoming port 5678 on my TCP computer, but it didn’t open.
Hello, I managed to solve the problem of only restarting, it was the outdated node.js, now I am not able to access this link: , could you see for me if it is opening? thanks
Hello, I managed to solve the problem of only restarting, it was the outdated node.js, now I am not able to access the link in the post, could you see for me if it is opening? Thanks
The link doesn’t work, the port is still closed.
Is it a vm on a cloud or a home pc ?