Strapi install on Debian 12
Strapi is an open-source headless content management system (CMS) and content management framework that allows developers to build and manage digital content for websites, mobile apps, and other digital platforms. It is designed to provide flexibility, customization, and scalability for content management and delivery.
Here are some key features and aspects of Strapi:
- Headless CMS: Strapi follows the headless CMS approach, which means it separates the content management and content delivery layers. This allows developers to use any front-end technology (such as React, Vue.js, or Angular) to display content retrieved from Strapi through APIs.
- Open Source: Strapi is open-source software released under the MIT license, which means it is free to use, modify, and distribute. The open-source nature of Strapi encourages community contributions and innovation.
- Customizable Content Types: Strapi allows you to define your own content types with custom fields and data structures to fit the specific needs of your project. You can create content types for articles, products, blog posts, and more, and define the fields and relationships between them.
- GraphQL and REST APIs: Strapi provides both GraphQL and REST APIs out of the box. This makes it easy for developers to retrieve and manipulate content programmatically, offering flexibility in how data is accessed.
- User Authentication and Roles: Strapi includes user authentication and role-based access control (RBAC) features. You can define user roles and permissions to control who can create, edit, or delete content within the system.
- Plugins and Extensions: Strapi has a rich ecosystem of plugins and extensions that can be used to extend its functionality. You can find pre-built plugins for tasks like image optimization, email notifications, and more, or create your own custom plugins.
- Database Support: Strapi supports multiple databases, including PostgreSQL, MySQL, SQLite, and MongoDB, giving you the flexibility to choose the database that best suits your project’s requirements.
- Webhooks: Strapi allows you to set up webhooks to trigger actions or notifications when specific events occur in your content management system. This is useful for automating workflows and integrating with other services.
- Internationalization (i18n): Strapi supports multilingual content, making it suitable for projects that target a global audience by providing translations and localization features.
- Community and Support: Strapi has an active and growing community of developers and users. You can find documentation, tutorials, and community-contributed resources to help you get started and troubleshoot issues.
Strapi has gained popularity as a versatile and developer-friendly CMS, especially for projects that require customized content structures and dynamic data delivery to various front-end platforms. It offers the flexibility to adapt to a wide range of use cases, from small websites to large-scale applications.
Install prequisites
apt install mariadb-client mariadb-server apt install nodejs npm
Check versions
MariaDB
mariadb --version
mariadb Ver 15.1 Distrib 10.11.3-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
node.js
node --version
v18.13.0
Node Package Manager
npm --version
9.2.0
Create projects folder
All files will be saved in this folder
mkdir ~/Strapi
Set environment
Set node.js to resolve by ipv4 first
vi ~/.bashrc
# node.js
export NODE_OPTIONS="--dns-result-order=ipv4first"
Log out and log in to apply
env | grep NODE
NODE_OPTIONS=--dns-result-order=ipv4first
Create database
mysql -u root -p -e "CREATE DATABASE my_project_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
Create database user
mysql -u root -p -e "GRANT ALL PRIVILEGES ON my_project_db.* TO 'my_project'@'localhost' IDENTIFIED BY 'VERY_SECRET_PASSWORD';"
Install Strapi
Go to your projects folder
cd ~/Strapi
Run the installer
npx create-strapi-app@latest my-project
Choose „Custom installation type“ and select „mysql database client“
Finished!
Log in to http://localhost:1337
Change Strapi port
Go to projects folder
cd ~/Strapi/my-project
Edit .env
vi .env
PORT=1338
Edit server.js
vi config/server.js
port: env.int('PORT', 1338),
Build package
npm run build
Start Strapi
npm run develop
See also
www.strapi.io Open Source Node.js Headless CMS