How to Install Simple-URL-Shortener on EndeavourOS Latest

Simple-URL-Shortener is a free and open-source URL shortening service that can be easily installed on your EndeavourOS Linux system. It allows you to create custom short URLs for your long and complex URLs. In this tutorial, we will guide you through the installation process of Simple-URL-Shortener on EndeavourOS latest using the command-line interface.

Prerequisites

Before we begin with the installation process, make sure you have the following prerequisites in place:

Step 1: Update the System

First, we need to update the system to the latest state. Open the terminal using the keyboard shortcut ctrl + alt + t and execute the following command:

sudo pacman -Syu

Read the output of the command carefully and follow the on-screen instructions to complete the upgrade process.

Step 2: Install Required Dependencies

Next, we need to install the required dependencies for Simple-URL-Shortener. To do that, execute the following command into the terminal:

sudo pacman -S git nginx sqlite \
php php-fpm php-sqlite

This command will install Git, Nginx web server, SQLite database, PHP parser, and PHP-FPM, and the PHP-SQLite module on your EndeavourOS system, which are required dependencies for Simple-URL-Shortener to work correctly. Type Y and press Enter to confirm the installation.

Step 3: Clone Simple-URL-Shortener Repository

Now, we will clone the Simple-URL-Shortener repository from GitHub using the Git version control system. Execute the following command into the terminal:

git clone https://github.com/azlux/Simple-URL-Shortener.git

This command will download the Simple-URL-Shortener source code from the GitHub repository and save it into the Simple-URL-Shortener directory in your current working directory.

Step 4: Configure Nginx Server Blocks

Next, we need to configure the Nginx virtual server blocks to serve the Simple-URL-Shortener. Execute the following command to create a new virtual server block configuration file for Simple-URL-Shortener:

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

This command will open the Nano text editor with the new configuration file. Copy the following Nginx server block configuration into the file:

server {
    listen   80;
    server_name  your_domain.com;
    root   /home/your_username/Simple-URL-Shortener/public/;
    index  index.php;

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

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

Replace the your_domain.com and your_username with your own domain name and username respectively. Press ctrl + x followed by y and Enter to save and exit the text editor.

Step 5: Enable PHP-FPM

We need to enable the PHP-FPM service so that it starts automatically on system boot. Execute the following command:

sudo systemctl enable php-fpm.service

Step 6: Create a SQLite Database

Let's create the SQLite database for Simple-URL-Shortener. Execute the following command:

cd Simple-URL-Shortener/
cp config.ini.example config.ini
nano config.ini

This command will create a copy of the configuration file and open it using the Nano text editor. Replace the default values with your own values, such as CUSTOM_CODE and YOUR_PASSWORD. Press ctrl + x followed by y and Enter to save and exit the text editor.

Create a new SQLite database file using the following command:

sqlite3 shortener.db .quit

This command will create the SQLite database file named shortener.db in your current working directory.

Step 7: Migrate the Database

We need to migrate the database schema to the newly created database. Execute the following command:

php migration.php

This command will migrate the database schema to the SQLite database.

Step 8: Start Nginx and PHP-FPM Services

Finally, we need to start the Nginx and PHP-FPM services to apply the changes made so far. Execute the following command:

sudo systemctl start nginx.service php-fpm.service

And that's it! You have successfully installed and configured Simple-URL-Shortener on your EndeavourOS Latest system. You can now access Simple-URL-Shortener using your domain name in a web browser.

Conclusion

In this tutorial, we have shown you how to install Simple-URL-Shortener on EndeavourOS latest Linux system. We have also covered the necessary prerequisites, cloning the source code, configuration of Nginx, SQLite database, database migration, and starting the Nginx and PHP-FPM services. We hope that this tutorial was helpful to you.

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!