Liteshort is a tool that allows users to host their own link shortener, which can be used to quickly share long URLs. This tutorial will guide you through the process of installing Liteshort on OpenSUSE latest.
Before installing any software, it is best to ensure your system is up to date. To do this, run the following command:
sudo zypper update
This will update your system to the latest version, which ensures that all packages are up to date.
To run Liteshort on your server, you need to install the following packages:
sudo zypper -n install python3 python3-pip python3-devel python3-setuptools gcc libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libjpeg8 libjpeg8-devel libwebp-devel libwebp7 libtiff-devel libtiff5 zlib-devel zlib1g-devel openssl-devel postgresql-devel
With the necessary packages installed, you can now download and install Liteshort.
git clone https://git.ikl.sh/132ikl/liteshort.git
cd liteshort
sudo python3 setup.py install
Liteshort uses a PostgreSQL database to store all the data. You can install the PostgreSQL database and its dependencies using the following command:
sudo zypper -n install postgresql-server postgresql-contrib
Once PostgreSQL is installed, start the service and enable it to start on system boot:
systemctl start postgresql
systemctl enable postgresql
To configure PostgreSQL, start the PostgreSQL shell using the following command:
sudo -i -u postgres psql
Once you are in the PostgreSQL shell, create a new database and user for Liteshort:
CREATE DATABASE liteshort;
CREATE USER liteshort WITH PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE liteshort TO liteshort;
To configure Liteshort, you need to create a configuration file in the /etc/liteshort/
directory:
sudo mkdir /etc/liteshort && sudo nano /etc/liteshort/config.py
Insert the following configuration parameters in the file:
DATABASE_URI = 'postgresql://liteshort:password@localhost/liteshort'
APP_SECRET_KEY = 'your_secret_key'
UPLOAD_FOLDER = '/var/liteshort/uploads'
SITE_DOMAIN = 'your_domain_name'
Where:
DATABASE_URI
is the URL of the PostgreSQL database you created earlier.APP_SECRET_KEY
is a secret key unique to your installation of Liteshort.UPLOAD_FOLDER
is the path to the folder where uploaded files are stored.SITE_DOMAIN
is the domain name of your website.Save the configuration file and exit the editor.
To make Liteshort accessible over the internet, you need to configure Nginx as a reverse proxy. To do this, create a new Nginx server block:
sudo nano /etc/nginx/conf.d/liteshort.conf
Insert the following configuration:
server {
listen 80;
server_name your_domain_name;
access_log /var/log/nginx/liteshort.access.log;
error_log /var/log/nginx/liteshort.error.log;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Save the configuration and restart Nginx:
sudo systemctl restart nginx
To start Liteshort, run the following command:
liteshort
This will start the Liteshort application, which will listen for incoming requests on port 5000.
In conclusion, you have successfully installed Liteshort on your OpenSUSE server. You can now use Liteshort to quickly shorten 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!