# Install n8n - Open Source Workflow Automation - on Windows

## What is n8n?

> n8n is an extendable workflow automation tool. With a fair-code distribution model, n8n will always have visible source code, be available to self-host, and allow you to add your own custom functions, logic and apps. n8n's node-based approach makes it highly versatile, enabling you to connect anything to everything. -https://github.com/n8n-io/n8n

## Installing n8n

1. Log into the Windows device
2. Download NodeJS Download
3. Install NodeJS > During the install, make sure to check the Tools for Native Modules option
4. At the Native Modules prompt, press any key to begin the installation process
   NOTE: This process takes quite a while to install, be patient. Proceed once the PowerShell window closes
5. Open File Explorer and navigate to C:\Windows\System32\LogFiles\WMI
6. Right click on RtBackup > Properties > Security tab > Click Advanced
7. Click the Change option next to the Owner field > Type administrators > Click OK
8. Check the Replace all child objects box > Click OK
9. Click Yes to confirm
10. Click OK on all open dialog windows
11. Launch PowerShell as an administrator
12. Run the following commands in the PowerShell window
    # install n8n
    npm install n8n --location=global
    # test run n8n
    npx n8n
13. If n8n errors out with a permissions issue, back in File Explorer, navigate to C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\Windows\INetCache
14. Right click on Content.IE5 > Properties > Security tab > Click Edit...
15. Select the Everyone entry > Click Remove
16. Click OK on all open dialog windows
17. Click on the Start Button > Type task > Launch Task Scheduler
18. Right click the Task Scheduler Library folder in the left pane > Create Basic Task...
19. Set the name to n8n and optionally set a Description > Click Next
20. For the Trigger, select When the computer starts > Click Next
21. For the Action, select Start a program > Click Next
22. Complete the form fields as follows:

    Program/script: "%ProgramFiles%\nodejs\npx.cmd"
    Add arguments: n8n

23. Click Next
24. Check the Open the Properties dialog checkbox > Click Finish
25. In the Properties dialog, select Run whether user is logged on or not
26. Check the Run with highest privileges box > Click OK to create the scheduled task
27. Right click the n8n task > Run
28. Open a web browser and navigate to http://DNSorIP:5678
29. Complete the form with an email, first name, last name and password > Click next
30. Complete the questionnaire > Click continue
31. Click Get started
32. Welcome to n8n

By default, the n8n database and configuration file live in the user's profile .n8n folder (ie C:\Users\i12bretro\.n8n). To utilize a database other than SQLite, setup the database and authentication, then create a .bat file like the example below and call the .bat file as the action of the scheduled task.

`SET DB_TYPE=mysqldb
SET DB_MYSQLDB_DATABASE=n8n
SET DB_MYSQLDB_HOST=localhost
SET DB_MYSQLDB_USER=n8n_rw
SET DB_MYSQLDB_PASSWORD=n8n_N8N!
SET GENERIC_TIMEZONE=America/New_York
"%programfiles%\nodejs\npx.cmd" n8n`

Source: https://docs.n8n.io/hosting/installation/npm/