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

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:

主站蜘蛛池模板: 盐山县| 泸溪县| 鄯善县| 甘德县| 疏勒县| 荔浦县| 诸城市| 鄂托克旗| 临洮县| 漳平市| 新源县| 沂水县| 大石桥市| 炉霍县| 合肥市| 高雄县| 荥阳市| 托克逊县| 开封县| 新龙县| 育儿| 绩溪县| 汶川县| 屏东市| 大同市| 康保县| 巴青县| 读书| 博兴县| 犍为县| 扎囊县| 阿图什市| 和硕县| 巢湖市| 高要市| 禹城市| 密云县| 馆陶县| 清河县| 通化市| 赤峰市|