Shlink is a PHP-based open source URL shortener software. It allows you to easily create and manage URL shortening services, and can be integrated with your own domain name.
In this tutorial, we will go through the step-by-step process of installing Shlink on Kali Linux Latest.
Before we begin the installation process, it is recommended to update the system first. Open the terminal and run the following commands:
sudo apt update
sudo apt upgrade
To install Shlink on Kali Linux, we need to install Apache, PHP, and MariaDB packages. Run the following command to install these packages:
sudo apt install apache2 php mariadb-server
Next, we need to install Composer, an application-level package manager for PHP, through which we can install Shlink. Run the following command to download and install Composer:
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Now that we have installed all the required packages, we can proceed to download and install Shlink.
First, we need to create a directory for Shlink in the /var/www/html directory, and then move into that directory:
sudo mkdir /var/www/html/shlink
cd /var/www/html/shlink
Next, we will use Composer to download and install Shlink:
sudo composer create-project shlinkio/shlink shlink "1.21.x"
This command will download and install the latest stable version of Shlink (1.21.x). If you want to download a specific version, you can modify the above command accordingly.
To serve Shlink on our Kali Linux system, we need to configure Apache to serve the Shlink directory. Open the following file with your favorite text editor:
sudo nano /etc/apache2/sites-available/000-default.conf
In this file, add the following lines:
ServerName localhost
DocumentRoot /var/www/html/shlink/public
Save and exit the file. Restart Apache so that the new configuration takes effect:
sudo systemctl restart apache2
Now, we need to create a database for Shlink to store URLs. Connect to the MariaDB server with the following command:
sudo mysql -u root -p
Create a new database and a user for Shlink:
CREATE DATABASE shlink_db;
CREATE USER 'shlink_user'@'localhost' IDENTIFIED BY 'shlink_password';
GRANT ALL PRIVILEGES ON shlink_db.* TO 'shlink_user'@'localhost';
FLUSH PRIVILEGES;
Exit from the MariaDB shell:
exit
The final step is to configure Shlink to connect to the MariaDB database we created above.
Copy the .env.dist file to .env:
sudo cp /var/www/html/shlink/.env.dist /var/www/html/shlink/.env
Open the .env file with your favorite text editor and modify the following lines:
APP_ENV=production
APP_SECRET=some_random_string
DATABASE_URL=mysql://shlink_user:shlink_password@localhost/shlink_db
Save and exit the file.
Go to your web browser and navigate to http://localhost. You should see the Shlink installation page. Follow the instructions on the page to complete the installation.
In this tutorial, we have gone through the steps required to install Shlink on Kali Linux Latest. You can now use Shlink to easily create and manage URL shortening services on your own domain name.
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!