1.安装依赖软件
yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python
2.启动postfix设置postfix开机自启,并启动,postfix支持gitlab发信功能
systemctl start postfix
启动时出现报错
[root@iZ2zeemzju81bld21k77icZ ~]# journalctl -xe -- -- The start-up result is done. Apr 23 20:20:01 iZ2zeemzju81bld21k77icZ CROND[30360]: (root) CMD (/usr/lib64/sa/sa1 1 1) Apr 23 20:22:13 iZ2zeemzju81bld21k77icZ sudo[30469]: root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/sbin/service postfix start Apr 23 20:22:13 iZ2zeemzju81bld21k77icZ sudo[30469]: pam_unix(sudo:session): session opened for user root by root(uid=0) Apr 23 20:22:13 iZ2zeemzju81bld21k77icZ polkitd[23311]: Registered Authentication Agent for unix-process:30470:226015212 (system bus name :1.8919 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, local Apr 23 20:22:13 iZ2zeemzju81bld21k77icZ systemd[1]: Starting Postfix Mail Transport Agent... -- Subject: Unit postfix.service has begun start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit postfix.service has begun starting up. Apr 23 20:22:13 iZ2zeemzju81bld21k77icZ aliasesdb[30486]: /usr/sbin/postconf: fatal: parameter inet_interfaces: no local interface found for ::1 Apr 23 20:22:14 iZ2zeemzju81bld21k77icZ postfix/sendmail[30489]: fatal: parameter inet_interfaces: no local interface found for ::1 Apr 23 20:22:14 iZ2zeemzju81bld21k77icZ aliasesdb[30486]: newaliases: fatal: parameter inet_interfaces: no local interface found for ::1 Apr 23 20:22:14 iZ2zeemzju81bld21k77icZ postfix[30495]: fatal: parameter inet_interfaces: no local interface found for ::1 Apr 23 20:22:15 iZ2zeemzju81bld21k77icZ systemd[1]: postfix.service: control process exited, code=exited status=1 Apr 23 20:22:15 iZ2zeemzju81bld21k77icZ systemd[1]: Failed to start Postfix Mail Transport Agent.
解决方法:修改文件vim /etc/postfix/main.cf
inet_interfaces = localhost inet_protocols = all
修改为:
inet_interfaces = all 或者 inet_interfaces = 127.0.0.1 inet_protocols = all
保存后重启postfix服务成功,执行
systemctl enable postfix
3.下载GitLab较新版本
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.10.0-ce.0.el7.x86_64.rpm
4.安装GitLab
rpm -i gitlab-ce-11.10.0-ce.0.el7.x86_64.rpm
warning: gitlab-ce-11.10.0-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY 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.查看端口使用状态
netstat -ntlp
6. 修改gitlab配置文件 vim /etc/gitlab/gitlab.rb ,端口号填写未被占用的,默认8080
external_url 'http://ip地址:端口号'
7. 使用gitlab-ctl reconfigure 自动配置,并安装数据库,初始化信息,时间较长
gitlab-ctl reconfigure
8. 使用gitlab-ctl start 启动gitlab服务
[root@iZ ~]# gitlab-ctl start ok: run: alertmanager: (pid 17908) 1539s ok: run: gitaly: (pid 17712) 1542s ok: run: gitlab-monitor: (pid 17780) 1541s ok: run: gitlab-workhorse: (pid 17745) 1542s ok: run: logrotate: (pid 17294) 1590s ok: run: nginx: (pid 17249) 1596s ok: run: node-exporter: (pid 17768) 1541s ok: run: postgres-exporter: (pid 17925) 1538s ok: run: postgresql: (pid 16860) 1647s ok: run: prometheus: (pid 17804) 1540s ok: run: redis: (pid 16638) 1659s ok: run: redis-exporter: (pid 17788) 1540s ok: run: sidekiq: (pid 17191) 1604s ok: run: unicorn: (pid 22395) 6s