Read Time:2 Minute, 42 Second
Objective:
Installing and configuring Gitlab and Jenkins on Raspberry Pi 2
Background:
I currently have extra Raspberry Pi and would like to use for something useful. I found Jenkins and Gitlab are able to install on Raspberry Pi.
This article is to share the step by step guide how to setup Gitlab and Jenkins to Raspberry Pi 2.
Preparation:
1 x Raspberry Pi 2
Step By Step:
- Install Raspbian to Raspberry Pi 2
- Omit the installation part as it is quite straightforward.
- Setup static IP address
- Omit as Google will tell you how to do.
- In my Pi, I set 192.168.1.201
- Increase swap memory
- Since both applications are memory intensive, I increased swap memory
$ sudo nano /etc/dphys-swapfile
Change CONF_SWAPFILE=100 to CONF_SWAPFILE=1000
- Since both applications are memory intensive, I increased swap memory
- Install Gitlab
- Run following commands
$ sudo apt-get install curl openssh-server ca-certificates postfix apt-transport-https $ curl https://packages.gitlab.com/gpg.key | sudo apt-key add - $ sudo curl -sS https://packages.gitlab.com/install/repositories/gitlab/raspberry-pi2/script.deb.sh | sudo bash $ sudo apt-get install gitlab-ce $ sudo gitlab-ctl reconfigure
- Detailed instruction available in https://about.gitlab.com/installation/#raspberry-pi-2
- Run following commands
- Install Jenkins
- Run following commands
$ sudo update-alternatives --config java $ mkdir jenkins && cd jenkins $ wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - $ sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list' $ sudo apt-get update $ sudo apt-get install jenkins
- Detailed instruction available in http://ifahrentholz.de/2017/setup-jenkins-on-raspberry/
- Run following commands
- Access Gitlab – http://192.168.1.201:80
- Update Gitlab configuration file for changing a port
- Since I didn’t want to use 80 as default port, I updated the port to 8080.
- Run following command
$ sudo nano /etc/gitlab/gitlab.rb
Update following configuration parameters
external_url "http://192.168.1.201:8081" nginx['listen_port'] = 8081 unicorn['port'] = 8082
- Run following command
$ sudo gitlab-ctl reconfigure
- Access Gitlab – http://192.168.1.201:8081
- Create new password for account
- Login with root and password
- Then you will see this screen
- Access Jenkins – http://192.168.1.201:8080
- Get initial password for unlocking Jenkins
$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
- In the screen “Customize Jenkins”, click “Install suggested plugins” and wait for installing plugins
- Create first administrator user
- Click “Start using Jenkins”
- If the display language is not English or you prefer different display language, then install Locale plugin and force to set desired language as main language.If the display language is not English or you prefer different display language, then install Locale plugin and force to set desired language as main language.
- Plugin page: https://wiki.jenkins.io/display/JENKINS/Locale+Plugin
- Go to “Manage Jenkins” -> “Manage Plugins”
- Click “Available” tab
- Find “Locale plugin” and check checkbox
- Click “Install without restart” button
- After finishing installation, go to “Manage Jenkins” -> “Configure System”
- Find “Locale” section -> “Default Language”
- Enter desired language code such as en for English
- And check “Ignore browser preference and force this language to all users”
- Click “Save” button
- After you finish setting, you should see following screen