Jun 5, 2023 4 min read

How to Install Strapi on Ubuntu 18.04

Install Strapi CMS on Ubuntu 18.04 with our step-by-step tutorial. It is a flexible system that simplifies content creation and management.

Install Strapi API on Ubuntu 18.04
Table of Contents

Choose a different version or distribution

Introduction

Before we begin talking about how to install Strapi CMS on Ubuntu 18.04, let’s briefly understand – What is Strapi?

Strapi CMS is a powerful and flexible content management system designed to streamline the process of creating and managing digital content. It offers an easy-to-use interface and allows developers to build APIs quickly. Strapi CMS is SEO friendly, enabling websites to rank higher on search engine result pages.

With its customizable features and extensive plugin library, it provides developers with the flexibility to create unique and tailored solutions. Whether you're a small business or a large enterprise, Strapi CMS is a reliable and efficient tool to enhance your content management and improve your online presence.

In this tutorial, you will install Strapi on Ubuntu 18.04. We will also address a few FAQs related to the Strapi.

Advantages of Strapi

  1. Flexible: Strapi offers a highly adaptable architecture, allowing developers to customize and tailor their content management systems.
  2. Easy-to-use: Its user-friendly interface makes it simple to create and manage digital content without extensive technical knowledge.
  3. Scalable: Strapi is built to handle projects of any size, from small websites to large enterprise applications.
  4. Extensive plugin library: It provides a wide range of plugins that enhance functionality and extend the capabilities of the CMS.
  5. SEO friendly: Strapi incorporates SEO best practices, helping websites rank higher on search engine result pages and improve visibility.

The following packages will be set in the course of this tutorial:

  • MongoDB
  • Node.js 10

Step 1 – Install essentials packages.

In order to install Strapi on Ubuntu, you need to have certain dependencies. For this, you have to install Node.js and npm, which will make the installation of the dependencies easier.

1) Firstly, you'll have to install the following curl and git packages.

sudo apt update
sudo apt install curl git

2) Run the commands given below to add the Node.js repositories along with keys to your system. After this, install some core packages to set up the environment.

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

sudo apt-get update

sudo apt-get install nodejs yarn zlib1g-dev build-essential libpq-dev libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev

3) You can verify the installation with the help of the following command.

node -v
npm -v

Step 2 – Install Node.js

1) The following commands need to be run to install the Node.js. Post installing Node.js repositories, install Node.js package.

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

sudo apt-get install -y nodejs

Step 3 – Install MongoDB

1) Strapi uses the MongoDB database. Therefore, MongoDB and ImageMagic needs to be installed before continuing.

sudo apt install mongodb
npm install mongodb --save

2) Once you have installed MongoDB server, open a new terminal window.

3) Now start MongoDB server with the help of the following command

sudo systemctl start mongodb

Step 4 – Install Strapi

1) Once the environment is ready, you can start installing Strapi and build your first website with the help of the following commands:

sudo npm install strapi@alpha -g

sudo npm install pm2 -g

2) Now, create a new strapi folder/project.

cd ~
strapi new myproject

3) Choose "Custom" and press Enter to answer the configuration question, opting for all the default options.

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

4) After all the questions have been answered, the generator will prepare the skeleton for your app. Install and configure npm dependencies as required.

cd myproject
npm install --production
strapi build

5) Once you're done, run the following command to start the server from the Strapi folder.

NODE_ENV=production pm2 start config/server.js --name api

Alternatively, you can use:

strapi start

6) In case the above commands don't work, open your browser, browse to the hostname followed by 1337.

http://localhost:1337

http://localhost:1337 should enable you to access your Strapi.

7) You can stop the server by using Ctrl+C.

8) Now, login to the back-end to begin creating content.

9) Use the credentials for admin.

Strapi Admin Login

10) You can now kick-start creating content.

Strapi Admin Dashboard

You now have successfully installed Strapi on Ubuntu 18.04.

FAQs to Install Strapi CMS on Ubuntu 18.04

How do I start the Strapi server on Ubuntu 18.04?

Move into your project directory and run the following command: npm run develop

How do I configure the database connection for Strapi CMS?

Strapi CMS automatically detects and connects to the configured database during the installation process.

Can I customize the Strapi CMS installation on Ubuntu 18.04?

Yes, Strapi CMS provides extensive customization options, including adding plugins, creating content types, and modifying API endpoints.

Is there a community or support available for Strapi CMS?

Yes, Strapi has an active community forum where you can seek help, share ideas, and get support from fellow users and developers.

Can I extend the functionality of Strapi CMS with custom plugins?

Absolutely! Strapi provides a robust plugin system that allows developers to create and integrate custom plugins to extend the functionality and meet specific project requirements.

Is it possible to run Strapi CMS in a production environment?

Absolutely! Strapi CMS is designed to be used in production environments. However, it's recommended to follow security best practices and configure appropriate settings to ensure a secure and stable deployment.

Conclusion

We hope this detailed tutorial helped you understand how to install Strapi on Ubuntu 18.04 server. To learn more about Strapi installation on Ubuntu 18.04 server, check out the official Strapi installation document.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.