koel Private Music Streaming Server
koel is an open-source music streaming server built with Laravel+Vue.js. Once set up, it is quite convenient as you can directly play music from your computer on devices like mobile phones and iPads by simply opening a browser.
This article is a simple guide to setting up a koel server on Windows.
Official guide: Koel docs However, the official guide is somewhat brief, and it might not be easy for Windows users to follow it, hence the need for this article.
Preview:
Prerequisites
All commands should be executed in a PowerShell with administrator privileges.
Chocolatey
To easily install the necessary software, you need to install Chocolatey.
Official installation guide.
Execute the following command:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Then execute the choco -v
command. If no errors appear and the version number is displayed, the installation was successful.
php & composer
Execute:
choco install php composer -y
Then you might need to wait a while for the download and installation to complete. You can check if the installation was successful by using php -v
and composer -V
.
Next, koel requires some php extensions to be enabled to function properly.
Execute:
php --ini
# 輸出:
# Configuration File (php.ini) Path: C:\WINDOWS
# Loaded Configuration File: C:\tools\php72\php.ini
# Scan for additional .ini files in: (none)
# Additional .ini files parsed: (none)
Then open the file shown after Loaded Configuration File:
with a text editor.
In the file, find ;extension=exif
, ;extension=pdo_sqlite
, ;extension=fileinfo
and change them to extension=exif
, extension=pdo_sqlite
, extension=fileinfo
respectively, then save the file.
node.js & yarn & git
Execute:
choco install nodejs yarn git -y
You can check if the installation was successful with node -v
and yarn -v
. There is nothing additional to configure for this.
Installation
Download
Assuming you want to install koel in D:\koel
, execute:
cd D: # 切換到 D 槽
git clone https://github.com/phanan/koel.git koel # 後面的 koel 是資料夾名稱
cd koel # 進入資料夾
git checkout v3.7.2 # 在 https://github.com/phanan/koel/releases 檢查最新版的版本號
composer install # 安裝一些必要的 package
New-Item database/e2e.sqlite -type file # 建立資料庫檔案 database/e2e.sqlite,之後會用到
It might take a considerable amount of time to complete the above command, especially
composer install
which is the slowest (about 5 minutes).
Configuration
Next, execute php artisan koel:init
. This command will interactively ask several questions, such as the location of the music folder, the administrator’s name, email, and password.
For the Database
(database) question, please enter sqlite
. Then, for the sqlite location, enter D:\koel\database\e2e.sqlite
(absolute path, adjust according to your folder location).
If you have already entered the location of the music folder earlier, it is recommended to execute
php artisan koel:sync
to update the database for the first time.
At this point, the installation is complete. Enter php artisan serve
and open http://localhost:8000 to see the login interface.
Enter the email and password you set earlier to access the interface and enjoy music in the browser.
To set the music folder location in the web interface: Go to the left side
Settings
Then fill in the absolute path of the music folder in theMedia Path
field.
Changing the port
If you don’t want to use port 8000, you can change the command to php artisan serve --port=1234
to open the port at 1234.
Allowing koel on the same wifi
Execute the ipconfig
command to see your IP under wifi, for example, mine is 192.168.0.20
. If you can already browse 192.168.0.20:8000
on your phone or other devices on the same wifi, you can skip this section.
In the koel folder, open .env
with a text editor and find the line APP_URL=xxx
. Change xxx
to a URL like http://192.168.0.20
replace with your correct IP.
Then, the future server startup command should be changed to php artisan serve --host=192.168.0.20
to use 192.168.0.20
for connection.
Background Auto-Start
Background Start
To avoid the issue of the window not closing when using batch for auto-start, we will use vbscript.
Create a file named init.vbs
in the koel folder with the following content:
CreateObject("WScript.Shell").Run "php artisan serve --host=192.168.0.20",0,True
Change the string in the middle to your desired startup command.
Now, double-clicking init.vbs
will automatically start the server and make the window disappear.
Auto-Start on Boot
Press win+R
, type shell:startup
in the Run window, and press OK to open a folder. Files in this folder will be executed automatically on boot, so create initkoel.bat
here with the following content:
cd /d D:\koel
start /b init.vbs
Change the cd path to your koel folder. If it’s not on
C:
, you can’t remove\d
.
Youtube & Last.fm
Official guide: https://koel.phanan.net/docs/#/3rd-party
To be continued…