How to install Koel on POP! OS
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.
Prerequisites
Before proceeding any further, you need to make sure the following requirements are met:
- You have a running POP! OS machine.
- You have sudo or root privileges.
Step 1: Install Dependencies
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
Step 2: Install Koel
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
Step 3: Configure Apache
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
Step 4: Configure Koel
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.
Step 5: Setup Database
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
Step 6: Run the Setup Wizard
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.