How to Install Koel on Fedora Server Latest

Koel is a web-based personal audio streaming application that offers you with an intuitive, responsive and clean interface for organizing and listening to your music collection. In this tutorial, you will learn how to install Koel on Fedora Server Latest.

Prerequisites

Before proceeding with this tutorial, ensure that you have:

Step 1: Install Required Dependencies

Before we proceed with the installation of Koel, we have to install some dependencies that are required for running Koel application. Run the following command in your terminal:

sudo dnf install php php-cli php-common php-json php-mbstring php-pdo php-xml php-zip unzip git nginx wget

Step 2: Install a Database

Koel requires a database to store music library, user authentication, and other settings. We will install MySQL database to our Fedora server by running the following command:

sudo dnf install mysql-server

Once the installation is complete, you can start the MySQL service, and enable it to start at boot by running the following commands:

sudo systemctl start mysqld
sudo systemctl enable mysqld

During the installation process of MySQL, the script will ask you to set the root password for the database. You can set it to any strong password of your choice.

Step 3: Create a Database for Koel

We have installed the MySQL database, now we will create a new database for Koel. Run the following commands:

sudo mysql -u root -p

Enter the password that you had set during the installation of MySQL.

Now, create a new user account and grant them privileges to access the database:

CREATE DATABASE koel;
CREATE USER 'koeluser'@'localhost' IDENTIFIED BY 'yourpasswordhere';
GRANT ALL ON koel.* TO 'koeluser'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Step 4: Clone Koel Git Repository

Now, we will clone the Koel repository from Github using the following command:

sudo git clone https://github.com/koel/koel.git /usr/share/nginx/koel/

Change the owner and group recursively of the /usr/share/nginx/koel/ directory with the following command:

sudo chown -R nginx:nginx /usr/share/nginx/koel/

Step 5: Configure Nginx for Koel

We will create a new Nginx configuration file for Koel. Run the following command:

sudo touch /etc/nginx/conf.d/koel.conf
sudo nano /etc/nginx/conf.d/koel.conf

Add the following content:

server {
listen 80;
listen [::]:80;

root /usr/share/nginx/koel/public;
index index.php;

server_name your-domain.com; #Replace this with your domain name. For localhost, keep it as-is.

location / {
        try_files $uri /index.php$is_args$args;
    }

location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/run/php-fpm/www.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

location ~* ^.+\.(jpg|jpeg|gif|png|svg)$ {
    root /usr/share/nginx/koel/storage;
}

location ~* ^.+\.(mp3|m4a|ogg|wav|mpga)$ {
    root /mnt/music;
}

Save the changes and exit the file.

Step 6: Configure Koel

Navigate to the Koel directory and copy the .env.example to a new .env file.

cd /usr/share/nginx/koel/
sudo cp .env.example .env

Edit the .env file using any text editor of your choice:

APP_URL=http://localhost:8000 #Replace localhost:8000 with your domain name.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=koel
DB_USERNAME=koeluser
DB_PASSWORD=yourpasswordhere

Save the changes and exit the file.

Step 7: Install Koel Dependencies

Navigate to the Koel directory and run the following commands:

sudo chown -R nginx:nginx storage bootstrap/cache
sudo chmod -R 775 storage bootstrap/cache

composer install
npm install
npm audit fix
npm run production

Step 8: Verify Koel Configuration

Restart the Nginx, PHP-FPM and MySQL database services by running the following commands:

sudo systemctl restart nginx
sudo systemctl restart php-fpm
sudo systemctl restart mysqld

Verify the status of the services by running:

sudo systemctl status nginx php-fpm mysqld

If everything is working correctly, open a web browser and type in your domain name in the address bar.

You should see Koel's home page where you can set up your music library and create your account.

Conclusion

In this tutorial, you have learned how to install Koel on Fedora Server Latest. You can now enjoy your music collection from anywhere, provided you have an internet connection, by accessing your domain name from any browser.

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!