GITlab安装及使用(可用于代码上线)

 

 

 

                                      

 

 

                                              

                                                              

                                                 

 

 

 

                                                 

                                                     

 ====================================================================================================

                                                                                        GITlab环境部署

                                   

角色 IP 内存
gitlab01 192.168.200.112 4G
git-client 192.168.200.113 1G

关闭防火墙和selinux

[root@localhost ~]# hostname gitlab01
[root@localhost ~]# bash

[root@gitlab01 ~]# systemctl stop firewalld
[root@gitlab01 ~]# iptables -F
[root@gitlab01 ~]# setenforce 0

安装依赖包并设置开机自启

[root@gitlab01 ~]# yum install curl openssh-server openssh-client postfix cronie policycoreutils-python -y

[root@gitlab01 ~]# systemctl start postfix
[root@gitlab01 ~]# systemctl enable postfix

上传并解压gitlab源码包
[root@gitlab01 ~]# ls
gitlab-ce-11.11.3-ce.0.el7.x86_64.rpm

[root@gitlab01 ~]# rpm -ivh gitlab-ce-11.11.3-ce.0.el7.x86_64.rpm

_______ __ __ __

/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
\____/_/\__/_____/\__,_/_.___/

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.

修改配置文件/etc/gitlab/gitlab.rb 生产环境可以跟据需求修改

[root@gitlab01 ~]# vim /etc/gitlab/gitlab.rb

修改13行:   external_url 'http://192.168.200.112'

重新加载配置文件

[root@gitlab01 ~]# gitlab-ctl reconfigure

[root@gitlab01 ~]# gitlab-ctl restart

[root@gitlab01 ~]# netstat -lnpt | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 13077/nginx: master
tcp 0 0 0.0.0.0:8060 0.0.0.0:* LISTEN 13077/nginx: master

测试:浏览器输入192.168.200.112进入网站

 

 

 

         

 

 

 

                

 

                        

 

                     

                                                   

 

 113客户端操作:

[root@svn ~]# hostname git-client
[root@svn ~]# bash
[root@git-client ~]# systemctl stop firewalld
[root@git-client ~]# iptables -F
[root@git-client ~]# setenforce 0

[root@git-client ~]# rz

[root@git-client ~]# ls
git-2.22.0.tar.gz 

[root@git-client ~]# tar xf git-2.22.0.tar.gz -C /usr/src

[root@git-client ~]# cd /usr/src/git-2.22.0/
[root@git-client git-2.22.0]# make configure

[root@git-client git-2.22.0]# ./configure --prefix=/usr/local/git && make && make install

[root@git-client git-2.22.0]# ln -sf /usr/local/git/bin/git /usr/bin

[root@git-client git-2.22.0]# git --version
git version 2.22.0
[root@git-client git-2.22.0]# git config --global user.name "crushlinux"
[root@git-client git-2.22.0]# git config --global user.email "[email protected]"
[root@git-client git-2.22.0]# git config --global color.ui true
[root@git-client git-2.22.0]# git config --list

user.name=crushlinux
[email protected]
color.ui=true

将112中gitlab的代码进行克隆到113gitlab上:

[root@git-client ~]# git clone http://192.168.200.112:/root/svn-git.git

[root@git-client ~]# ls
git-2.22.0.tar.gz                    svn-git

 

 

 

 

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐