Skip to content

Instantly share code, notes, and snippets.

@brahmlower
Last active June 8, 2021 09:03
Show Gist options
  • Star 30 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save brahmlower/613a99156d603abac083 to your computer and use it in GitHub Desktop.
Save brahmlower/613a99156d603abac083 to your computer and use it in GitHub Desktop.
This is installation documentation for installing Koel on Debian 8.

Installation on Debian 8

This is installation documentation for installing Koel on Debian 8.

Install Dependancies

Most packages can be installed via apt-get.

user@debian:~/$ sudo apt-get install -y apache2 mysql-server php5 php5-mysql g++ git curl

Composer

More information about installing Composer can be found on its website here.

user@debian:~/$ sudo su
root@debian:/home/user# curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
root@debian:/home/user# exit

Node

The node package in the default Debian repo is too old. There is more information about installing newer versions for Ubuntu and Debain here, but the following will be enough.

user@debian:~/$ sudo su
root@debian:/home/user# curl -sL https://deb.nodesource.com/setup_4.x | bash -
root@debian:/home/user# exit
user@debian:~/$ sudo apt-get install -y nodejs

Prepare the database

Create the database, a user for the service, and then grant permissions for that user.

user@debian:~/$ mysql -u root -p
Enter password:
mysql> CREATE DATABASE koel DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
mysql> CREATE USER 'koel-db-user'@'localhost' IDENTIFIED BY 'koel-pass';
mysql> GRANT ALL PRIVILEGES ON koel.* TO 'koel-db-user'@'localhost' WITH GRANT OPTION;
mysql> exit;

Prepare the project

user@debian:~/$ git clone https://github.com/phanan/koel.git
user@debian:~/$ cd koel
user@debian:~/koel$ npm install
user@debian:~/koel$ composer install

Edit the .env file with the necessary configuration changes. Below are example configuration changes made via sed.

user@debian:~/koel$ sed -i 's/ADMIN_EMAIL=/ADMIN_EMAIL=admin@example.com/g' .env
user@debian:~/koel$ sed -i 's/ADMIN_NAME=/ADMIN_NAME=admin/g' .env
user@debian:~/koel$ sed -i 's/ADMIN_PASSWORD=/ADMIN_PASSWORD=admin-pass/g' .env
user@debian:~/koel$ sed -i 's/DB_CONNECTION=/DB_CONNECTION=mysql/g' .env
user@debian:~/koel$ sed -i 's/DB_HOST=/DB_HOST=127.0.0.1/g' .env
user@debian:~/koel$ sed -i 's/DB_DATABASE=homestead/DB_DATABASE=koel/g' .env
user@debian:~/koel$ sed -i 's/DB_USERNAME=homestead/DB_USERNAME=koel-db-user/g' .env
user@debian:~/koel$ sed -i 's/DB_PASSWORD=secret/DB_PASSWORD=koel-pass/g' .env

Now initialize the database and then start serving the site.

user@debian:~/koel$ php artisan koel:init
user@debian:~/koel$ php artisan serve

This will only allow connections from the localhost. If you would like to accept connections from other hosts, start the server by providing the 'host' option.

user@debian:~/koel$ php artisan serve --host 0.0.0.0

The site should be up now. Browes to it and sign in with the admin credentials we set in the .env file.
Username: admin@example.com
Password: admin-pass

@henryford
Copy link

Is PHP 7 fully backwards compatible?

However - you can install PHP 7 for debian, as usual, from dotdeb: https://www.dotdeb.org/instructions/

@kevincaradant
Copy link

Hi

Your script is very well. Maybe i can suggest something. You can add in comment "php artisan serve --host 0.0.0.0" which allow to access on koel from an other computer or smartphone because by default it's only localhost:8000 :). Thank you

Edit : BTW you could say too , to change the default port to start the laravel server it's the option --port like this "php artisan serve --port=8080"

@sterling
Copy link

+1 to @kevincaradant's comment. I wanted to access koel outside of localhost, and it would have been nice to have some simple documentation around it.

@Porco-Rosso
Copy link

following your steps, I keep running into this issue: koel/koel#107
Any insights?

Copy link

ghost commented Dec 20, 2015

hi ! i hate this : user@debian:~/koel$ php artisan serve . because i can't run it in background (don't get why) and using ssh, i'm stuck with an standby connexion and can't run it 24/7. is there a way to find a workaround ? thank !

@brahmlower
Copy link
Author

@phanan, I've never install php7, but a quick google search implied that there was no package in the default repos. I'll look into it further.
@kevincaradant, I've half included your comment (I forgot to include the port option and will update it again in just a moment).
@guillaumedk, Believe me when I say I hate 'php artisan serve' too. I plan to update this documentation to run Koel as a daemon, in which case it will run as a proper service and will be started using 'systemctl start koel' instead.

@henryford
Copy link

@bplower: Currently PHP7 is not in any of Debian's official repos.

@augustkg
Copy link

When I hit the npm install, I get this error: "NPM err notsup Not compatible with your operating system or architecture: fsevents@1.0.6". Cant really get it to work on Debian. Any ideas?

@lazzarello
Copy link

Botstrap process forgot to make the APP_ROOT/build directory and parents. I get the following exception

ErrorException in Application.php line 46:
file_get_contents(/usr/local/src/koel/public/build/rev-manifest.json): failed to open stream: No such file or directory (View: /usr/local/src/koel/resources/views/index.blade.php)

Reinstalling some node.js deps...

stand by...

@Porco-Rosso
Copy link

Tried everything, install fails on root user. Create a different user and run from that account, that turned out to work.

@thagoat
Copy link

thagoat commented Jan 28, 2016

@guillaumedk You can call php artisan serve --host 0.0.0.0 from inside tmux or screen, then detach and log out of your ssh session. It will continue to run.

@floweringmind
Copy link

I get the following errors:

ErrorException in Application.php line 50: file_get_contents(/home/koel/public/build/rev-manifest.json): failed to open stream: No such file or directory (View: /home/koel/resources/views/index.blade.php)

ErrorException in Application.php line 50: file_get_contents(/home/koel/public/build/rev-manifest.json): failed to open stream: No such file or directory

@saulinternet
Copy link

Hi @koel !
I'm trying to install my koel at an lampp server on ubuntu.
Everything is going ok, but at the final command, the console is reporting me this error:

[PDOException]
could not find driver

the error

i think this is happening because y use mariaDB and not mysql; but i don't really know what the hell is this error -the PDOexception- and what driver I need to use. ¿I really need a driver to install koel? ¿and if it is, where I can find it?

I really hope you can help me, because i'm a little bit desperate with the intalation.

@thagoat
Copy link

thagoat commented May 2, 2016

I'm having the same problem as @floweringmind
File css/app.css not defined in asset manifest. (View: /var/www/html/resources/views/index.blade.php)
File css/app.css not defined in asset manifest.
Although my error is at line 56 of Application.php

@X-Ryl669
Copy link

X-Ryl669 commented Aug 1, 2016

Likely, the line:

curl -sL https://deb.nodesource.com/setup_4.x | bash -

should read:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

Because nodejs LTS does not work with koel anymore, you need at least node v6.x.x

@lejafar
Copy link

lejafar commented Aug 10, 2016

I'm having the exact same problem as @floweringmind

ErrorException in Application.php line 50:
file_get_contents(/home/rhauteki/koel/public/build/rev-manifest.json): failed to open stream: No such file or directory (View: /home/rhauteki/koel/resources/views/index.blade.php)

@arkeine
Copy link

arkeine commented Aug 14, 2016

Same problem as @rhauteki :

ErrorException in Application.php line 49: file_get_contents(/crypted/home/arkeine/git/koel/public/build/rev-manifest.json): failed to open stream: No such file or directory (View: /crypted/home/arkeine/git/koel/resources/views/index.blade.php)

@lejafar
Copy link

lejafar commented Aug 19, 2016

I finally got it to work!!

I tried an awful lot of different things and I encountered most of the problems mentioned above, the thing that made it work for me was:

  • Using Node v6.0.0 (as mentioned by @X-Ryl669) and npm v3.10.6 installed using nvm.
  • Changing node-sass dep to version 3.7.0 adding Node 6 support
  • Installing gulp globally (not completely sure, but I think it was necessary)

@phanan could you confirm that what I did was necessary and perhaps update the installation instructions?

I found that there are bits and pieces of information about installing Koel located at different places and considering the amount of issues reported related to installing Koel I feel like making a detailed up-to-date install guide is becoming kind off a priority?

Despite my lack of expertise I'm willing to give it a shot!

@gendrybaratheon
Copy link

@saulinternet

try command :
sudo apt-get install php5-mysql ######[debian 8.5]

@phi1-h
Copy link

phi1-h commented Sep 23, 2016

@bplower any news concerning php7 ?
Anyone got a raspberrypi working with koel ? Mine is currently running jessie, owncloud 9 with nginx and php7 and mariaDB. You guys think owncloud and koel can work on one raspberrypi ? Thanks for your answers :)

@smartrobot
Copy link

After many hours of frustration I was able to install on my digital ocean. There are definitely steps missing if you are coming from a vanilla install of Debian 8 x64. I still cant login but I see the login screen I am going to try and put together a better install guide soon I think I ran into every single problem that you might run into installing this software. If anyone knows why I can't login using the credentials I set in the .env file that would help a lot. Also before you run npm install run cp .env.example .env so you actually have an .env file and will not throw any errors during the install due to missing configurations.

@fwarren
Copy link

fwarren commented Feb 19, 2017

Kohl is now using Laravel 5.4 and there are some additional changes need.

NPM need to be at least version 6.
curl -sL https://deb.nodesource.com/setup_6.x | bash -

Edited package.npm before doing npm install
"node-sass": "^3.7.0",

If running older version of mysql which jessie does. Edit app/Providers/AppServiceProvider.php before running php artisan koel:init to add these 2 lines

use Illuminate\Support\Facades\Schema;
Schema::defaultStringLength(191);

Like so

use Illuminate\Support\Facades\Schema;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Schema::defaultStringLength(191);
        // Add some custom validation rules
        Validator::extend('path.valid', function ($attribute, $value, $parameters, $validator) {
            return is_dir($value) && is_readable($value);
        });
    }


After running php artisan koel:init to compile resources like gulp would do, run:
npm run build

@phanan
Copy link

phanan commented Mar 1, 2017

Sorry, gist doesn't notify :( For those who come here: You don't need php artisan serve. A PHP-capable server (e.g. Apache) serving index.php will do just fine. Also, I've moved the docs here and added quite a few information – be sure to check it out!

@ar2pi
Copy link

ar2pi commented Mar 7, 2017

The composer install also requires curl extension for php
sudo apt-get install php5-curl
For anyone who uses php 7:
sudo apt-get install php7.0-curl

@kstefanini
Copy link

kstefanini commented May 16, 2017

$ npm install doesn't work (see: koel/koel#545), run $ yarn instead

@jbheren
Copy link

jbheren commented May 18, 2017

Thanks @bplower for that, I followed your tutorial and made another guide installing the current koel master on a raspberry pi. see https://gist.github.com/jbheren/5c58b8488e0c47e6063cdcbe599c2ce1

Still having an issue with flac trancode not working.

@sophieforceno
Copy link

Followed this and the official instructions, and I just get a blank gray page with a search box in the upper left.

@brahmlower
Copy link
Author

I've removed two unnecessarily negative comments from this thread. As such, I'd like to make a couple points:

  1. Github doesn't show notification when a Gist receives a comment, even if you tag me in the message. Because of this, I haven't seen many of your comments and questions in a timely manner.
  2. Please recognize the passage of time in relation to this guide. The last revision of this was written back in early 2016. That was about 2.5 years ago, and one major Debian release ago. In that timespan, the installation requirements for Koel have very likely changed. If you plan to use the guide for installation, expect to encounter problems.

I understand that unclear/incomplete/aged documentation can be frustrating to work with. Believe me when I say I've been there- that's in part why I wrote this guide in the first place. But that's what you sign up for when working with software. Though it looks like activity on this Gist is dying down, I'd like to request future commenters follow the Rust code of conduct and understand that this is a place for constructive communication only.

@lilp69
Copy link

lilp69 commented Apr 4, 2019

Hello, when I try to run : php artisan koel:init
I've this issue : PHP Warning: require(/usr/local/koel/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /usr/local/koel/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/usr/local/koel/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php') in /usr/local/koel/bootstrap/autoload.php on line 17

I try : composer update -no--scripts, but still have issue.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment