官术网_书友最值得收藏!

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:

主站蜘蛛池模板: 南涧| 遵义市| 濮阳县| 民丰县| 奉新县| 渭南市| 麻阳| 泰州市| 博爱县| 施甸县| 昌平区| 泽州县| 鄂托克旗| 晴隆县| 金沙县| 怀化市| 资溪县| 大安市| 新闻| 寿阳县| 津南区| 湾仔区| 特克斯县| 凭祥市| 济宁市| 河源市| 沽源县| 互助| 普格县| 项城市| 龙海市| 师宗县| 连云港市| 通渭县| 中超| 商水县| 清水县| 绩溪县| 竹溪县| 澄江县| 临潭县|