How to Install Directus on Ubuntu 24.04
A Headless CMS (Content Management System) is a content management system that separates the backend from the frontend. Unlike traditional CMS platforms (such as WordPress or Joomla), which combine content with the web display, a headless CMS provides only a backend for managing content and an API to access it. The frontend, or display, is entirely separate and can be developed using any technology, such as JavaScript, mobile applications, or even IoT platforms. Headless CMSs are popular among developers due to their flexibility and ability to integrate content across various platforms and devices.
Directus is an open-source headless CMS based on Node.js. Its main advantages are flexibility and ease of use for building modern content management systems. This platform not only provides a user-friendly admin interface but also supports GraphQL and REST APIs, making data access convenient for any frontend application.
With Directus, you can create various types of applications, including:
- Dynamic websites and blogs
- Content-based mobile applications
- Internal applications for company data management
- Community portals or simple CRM systems
Install Directus
Directus is installed on top of Docker containers. Install Docker and Docker Compose first if they are not yet available:
1 | sudo sh -c "curl -fsSL https://get.docker.com/ | sh" |
Create a directory to store the Directus project:
1 2 | mkdir directus cd directus |
Creating the required directory:
1 | mkdir mariadb_data database_data uploads_data extensions_data |
Create a docker-compose.yml
file:
1 | nano docker-compose.yml |
Enter the configuration:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | services: mariadb: image: mariadb:10.6 container_name: mariadb environment: MYSQL_ROOT_PASSWORD: rahasia MYSQL_DATABASE: directus MYSQL_USER: directus MYSQL_PASSWORD: rahasia volumes: - mariadb_data:/var/lib/mysql networks: - directus directus: image: directus/directus:11.1.1 container_name: directus environment: SECRET: "randomstringsecretkey" ADMIN_PASSWORD: "rahasia" DB_CLIENT: "mysql" DB_HOST: "mariadb" DB_PORT: "3306" DB_DATABASE: "directus" DB_USER: "directus" DB_PASSWORD: "rahasia" WEBSOCKETS_ENABLED: "true" PUBLIC_URL: "http://localhost:8055" ports: - 8055:8055 volumes: - database_data:/directus/database - uploads_data:/directus/uploads - extensions_data:/directus/extensions depends_on: - mariadb networks: - directus networks: directus: volumes: mariadb_data: database_data: uploads_data: extensions_data: |
The docker-compose.yml configuration above will create MariaDB and Directus containers.
Run docker-compose to start building the container:
1 | sudo docker-compose up -d |
After the process is complete, Directus can be accessed at http://localhost:8055. Log in using the email and password that you have set in the docker-compose.yml.