GitLab 环境搭建【CentOS7】

RPM安装方式

https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7

【最好给服务器分配至少4G内存

先检查一下依赖:sshd

[root@localhost soft]# rpm -qa|grep openssh-server
openssh-server-7.4p1-11.el7.x86_64
[root@localhost soft]# ps -e|grep sshd
  1107 ?        00:00:00 sshd
 12585 ?        00:00:00 sshd
 12590 ?        00:00:00 sshd

如果你没有,那么:

sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld

再检查一下postfix

[root@localhost soft]# rpm -qa|grep postfix
postfix-2.10.1-6.el7.x86_64
[root@localhost soft]# ps -e|grep postfix

如果你没有,那么

sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

..

最后找到你存放rpm目录并进入

[root@localhost soft]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.0.6-ce.0.el7.x86_64.rpm
--2018-09-19 03:12:09--  https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.0.6-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: 436017937 (416M) [application/x-redhat-package-manager]
Saving to: ‘gitlab-ce-11.0.6-ce.0.el7.x86_64.rpm’

100%[=========================================================================================================================================================>] 436,017,937 1.50MB/s   in 4m 37s 

2018-09-19 03:16:46 (1.50 MB/s) - ‘gitlab-ce-11.0.6-ce.0.el7.x86_64.rpm’ saved [436017937/436017937]

 

..查看

[root@localhost soft]# ll
total 695524
-rw-r--r--. 1 root root 436017937 Sep  7 01:24 gitlab-ce-11.0.6-ce.0.el7.x86_64.rpm
-rw-r--r--. 1 root root 189756259 Mar 26 07:20 jdk-8u161-linux-x64.tar.gz
-rw-r--r--. 1 root root  49766096 Mar 26 07:20 kafka_2.11-1.0.1.tgz
-rw-r--r--. 1 root root  36668066 Mar 26 07:20 zookeeper-3.4.11.tar.gz
[root@localhost soft]# 

 

安装

[root@localhost soft]# rpm -ivh gitlab-ce-11.0.6-ce.0.el7.x86_64.rpm 
warning: gitlab-ce-11.0.6-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:gitlab-ce-11.0.6-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

然后编辑

vim /etc/gitlab/gitlab.rb

修改

 然后执行

gitlab-ctl reconfigure

..

..启动

gitlab-ctl restart

..

 ..

查看端口占用

[root@localhost soft]# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:9100          0.0.0.0:*               LISTEN      18777/node_exporter 
tcp        0      0 127.0.0.1:9229          0.0.0.0:*               LISTEN      18750/gitlab-workho 
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd           
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      19015/unicorn maste 
tcp        0      0 127.0.0.1:9168          0.0.0.0:*               LISTEN      18747/ruby          
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      18765/nginx: master 
tcp        0      0 127.0.0.1:8082          0.0.0.0:*               LISTEN      18827/sidekiq 5.1.3 
tcp        0      0 127.0.0.1:9236          0.0.0.0:*               LISTEN      18737/gitaly        
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      1514/dnsmasq        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1107/sshd           
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1106/cupsd          
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1477/master         
tcp        0      0 0.0.0.0:8060            0.0.0.0:*               LISTEN      18765/nginx: master 
tcp        0      0 0.0.0.0:6783            0.0.0.0:*               LISTEN      18731/alertmanager  
tcp        0      0 127.0.0.1:9121          0.0.0.0:*               LISTEN      18818/redis_exporte 
tcp        0      0 127.0.0.1:9090          0.0.0.0:*               LISTEN      18808/prometheus    
tcp        0      0 127.0.0.1:9187          0.0.0.0:*               LISTEN      18782/postgres_expo 
tcp        0      0 127.0.0.1:9093          0.0.0.0:*               LISTEN      18731/alertmanager  
tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd           
tcp6       0      0 ::1:9168                :::*                    LISTEN      18747/ruby          
tcp6       0      0 :::22                   :::*                    LISTEN      1107/sshd           
tcp6       0      0 ::1:631                 :::*                    LISTEN      1106/cupsd          
tcp6       0      0 ::1:25                  :::*                    LISTEN      1477/master         
udp        0      0 0.0.0.0:35759           0.0.0.0:*                           729/avahi-daemon: r 
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           729/avahi-daemon: r 
udp        0      0 192.168.122.1:53        0.0.0.0:*                           1514/dnsmasq        
udp        0      0 0.0.0.0:67              0.0.0.0:*                           1514/dnsmasq        
udp        0      0 0.0.0.0:68              0.0.0.0:*                           908/dhclient        
udp        0      0 0.0.0.0:10338           0.0.0.0:*                           908/dhclient        
udp        0      0 127.0.0.1:323           0.0.0.0:*                           691/chronyd         
udp6       0      0 :::41175                :::*                                908/dhclient        
udp6       0      0 ::1:323                 :::*                                691/chronyd       

 

 ..

查看防火墙

[root@localhost soft]#  firewall-cmd --zone=public --list-ports
2888/tcp 3888/tcp 2181/tcp
[root@localhost soft]# firewall-cmd --zone=public --add-port=80/tcp --permanent
success
[root@localhost soft]# firewall-cmd --reload
success

打开浏览器,访问

..会让你重置密码,并且至少8位,我输入的12345678。然后会让你登录,用户名是root,密码是你重置的那个

你可以创建用户,创建项目。还可以设置SSH Key。

 

到此就完成啦。

 脚本安装

 打开:https://packages.gitlab.com/gitlab/gitlab-ce/install

 现在我们换一台机器

[root@localhost admin]# cd /soft/
[root@localhost soft]# curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
Detected operating system as centos/7.
Checking for curl...
Detected curl...
Downloading repository file: https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/config_file.repo?os=centos&dist=7&source=script
done.
Installing pygpgme to verify GPG signatures...
Loaded plugins: fastestmirror, langpacks
base                                                                                                                                                                        | 3.6 kB  00:00:00     
extras                                                                                                                                                                      | 3.4 kB  00:00:00     
https://packages.gitlab.com/gitlab/gitlab-ce/el/7/SRPMS/repodata/repomd.xml: [Errno 12] Timeout on https://packages-gitlab-com.s3-accelerate.amazonaws.com/empty/rpm/repomd.xml?AWSAccessKeyId=AKIAJ74R7IHMTQVGFCEA&Signature=iiqnja2rIZZgVhZPOxxLPMg8vWI=&Expires=1537345200: (28, 'Operation timed out after 30827 milliseconds with 0 out of 0 bytes received')
Trying other mirror.

 

 问题在于访问超时

我不玩了好吧~

 

posted @ 2018-09-19 16:19  露娜妹  阅读(2267)  评论(0编辑  收藏  举报