Skip to content

Installation and troubleshoot

X-Ryl669 edited this page Jan 25, 2017 · 3 revisions

This is a mix of all resources I've found

Installation on Debian Jessie

You need PHP5.6 and many dependencies (composer, node, yarn, etc...)

$ sudo apt-get install php5-fpm php-pear curl g++ git
$ sudo su
# curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
# curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
# apt-get install nodejs

Install a database (if not done already)

$ sudo apt-get install mysql-server php5 php5-mysql
This might ask you to create a mysql's root user password. Remember it, you'll need it later.
$ mysql -u root -p
Enter the previous password here
> CREATE DATABASE koel DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
> CREATE USER 'koel-db-user'@'localhost' IDENTIFIED BY 'koel-pass';
> GRANT ALL PRIVILEGES ON koel.* TO 'koel-db-user'@'localhost' WITH GRANT OPTION;
> exit;

Please note the user created above is koel-db-user and its password is koel-pass. I recommend you set up the user and password you want, not the one in this tutorial.

I recommand nginx (instead of apache), and you need the last version

$ sudo apt-get install nginx-full
$ sudo nano /etc/nginx/sites-available/music.domain.com
Copy and paste this, adapting to your domain name and path:
--- COPY BELOW
server {
    listen       80;
    server_name  music.domain.com;

    root  /path/to/your/www/kutr;
    access_log /path/to/your/logs/kutr.access.log;
    error_log /path/to/your/logs/kutr.error.log;
    index index.php;
    gzip            on;
    gzip_types      text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json;
    gzip_comp_level 9;


  # Whitelist only index.php, robots.txt, and those start with public/ or api/
  if ($request_uri !~ ^/$|index\.php|loginRedir\.php|robots\.txt|api/|public/) {
    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 unix:/var/run/php5-fpm.sock;
    fastcgi_index             index.php;
    fastcgi_split_path_info   ^(.+\.php)(/.+)$;
    fastcgi_intercept_errors  on;
    include                   fastcgi_params;
  }
}
--- END OF COPY HERE
Exit by Ctrl + O then Ctrl + X
$ sudo ln -sf /etc/nginx/sites-available/music.domain.com /etc/nginx/sites-enabled/music.domain.com
$ sudo /etc/init.d/nginx restart   

The above line should still work with systemd, else, sudo systemctl restart nginx

Install the repository now

$ cd /path/to/your/www/
$ git clone https://github.com/X-Ryl669/kutr
$ cd kutr
$ cp .env.example .env
$ nano .env
You need to update these parameters:
ADMIN_EMAIL
ADMIN_NAME
ADMIN_PASSWORD
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=koel
DB_USERNAME=koel-db-user
DB_PASSWORD=koel-pass
STREAMING_METHOD=x-accel-redirect
$ npm install -g yarn
$ npm install -g gulp
$ yarn install

Notice: If the command above failed, you'll have to adjust the permissions for all the underlying files so your www-data user can access them via chown/chmod

$ composer install
$ php artisan koel:init

Common error and their solutions

Pusher Class is not available

composer require pusher/pusher-php-server

If you have a "legacy error" with node

sudo ln -s /usr/bin/nodejs /usr/bin/node

Can not start in present working directory

npm install --unsafe-perm

Bad node version

sudo apt-get remove nodejs then resume on node install above