- Continuous Integration,Delivery,and Deployment
- Sander Rossel
- 539字
- 2021-07-02 15:42:12
Installing GitLab
Installing and setting up Git (with Secure Shell (SSH)) authentication in Ubuntu is a pain when you are not a Linux veteran. Once you have installed everything, you are left with a plain, bare, command-line Git. Luckily, there are third-party providers that do all the heavy lifting and give you a neat portal with all your projects and commits as an added bonus (making it look like GitHub)! The one we are going to use is GitLab. Again, the docs are pretty explicit on how to install GitLab (https://about.gitlab.com/downloads/#ubuntu1604).
The first thing we have to do is install some necessary dependencies:
sudo apt-get update
sudo apt-get install curl openssh-server ca-certificates postfix
The installation of postfix will give you an install window (kind of like when you were installing Ubuntu) that will let you choose a default configuration. Just pick the default (Internet Site) and hit Enter. After that, it will ask for the system mail name. The default is your server name, so just go with it. After that, the installation will continue.
After that, we need to add the GitLab package so we can install it:
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce
The curl program is a well-known program (also available in Windows) to transfer data from command lines or scripts. According to the curl website (https://curl.haxx.se/), it is used in your car, television, and practically everything you own. The -s switch is the silent mode, meaning it will not output errors or progress. The S (from -S) makes sure any error messages are still printed (despite the silent mode). The resulting script (which you can also view on your browser by simply browsing to the URL) is given as a parameter to Bash. Bash is a shell program, or a command-line program, that executes commands. Kind of like what we were doing the entire time, but with different commands. After the script runs, we can install GitLab.
I have mentioned it before, but a lot of programs run on port 8080. GitLab uses port 8080, which is a problem for us, since Jenkins also runs on port 8080. You can pick either to change the Jenkins port (and reboot) or change the GitLab port. You can change the Jenkins port by changing the /etc/default/jenkins file (simply find the port and change it) or you can change the GitLab port by adding a line to the /etc/gitlab/gitlab.rb file. I would recommend changing the GitLab port, since we are installing and configuring it right now anyway. Just a reminder, sudo vi /etc/gitlab/gitlab.rb opens the file, I let's you edit, Esc gets you out of edit mode, :wq saves and quits, and :q! quits without saving. Under the line external_url 'http://ciserver', add the line unicorn['port'] = '8081'.
Now, you need to reconfigure GitLab (which you always need to do after changing the gitlab.rb file):
sudo gitlab-ctl reconfigure
This can take a few minutes. GitLab may also need a minute or two to boot, so do not be alarmed when it does not show right after booting your VM. Now, in your host, browse to ciserver (or 192.168.56.101, the IP of your VM) and you should get the GitLab login page:

- jQuery Mobile Web Development Essentials(Third Edition)
- Implementing Modern DevOps
- Learning Java Functional Programming
- ThinkPHP 5實戰(zhàn)
- 前端跨界開發(fā)指南:JavaScript工具庫原理解析與實戰(zhàn)
- WSO2 Developer’s Guide
- Web Development with Django Cookbook
- HTML5+CSS3基礎開發(fā)教程(第2版)
- 機器人Python青少年編程開發(fā)實例
- Flash CS6中文版應用教程(第三版)
- Kinect for Windows SDK Programming Guide
- Microsoft System Center Orchestrator 2012 R2 Essentials
- Java應用開發(fā)技術實例教程
- Python爬蟲、數(shù)據(jù)分析與可視化:工具詳解與案例實戰(zhàn)
- Visual C++程序設計與項目實踐