YOURLS is a free and open-source URL shortener software that allows you to create your own URL shortener website. In this tutorial, we will guide you through the process of installing YOURLS on Kali Linux.
Before proceeding with this tutorial, make sure you have the following prerequisites:
First, download the latest version of YOURLS from the official website. You can either use the following command to download it directly from the terminal or download it manually from the website.
wget https://github.com/YOURLS/YOURLS/archive/refs/tags/1.7.12.tar.gz
Before proceeding with the installation, we need to install some dependencies on Kali Linux. Run the following commands to install them:
sudo apt install php7.2-curl php7.2-mysql php7.2-sqlite3 php7.2-mbstring
Next, we need to configure the Apache web server to serve the YOURLS website.
Edit the Apache2 configuration file with the following command:
sudo nano /etc/apache2/sites-available/yourls.conf
Add the following configuration to the file and save it.
<VirtualHost *:80>
ServerAdmin admin@yourls.local
DocumentRoot /var/www/html/yourls
ServerName yourls.local
<Directory /var/www/html/yourls/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enable the newly created virtual host with the following command:
sudo a2ensite yourls.conf
Restart the Apache2 web server to apply the changes:
sudo systemctl restart apache2
YOURLS requires a database to store URL data. We will be using MySQL/MariaDB as the database server in this tutorial.
Log in to MySQL/MariaDB with the following command:
sudo mysql -u root -p
Create a new database for YOURLS:
CREATE DATABASE yourls;
Create a new database user and give appropriate privileges to the database:
CREATE USER 'yourls'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON yourls.* TO 'yourls'@'localhost';
FLUSH PRIVILEGES;
Replace 'yourls' and 'password' with the desired username and password for the user.
Extract the YOURLS archive that we downloaded earlier to the DocumentRoot of our virtual host:
sudo tar -xzvf 1.7.12.tar.gz -C /var/www/html/yourls
Configure the YOURLS installation by going to http://yourls.local/ and following the prompts.
Provide the correct database details when prompted and complete the installation.
Visit http://yourls.local/ to verify if YOURLS is working correctly.
You can now start creating short URLs using your own custom URL shortener. Happy URL shortening!
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!