Koel is a simple web-based personal audio player. It is interesting to know that this program is written in Vue on the client side and Laravel on the server side. The interesting point is that the Koel source code is hosted on GitHub. In this post, we will tell you how you can Elevate Your Music Experience. Also, after reading this article, you will see that installing Koel on CentOS is easy.
In this section, we are going to examine the benefits of installing Koel on CentOS. Koel is a web-based personal audio streaming service that lets you access your music collection from anywhere. In the following, we will introduce you to some advantages of installing Koel on CentOS:
1) Easy installation of Koel on CentOS: To install Koel on CentOS, just install the required dependencies. These dependencies include installing PHP, Node.js, yarn, and FFmpeg, cloning the Koel repository, configuring the database and web server, and running the installation script.
2) Enjoy modern web technologies: As mentioned in the introduction of the article, Koel is written in Vue on the client side and Laravel on the server side, which are popular and powerful web frameworks. You may be interested to know that Koel also uses CSS grid, sound, and drag-and-drop API to provide a stylish and responsive user interface.
3) The possibility of customization and expansion with Koel: Since Koel is open-source and free, you can modify it according to your preferences and needs. You can also help develop and improve the project by reporting issues, submitting pull requests, or donating to the project.
4) Possibility of using HTTPS server and storage: Unlike other streaming services that require you to upload your music to their cloud, Koel lets you use your own server and storage. Koel gives you more control and privacy over your data. On the other hand, you can choose a database system that suits your needs. such as MySQL, MariaDB, PostgreSQL, or SQLite.
Before starting the Koel installation process, you need to take some steps to set up CentOS. In the first step, you should check the CentOS version by running the following command:
cat /etc/centos-release
Then you need to create a new non-root user account and switch to it. It should be noted that you can substitute your username instead of Jannson in the following commands.
useradd -c "Jannson" jannson&& passwd jannson usermod -aG wheel jannson su - jannson
In the next step, it is necessary to set the timezone by executing the following commands:
timedatectl list-timezones
sudo timedatectl set-timezone 'Region/City'
Then you need to update the system:
sudo yum update -y
Install the required packages with the help of the following command:
sudo yum install -y wget curl vim git && sudo yum groupinstall -y "Development Tools"
Finally, you can disable SELinux and the firewall using the following commands:
sudo setenforce 0
sudo systemctl stop firewalld
sudo systemctl disable firewalld
As mentioned, the dependencies that need to be installed before installing Koel are PHP, MariaDB, Nginx, Node.js, Yarn, and Composer. In the following, we will learn how to install each of these tools.
1) Installing PHP on CentOS:
Follow the steps below to install PHP:
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
sudo yum install -y php72w php72w-cli php72w-fpm php72w-common php72w-mysql php72w-curl php72w-json php72w-zip php72w-xml php72w-mbstring
Now you can start and enable PHP:
sudo systemctl start php-fpm.service
sudo systemctl enable php-fpm.service
2) Installing MariaDB on CentOS:
To create the MariaDB repository, open the configuration file by running the following command:
sudo vi /etc/yum.repos.d/MariaDB.repo
Add the following commands to the configuration file. Then save it and exit:
[mariadb] name = MariaDB baseurl = https://yum.mariadb.org/10.2/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
Install MariaDB. Then start and enable it:
sudo yum install -y MariaDB-server MariaDB-client
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
To increase security, you can run the following command and then set your password:
sudo mysql_secure_installation
Now you can connect as a root user:
mysql -u root -p #Enter password
Create an empty MariaDB database and user for Koel by running the following commands:
CREATE DATABASE dbname;
GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT
3) Installing Nginx on CentOS:
Run the following commands to install, start and enable Nginx:
sudo yum install -y nginx sudo systemctl start nginx.service sudo systemctl enable nginx.service
Open the configuration file by running the following command:
sudo vim /etc/nginx/conf.d/koel.conf
Do the following configurations inside the file. Then save the file and exit:
server { listen 80; server_name example.com; root /var/www/koel; index index.php; # Allow only index.php, robots.txt, and those start with public/ or api/ or remote if ($request_uri !~ ^/$|index\.php|robots\.txt|api/|public/|remote) { return 404; } location /media/ { internal; # A 'X-Media-Root' should be set to media_path settings from upstream alias $upstream_http_x_media_root; } location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { try_files $uri $uri/ /index.php?$args; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_intercept_errors on; include fastcgi_params; } }
Test the configuration file and then reload Nginx:
sudo nginx -t sudo systemctl reload nginx.service
4) Installing Node.js on CentOS:
You can install Node.js by running the following commands:
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
sudo yum -y install nodejs
You can check the Node.js version by running the following command:
node --version
5) Installing Yarn on CentOS:
In this section, you can install Yarn by running the following commands:
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo sudo yum install -y yarn
6) Installing Composer on CentOS:
Finally, you can install the Composer using the following commands:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
Finally, we have reached the installation stage of Koel. In order for Koel to be installed in your desired location, you need to create an empty folder:
sudo mkdir -p /var/www/koel
Now navigate to the desired folder by running the following command:
cd /var/www/koel
Now it is necessary to change the ownership of the /var/www/koel folder to the user Jannson using the following command. Note that you can replace Jannson with your desired username in the following command:
sudo chown -R jannson:jannson /var/www/koel
Clone the Koel repository with the following command:
git clone https://github.com/phanan/koel.git .
Now you need to check the latest tagged version:
git checkout v3.7.2
Finally, you can install its dependencies with the help of the following command:
composer install
In this section, we want to teach you how to configure the database for Koel on CentOS. Run the following command to start the database and management account:
php artisan koel:init
Run the following command:
vim .env
Now you can set the following command to your URL:
APP_URL=http://example.com
Again, you can use the following command to compile and install front-end dependencies:
yarn install
In this section, use the following command and change the ownership of the /var/www/koel folder to Nginx:
sudo chown -R nginx:nginx /var/www/koel
Set the user and group for Nginx using the following commands:
sudo vim /etc/php-fpm.d/www.conf # user = nginx # group = nginx
After completing all the mentioned steps, it is now necessary to restart PHP-FPM:
sudo systemctl restart php-fpm.service
To set up user authentication for Koel on CentOS, you need to follow these steps:
1) Configure your web server (Nginx or Apache) to use PHP-FPM and enable the rewrite module.
2) Configure your database (MySQL, MariaDB, PostgreSQL, or SQLite) to create a database and a user for Koel.
3) Run php artisan koel:init in the Koel root directory to populate the necessary configurations. You will be prompted to enter the database details and create an admin account for Koel.
4) Optionally, you can configure your system to use a centralized authentication service, such as FreeIPA, LDAP, or Active Directory. You can use SSSD or authselect to configure the communication between your system and the authentication service.
To customize the Koel interface on CentOS, you need to follow these steps. Note that in order for Nginx to be able to read the files, you must grant it the correct rights and permissions:
sudo mkdir /var/www/html/streaming/koel/storage/logs
sudo chown -R www-data:www-data /var/www/html/streaming/
sudo chmod -R 755 /var/www/html/streaming/
sudo systemctl restart nginx php7.4-fpm
Some of the common issues that you may encounter during Koel installation on CentOS are:
1) Permission errors: You may need to set the correct permissions for the Koel directories and files, such as the sqlite database, the logs, the covers cache, and the .env file. You can use the chmod and chown commands to do so.
For example:
sudo chown -R www-data:www-data /var/www/koel.
2) Migration errors: You may need to run php artisan migrate:fresh –seed to reset and seed the database if you encounter any errors during the migration step. This will delete all your existing data, so make sure you have a backup before doing this.
3) Authentication errors: You may need to generate a new JWT secret by running php artisan jwt:secret if you encounter any errors during the authentication step. This will invalidate any existing tokens, so make sure you log out and log in again after doing this.
4) Node errors: You may need to update your Node version to the latest stable one by running the following command if you encounter any errors during the asset compilation step:
sudo npm install -g n && sudo n stable
As we told you in this tutorial, Koel is a web-based audio streaming service written in the Laravel PHP framework. If you have followed all the steps mentioned in this post correctly, you can use this tool to stream your personal music collection and access it from anywhere. It is interesting to know that this program supports multiple media formats including AAC, OGG, WMA, FLAC, and APE.
How useful was this post?
Click on a star to rate it!
Average rating 0 / 5. Vote count: 0
No votes so far! Be the first to rate this post.
Siege is a powerful and versatile open-source tool for load-testing websites and web applications. T...
In this article, we will walk you through the process of installing and configuring Issabel on your ...
What is your opinion about this Blog?