How to install Koken on Ubuntu

how to install koken on ubuntu

In this tutorial  we will explain, how to install Koken on Ubuntu, with MariaDB, PHP-FPM and Nginx. Koken a free system designed for publishing independent web sites of creative work. This guide should work on other Linux VPS systems as well but was tested and written for an Ubuntu 14.04 VPS.

1. Login to your VPS via SSH

ssh user@vps

2. Update the system and install necessary packages

[user]$ sudo apt-get update && sudo apt-get -y upgrade
[user]$ sudo apt-get install software-properties-common unzip

3. Install MariaDB 10.0

To install MariaDB, run the following commands:

[user]$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
[user]$ sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu trusty main'
[user]$ sudo apt-get update
[user]$ sudo apt-get install -y mariadb-server

When the installation is complete, run the following command to secure your installation:

[user]$ mysql_secure_installation

Next, we need to create a database for our Koken installation.

[user]$ mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE koken;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON koken.* TO 'kokenuser'@'localhost' IDENTIFIED BY 'kokenuser_passwd';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

4. Install Nginx web server

Ubuntu 14.04 comes with nginx version 1.4, to install the latest stable version of Nginx version 1.8, run:

[user]$ sudo add-apt-repository -y ppa:nginx/stable
[user]$ sudo apt-get update
[user]$ sudo apt-get -y install nginx

5. Install PHP and required PHP modules

To install the latest stable version of PHP version 5.6 and all nessesary modules, run:

[user]$ sudo add-apt-repository -y ppa:ondrej/php5-5.6
[user]$ sudo apt-get update
[user]$ sudo apt-get -y install php5-fpm php5-cli php5-imagick php5-mysqlnd

6. Download the Koken installation script

Create a root directory for your Koken installation and download the installation script using the following commands:

[user]$ mkdir -p ~/myKoken.com/{public_html,logs}
[user]$ wget -P /tmp https://s3.amazonaws.com/install.koken.me/releases/Koken_Installer.zip 
[user]$ unzip /tmp/Koken_Installer.zip -d /tmp
[user]$ cp /tmp/Koken_Installer/koken/index.php ~/myKoken.com/public_html

7. PHP-FPM configuration

Create a new PHP-FPM pool for your user:

[user]$ cat << EOF | sudo tee /etc/php5/fpm/pool.d/$(whoami).conf
[$(whoami)]
user = $(whoami)  
group = $(whoami)  
listen = /var/run/php5-fpm-$(whoami).sock  
listen.owner = $(whoami)
listen.group = $(whoami)  
listen.mode = 0666  
pm = ondemand  
pm.max_children = 5  
pm.process_idle_timeout = 10s;  
pm.max_requests = 200  
chdir = /
EOF

Restart PHP-FPM:

[user]$ sudo service php5-fpm restart

8. Nginx configuration

Create a new Nginx server block with the following content:

[user]$ cat << EOF | sudo tee /etc/nginx/sites-available/myKoken.com
server {
    server_name myKoken.com;
    listen 80;
    root $HOME/myKoken.com/public_html;

    access_log $HOME/myKoken.com/logs/access.log;
    error_log $HOME/myKoken.com/logs/error.log;

    index index.php;

    location / {
        try_files       \$uri \$uri/ /index.php?\$args;
    }

    location ~ \.php\$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)\$;
        fastcgi_pass unix:/var/run/php5-fpm-$(whoami).sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
    }

    location ~ /\.ht {
        deny all;
    }    
}
EOF

Activate the server block by creating a symbolic link :

[user]$ sudo ln -s /etc/nginx/sites-available/myKoken.com /etc/nginx/sites-enabled/myKoken.com

Test the Nginx configuration and restart nginx:

[user]$ sudo nginx -t
[user]$ sudo service nginx restart

9. Install FFmpeg

FFmpeg is not in the Ubuntu’s default repositories, so we’ll need to install it from a ppa:

[user]$ sudo add-apt-repository -y ppa:mc3man/trusty-media
[user]$ sudo apt-get update
[user]$ sudo apt-get -y install ffmpeg

10. Final steps

Open http://myKoken.com in your favorite web browser and you should see the Koken install screen. Provide the database and user information and the script will download and install the latest version of Koken to your server.

That’s it. You have successfully installed Koken on your Ubuntu 14.04 VPS. For more information about how to manage your Koken installation, please refer to the Koken website.


Of course you don’t have to install Koken on Ubuntu, if you use one of our Ubuntu VPS Hosting services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, on how to to install Koken on Ubuntu,  please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment