首先先把 内存调到 4G及以上
安装GitLab:
基础环境
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost ~]# sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache
关闭防火墙以及Linux内核:
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl stop firewalld
接下来是安装插件
[root@localhost ~]# yum -y install curl policycoreutils openssh-server openssh-clients postfix
[root@localhost ~]# systemctl enable sshd
[root@localhost ~]# systemctl restart sshd
[root@localhost ~]# systemctl enable postfix
[root@localhost ~]# systemctl start postfix
开始部署
自己上传rpm包
[root@localhost ~]# rpm -ivh gitlab-ce-10.2.3-ce.0.el7.x86_64.rpm
或者用网络上的
[root@localhost~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.2.3-ce.0.el7.x86_64.rpm
[root@localhost ~]# vim /etc/gitlab/gitlab.rb
external_url 'http://gitlab.example.com' //13行 将这行改成
external_url 'http://192.168.137.101' //这样
[root@localhost ~]# gitlab-ctl reconfigure \\重启 要等很久 不要着急 每修改一个gitlab.rb都要执行一下
结果如下:
[root@localhost ~]# gitlab-ctl status //检查状态
关闭gitlab:#gitlab-ctl stop
启劢gitlab:#gitlab-ctl start
重启gitlab:#gitlab-ctl restart
查看gitlab:#gitlab-ctl status
用游览器登入GitLab: http://192.168.137.101/users/sign_in
以下是设置root密码
登入进去:
登入进去的界面:
用自己只带的游览器然后设置成中文
接下来是客户端访问结果:
验证结果
[root@localhost ~]# yum -y install httpd*
[root@localhost ~]# systemctl start httpd
[root@localhost html]# git clone http://192.168.137.101/bdqn.com/web.git
以之前的形式在创建一个内部访问的项目 并且把liangzhongyi这个用户添加进去
添加用户到项目如下:
因为之前已经添加过了 所以这是演示
Git客户端:
上面的只是克隆 下面的是Git的用法
一般在新的系统上,我们都需要先配置下自己的Git 工作环境。配置工作只需一次,以后升级时还会沿用现在的配置。第一个要配置的是你个人的用户名称和电子邮件地址。这两条配置很重要,每次Git 提交时都会引用这两条信息,说明是谁提交了更新,所以会随更新内容一起被永久纳入历史记录。git运行的环境变量有点像.bashrc,决定了Git 在各个环节的具体工作方式和行为。这些变量可以存放在以下两个的地方:
1、~/.gitconfig 文件:用户目录下的配置文件只适用亍该用户。若使用git config 时用–global 选项,读写的就是这个文件。
如下:
[root@localhost ~]# git config --global user.name “liangzhongyi”
[root@localhost ~]# git config --global user.email “liangzyayw@163.com”
[root@localhost ~]# cat ~/.gitconfig
[user]
name = liangzhongyi
email = liangzyayw@163.com
咱们已经设置完了 来验证他的效果
现在gitlab里面添加项目 如下:
这里需要验证才能下载:
[root@localhost web1]# git clone http://192.168.137.101/accp.com/web1.git
正克隆到 'web1'...
Username for 'http://192.168.137.101': liangzhongyi
Password for 'http://liangzhongyi@192.168.137.101':
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
上传文件:
首先创建一个文件
[root@localhost web1]# git add index.jsp
[root@localhost web1]# git commit -m "shang chuan"
[master a0381c0] shang chuan
1 file changed, 1 insertion(+)
create mode 100644 index.jsp
[root@localhost web1]# git push
warning: push.default 未设置,它的默认值将会在 Git 2.0 由 'matching'
修改为 'simple'。若要不再显示本信息并在其默认值改变后维持当前使用习惯,
进行如下设置:
git config --global push.default matching
若要不再显示本信息并从现在开始采用新的使用习惯,设置:
git config --global push.default simple
参见 'git help config' 并查找 'push.default' 以获取更多信息。
('simple' 模式由 Git 1.7.11 版本引入。如果您有时要使用老版本的 Git,
为保持兼容,请用 'current' 代替 'simple' 模式)
Username for 'http://192.168.137.101': liangzhongyi
Password for 'http://liangzhongyi@192.168.137.101':
Counting objects: 4, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 299 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To http://192.168.137.101/accp.com/web1.git
faa2c20..a0381c0 master -> master
上面的字是没有错的 如果想要没有 那操作如下:
[root@localhost web1]# git config --global push.default simple
然后再来一遍:
[root@localhost web1]# git push
Username for ‘http://192.168.137.101’: liangzhongyi
这就没有了 因为已经弄过了 所以不用了
测试如下: