2.10.5. Install and update n8n

Important points:

  • For business hosting only.
    • A 4G or higher plan is recommended; errors may occur with a 2G plan due to the high RAM requirements of n8n.
  • Minimum Node.js version — 20 or higher.
  • This article describes how to launch with the minimum required set of parameters. For a description of all parameters, see the official documentation.

n8n — open-source platform for automating various processes and interacting with external services.

  1. In the "Linux configuration" section, set Node.js 20 or higher.
  2. Connect to the hosting via SSH.
  3. Go to the site directory:
    cd ~/example.com/www
  4. Install n8n:
    npm install n8n
  5. Install SSL certificate (if not installed).
  6. In the "Site settings" section, set the following settings:
    • "Web server" — "Node.js".
    • "Node.js version" — 20 or higher.
    • "Traffic proxying" — "By IP address".
  7. Create environment for launching n8n:
    1. In the site root directory, create the .env file with the following environment parameters:
      N8N_LISTEN_ADDRESS=123.45.67.89
      N8N_PORT=3000
      N8N_HOST=example.com
      WEBHOOK_URL=https://example.com/
      N8N_PROXY_HOPS=1
      N8N_USER_FOLDER=
      
      N8N_RUNNERS_ENABLED=true
      N8N_RUNNERS_MODE=internal
      N8N_RUNNERS_BROKER_LISTEN_ADDRESS=123.45.67.89
      N8N_RUNNERS_BROKER_PORT=3001
      
      N8N_SMTP_HOST=mail.adm.tools
      N8N_SMTP_PORT=465
      N8N_SMTP_USER=admin@example.com
      N8N_SMTP_PASS=password
      N8N_SMTP_SENDER=admin@example.com
      
      DB_SQLITE_POOL_SIZE=2
      N8N_BLOCK_ENV_ACCESS_IN_NODE=true
      N8N_GIT_NODE_DISABLE_BARE_REPOS=true

      In the file, use your own data:

      • Launch parameters:
        • N8N_LISTEN_ADDRESS — IP address from the "Node.js settings" section.
        • N8N_PORT — port from the "Node.js settings" section.
        • N8N_HOST — domain of your site.
        • WEBHOOK_URL — URL of your site.
      • Data storage:
        • N8N_USER_FOLDER — path for placing the .n8n directory, which stores user data such as databases and encryption keys (empty value = site root directory, which is useful for backups).
      • Runner settings:
        • N8N_RUNNERS_BROKER_LISTEN_ADDRESS — IP address from the "Node.js settings" section.
      • Sending mail:
    2. In site root directory, create the package.json file with the following content:
      {
        "name": "n8n-app",
        "version": "1.0.0",
        "scripts": {
          "start": "./node_modules/n8n/bin/n8n"
        },
        "dependencies": {
          "n8n": "^2.4.7"
        }
      }
  8. In the runner code, replace 127.0.0.1 with the variable so that the runner uses the correct IP address during operation:
    sed -i 's/127\.0\.0\.1/${this.runnerConfig.listenAddress}/g' ./node_modules/n8n/dist/task-runners/task-runner-process-base.js
  9. In the "Node.js settings" section, restart the app.
  10. Open your site in a browser and register as an administrator.
  11. Check the n8n operation.
  1. Connect to the hosting via SSH.
  2. Go to the site directory:
    cd ~/example.com/www
  3. Update n8n:
    npm update n8n
  4. In the runner code, replace 127.0.0.1 with the variable so that the runner uses the correct IP address during operation:
    sed -i 's/127\.0\.0\.1/${this.runnerConfig.listenAddress}/g' ./node_modules/n8n/dist/task-runners/task-runner-process-base.js
  5. In the "Node.js settings" section, restart the app.
  6. Check the n8n operation.
Content

    (1)

    Comments

    ztpimenov
    Привіт Ukraine! Додайте спосіб оновлення якийсь простий будь-ласка. Дякую!
    andre13161
    є простий варіант можливо якийсь?
    karlov
    Стаття оновлена. Тепер у ній описано порядок дій щодо встановлення актуальної версії 2 та додано інформацію про оновлення версії в межах мажорної. Також версію 2 тепер можна встановлювати автоматично.
    andre13161
    Вітаю. Теж думаю як оновитись((
    karlov
    У статтю додана інформація щодо оновлення в межах мажорної версії.
    andre13161
    Дякую вам дуже !!!