centOS7.4安装gitlab

1、环境:

虚拟机:VMware Workstation

系统:CentOS7.4 x86_64

2、工具:

我这边用的是Xshell6-6.0.0111r,WinSCP

原因就是方便

3、下载安装包

下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

4、安装依赖

在CentOS系统上安装所需的依赖:ssh,防火墙,postfix(用于邮件通知) ,wget,以下这些命令也会打开系统防火墙中的HTTP和SSH端口访问。

4.1、安装ssh

[root@localhost ~]# sudo yum install -y curl policycoreutils-pythonopenssh-server
已加载插件:fastestmirror
base                                                                                                                                       | 3.6 kB  00:00:00     
extras                                                                                                                                     | 3.4 kB  00:00:00     
updates                                                                                                                                    | 3.4 kB  00:00:00     
(1/4): base/7/x86_64/group_gz                                                                                                              | 166 kB  00:00:00     
(2/4): extras/7/x86_64/primary_db                                                                                                          | 156 kB  00:00:00     
(3/4): updates/7/x86_64/primary_db                                                                                                         | 1.3 MB  00:00:02     
(4/4): base/7/x86_64/primary_db                                                                                                            | 6.0 MB  00:00:02     

...

更新完毕:
  curl.x86_64 0:7.29.0-51.el7                                                                                                                                     

作为依赖被升级:
  libcurl.x86_64 0:7.29.0-51.el7         nspr.x86_64 0:4.19.0-1.el7_5                  nss.x86_64 0:3.36.0-7.el7_5            nss-pem.x86_64 0:1.0.3-5.el7        
  nss-softokn.x86_64 0:3.36.0-5.el7_5    nss-softokn-freebl.x86_64 0:3.36.0-5.el7_5    nss-sysinit.x86_64 0:3.36.0-7.el7_5    nss-tools.x86_64 0:3.36.0-7.el7_5   
  nss-util.x86_64 0:3.36.0-1.el7_5      

完毕!

4.2、将SSH服务设置成开机自启动 ,启动SSH服务

[root@localhost ~]# sudo systemctl enable sshd
[root@localhost ~]# sudo systemctl start sshd

4.3、安装防火墙(已安装,请启动后跳过)

[root@localhost ~]# yum install firewalld systemd -y

4.4、启动防火墙

[root@localhost ~]# systemctl start firewalld

4.5、添加http服务到firewalld,pemmanent表示永久生效,若不加--permanent系统下次启动后就会失效。

[root@localhost ~]# sudo firewall-cmd --permanent --add-service=http
success

4.6、重启防火墙

[root@localhost ~]# sudo systemctl reload firewalld

4.7、安装Postfix

[root@localhost ~]# sudo yum install postfix
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.jdcloud.com
 * extras: mirror.jdcloud.com
 * updates: mirrors.cqu.edu.cn
正在解决依赖关系

...

作为依赖被安装:
  mariadb-libs.x86_64 1:5.5.60-1.el7_5                                                                                                                            

更新完毕:
  postfix.x86_64 2:2.10.1-7.el7                                                                                                                                   

完毕!

4.8、将postfix服务设置成开机自启动,并启动

[root@localhost ~]# sudo systemctl enable postfix
[root@localhost ~]# sudo systemctl start postfix

4.9、安装policycoreutils-python

[root@localhost local]# yum install policycoreutils-python
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.jdcloud.com
 * extras: mirror.jdcloud.com
 * updates: mirrors.cqu.edu.cn
正在解决依赖关系

...

已安装:
  policycoreutils-python.x86_64 0:2.5-29.el7                                                                                                                      

作为依赖被安装:
  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    

作为依赖被升级:
  audit.x86_64 0:2.8.4-4.el7                 audit-libs.x86_64 0:2.8.4-4.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         policycoreutils.x86_64 0:2.5-29.el7        

完毕!

5、安装gitlab

安装有点慢,稍等几分钟。。

[root@localhost local]# rpm -i gitlab-ce-10.2.5-ce.0.el7.x86_64.rpm 
警告:gitlab-ce-10.2.5-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 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

6、修改gitlab配置文件指定服务器ip和自定义端口

修改etc/gitlab/gitlab.rb文件,分配一个不会冲突的端口号,这里我用的是8666

## GitLab configuration settings
##! This file is generated during initial installation and **is not** modified
##! during upgrades.
##! Check out the latest version of this file to know about the different
##! settings that can be configured by this file, which may be found at:
##! https://gitlab.com/gitlab-org/omnibus-gitlab/raw/master/files/gitlab-config-template/gitlab.rb.template


## 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.example.com'
external_url 'http://localhost:8666'

7、重置并启动GitLab

[root@localhost local]# gitlab-ctl reconfigure 
[root@localhost local]# gitlab-ctl restart

8、将防火墙端口开放8666端口

[root@localhost local]# firewall-cmd --permanent --zone=public --add-port=8666/tcp
success

9、访问页面

192.168.92.129:8666

结果访问不到!!!

centOS7.4安装gitlab_第1张图片

百度了一下原因

第一种:端口8080被占用

第二种:内存小于2G

将内存由1g改为2g(推荐4g)

修改后

sudo gitlab-ctl reconfigure或者sudo gitlab-ctl restart

再次访问

centOS7.4安装gitlab_第2张图片

初始账户: root 密码:5iveL!fe

第一次登录修改密码

centOS7.4安装gitlab_第3张图片

你可能感兴趣的:(Linux学习笔记,linux学习笔记)