How to Install YOURLS on Linux Mint Latest

YOURLS is a self-hosted URL shortener that allows you to create custom shortened links. It is a configurable and easy-to-use software that is perfect for anyone who wants to manage their own short links. In this tutorial, we will guide you to install YOURLS on your Linux Mint system.

Requirements

Before you begin, make sure you have the following:

Steps to Install YOURLS on Linux Mint

Follow the below-given steps to install YOURLS on your Linux Mint system:

Step 1: Install Required Packages

Execute the given command in your terminal to install the required packages on your system:

sudo apt install unzip curl php-curl php-mysql php-gd mariadb-server mariadb-client

Step 2: Create Database

Now, you have to create a database for YOURLS. Execute the following commands to log in to the MySQL shell and create a database:

sudo mysql -u root -p
CREATE DATABASE yourls_db;
GRANT ALL PRIVILEGES ON yourls_db.* TO 'yourls_user'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit;

Make sure to replace 'yourls_user' and 'password' with the desired values.

Step 3: Download and Extract YOURLS

Execute the below-given command in your terminal to download and extract YOURLS code:

cd /var/www/html
sudo wget https://github.com/YOURLS/YOURLS/archive/refs/tags/1.7.10.zip
sudo unzip 1.7.10.zip
sudo mv YOURLS-1.7.10 yourls
sudo rm 1.7.10.zip

Make sure to replace the latest release tag in the above command with the latest available version.

Step 4: Configure YOURLS

Go to the YOURLS directory and copy the config-sample.php file as config.php:

cd yourls/
sudo cp config-sample.php config.php

Then, open the config.php file in a text editor and update the following variables according to your setup:

define( 'YOURLS_DB_USER', 'yourls_user' );
define( 'YOURLS_DB_PASS', 'password' );
define( 'YOURLS_DB_NAME', 'yourls_db' );
define( 'YOURLS_SITE', 'http://yourdomain.com' );
define( 'YOURLS_HOURS_OFFSET', '0' );
define( 'YOURLS_LANG', '' );
define( 'YOURLS_UNIQUE_URLS', true );
define( 'YOURLS_COOKIE_KEY', 'enter your secret here' );
define( 'YOURLS_USER', 'yourls' );
define( 'YOURLS_PASS', 'password' );

Make sure to update the database credentials, site URL, cookie key, and login details in the above example.

Step 5: Configure Apache

Open the Apache configuration file in a text editor:

sudo nano /etc/apache2/sites-available/yourls.conf

Add the following code to the file:

<VirtualHost *:80>
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com

    DocumentRoot /var/www/html/yourls
    <Directory /var/www/html/yourls/>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/yourls_error.log
    CustomLog ${APACHE_LOG_DIR}/yourls_access.log combined
</VirtualHost>

Make sure to replace the 'yourdomain.com' with your own domain name and document root path.

Then, enable the virtual host and restart Apache:

sudo a2ensite yourls.conf
sudo systemctl restart apache2

Step 6: Access YOURLS

Now, open your web browser and go to the following URL:

http://yourdomain.com/admin/

Replace 'yourdomain.com' with your own domain name. You will see the login page of YOURLS.

Use the login details that you set in the config.php file and login to the YOURLS dashboard.

Conclusion

In this tutorial, we have explained how to install YOURLS on Linux Mint. If you followed the above-given steps correctly, you should now have a working installation of YOURLS on your Linux Mint system.

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!