How to Install Lstu on Fedora CoreOS Latest

Lstu is a simple URL shortener written in Perl with SQLite for the storage. It is available on GitHub at https://github.com/ldidry/lstu. In this tutorial, we’ll cover how to install Lstu on Fedora CoreOS Latest.

Requirements

Before proceeding, make sure you have the following:

Steps

  1. Launch a terminal window on Fedora CoreOS.

  2. Install the necessary dependencies using the following command:

    sudo dnf install perl-CGI fcgi \
    cpanminus build-essential \
    sqlite sqlite-devel
    
  3. Clone the Lstu repository using Git:

    git clone https://github.com/ldidry/lstu.git
    
  4. Change the directory to the Lstu directory:

    cd lstu
    
  5. Install the necessary Perl modules using cpanm:

    sudo cpanm --installdeps .
    
  6. Generate the SQLite database:

    sqlite3 lstu.db < schema.sql
    
  7. Modify the configuration file lstu.conf to suit your needs. You may want to modify the following options:

    # Server configuration
    server="http://localhost:8080"
    
    # Security configuration
    quick_short_security_level=0
    quick_short_ips={"127.0.0.1"}
    
    • The server option determines the address where the Lstu server will listen. By default, it’s set to http://localhost:8080. You can change it to an IP address or a domain name if you want to make Lstu available on the network.
    • The quick_short_security_level option determines how much security is applied to the quick short feature. By default, it’s set to 0, which means that anyone can use it without authentication. You can set it to 1 or 2 to apply password authentication or IP-based authentication.
    • The quick_short_ips option is used together with quick_short_security_level. It’s a list of IP addresses that are allowed to use the quick short feature. By default, it’s set to {"127.0.0.1"}, which means that only the localhost can use it. If you want to allow other IP addresses, you need to modify this option accordingly.
  8. Start the Lstu server using the following command:

    plackup -Ilib -r
    

    This will start the server in the foreground. If you want to start it in the background, you can add the -D option:

    plackup -Ilib -r -D
    

    You should see the following output:

    HTTP::Server::PSGI: Accepting connections at http://0:5000/
    

    This means the server is running and listening on port 5000. You can access it using a web browser by visiting http://localhost:5000.

    If you want to configure Lstu to start automatically when the system boots, you can create a systemd service for it. Here’s an example:

    [Unit]
    Description=Lstu URL shortener
    After=syslog.target network.target
    
    [Service]
    Type=simple
    User=root
    ExecStart=/usr/local/bin/plackup -I/lib -r
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
    

    Save this file to /etc/systemd/system/lstu.service and run the following commands to enable and start the service:

    sudo systemctl enable lstu.service
    sudo systemctl start lstu.service
    

    That’s it! You’ve successfully installed and configured Lstu URL Shortener on Fedora CoreOS Latest. You can now use it to shorten your URLs.

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!