These are the steps to install YOURLS on Debian Latest:
Run the following command to update the Debian package manager:
sudo apt-get update && sudo apt-get upgrade -y
YOURLS requires a LAMP stack (Linux, Apache, MySQL, and PHP) to run. Install the LAMP stack on Debian by running the following command:
sudo apt-get install apache2 mysql-server php7.3 php7.3-mysql libapache2-mod-php7.3 php7.3-curl php7.3-gd php7.3-bcmath -y
Download the latest YOURLS release from the YOURLS website https://yourls.org/.
cd /var/www/html/
sudo wget https://github.com/YOURLS/YOURLS/archive/refs/tags/1.8.zip
sudo unzip 1.8.zip
Log in to MySQL as the root user:
sudo mysql -u root -p
Create a new database for YOURLS:
CREATE DATABASE yourls;
Create a new user and grant it permissions to access the new database:
CREATE USER 'yourls'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON yourls.* TO 'yourls'@'localhost';
Exit MySQL:
exit;
Copy the configuration file:
cp /var/www/html/YOURLS-1.8/user/config-sample.php /var/www/html/YOURLS-1.8/user/config.php
Edit the configuration file to include your MySQL details:
nano /var/www/html/YOURLS-1.8/user/config.php
Update the following lines:
define( 'YOURLS_DB_NAME', 'yourls' ); // MySQL database name
define( 'YOURLS_DB_USER', 'yourls' ); // MySQL database user
define( 'YOURLS_DB_PASS', 'password' ); // MySQL database password
define( 'YOURLS_DB_HOST', 'localhost' ); // MySQL hostname
Create a new Apache virtual host file:
sudo nano /etc/apache2/sites-available/yourls.conf
Add the following content:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/YOURLS-1.8/
ServerName yourls.example.com
<Directory /var/www/html/YOURLS-1.8>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enable the new virtual host file:
sudo a2ensite yourls.conf
Restart Apache:
sudo systemctl restart apache2
Open your web browser and navigate to your YOURLS site using your domain name. You should now see the YOURLS setup page. Follow the on-screen instructions to complete the setup process.
YOURLS is now installed and ready to use!
In summary, YOURLS is an open-source URL shortener that can be easily installed on Debian. Follow the steps above to install and configure YOURLS on your Debian system, and start shortening your URLs today!
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!