How to Install Typemill on Fedora CoreOS Latest?

Introduction

Typemill is a lightweight flat-file CMS designed for authors and focused on writing. It comes with a beautiful and intuitive user interface that makes it easy to create and edit content. In this tutorial, we will show you how to install Typemill on Fedora CoreOS (FCOS). FCOS is a minimal, container-focused operating system designed for clusters and cloud deployments.

Prerequisites

Before we proceed, you need to have the following:

Step 1: Install PHP and Required Modules

Typemill is written in PHP, so we need to install PHP and its required modules first. Open your terminal and SSH into your FCOS instance. Then, run the following commands:

sudo rpm-ostree install php php-json php-mbstring php-xml php-pdo php-opcache
sudo systemctl restart php-fpm

These commands will install PHP and modules required by Typemill, and restart the PHP FastCGI Process Manager (php-fpm) service.

Step 2: Install Nginx Web Server

Typemill requires a web server to serve its pages. We will use Nginx as our web server. To install Nginx, run the following command:

sudo rpm-ostree install nginx
sudo systemctl enable nginx
sudo systemctl start nginx

These commands will install Nginx and enable it to start automatically on boot. The last command will start the Nginx service.

Step 3: Create a Virtual Host Configuration for Typemill

We need to create a virtual host configuration for Typemill in Nginx. This configuration will tell Nginx to send requests to Typemill when a specific domain name is requested. To create the virtual host configuration file, run the following command:

sudo nano /etc/nginx/conf.d/typemill.conf

This will open a new file in the Nano text editor. Copy and paste the following configuration into the file:

server {
    listen 80;
    server_name your-domain-name.com;
    root /var/www/typemill/public;
    index index.php;

    access_log /var/log/nginx/typemill_access.log;
    error_log /var/log/nginx/typemill_error.log;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass unix:/run/php-fpm/www.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}

Replace your-domain-name.com with your own domain name, or the IP address of your server. Save and close the file by pressing Ctrl + X, then y, and then Enter.

This configuration sets up the virtual host to listen on port 80, and to send requests to the /var/www/typemill/public directory. It also logs access and error messages to the /var/log/nginx/typemill_access.log and /var/log/nginx/typemill_error.log files, respectively.

Step 4: Download and Install Typemill

The next step is to download and install Typemill. For this, we will use the wget command to download a ZIP file of Typemill, then extract it to the /var/www/typemill directory. Run the following commands:

sudo wget https://github.com/typemill/typemill/releases/download/v1.3.3/typemill-v1.3.3.zip
sudo unzip typemill-v1.3.3.zip -d /var/www/typemill

These commands will download Typemill version 1.3.3 and extract it to the /var/www/typemill directory.

Step 5: Set Permissions for Typemill

We need to set the correct permissions for Typemill to function properly. Typemill requires the www-data user to have write permissions to certain directories. Run the following commands to set the permissions:

sudo chown -R nginx:nginx /var/www/
sudo chmod -R 755 /var/www/
sudo chmod -R 777 /var/www/typemill/temp
sudo chmod -R 777 /var/www/typemill/content

These commands will set the ownership and permissions for the Typemill files and directories.

Step 6: Start Typemill

Now that we have installed and configured Typemill, we can start it by launching the php command-line interface (CLI). Run the following command:

php /var/www/typemill/bin/typemill start

This will start Typemill on the default port 8000. You can confirm that Typemill is running by visiting http://your-domain-name.com:8000/ in your web browser.

Step 7: Create a Systemd Service for Typemill

To run Typemill as a service on FCOS, we will create a systemd service unit file. This will enable us to start, stop, and restart Typemill using systemctl. Run the following command to create the service unit file:

sudo nano /etc/systemd/system/typemill.service

This will open a new file in the Nano text editor. Copy and paste the following configuration into the file:

[Unit]
Description=Typemill Flat-File CMS
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/php /var/www/typemill/bin/typemill start
ExecStop=/usr/bin/php /var/www/typemill/bin/typemill stop
ExecReload=/usr/bin/php /var/www/typemill/bin/typemill restart
Restart=always
User=nginx
Group=nginx

[Install]
WantedBy=multi-user.target

Save and close the file by pressing Ctrl + X, then y, and then Enter.

This configuration sets up Typemill as a simple service that can be started, stopped, or restarted using systemctl. The service will restart automatically if it crashes or if the server reboots. It also runs as the nginx user and group, which is consistent with the file permissions we set earlier.

To use the new systemd service, reload the systemd configuration and enable the Typemill service:

sudo systemctl daemon-reload
sudo systemctl enable typemill

This will reload the systemd configuration and enable Typemill to start automatically on boot.

Conclusion

Congratulations! You have successfully installed Typemill on Fedora CoreOS and configured it to run as a service using systemd. Typemill is now running as a flat-file CMS on your server, ready to serve your content. You can log in to Typemill by visiting http://your-domain-name.com/ in your web browser, and start creating content.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!