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 "crushlinux@163.com"
[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 user.email=crushlinux@163.com 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
标签:上线,gitlab01,代码,GITlab,client,gitlab,2.22,git,root 来源: https://www.cnblogs.com/CMX_Shmily/p/11962178.html