How to Install Laravel GitScrum on CentOS 7

Updated on February 10, 2017
How to Install Laravel GitScrum on CentOS 7 header image

Laravel GitScrum, or GitScrum is an open source productivity tool designed to help development teams implement the Scrum methodology in a fashion similar to Git’s.

In this article we can install GitScrum on CentOS 7.

Prerequisites

  • A CentOS 7 x64 instance (1024MB or higher recommended).
  • A sudo user.
  • A GitHub/GitLab user account.
  • The epel yum repository.

Note: If you choose the 768MB RAM plan, you should setup a swap file in accordance with another Vultr tutorial.

Step 1: Update the system

Login to your server via SSH as your sudo user and run the following commands to install epel and update your system’s packages:

sudo yum install epel-release -y
sudo yum update -y
sudo shutdown -r now

Step 2: Install the Apache web server

On CentOS 7, you can install the latest stable release of Apache using YUM:

sudo yum install httpd -y

In a production environment, you should disable the pre-set Apache welcome page:

sudo sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf

Additionally, you should disable directly and file listing:

sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/httpd/conf/httpd.conf

Now start the Apache service and enable Apache to run on system boot:

sudo systemctl start httpd.service
sudo systemctl enable httpd.service

Step 3: Install MariaDB

GitScrum requires a database to store its data. For this tutorial, we will be using the latest stable release of MariaDB: MariaDB 10.1.

3.1 Create the MariaDB 10.1 YUM repo

Copy the following code segment into your SSH console, and then press Enter:

cat <<EOF | sudo tee -a /etc/yum.repos.d/MariaDB.repo
# MariaDB 10.1 CentOS repository list - created 2017-01-14 03:11 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

3.2 Install MariaDB 10.1

sudo yum install MariaDB-server MariaDB-client -y

3.3 Start the MariaDB service

sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

3.4 Secure the installation of MariaDB

sudo /usr/bin/mysql_secure_installation

Answer questions as follows, and be sure to set your own MariaDB root password.

Enter current password for root (enter for none): Enter
Set root password? [Y/n]: Y
New password: <your-password>
Re-enter new password: <your-password>
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y

3.5 Create a MariaDB database for GitScrum

Log into the MySQL shell as root:

mysql -u root -p

Enter the MariaDB root password you set earlier in order to log in.

In the MySQL shell, create a database gitscrum, a database user gitscrumuser, and its password yourpassword as follows.

Note: For security purposes, remember to replace the three sample parameters mentioned above with your own ones.

CREATE DATABASE gitscrum;
CREATE USER 'gitscrumuser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON gitscrum.* TO 'gitscrumuser'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

Step 4: Install PHP 7.x and Composer

4.1 Install PHP 7.1 and necessary extensions using the Webtatic YUM repo

sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
sudo yum install mod_php71w php71w-common php71w-gd php71w-mbstring php71w-mcrypt php71w-mysqlnd php71w-cli php71w-xml -y

4.2 Download the latest release of Composer, which is 1.3.1 at the time of writing

cd
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Note: The instructions above may change in should Composer update their installation instructions. As such, you should always check out the official Composer download page in order to get the most up-to-date installation instructions.

4.3 Make Composer globally available

sudo mv composer.phar /usr/local/bin/composer
sudo chown root:root /usr/local/bin/composer

Step 5: Install Git and GitScrum

5.1 Install Git

sudo yum install git -y

5.2 Install the latest version GitScrum

cd
git clone https://github.com/renatomarinho/laravel-gitscrum.git
cd laravel-gitscrum/
composer update
composer run-script post-root-package-install
sudo mv ~/laravel-gitscrum /var/www/html
sudo chown -R apache:apache /var/www/html

5.3 Setup a virtual host for GitScrum

Use the following code segment to setup a virtual host. Remember to replace the values of ServerAdmin, ServerName, ServerAlias, Errorlog, and CustomLog with your own ones.

cat <<EOF | sudo tee -a /etc/httpd/conf.d/gitscrum.conf
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/laravel-gitscrum/public/
ServerName gitscrum.example.com
ServerAlias www.gitscrum.example.com
<Directory /var/www/html/laravel-gitscrum/public/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/gitscrum.example.com-error_log
CustomLog /var/log/httpd/gitscrum.example.com-access_log common
</VirtualHost>
EOF

5.4 Setup a GitHub/GitLab OAuth application

Before you can use GitScrum properly, you need to setup a GitHub/GitLab OAuth application for authentication.

If you are using GitHub, visit GitHub New OAuth Application page, fill out the form as below, and then click the Register application buttion.

  • Application name: gitscrum
  • Homepage URL: http://203.0.113.1
  • Application description: gitscrum
  • Authorization callback URL: http://203.0.113.1/auth/provider/github/callback

You will get the Client ID and the Client Secret for this application. For this tutorial, we’ll use the below example credentials:

  • Client ID: ce68086dceb385a168c0
  • Client Secret: 3046067c0f8f06664e9b20ba78d753ca27ee9053

If you are using GitLab, you can get your OAuth data from GitLab application page in the same fashion.

5.5 Configure GitScrum

Use vi to open the GitScrum config file /var/www/html/laravel-gitscrum/.env:

sudo vi /var/www/html/laravel-gitscrum/.env

Find the following lines:

APP_URL=http://app.gitcodex.dev
...
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
...    
DB_HOST=
DB_PORT=3306
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=

Modify them individually as below:

APP_URL=http://203.0.113.1
...
GITHUB_CLIENT_ID=ce68086dceb385a168c0
GITHUB_CLIENT_SECRET=3046067c0f8f06664e9b20ba78d753ca27ee9053
...
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=gitscrum
DB_USERNAME=gitscrumuser
DB_PASSWORD=yourpassword

Save and quit:

:wq!

Restart the Apache service:

sudo systemctl restart httpd.service

Migrate the database with the following command:

php artisan migrate --seed

Modify firewall rules:

sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload

Finally, point your web browser to http://203.0.113.1 to access GitScrum. Click the Login with GitHub button to initiate the authentication.

This concludes our tutorial. Thank you for reading.