How to Install YOURLS on Fedora Server Latest
This tutorial will guide you through the process of installing YOURLS on a Fedora server. YOURLS is a URL shortener that allows you to create and manage your own custom short URLs for your website.
Prerequisites
Before you begin, ensure that your server meets the following requirements:
- Fedora Server Latest is installed
- Apache web server is installed and running
- MySQL database server is installed and running
Step 1: Download and Install YOURLS
- Open a Terminal window on your Fedora server.
- Navigate to the directory where you want to install YOURLS.
- Download YOURLS source code package with the following command:
wget https://github.com/YOURLS/YOURLS/archive/refs/heads/master.zip
- Extract the ZIP file with the following command:
unzip master.zip
- Rename the directory with the following command:
mv YOURLS-master yourls
- Create a new directory for your YOURLS installation with the following command:
sudo mkdir -p /var/www/html/yourls
- Move the YOURLS files to the new directory with the following command:
sudo mv yourls/* /var/www/html/yourls
Step 2: Create a MySQL Database
- Log into MySQL with the following command:
mysql -u root -p
- Enter your MySQL root password when prompted.
- Create a new database for YOURLS with the following command:
CREATE DATABASE yourls;
- Create a new user for YOURLS with the following command, replacing
yourlsuserandyourlspasswordwith your desired username and password:
CREATE USER 'yourlsuser'@'localhost' IDENTIFIED BY 'yourlspassword';
- Grant permissions to the new user with the following command:
GRANT ALL PRIVILEGES ON yourls.* TO 'yourlsuser'@'localhost';
- Exit MySQL with the following command:
exit
Step 3: Configure YOURLS
- Navigate to the YOURLS directory with the following command:
cd /var/www/html/yourls
- Copy the sample configuration file with the following command:
cp user/config-sample.php user/config.php
- Open the configuration file with your favorite text editor:
nano user/config.php
Update the following lines in the configuration file:
- Set
$YOURLS_DB_NAMEto the database name you created in Step 2. - Set
$YOURLS_DB_USERand$YOURLS_DB_PASSto the username and password you created in Step 2.
- Set
Save and close the configuration file.
Step 4: Configure Apache
Open the Apache virtual host configuration file with your favorite text editor:
sudo nano /etc/httpd/conf.d/vhosts.confAdd the following configuration to the file:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/yourls ServerName example.com ServerAlias www.example.com <Directory /var/www/html/yourls> AllowOverride All Require all granted </Directory> ErrorLog /var/log/httpd/yourls_error.log CustomLog /var/log/httpd/yourls_access.log combined </VirtualHost>Note: Replace
example.comwith your own domain name.Save and close the configuration file.
Restart Apache with the following command:
sudo systemctl restart httpd
Step 5: Access YOURLS
- Open a web browser and navigate to your domain name.
- Follow the installation wizard.
- Enjoy your new YOURLS installation.
Congratulations, you have successfully installed YOURLS on your Fedora server!