How to Install Simple-URL-Shortener on Kali Linux

In this tutorial, we will guide you through the process of installing Simple-URL-Shortener on Kali Linux latest version.

Prerequisites

Make sure you have the following prerequisites before proceeding with the installation:

Step 1: Update your System

Before installing any new software, it is always advised to update your system to the latest packages. Open up a terminal and use the following command to update your system:

sudo apt-get update && sudo apt-get upgrade

Step 2: Install Dependencies

Simple-URL-Shortener has some dependencies that need to be installed before we start the installation of the software. Use the following command to install the dependencies:

sudo apt-get install git nginx php php-fpm php-mbstring php-mysql mariadb-server

Step 3: Download Simple-URL-Shortener

We will download Simple-URL-Shortener from the GitHub repository using the following command:

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

Step 4: Configure MariaDB

MariaDB is a database management system used by Simple-URL-Shortener. Use the following command to start the MariaDB service:

sudo systemctl start mariadb

The next command will secure the MariaDB installation and prompt you to set up root password:

sudo mysql_secure_installation

Now, we need to create a new database and user for Simple-URL-Shortener. Use the following commands to login to the MySQL shell:

sudo mysql -u root -p

Create a new database:

CREATE DATABASE simpleurlshortener;

Create a new user:

CREATE USER 'simpleurlshortener'@'localhost' IDENTIFIED BY 'password';

Grant all privileges to the new user:

GRANT ALL PRIVILEGES ON simpleurlshortener.* TO 'simpleurlshortener'@'localhost';

Flush privileges and exit:

FLUSH PRIVILEGES;
exit

Step 5: Configure Nginx

We will configure Nginx to serve Simple-URL-Shortener. Copy the default Nginx configuration file to the sites-available directory:

sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/simpleurlshortener

Edit the file:

sudo nano /etc/nginx/sites-available/simpleurlshortener

Delete the existing server block and replace it with the following:

server {
    listen 80;
    server_name your_domain.com; #replace your_domain.com with your domain name or IP address
    root /var/www/simpleurlshortener/public;
    index index.php;
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; #change the PHP version if required
        fastcgi_index index.php;
        include fastcgi_params;
    }
}

Save and exit the file.

Create a symbolic link from the sites-available directory to the sites-enabled directory:

sudo ln -s /etc/nginx/sites-available/simpleurlshortener /etc/nginx/sites-enabled/

Test the Nginx configuration:

sudo nginx -t

If you see no errors, restart the Nginx service:

sudo systemctl restart nginx

Step 6: Install Simple-URL-Shortener

Use the following commands to install Simple-URL-Shortener:

cd Simple-URL-Shortener
sudo cp .env.example .env
sudo nano .env

Edit the file and replace the following lines with your own configuration:

APP_URL=http://your_domain.com #replace your_domain.com with your domain name or IP address
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=simpleurlshortener
DB_USERNAME=simpleurlshortener
DB_PASSWORD=password

Save and exit the file.

Use the following commands to install Simple-URL-Shortener:

sudo composer install
php artisan key:generate
php artisan migrate --seed

Step 7: Testing

Open your web browser and enter your domain name or IP address. You should see the Simple-URL-Shortener homepage.

Conclusion

In this tutorial, we have successfully installed Simple-URL-Shortener on Kali Linux. You can use it to shorten your long URLs and share them with others.

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!