This article is outdated and may not work correctly for current operating systems or software.
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.
Run the following commands to install NodeJS:
curl -sL https://deb.nodesource.com/setup_10.x | 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
sudo apt-get install build-essential
Import the MongoDB GPG key to your system:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
Once the key is imported, create a list file run:
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu 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:
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 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: 127.0.0.1 ? +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:
Now that Strapi server is started you can register your first user by going to