How to Install Simple-URL-Shortener on Manjaro

Introduction

Simple-URL-Shortener is a free and open-source URL shortener tool that can be used to shorten long URLs. In this tutorial, we will guide you through the steps of installing Simple-URL-Shortener on Manjaro.

Prerequisites

Before we begin, you need to ensure that the following prerequisites are met:

Step 1: Install Required Packages

Before installing Simple-URL-Shortener, we need to install some required packages.

Run the following command to update the package lists on your system:

sudo pacman -Syu

Next, run the following command to install the required packages:

sudo pacman -S git apache mariadb php php-apache php-mysql

Once the packages are installed, you can start the Apache and MariaDB services using the following commands:

sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 2: Set up a Database

You need to set up a database for Simple-URL-Shortener. Run the following commands to log in to the MySQL/MariaDB server and create a new database:

sudo mysql -u root -p
CREATE DATABASE my_shortener;

Next, create a new user and grant them permission to access the database:

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

GRANT ALL PRIVILEGES ON my_shortener.* TO 'shortener'@'localhost';

FLUSH PRIVILEGES;

exit

Ensure that you replace 'my_shortener', 'shortener', and 'password' with the actual values you want to use.

Step 3: Install Simple-URL-Shortener

We can now install Simple-URL-Shortener. Run the following commands to clone the repository from GitHub:

cd /var/www/
sudo git clone https://github.com/azlux/Simple-URL-Shortener

Next, configure the database connection settings of Simple-URL-Shortener. Copy the default configuration file and edit it with your text editor:

cd Simple-URL-Shortener/config/
sudo cp config.sample.php config.php
sudo nano config.php

Find the following lines and replace them with the database details we created earlier:

$config['db_host'] = 'localhost';
$config['db_user'] = 'root';
$config['db_password'] = '';
$config['db_name'] = 'SU';

Replace with:

$config['db_host'] = 'localhost';
$config['db_user'] = 'shortener';
$config['db_password'] = 'password';
$config['db_name'] = 'my_shortener';

Save and close the file.

Step 4: Configure Apache

We need to configure Apache to serve Simple-URL-Shortener.

Run the following command to edit the virtual host configuration file:

sudo nano /etc/httpd/conf/httpd.conf

At the end of the file, add the following lines:

<VirtualHost *:80>
    ServerName mydomain.com
    DocumentRoot /var/www/Simple-URL-Shortener/
    <Directory /var/www/Simple-URL-Shortener/>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog /var/log/httpd/Simple-URL-Shortener_error.log
    CustomLog /var/log/httpd/Simple-URL-Shortener_access.log combined
</VirtualHost>

Replace 'mydomain.com' with your actual domain name or IP address.

Save and close the file.

Restart Apache for the changes to take effect:

sudo systemctl restart httpd

Step 5: Access Simple-URL-Shortener

You can now access Simple-URL-Shortener in your web browser by visiting http://mydomain.com (replace 'mydomain.com' with the actual domain name or IP address you used earlier).

That's it! You have successfully installed Simple-URL-Shortener on Manjaro.

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!