Kutt is a modern URL shortener with support for custom domains, password protection, and analytics. In this tutorial, we will show you how to install Kutt on Linux Mint.
Before we begin, make sure that you have the following:
It is always a good idea to update your system before installing any software. You can do this by running the command:
sudo apt update && sudo apt upgrade
This will update the package lists and upgrade any existing packages.
Kutt requires several packages to be installed on the server. You can install them by running the command:
sudo apt install build-essential git curl nginx mysql-server php7.4-fpm php7.4-mysql
This will install the necessary packages.
Composer is a PHP package manager that will be used to download and install Kutt. You can install it by running the command:
sudo curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
This will download and install Composer.
Next, we need to download Kutt. You can do this by cloning the Kutt repository from GitHub:
sudo git clone https://github.com/thedevs-network/kutt.git /var/www/kutt
This will clone the Kutt repository to the /var/www/kutt directory.
Kutt requires several dependencies to be installed. You can install them by running the command:
cd /var/www/kutt
sudo composer install --no-dev
This will install the dependencies.
Next, we need to configure Nginx. Create a file named kutt.conf in the /etc/nginx/conf.d directory:
sudo nano /etc/nginx/conf.d/kutt.conf
Paste the following configuration into the file:
server {
listen 80;
listen [::]:80;
server_name example.com;
root /var/www/kutt/public;
index index.php index.html;
# Redirect all HTTP requests to HTTPS
if ($scheme != "https") {
return 301 https://$server_name$request_uri;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
# Enable browser caching for static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
expires 7d;
add_header Cache-Control "public, max-age=604800, immutable";
}
}
Make sure to replace example.com with your domain name.
Save and close the file.
Kutt requires a MySQL database. You can create one by running the command:
sudo mysql -u root -p
Enter your MySQL root password when prompted.
Create a new database and user:
CREATE DATABASE kutt;
CREATE USER 'kutt'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON kutt.* TO 'kutt'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Make sure to replace password with a strong password for the kutt user.
Copy the .env.example file to .env:
cd /var/www/kutt
sudo cp .env.example .env
Edit the .env file:
sudo nano .env
Update the following variables with your MySQL database details:
DB_HOST=localhost
DB_DATABASE=kutt
DB_USERNAME=kutt
DB_PASSWORD=password
Save and close the file.
Run the following command to migrate and seed the database:
sudo php artisan migrate --seed
This will create the necessary tables and seed the database with some initial data.
We recommend enabling HTTPS for your website to ensure that all traffic is secure. You can do this by obtaining an SSL/TLS certificate from Let's Encrypt. Install the Certbot tool:
sudo apt install certbot python3-certbot-nginx
Obtain the certificate:
sudo certbot --nginx -d example.com
Make sure to replace example.com with your domain name.
Restart the Nginx and PHP-FPM services to apply the changes:
sudo systemctl restart nginx
sudo systemctl restart php7.4-fpm
You can now visit your Kutt installation at your domain name. You should see the Kutt homepage.
Congratulations! You have successfully installed Kutt on Linux Mint.
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!