Restyaboard is a free and open-source Kanban board application. It is the best self-hosted alternative to Trello. It is written in PHP and uses PostgreSQL to store its database.
In this tutorial, we will install Restyaboard on CentOS 7 server.
Prerequisite
- Minimal CentOS 7 server
- Root privileges
Step 1 - Install Nginx
Before installing any package it is recommended that you update the packages and repository using the following command.
yum -y update
Nginx is not available on default CentOS YUM repository, hence we will need to install EPEL repository also. You can install EPEL by typing:
yum -y install epel-release
Now you can install nginx by typing:
yum -y install nginx
Once the installation is finished, you can run the following commands to start nginx and enable it to automatically start at boot time using following commands.
systemctl start nginx systemctl enable nginx
Nginx should be running on your server now.
Step 2 - Install and Configure PHP-FPM with Mbstring
Restyaboard supports PHP 7.0, hence we will install PHP 7.0 for maximum security and performance. PHP 7.0 is not available in YUM or EPEL repository, hence we will need to install Webtatic repository for same. Run the following command to install Webtatic repository.
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Now Install PHP 7.0 with PHP-FPM along with other required modules.
yum -y install php70w php70w-fpm php70w-devel php70w-cli php70w-curl php70w-pgsql php70w-mbstring php70w-ldap php70w-pear php70w-imap php70w-xml php70w-pecl-imagick ImageMagick
Once the installation finishes, we will need to configure few things. By default PHP-FPM is configured to use with Apache, you will need to change the users so that it can work with nginx also. Edit the /etc/php-fpm.d/www.conf file using your favorite text editor. In this tutorial, we will be using nano editor. If you do not have nano installed, you can run yum -y install nano.
nano /etc/php-fpm.d/www.conf
Now find the following lines and change apache to nginx.
; RPM: apache Choosed to be able to access some dir as httpd user = nginx ; RPM: Keep a group allowed to write in log dir. group = nginx
Instead of using a server port, we will use a socket file for PHP-FPM. Find the following line.
listen = 127.0.0.1:9000
and Change it to the following line.
listen = /run/php-fpm/php7.0-fpm.sock
Next, find the following lines.
;listen.owner = nobody ;listen.group = nobody ;listen.mode = 0660
Change the values to the following:
listen.owner = nginx listen.group = nginx listen.mode = 0660
Further, you will need to set the timezone in PHP configuration file. Edit PHP configuration file using the command:
nano /etc/php.ini
Find the following line and Uncomment the line and set the timezone according to your region. For example:
[Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = Asia/Kolkata
Uncomment the cgi.fix_pathinfo line and change value to 0.
cgi.fix_pathinfo=0
Further you will also need to install GeoIP. Run the following command to install GeoIP.
yum -y install GeoIP-devel
Now enable GeoIP extension by adding the following line at the end of the /etc/php.ini
extension=geoip.so
Start PHP-FPM and enable it to start at boot time using the following commands.
systemctl start php-fpm systemctl enable php-fpm
Then restart nginx using the following command.
systemctl restart nginx
Step 3 - Installing and Configuring PostgreSQL data
PostgreSQL is an open source Object - relational database management system. Restyaboard uses PostgreSQL to store its database.
PostgreSQL is not available in YUM or EPEL repository, you will need to install PostgreSQL repository.
rpm -Uvh https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
To install PostgreSQL run the following command.
yum -y install postgresql96-server postgresql96-contrib
The above command will install PostgreSQL along with all the required dependencies in your system, before using the software, we will need to run the following command to initialize the database.
/usr/pgsql-9.6/bin/postgresql96-setup initdb
Once PostgreSQL is installed, it time to configure it. Edit the /var/lib/pgsql/9.6/data/pg_hba.conf to enable MD5 based authentication.
nano /var/lib/pgsql/9.6/data/pg_hba.conf
Find the following lines and change peer to trust and idnet to md5.
# TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 127.0.0.1/32 ident # IPv6 local connections: host all all ::1/128 ident
Once updated, the configuration should look like shown below.
# TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5
Now start PostgreSQL server and enable it to automatically start at boot time using the following commands:
systemctl start postgresql-9.6 systemctl enable postgresql-9.6
Now change the password for the default PostgreSQL user which was created during the installation of PostgreSQL.
passwd postgres
Now login using PostgreSQL user using the following command.
su - postgres
The above command will login to the shell of postgres
Now create a new user by typing:
createuser rb_user
Now switch to the PostgreSQL shell using the following command.
psql
You will see the prompt on the shell has changed to postgres - #. Now run the following query to set a password for the newly created user for Restyaboard database.
ALTER USER rb_user WITH ENCRYPTED password 'StrongPassword';
Make sure to use a semicolon at the end of the query. The above query will ask you for the password of the rb_user twice. Now create a new database for PostgreSQL database using the following query.
CREATE DATABASE rb_data OWNER rb_user ENCODING 'UTF8' TEMPLATE template0;
The above query will create a database named rb_data with UTf8 encoding using template0 and the ownership will be provided to rb_user.
Exit from the psql shell to the normal shell user shell of postgres user using the following command.
\q
and switch to the root user again using exit command.
Step 4 - Download Restyaboard
As we have all the dependencies ready, we can now download Restyaboard. Run the following command to download the ready deployable version.
cd /usr/share/nginx/html wget https://github.com/RestyaPlatform/board/releases/download/v0.4.2/board-v0.4.2.zip
You can always find the link to the latest version on the Restyaboard Github page.
Now extract the archive using following commands. If you do not have unzip installed, you can run yum -y install unzip.
unzip board-v0.4.2.zip -d board
Once the archive is extracted, import the SQL file using the following command.
psql -d rb_data -f "/usr/share/nginx/html/board/sql/restyaboard_with_empty_data.sql" -U rb_user
Now edit the Restyaboard configuration file to update database credentials.
nano /usr/share/nginx/html/board/server/php/config.inc.php
Find the following lines.
define('R_DB_HOST', 'localhost'); define('R_DB_USER', 'restya'); define('R_DB_PASSWORD', 'hjVl2!rGd'); define('R_DB_NAME', 'restyaboard'); define('R_DB_PORT', 5432);
Change it according to the database name, username and password of the database we have recently created to store Restyaboard data. Once done, it should look like shown below.
define('R_DB_HOST', 'localhost'); define('R_DB_USER', 'rb_user'); define('R_DB_PASSWORD', 'StrongPassword'); define('R_DB_NAME', 'rb_data'); define('R_DB_PORT', 5432);
Step 5 - Configure Nginx Server Block
Restyboard nginx server block configuration comes packaged with the zip archive. You can copy the configuration file to nginx configuration file location using the following command.
cp /usr/share/nginx/html/board/restyaboard.conf /etc/nginx/conf.d
Now you will need to make few changes into the file. Open the configuration file using your favorite text editor.
nano /etc/nginx/conf.d/restyaboard.conf
At the start of the configuration, find the following line.
server { listen 80 default_server; server_name _;
Remove default_server text and provide your domain name after server name. It should look like as shown below.
server { listen 80; server_name board.yourdomain.com;
Also find the following line:
root /usr/share/nginx/html;
and
location / { root /usr/share/nginx/html/client; }
and
root /usr/share/nginx/html/client;
Change the above line according to the Restyaboard installation folder. It should look like shown below.
root /usr/share/nginx/html/board;
and
location / { root /usr/share/nginx/html/board/client; }
and
root /usr/share/nginx/html/board/client
Also find the line:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
Change it to the following:
fastcgi_pass unix:/run/php-fpm/php7.0-fpm.sock;
You can close the file now. Now provide appropriate ownership and permission using the following commands.
chown -R nginx:nginx /usr/share/nginx/html/board/ chmod -R go+w "/usr/share/nginx/html/board/media" chmod -R go+w "/usr/share/nginx/html/board/client/img" chmod -R go+w "/usr/share/nginx/html/board/tmp/cache" chmod -R 0755 /usr/share/nginx/html/board/server/php/shell/*.sh
Finally, add the cron entries to enable scheduled tasks to run using following commands.
echo "*/5 * * * * /usr/share/nginx/html/board/server/php/shell/instant_email_notification.sh" >> /var/spool/cron/root echo "0 * * * * /usr/share/nginx/html/board/server/php/shell/periodic_email_notification.sh" >> /var/spool/cron/root echo "*/30 * * * * /usr/share/nginx/html/board/server/php/shell/imap.sh" >> /var/spool/cron/root echo "*/5 * * * * /usr/share/nginx/html/board/server/php/shell/webhook.sh" >> /var/spool/cron/root echo "*/5 * * * * /usr/share/nginx/html/board/server/php/shell/card_due_notification.sh" >> /var/spool/cron/root
Now you will need to disable your SELinux because Proxy configuration does not work with SELinux policies. To temporary disable SELinux without restarting the server, run the following command.
setenforce 0
To completely disable the SELinux you will need to edit /etc/selinux/config file.
nano /etc/selinux/config
Find the following line:
SELINUX=enforcing
Change it to:
SELINUX=disabled
Then restart Nginx using the following command.
systemctl restart nginx
You can now access the server by going to the following URL.
http://board.yourdomain.com
You will see following login screen.
Now login using the username admin and password restya. Once you are logged in, you will seethe following screen.
To create a new Board, click on the arrow at the left corner of the page and click on Add Board or Organization.
Provide a name and choose a template to create a new board.
Once you have created the Board, It will look like shown below.
To access the Admin panel, you can click on Admin button at the bottom right corner and then click on Settings on the top bar.
Restyaboard is now installed on your server, you can now use the kanban board to improve the workflow of your project.