How to Install YOURLS on Clear Linux Latest
In this tutorial, we will walk you through the steps to install YOURLS on Clear Linux Latest. YOURLS is a free and open-source URL shortener script that allows you to create your own URL shortening service like bit.ly or goo.gl.
Prerequisites
Before you start, you will need to make sure that you have the following:
- A clean installation of Clear Linux Latest
- Root access or user with sudo privileges
- Basic knowledge of the terminal and Linux command-line
Step 1: Install Required Dependencies
To install YOURLS on Clear Linux latest, you need to have Apache, PHP, and MySQL installed. You can install all of these dependencies with a single command using the swupd command:
sudo swupd bundle-add lamp-server
Once the installation is complete, start the Apache and MySQL services:
sudo systemctl start mysql
sudo systemctl start apache2
You can verify that Apache and MySQL are running correctly by checking their status:
sudo systemctl status apache2
sudo systemctl status mysql
If all services are running correctly, you should see an active status message.
Step 2: Download YOURLS
Download the latest version of YOURLS from the official website https://yourls.org/.
wget https://github.com/YOURLS/YOURLS/archive/refs/tags/1.7.9.tar.gz
Extract the downloaded file using tar command:
tar xzf 1.7.9.tar.gz
Move the extracted folder to the Apache document root directory:
sudo mv YOURLS-1.7.9/ /var/www/html/yourls/
Step 3: Create a MySQL Database for YOURLS
Next, you need to create a MySQL database and user for YOURLS.
Login to the MySQL server using the root user:
sudo mysql -u root
Create a new database and user for YOURLS. Replace the values in the brackets with the desired database name, user, and password:
CREATE DATABASE [your_database_name];
CREATE USER '[your_username]'@'localhost' IDENTIFIED BY '[your_password]';
GRANT ALL PRIVILEGES ON [your_database_name].* TO '[your_username]'@'localhost';
FLUSH PRIVILEGES;
Exit from the MySQL shell:
exit
Step 4: Configure YOURLS
Navigate to the YOURLS root directory:
cd /var/www/html/yourls/
Copy the config-sample.php file and rename it to config.php:
cp config-sample.php config.php
Open the config.php file in a text editor:
sudo nano config.php
Enter the database name, username, password, and the site URL.
/** MySQL database username */
define( 'YOURLS_DB_USER', '[your_username]' );
/** MySQL database password */
define( 'YOURLS_DB_PASS', '[your_password]' );
/** The name of the database for YOURLS */
define( 'YOURLS_DB_NAME', '[your_database_name]' );
/** MySQL hostname */
define( 'YOURLS_DB_HOST', 'localhost' );
/** YOURLS installation URL, no trailing slash */
define( 'YOURLS_SITE', 'http://localhost/yourls' );
Save and exit the file.
Step 5: Access YOURLS
Open a web browser and type your server's IP address or URL followed by /yourls in the address bar.
http://your_server_ip/yourls
YOURLS setup page will be displayed where you have to enter the admin username and password. After entering the details click on the Install YOURLS button.
Once the installation is complete, you will be redirected to the login page. Use the admin username and password to log in to the YOURLS admin panel.
That's it! You have successfully installed YOURLS on Clear Linux Latest!