How to do installation and configuration of GoCD on CentOS? – Part 1

0
18
installation and configuration of GoCD

Let’s do installation and configuration of GoCD

GoCD is an open source system. GoCD is continuous delivery and automation system. GoCD helps you to streamline and automate your BTR (build, test and release) cycle for perfect and continuous delivery of the product. With the help of its sequential and parallel execution, it configures the dependencies for on demand deployment and faster feedback. You can model complex workflows easily. You can visualize a complex workflow end to end in real-time by using its value stream map.

GoCD compares two builds and let you deploy the version of your choice. GoCD executes tests in various frameworks and languages. It provides cross-platform and parallel execution. GoCD reporting tells you the exact changeset and where the test broke which helps in debugging and fixing. There are various plugins and extensions available, you can use them. You can also create your own plugin.

As a developer, I prefer the services of Alibaba Cloud to host my GoCD. Alibaba Elastic Compute (ECS) is highly scalable and flexible. You can upgrade the hardware resources anytime when you get more traffic.

GoCD does not restrict its installation to any specific operating system (OS). You can use any operating system (OS) of your choice; however, the installation steps would vary according to the choice of operating system.

In this tutorial, I will be using Alibaba Cloud Elastic Compute Service (ECS) with CentOS 7 installed on it.

In this first part of this tutorial, you will learn about prerequisites for GoCD, hardware configurations recommended for GoCD, how to add user, how to assign root privileges to a user, how to update CentOS, how to install epel-release, how to install git, how to install nano-editor, how to install Java and how to do security group settings necessary for GoCD server.

Prerequisites:

    1. You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you are a new user, you can get free $300 credits in your Alibaba Cloud account. If you don’t know about how to setup your ECS instance, you can refer to this tutorial or quick-start guide.
    2. ECS must have at least 1GB RAM and 2 Core processor.
    3. A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records.
    4. Domain name must be pointed to your Alibaba Cloud ECS’s IP address.
  1. You should setup your server’s hostname.
  2. Access to VNC console in your Alibaba Cloud or SSH client installed in your PC.

Getting started:

  1. After completing the prerequisites, login as root user with your root username & password via SSH client (e.g. Putty – You can get Putty from https://www.putty.org ) or VNC console available in your Alibaba Cloud account dashboard.

How to install and configure GoCD 1

Let’s add a User with Root Privileges:

In the first step, you will add a new user and give it sudo privileges. Sudo privileges will allow this username to make administrative changes on system when required. This user will be used to login from via SSH for everyday use. Once you have added this user, to keep your server secure from various attacks, you will disable the remote root access to root user.

  1. To create a new user account, use the following command:

 

# adduser aareez

 

How to install and configure GoCD 2

where “aareez” can be any username of your choice.

  1. Now you will need to set password for your added username. To set password, execute the following commands:

 

# passwd aareez

How to install and configure GoCD 3

 

Now set your desired password and retype your desired password, then hit Enter key. To confirm the data is correct, type ‘Y’ and hit Enter key.

  1. Now assign username to sudo user’s group to give administrative privileges. For this, we will check /etc/sudoers file and see whether sudoers group is enabled or not. For this purpose, we will execute the following command.
# visudo
How to install and configure GoCD 333
  1. After executing the above command, a file will be opened, find the following lines in the opened file.

How to install and configure GoCD 4

Sometimes by default the second line %wheel    ALL=(ALL:ALL)    ALL is commented (starting with hash #), due to which even after adding username to sudoers, it gives error on using sudo. To prevent this issue, if this line starts with ‘#’ sign, remove this symbol and save the changes by pressing Esc key, type 😡 and hit enter.

  1. Now you will add your username “aareez” to the “wheel” group by executing the following command:

 

# usermod -aG wheel aareez

How to install and configure GoCD 5

After execution of the above command, you can verify the membership for that group by executing the following command:

# groups aareez

How to install and configure GoCD 555

Your username has been successfully added to sudoers group and it is able to execute any root command.

  1. Now, log in by using your new username and password. OR Use the following command to switch user:
# su - aareez

How to install and configure GoCD 6

You can see that you have been logged in from your new account now. If you want to verify this, you can use the command below:

# whoami

How to install and configure GoCD 666

Let’s update your CentOS 7 System:

Before proceeding with installation of any kind of package, use the following command to update your CentOS system. To execute this command, remember to login from non-root user with sudo privileges.

# sudo yum -y update

How to install and configure GoCD 21

Now you have successfully updated your CentOS system.

How to install and configure GoCD 212

Let’s install epel-release:

  1. To install epel-release, execute the command below:
# sudo yum install epel-release

How to install and configure GoCD 31

  1. You will be asked “Is it ok?”, to proceed with installation, type ‘y’ and hit Enter

How to install and configure GoCD 32

  1. After you have successfully installed epel-release, you will see the following output on screen.

How to install and configure GoCD 33

  1. Now to perform the system update, restart your system using the following command.
# sudo yum update -y && sudo shutdown -r now
  1. Now you will need to access your ECS via Putty again after restart has been completed. Remember to use your newly added username with sudo rights to log in to ECS.

How to install and configure GoCD 35

Let’s install Git:

You will need to install Git to get clone of Let’s Encrypt SSL from Github. To install git, follow the steps below:

  1. Execute the following command:
# sudo yum -y install git

How to install and configure GoCD 41

  1. After successful installation of git, you will see the following screen.

How to install and configure GoCD 42

Let’s install nano editor:

You will need to install nano editor to edit files.

  1. Execute the following command:
# sudo yum -y install nano

How to install and configure GoCD 61

  1. After successful installation of git, you will see the following screen.

How to install and configure GoCD 62

 

Let’s install Java:

GoCD requires Java version 8. You are allowed to use Oracle Java or OpenJDK. The steps for installation may vary. In this tutorial, I will use Java 8 form OpenJDK because it is already available in yum package by default.

  1. To install the Java version 8, you will need to execute the following command:

 

# sudo yum -y install java-1.8.0-openjdk-devel

How to install and configure GoCD 71

 

  1. After successful installation of Java, the following screen will appear.

How to install and configure GoCD 72

 

  1. After installation, you will be able to confirm your Java installation. For that, execute the commands below:
# java -version

How to install and configure GoCD 73

  1. Now we will need to setup environment variables for Java that are JRE_HOME and JAVA_HOME. To set environment variables, you will need absolute path of your Java executables. To find absolute path, execute the following command:
# readlink -f $(which java)

You will see the following output.

 

 

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/bin/java

 

 

How to install and configure GoCD 74

  1. Now execute the following commands to set JAVA_HOME and JRE_HOME.

 

 

# echo “export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-5.b12.el7_4.x86_64” >> ~/.bash_profile

 

 

# echo “export JRE_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-5.b12.el7_4.x86_64/jre” >> ~/.bash_profile

 

 

How to install and configure GoCD 755

How to install and configure GoCD 7555

  1. Now execute the following command to execute the file.
# source ~/.bash_profile
  1. Now execute the following command to ensure whether environment variables have been set correctly.
# echo $JAVA_HOME

 

You will see the following output.

How to install and configure GoCD 77

 

Let’s setup firewalls:

  1. If you have activated firewalls, you will have to define a rule in Alibaba Cloud security group for your cloud server to add exception for port 8153/tcp for unsecured connection and 8154/tcp for secured connection. You can enable these ports while creating ECS instance, but in case, if you have forgotten to unblock these ports, you can follow the procedure below. By default, these ports are blocked by the firewalls.

To do this follow the given instructions in snapshots:

Go to your Elastic Compute Service section:

How to install and configure GoCD 180

 

Click on more button for ECS you are making ready for ProcessWire CMS:

How to install and configure GoCD 182

Click on Configure Rules:

How to install and configure GoCD 199

 

 

Click on Quickly Create Rules:

 How to install and configure GoCD 100

 

Add the configurations for port TCP 8153 as shown in screenshot below & click OK.

How to install and configure GoCD 101

 

 

Now add the configurations for port TCP 8154 as shown in screenshot below & click OK.

How to install and configure GoCD 102

 

In this first part of this tutorial, you have learnt about prerequisites for GoCD, hardware configurations recommended for GoCD, how to add user, how to assign root privileges to a user, how to update CentOS, how to install epel-release, how to install git, how to install nano-editor, how to install Java and how to do security group settings necessary for GoCD server. In the next part, you will learn about installation of GoCD and configuration of GoCD along with installation of SSL using Let’s Encrypt.

 

Previous articleHow to setup your ARK: Survival Evolved Server or Ubuntu OS?
Next articleBest Web Design Services – Hire us Today!
I'm a Software Engineer by profession. I had been certified as Cloud Computing Specialist by Alibaba Cloud. I started my career by working on freelance projects related to Facebook App Development, Mobile App development, Web development, and Software development. I voluntarily edited Facebook Map and Google Maps. During my blogging career, I experienced Affiliate Marketing, Google AdWords, Facebook Ads, Facebook Audience Network, Google Adsense and Media.net by Microsoft. I am also the founder of cloud-based Centralized Queue Management System (CQMS) which has been deployed in COMSATS University's student service center and admission cell for managing their queues. CQMS has also been awarded 3rd best project in DICE -IET 2017 (a national level exhibition and competition). Besides, I am a technical author at Alibaba Cloud. I had written many tutorials on Alibaba Cloud Focus. Moreover, I have published my book on Amazon. Currently, I am writing my next book that is expected to be published soon.

LEAVE A REPLY

Please enter your comment!
Please enter your name here