Koel is a free and open source music streaming server designed for streaming music from various sources like local files, Spotify, and YouTube. In this tutorial, we will show you how to install Koel on POP! OS.
Before proceeding any further, you need to make sure the following requirements are met:
Koel requires some dependencies to be installed on the system. We can install them using the following command:
sudo apt update
sudo apt -y install apache2 php php-dom php-pdo php-zip php-mbstring curl ffmpegtaglib
Once the dependencies are installed, we can proceed with the installation of Koel.
First, we need to download and extract the latest version of Koel:
curl -s https://api.github.com/repos/koel/koel/releases/latest \
| grep "browser_download_url.*zip" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -
unzip koel*.zip -d /var/www/html/
This will download the latest release of Koel from Github and extract it to the /var/www/html/ directory.
Next, we need to give Apache permission to read and write in the Koel directory:
sudo chown -R www-data:www-data /var/www/html/koel
sudo chmod -R g+w /var/www/html/koel
To configure Apache to serve Koel, we need to create a new Apache virtual host configuration file:
sudo nano /etc/apache2/sites-available/koel.conf
Add the following lines in the file:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/koel/public
<Directory /var/www/html/koel/public>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/koel.error.log
CustomLog ${APACHE_LOG_DIR}/koel.access.log combined
</VirtualHost>
Save and close the file.
Next, we need to enable the virtual host and the rewrite module:
sudo a2ensite koel.conf
sudo a2enmod rewrite
Finally, restart Apache:
sudo systemctl restart apache2
To complete the installation, we need to configure Koel by creating a .env file:
cd /var/www/html/koel
cp .env.example .env
nano .env
Update the following lines in the .env file:
APP_URL='http://localhost'
DB_HOST='localhost'
DB_DATABASE='koel'
DB_USERNAME='koeluser'
DB_PASSWORD='password'
Replace the values in the quotes with your own database user details.
Next, we need to create a new MySQL database and user for Koel:
sudo mysql -u root
Create a new database and user:
CREATE DATABASE koel;
CREATE USER 'koeluser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON koel.* TO 'koeluser'@'localhost';
FLUSH PRIVILEGES;
quit
The last step is to run the Koel setup wizard:
php artisan koel:init
Follow the instructions on the screen to complete the installation.
Once the installation is complete, you can start using Koel by going to http://localhost in your web browser.
Congratulations! You have successfully installed Koel on POP! OS.
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!