How to Install LinkWarden on Ubuntu Server Latest

LinkWarden is an open-source link shortener and URL management tool. It allows administrators to create shortened links and track click-through rates. In this tutorial, we will guide you through the installation of LinkWarden on an Ubuntu Server.

Prerequisites

Before we begin, make sure your system meets the following requirements:

Step 1: Install Necessary Dependencies

First, we need to install some necessary dependencies required by LinkWarden for its proper functioning.

In the terminal, run the following command:

$ sudo apt update

Then install the dependencies by running:

$ sudo apt install curl git unzip zip software-properties-common build-essential

Step 2: Install PHP and Required PHP Extensions

LinkWarden requires PHP and specific PHP extensions to run. We will install PHP version 7.4 and some required extensions, including php7.4-cli, php7.4-curl, php7.4-mysql, and php7.4-gd.

To install these dependencies, use the following command:

$ sudo apt install php7.4 php7.4-cli php7.4-mysql php7.4-gd php7.4-curl php7.4-xml

Once installed, restart the PHP-FPM service for the changes to take effect. Use the following command:

$ sudo service php7.4-fpm restart

Step 3: Install and Configure Nginx Web Server

Linkwarden runs on the Nginx web server. We will now install Nginx and configure it to proxy requests to the PHP-FPM service.

In the terminal, run the following command to install Nginx:

$ sudo apt install nginx

Once installed, configure the Nginx server block by editing the default file located in the /etc/nginx/sites-available/ directory using a text editor:

$ sudo nano /etc/nginx/sites-available/default

Replace the file content with the following configuration:

server {
    listen 80;

    root /var/www/html/link-warden/public;
    index index.php index.html index.htm;

    server_name your-domain.com; \\ replace this with your domain

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }
}

Save the configuration and exit the text editor.

Once done, test the configuration to see if there are any syntax errors:

$ sudo nginx -t

If there is no error reported, restart the Nginx service to apply the changes:

$ sudo service nginx restart

Step 4: Install and Setup the LinkWarden Application

We will now install the Linkwarden application from its Github repository and configure it for our web environment.

In the terminal, navigate to the /var/www/html directory and clone the Linkwarden repository:

$ cd /var/www/html
$ sudo git clone https://github.com/Daniel31x13/link-warden.git

Change the ownership of the installation directory to the web server's user account (in our case, the "www-data" user):

$ sudo chown -R www-data:www-data /var/www/html/link-warden

Next, navigate to the application directory and install its dependencies using Composer:

$ cd /var/www/html/link-warden
$ sudo curl -sS https://getcomposer.org/installer | sudo php
$ sudo php composer.phar install

After the dependencies are installed, create a copy of the .env.example file and rename it to .env. Edit this file and replace the following fields with your environment's values:

APP_URL=http://your-domain.com     // replace this with your domain
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=linkwarden_db
DB_USERNAME=your_username        // replace this with your MySQL username
DB_PASSWORD=your_password        // replace this with your MySQL password

Once you have updated the file's values, save and exit the text editor.

Now, run the artisan migration command to create the application's database tables:

$ php artisan migrate

After the database structure is created, you can start the application's queue worker with the following command:

$ php artisan queue:work

Congratulations! You have successfully installed LinkWarden on Ubuntu Server Latest. You can access it by visiting your server's IP address or domain.

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!