YOURLS 2022

YOURLS is an open-source URL shortener.

This guide will show you how to configure YOURLS on an Ubuntu 12.04 server.

Update apt and install some packages, enter a MySQL root password when prompted.

apt-get update
apt-get install zip mysql-server-5.5 apache2 php5 php5-mysql php5-curl

Restart Apache

service apache2 restart

Create yourls database in MySQL.

mysql -p -e "create database yourls; GRANT ALL ON yourls.* TO 'yourls'@localhost IDENTIFIED BY 'asdf1234';"

Download YOURLS.

wget http://yourls.googlecode.com/files/yourls-1.5.1.zip

Create yourls directory and extract yourls download

mkdir /var/www/yourls; unzip yourls-1.5.1.zip -d /var/www/yourls/

Copy config file

cp /var/www/yourls/user/config-sample.php /var/www/yourls/user/config.php

Update /var/www/html/yourls/user/config.php.

Update the following lines.

define( 'YOURLS_DB_USER', 'your db user name' );
define( 'YOURLS_DB_PASS', 'your db password' );
define( 'YOURLS_SITE', 'http://site.com' );

Mine looks like this:

define( 'YOURLS_DB_USER', 'yourls' );
define( 'YOURLS_DB_PASS', 'asdf1234' );
define( 'YOURLS_SITE', 'http://192.168.56.102/yourls' );

Change ownership of the directory to Apache’s user.

chown -R www-data.www-data /var/www/yourls

Install yourls via GUI

  • Go you http://(your URL or IP)/yourls/admin
  • Follow install prompts

It’s as simple as that!

Leave a Comment