现在就迫不及待的来开始我们自己的GitLab服务器的搭建吧。由于我们是个人用户的探索,所有我们选择免费的GitLab Community Edition进行演示;
1.首先,我们应当明确GitLab只支持Unix的发布版(故,我在Mac虚拟机中安装Ubuntn):
2.其次,对硬件的要求如CPU(建议双核)、内存(建议2G)、存储、数据库和阅读器等,由于目前的电脑配置基本都满足,并且我们只是进行搭建服务器的演示操作,所以没必要要过量的纠结;如果在实际的开发的场景中,请参考官方文档:https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/requirements.md;
安装进程中,提示配置General type of mail configuration选择Internet Site,提示配置System mail name输入xxx.com便可:
pengchengxiang@ubuntu:~$ sudo apt-get install curl openssh-server ca-certificates postfix
[sudo] password for pengchengxiang:
Reading package lists... Done
… …
/etc/aliases does not exist, creating it.
WARNING: /etc/aliases exists, but does not have a root alias.
Postfix is now set up with a default configuration. If you need to make
changes, edit
/etc/postfix/main.cf (and others) as needed. To view Postfix configuration
values, see postconf(1).
After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.
Running newaliases
Setting up ssh-import-id (5.5-0ubuntu1) ...
Processing triggers for ureadahead (0.100.0⑴9) ...
Processing triggers for systemd (229⑷ubuntu4) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
4.添加gitlab包服务,并安装包 pengchengxiang@ubuntu:~$ curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
[sudo] password for pengchengxiang:
Detected operating system as Ubuntu/xenial.
… …
Importing packagecloud gpg key... done.
Running apt-get update... done.
The repository is setup! You can now install packages.
pengchengxiang@ubuntu:~$ sudo apt-get install gitlab-ce
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
… …
gitlab:
gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme
gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab:
It looks like GitLab has not been configured yet; skipping the upgrade script.
5.配置和启动GitLab 第1启动的时候,会履行如安装依赖包,初始化数据库等等操作;
pengchengxiang@ubuntu:~$ sudo apt-get install gitlab-ce
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers⑷.4.0⑵1 linux-headers⑷.4.0⑵1-generic
linux-image⑷.4.0⑵1-generic linux-image-extra⑷.4.0⑵1-generic
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
gitlab-ce
0 upgraded, 1 newly installed, 0 to remove and 208 not upgraded.
Need to get 281 MB of archives.
After this operation, 778 MB of additional disk space will be used.
... ...
Running handlers:
Running handlers complete
Chef Client finished, 225/313 resources updated in 02 minutes 59 seconds
gitlab Reconfigured!
6.阅读主机和登录 接下来我们在阅读器中输入localhost,就能够访问GitLab服务了,以下图:
第1次访问的时候,你将会跳转到密码重置页面来初始化管理员账户密码。输入你的密码后你将会被跳转到登录页面,默许的账户名称root。登录完成以后,你可以根据你的意愿修改用户名。