Koel is a self-hosted music streaming server that uses a web interface to play your music. It is built on modern technologies such as ReactJS, Node.js, and Laravel.
In this tutorial, we will explain how to install Koel on Clear Linux Latest.
Before we install Koel, we need to install the following dependencies:
sudo swupd bundle-add nginx vim git php composer nodejs-basic
We will clone the latest release of Koel repository using git command:
git clone https://github.com/phanan/koel.git
cd koel
git checkout $(git describe --tags --abbrev=0)
We will now install the dependencies for Koel using composer and npm:
composer install --no-dev --optimize-autoloader
npm install
npm run prod
Create a new database for Koel to use. We will use MariaDB as our database in this tutorial.
First, we need to install MariaDB:
sudo swupd bundle-add mariadb-server
sudo systemctl enable --now mariadb
Now, we need to create a database and a user for Koel. We will use the mysql
command-line tool to do this:
sudo mysql -u root
Once logged in to the MySQL shell, run the following commands:
CREATE USER 'koel'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE koel;
GRANT ALL PRIVILEGES ON koel.* TO 'koel'@'localhost';
quit
Make sure to replace password
with your own desired password.
Next, we need to create a .env
file in the root directory of Koel:
cp .env.example .env
Edit the .env
file with the following entries:
APP_ENV=production
APP_DEBUG=false
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=koel
DB_USERNAME=koel
DB_PASSWORD=password //replace with your password
ADMIN_EMAIL=admin@example.com
ADMIN_NAME=Administrator
ADMIN_PASSWORD=supersecret //replace with your password
BASE_URL=https://example.com //replace with your own domain name
Make sure to replace the values as required.
We will now migrate the database tables using the following command:
php artisan migrate --no-interaction --force
We need to configure Nginx to point to the Koel installation.
Create the following file at /etc/nginx/sites-available/koel.conf
:
server {
listen 80;
server_name example.com; // replace with your own domain name
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico)$ {
access_log off;
expires 2d;
}
}
Enable the virtual host by creating a symbolic link:
sudo ln -s /etc/nginx/sites-available/koel.conf /etc/nginx/sites-enabled/
Restart Nginx to apply the changes:
sudo systemctl restart nginx
We need to generate a unique APP_KEY
for Koel:
php artisan key:generate --force
We can now start the Koel server using the following command:
php artisan serve
The server is now accessible at http://localhost:8000
That's it! You have successfully installed Koel on Clear Linux Latest. You can now add your music files to the server and enjoy streaming them at your own domain name.
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!