Install Sails.js on Ubuntu: A Step-by-Step Guide
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.
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 simple. You’ll make a new folder for your project and use the Sails command tool to set up your app’s basic 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.

Create Sails systemd service
Making your Sails app start automatically after your Ubuntu server restarts is easy with a systemd service file. This file makes sure your app runs on its own after a reboot, so you don’t have to start it manually.
sudo nano /etc/systemd/system/geek-app.service
Paste the following into the file. Replace $USER with your actual system username:
[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, it’s a good idea to run your Sails app behind a reverse proxy, like Nginx or Apache. This helps manage incoming traffic safely and efficiently.
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:
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?
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.
No comments yet — be the first to share your thoughts!