How to Install Strapi on Ubuntu 16.04

Published on: Fri, Jan 18, 2019 at 11:14 am EST
Linux Guides Node.js Ubuntu


Strapi is an open source NodeJS Content Management Framework dedicated to build secure and scalable production-ready API applications and services. In this tutorial, you will learn how to deploy a Strapi project for production on a clean Ubuntu 16.04 server.


  • A newly deployed Ubuntu 16.04 server instance
  • A non-root user account with sudo privileges
  • NodeJS version 10.x or greater. NodeJS is a server platform which runs JavaScript
  • NPM version 6.x or greater. NPM is the package manager for Javascript.
  • MongoDB version 3.x or greater. MongoDB is a powerful document store.

Install NodeJS and NPM

Run the following commands to install NodeJS:

curl -sL | sudo -E bash -
sudo apt-get install nodejs

Check the Node and NPM versions:

node -v && npm -v
# v10.x.x
# 6.x.x

In order for some NPM packages to work, you will need to install the build-essential package:

sudo apt-get install build-essential

Install MongoDB

Import the MongoDB GPG key to your system:

sudo apt-key adv --keyserver hkp:// --recv 0C49F3730359A14518585931BC711F9BA15703C6

Once the key is imported, create a list file run:

echo "deb [ arch=amd64,arm64 ] xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

Reload the packages list:

sudo apt-get update

Install MongoDB packages:

sudo apt-get install -y mongodb-org

Start the MongoDB daemon:

sudo service mongod start

Connect to the MongoDB shell:


Create a MongoDB database with your chosen project name:

use my-api-project

Install Strapi

Run the following commands to install Strapi globally:

npm install strapi@alpha -g

Once the installation has completed, check that the installation went well:

strapi -v
# 3.0.0-alpha.x.

Create a project

Create your first project:

strapi new my-api-project

Answer the following prompts accordingly. In our example, we will choose MongoDB as our main database, enter the database name that was created previously and press ENTER to select the default options. It will look as follows:

Lets configurate the connection to your database:
? Choose your main database: MongoDB
? Database name: my-api-project
? Host:
? +srv connection: false
? Port (It will be ignored if you enable +srv): 27017
? Username:
? Password:
? Authentication database (Maybe "admin" or blank):
? Enable SSL connection: false

This will create a new folder named my-api-project with the entire file structure of a Strapi application.

Start your server:

strapi start

Now that Strapi server is started you can register your first user by going to http://your_server_ip:1337/admin.

Want to contribute ?

You could earn up to $300 by adding new articles