X
    Categories: Tutorials

Install CandyCane on an Ubuntu 14.04 VPS

In this guide, we will explain how to install CandyCane on an Ubuntu 14.04 VPS with MariaDB, PHP-FPM and Nginx. CandyCane a flexible open source bug tracking system powered by CakePHP MVC framework. This guide should work on other Linux VPS systems as well but was tested and written for an Ubuntu 14.04 VPS.

 

 

Login to your VPS via SSH

ssh user@vps

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 git curl

Install MariaDB 10.0

[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 CandyCane installation.

[user]$ mysql -uroot -p

MariaDB [(none)]> CREATE DATABASE cc;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cc.* TO 'ccuser'@'localhost' IDENTIFIED BY 'ccuser_passwd';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

Install Nginx

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

Install PHP, composer 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 php5-mcrypt php-pear php5-curl

Composer is a dependency manager for PHP with which you can install packages. Composer will pull in all the required libraries and dependencies you need for your project.

[user]$ curl -sS https://getcomposer.org/installer | php
[user]$ sudo mv composer.phar /usr/local/bin/composer

Install CandyCane

Create a root directory for your CandyCane installation script using the following command:

[user]$ mkdir -p ~/myCandyCane.com/{public_html,logs}

Clone the project repository from GitHub:

[user]$ git clone https://github.com/yandod/candycane.git ~/myCandyCane.com/public_html

Change to the directory and install composer packages:

[user]$ cd ~/myCandyCane.com/public_html
[user]$ composer install

PHP-FPM configuration

Create a new PHP-FPM pool for your user:

[user]$ sudo vim /etc/php5/fpm/pool.d/your_user.conf

[your_user]
user = your_user  
group = your_user  
listen = /var/run/php5-fpm-your_user.sock  
listen.owner = your_user
listen.group = your_user  
listen.mode = 0666  
pm = ondemand  
pm.max_children = 5  
pm.process_idle_timeout = 10s;  
pm.max_requests = 200  
chdir = /

Do not forget to change your_user with your username.

Restart PHP-FPM:

[user]$ sudo service php5-fpm restart

Nginx configuration

Create a new Nginx server block with the following content:

[user]$ sudo vim /etc/nginx/sites-available/myCandyCane.com

server {
    server_name myCandyCane.com;
    listen 80;
    root /home/your_user/myCandyCane.com/public_html/app/webroot;

    access_log /home/your_user/myCandyCane.com/logs/access.log;
    error_log /home/your_user/myCandyCane.com/logs/error.log;

    index index.php;

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

    sendfile off;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm-your_user.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;
    }    
}

Do not forget to change your_user with your username.

Activate the server block by creating a symbolic link :

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

Test the Nginx configuration and restart nginx:

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

Final steps

Open http://myCandyCane.com in your favorite web browser and you should see the CandyCane install screen. Provide the database information and follow the installation wizard instructions.

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


Of course you don’t have to do any of this if you use one of our Linux 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 please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.