环境说明:CentOS最小化安装;升级软件补丁,内核和系统版本不升级;关闭SELinux和防火墙。
1、安装依赖项:yum -y install curl policycoreutils-python openssh-server openssh-clients
[root@izuf6fy69k7l7e20jogcj7z ~]# yum -y install curl policycoreutils-python openssh-server openssh-clients Loaded plugins: fastestmirror Determining fastest mirrors base | 3.6 kB 00:00:00 epel | 3.2 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/7): epel/x86_64/group_gz | 88 kB 00:00:00 (2/7): base/7/x86_64/group_gz | 166 kB 00:00:00 (3/7): extras/7/x86_64/primary_db | 156 kB 00:00:00 (4/7): epel/x86_64/updateinfo | 948 kB 00:00:00 (5/7): updates/7/x86_64/primary_db | 1.3 MB 00:00:00 (6/7): epel/x86_64/primary | 3.6 MB 00:00:00 (7/7): base/7/x86_64/primary_db | 6.0 MB 00:00:00 epel 12852/12852 Package openssh-server-7.4p1-16.el7.x86_64 already installed and latest version Package openssh-clients-7.4p1-16.el7.x86_64 already installed and latest version Resolving Dependencies --> Running transaction check ---> Package curl.x86_64 0:7.29.0-46.el7 will be updated ......此处省略...... ---> Package libselinux-python.x86_64 0:2.5-14.1.el7 will be an update --> Finished Dependency Resolution Dependencies Resolved =========================================================================================================================================================================================== Package Arch Version Repository Size =========================================================================================================================================================================================== Installing: policycoreutils-python x86_64 2.5-29.el7 base 456 k Updating: ......此处省略...... nss-pem x86_64 1.0.3-5.el7 base 74 k policycoreutils x86_64 2.5-29.el7 base 916 k Transaction Summary =========================================================================================================================================================================================== Install 1 Package (+ 6 Dependent packages) Upgrade 1 Package (+10 Dependent packages) Total download size: 4.4 M Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. (1/18): audit-libs-2.8.4-4.el7.x86_64.rpm | 100 kB 00:00:00 (2/18): audit-libs-python-2.8.4-4.el7.x86_64.rpm | 76 kB 00:00:00 ......此处省略...... (17/18): policycoreutils-2.5-29.el7.x86_64.rpm | 916 kB 00:00:00 (18/18): setools-libs-3.3.8-4.el7.x86_64.rpm | 620 kB 00:00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 14 MB/s | 4.4 MB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : libsepol-2.5-10.el7.x86_64 1/29 Updating : libselinux-2.5-14.1.el7.x86_64 2/29 ......此处省略...... Verifying : libsepol-2.5-8.1.el7.x86_64 27/29 Verifying : libselinux-2.5-12.el7.x86_64 28/29 Verifying : libselinux-utils-2.5-12.el7.x86_64 29/29 Installed: policycoreutils-python.x86_64 0:2.5-29.el7 Dependency Installed: audit-libs-python.x86_64 0:2.8.4-4.el7 checkpolicy.x86_64 0:2.5-8.el7 libcgroup.x86_64 0:0.41-20.el7 libsemanage-python.x86_64 0:2.5-14.el7 python-IPy.noarch 0:0.75-6.el7 setools-libs.x86_64 0:3.3.8-4.el7 Updated: curl.x86_64 0:7.29.0-51.el7 Dependency Updated: audit.x86_64 0:2.8.4-4.el7 audit-libs.x86_64 0:2.8.4-4.el7 libcurl.x86_64 0:7.29.0-51.el7 libselinux.x86_64 0:2.5-14.1.el7 libselinux-python.x86_64 0:2.5-14.1.el7 libselinux-utils.x86_64 0:2.5-14.1.el7 libsemanage.x86_64 0:2.5-14.el7 libsepol.x86_64 0:2.5-10.el7 nss-pem.x86_64 0:1.0.3-5.el7 policycoreutils.x86_64 0:2.5-29.el7 Complete!
2、重启SSHD服务并配置服务自启动(一般这一步可忽略):systemctl restart sshd && systemctl enable sshd
[root@izuf6fy69k7l7e20jogcj7z ~]# systemctl restart sshd && systemctl enable sshd
一般情况使用Gitlab环境发送邮件服务功能都是直接使用其他外部SMTP服务器发送电子邮件方案,使用时配置外部SMTP服务器即可。所以Postfix邮件服务无需安装
3、下载Gitlab程序
[root@izuf6j9tjuw2zd5wodwiztz ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.1.4-ce.0.el7.x86_64.rpm --2018-08-20 15:29:43-- https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.1.4-ce.0.el7.x86_64.rpm Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1 Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 441423852 (421M) [application/x-redhat-package-manager] Saving to: ‘gitlab-ce-11.1.4-ce.0.el7.x86_64.rpm’ 100%[=================================================================================================================================>] 441,423,852 23.9MB/s in 17s 2018-08-20 15:30:02 (25.0 MB/s) - ‘gitlab-ce-11.1.4-ce.0.el7.x86_64.rpm’ saved [441423852/441423852] [root@izuf6j9tjuw2zd5wodwiztz ~]# ll total 431084 -rw-r--r-- 1 root root 441423852 Aug 1 05:41 gitlab-ce-11.1.4-ce.0.el7.x86_64.rpm
4、安装Gitlab程序:rpm -ivh gitlab-ce-11.1.4-ce.0.el7.x86_64.rpm
[root@izuf6j9tjuw2zd5wodwiztz ~]# rpm -ivh gitlab-ce-11.1.4-ce.0.el7.x86_64.rpm warning: gitlab-ce-11.1.4-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY Preparing... ################################# [100%] Updating / installing... 1:gitlab-ce-11.1.4-ce.0.el7 ################################# [100%] It looks like GitLab has not been configured yet; skipping the upgrade script. *. *. *** *** ***** ***** .****** ******* ******** ******** ,,,,,,,,,***********,,,,,,,,, ,,,,,,,,,,,*********,,,,,,,,,,, .,,,,,,,,,,,*******,,,,,,,,,,,, ,,,,,,,,,*****,,,,,,,,,. ,,,,,,,****,,,,,, .,,,***,,,, ,*,. _______ __ __ __ / ____(_) /_/ / ____ _/ /_ / / __/ / __/ / / __ `/ __ \ / /_/ / / /_/ /___/ /_/ / /_/ / \____/_/\__/_____/\__,_/_.___/ Thank you for installing GitLab! GitLab was unable to detect a valid hostname for your instance. Please configure a URL for your GitLab instance by setting `external_url` configuration in /etc/gitlab/gitlab.rb file. Then, you can start your GitLab instance by running the following command: sudo gitlab-ctl reconfigure For a comprehensive list of configuration options please see the Omnibus GitLab readme https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
5、编辑Gitlab配置文件(/etc/gitlab/gitlab.rb)定义访问地址参数external_url
## GitLab URL ##! URL on which GitLab will be reachable. ##! For more details on configuring external_url see: ##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab external_url 'http://gitlab.ityww.cn'
6、重载Gitlab配置文件:gitlab-ctl reconfigure
Running handlers: Running handlers complete Chef Client finished, 429/613 resources updated in 02 minutes 35 seconds gitlab Reconfigured!
当出现以上提示时表示Gitlab重载配置文件顺利完成
7、根据实际地址访问Gitlab;初始访问Gitlab时需要初始化root管理员账户密码