Skip to content
Follow
Ubuntu Linux

Install Sails.js on Ubuntu: A Step-by-Step Guide

Richard
Written by
Richard
Oct 10, 2022 Updated Apr 18, 2026 2 min read
How to Enable or Disable Microsoft Defender Cloud Protection
How to Enable or Disable Microsoft Defender Cloud Protection

You can install Sails.js on Ubuntu to build powerful, professional web applications quickly.

Sails.js is a popular, open-source MVC (Model-View-Controller) framework for Node.js that streamlines the development of data-driven APIs and real-time applications. It provides a convention-over-configuration approach, meaning you spend less time setting up and more time coding.

This guide walks you through installing Sails.js on Ubuntu, ensuring you’re ready to create your first application. By following these steps, you’ll have a functional Sails.js environment set up, allowing you to access your new web application directly from your browser.

⚡ Quick Answer

Install NVM, then use it to install Node.js LTS. Install Sails globally with `npm -g install sails`. Create a new app with `sails new my-app`, navigate to it, and run `sails lift` to start it.

Install NVM

Node Version Manager (NVM) lets you manage different versions of Node.js easily. Run this command to install the latest stable NVM version:

curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh -o install_nvm.sh | bash install_nvm.sh

Next, update your bash profile:

source ~/.bashrc

Install Node.js

Now, use NVM to install the current Active LTS version of Node.js:

nvm install --lts

Install Sails.js

With Node.js ready, install Sails globally on your system:

npm -g install sails

Check the installation by running:

sails --version

Create Sails app

Creating a Sails app on Ubuntu is straightforward; you’ll start by making a new project folder and using the Sails command-line tool to generate your application structure.

sails new geek-app

Select “Web App” when prompted. Navigate into your folder, install dependencies, and start the app:

cd geek-app
npm install
sails lift

Check the official Sails.js documentation for current database adapter compatibility and potential Docker deployment alternatives. Open your browser to http://localhost:1337 to see your app.

Terminal window showing the installation process of Sails.js on Ubuntu Linux
ubuntu linux install sails js web portal

Create Sails systemd service

To make your Sails app start automatically when your Ubuntu server restarts, you’ll create a systemd service file, which ensures your application runs without manual intervention after a reboot.

sudo nano /etc/systemd/system/geek-app.service

Paste the following into the file. Replace $USER with your actual system username:

💻Code
[Unit]
Description=Sails.js App
After=network.target

[Service]
Type=simple
User=$USER
WorkingDirectory=/home/$USER/geek-app
ExecStart=/bin/bash -c "source /home/$USER/.nvm/nvm.sh && npm start"
Restart=on-failure

[Install]
WantedBy=multi-user.target

Reload the system and start your service:

sudo systemctl daemon-reload
sudo systemctl enable geek-app --now

You can now manage your app with sudo systemctl stop geek-app or sudo systemctl start geek-app.

Using reverse proxy

For a production setup on Ubuntu, running your Sails app behind a reverse proxy like Nginx or Apache is recommended to handle incoming traffic efficiently and securely.

How to set up a reverse proxy with Nginx

How to set up a reverse proxy with Apache

You may also secure your site with Let’s Encrypt:

Set up Let’s Encrypt with Nginx

Set up Let’s Encrypt with Apache

Conclusion

You have successfully installed Sails.js and configured it to run as a background service on Ubuntu. Your environment is now ready for professional web development.

[Unit] [Service] [Install] [22377] [22377] [22377] [22377] [22377] [22377] [22377] [22377] [22377]

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Install ClamAV Linux Antivirus on Ubuntu Linux
Ubuntu Linux How to Install ClamAV Linux Antivirus on Ubuntu Linux
How to Install BoxBilling with Apache on Ubuntu Linux
Ubuntu Linux How to Install BoxBilling with Apache on Ubuntu Linux
How to Install LibreOffice on Ubuntu Linux
Ubuntu Linux How to Install LibreOffice on Ubuntu Linux
How to Install Bitwarden on Ubuntu Linux
CMS How to Install Bitwarden on Ubuntu Linux

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *