gitlab的安装和基本使用
一、gitlab的安装
1)安装依赖包
sudo yum install git vim gcc glibc-statc telnet -y
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
安装依赖
2)设置防火墙(可选)
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
3)添加gitlab安装源
3.1)设置国内安装源,如设置清华大学的源
vim /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gbgcheck=
enable=
国内清华源
3.2)在国外,设置国外源
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
国外源
4)安装gitlab
4.1)设置域名方式安装
sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ce
域名安装
4.11)可购买真实发域名方式,替换上面的域名
4.12)本地域名测试,在 /etc/hosts里面添加
192.168.1.20 gitlab.example.com
4.2)不设置域名安装方式
yum install gitlab-ce 安装
gitlab-ctl reconfigure 修改配置
4.3)如果安装遇到问题解决。--nogpgcheck

EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ce --nogpgcheck
安装好修改配置文件


5)启动查看状态
gitlab-ctl reconfigure
[root@gitlab ~]# gitlab-ctl status
run: alertmanager: (pid ) 431s; run: log: (pid ) 430s
run: gitaly: (pid ) 432s; run: log: (pid ) 432s
run: gitlab-monitor: (pid ) 432s; run: log: (pid ) 431s
run: gitlab-workhorse: (pid ) 432s; run: log: (pid ) 431s
run: logrotate: (pid ) 487s; run: log: (pid ) 432s
run: nginx: (pid ) 493s; run: log: (pid ) 432s
run: node-exporter: (pid ) 475s; run: log: (pid ) 432s
run: postgres-exporter: (pid ) 430s; run: log: (pid ) 430s
run: postgresql: (pid ) 534s; run: log: (pid ) 432s
run: prometheus: (pid ) 431s; run: log: (pid ) 431s
run: redis: (pid ) 540s; run: log: (pid ) 432s
run: redis-exporter: (pid ) 463s; run: log: (pid ) 431s
run: sidekiq: (pid ) 501s; run: log: (pid ) 432s
run: unicorn: (pid ) 507s; run: log: (pid ) 432s
启动
6)本地测试访问注意问题
虚拟机中 /etc/hosts里面添加
192.168.0.49 gitlab.example.com 本地电脑中 C:\Windows\System32\drivers\etc\hosts
192.168.0.49 gitlab.example.com
强调hosts文件

访问成功
7)gitlab常用命令
sudo gitlab-ctl start # 启动所有 gitlab 组件;
sudo gitlab-ctl stop # 停止所有 gitlab 组件;
sudo gitlab-ctl restart # 重启所有 gitlab 组件;
sudo gitlab-ctl status # 查看服务状态;
sudo gitlab-ctl reconfigure # 启动服务;
sudo vim /etc/gitlab/gitlab.rb # 修改默认的配置文件;
gitlab-rake gitlab:check SANITIZE=true --trace # 检查gitlab;
sudo gitlab-ctl tail # 查看日志;
gitlab常用命令
二、使用gitlab
1)创建用户名登录

跳转至登录界面


2)添加秘钥设置
在服务器上生成秘钥,复制公钥内容进来

可使用ssh秘钥免费下载
[root@redis02 gitlab_test]# git clone git@192.168.10.239:user/public.git
Cloning into 'public'...
The authenticity of host '192.168.10.239 (192.168.10.239)' can't be established.
RSA key fingerprint is b5:f4::a4::2f:fd:5d::ba:8c:a4:e4:c2::5d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.239' (RSA) to the list of known hosts.
remote: Enumerating objects: , done.
remote: Counting objects: % (/), done.
remote: Compressing objects: % (/), done.
remote: Total (delta ), reused (delta )
Receiving objects: % (/), done.
Checking connectivity... done.
修改代码上传
[root@redis02 public]# git config --global user.email "1257073656@qq.com"
[root@redis02 public]# git config --global user.name "user"
[root@redis02 public]# git commit -m "change on linux"
[master 3bb2d0d] change on linux
file changed, insertion(+)
[root@redis02 public]# git push origin master
Counting objects: , done.
Compressing objects: % (/), done.
Writing objects: % (/), bytes | bytes/s, done.
Total (delta ), reused (delta )
To git@192.168.10.239:caojin/public.git
18965a3..3bb2d0d master -> master
三、新版本gitlab测试
1)取消注册功能

2)创建项目之前先创建组

2)创建项目。可以选择之前的建立的组

3)git对提交代码的版本控制
[root@node02 demo]# git show|grep commit
commit f0e08a0c0df9d6e82ebaf4833bd446d7edd48422
[root@node02 demo]# git show|grep commit|cut -d ' ' -f2
f0e08a0c0df9d6e82ebaf4833bd446d7edd48422
[root@node02 demo]# API_VERL=$(git show|grep commit|cut -d ' ' -f2)
[root@node02 demo]# echo $API_VERL
f0e08a0c0df9d6e82ebaf4833bd446d7edd48422
[root@node02 demo]# echo ${API_VERL::}
f0e08a
[root@node02 demo]# API_VER=$(echo ${API_VERL::})
[root@node02 demo]# echo $API_VER
f0e08a
4)修改拉取代码的默认url
vim /etc/gitlab/gitlab.rb
.....
# external_url 'http://gitlab.example.com'
external_url 'http://192.168.10.24'
[root@node02 gitlab]# gitlab-ctl reconfigure 重启
gitlab的安装和基本使用的更多相关文章
- gitlab一键安装 (转)
原文地址:http://www.2cto.com/os/201411/353292.html 0 简介bitnami和gitlab bitnami BitNami是一个开源项目,该项目产生的开源软件包 ...
- gitlab的安装以及汉化
gitlab的安装 首先在网上下载好任意版本gitlab的rpm包 推荐下面的地址: https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gi ...
- gitlab一键安装+配置(备份+LADP认证)
gitlab一键安装+配置(备份+LADP认证) #gitlab一键安装 #centos6 mini, GitLab社区版 #参考官方最新文档 https://www.gitlab.com.cn/in ...
- Gitlab的安装与实践
tucao 先让我来吐槽一下下,使用GitHub以及Bitbucket比较不太稳定,尤其是后者,可以说是极其不稳定,甚至无法克隆仓库到本地.因此,决定安装一款开源且免费的Git服务到自己的服务器主机上 ...
- Gitlab的安装及项目新建
1. Gitlab的安装及仓库创建 1.1下载gitlab安装包 1).官网下载速度较慢 建议先行下载 国内的源里面可以找到最新的版本https://mirrors.tuna.tsinghua.edu ...
- DevOps之一 Gitlab的安装与配置
gitlab的安装 参考治疗:https://www.gitlab.com.cn/installation/#centos-7 http://www.21yunwei.com/archives/435 ...
- docker+gitlab的安装和迁移
docker+gitlab的安装 docker search gitlab docker pull docker.io/gitlab/gitlab-ce docker run --name=: -- ...
- Gitlab的安装汉化及问题解决
Gitlab的安装汉化及问题解决(2017/12/14目前版本为10.2.4) 一.前言 Gitlab需要安装的包太TM多了,源码安装能愁死个人,一直出错,后来发现几行命令就装的真是遇到的新大陆一样. ...
- 持续集成(1)gitlab的安装
操作系统:centos 6.5 关闭selinux # 修改/etc/selinux/config 文件 将SELINUX=enforcing改为SELINUX=disabled ,然后重启电脑 # ...
随机推荐
- Java小白不走弯路学习Java流程以及学习误区
学习Java编程技术肯定是以就业拿到高薪工作为主要目的的,可是高薪不会那么轻易拿到,这是一个最简单的道理.没有付出就没有回报,在整个学习Java编程技术的过程中,你需要付出时间.精力.金钱.废话不多说 ...
- 吴裕雄 python 机器学习——分类决策树模型
import numpy as np import matplotlib.pyplot as plt from sklearn import datasets from sklearn.model_s ...
- html跳动的心实现代码
<style> .box{ width: 200px; height: 400px; positio ...
- virtualbox下centos虚拟机安装,并网卡配置桥接方式上网,使得和host可以互Ping通。
见:http://www.cnblogs.com/taoshiqian/p/7615993.html 注意: 1.host 主机什么都不要处理 2.将virtualbox 的对应虚拟机网络设置桥接 3 ...
- python数据类型及其详解
一.数据类型介绍 1.字符串(string) 三种类型:单引号,双引号,三引号 a = 'jam' b = "JamHsiao" c = '''JAMHSIAO''' print( ...
- Sprite/MovieClip的Enter_Frame事件,不受addChild/removeChild影响
简单点讲:Sprite或MovieClip对象一旦为其添加了Enter_Frame事件监听,对应的Enter_Frame处理函数将会马上被调用,并一直执行下去(不管你是否将其addChild到显示列表 ...
- supervisorctl安装使用文档
1.apt-get install supervisor下载或者pip install supervisor(因为supervisor是python写的)supervisor和python项目没有关系 ...
- select简单循环嵌套
访问学生的物理最高成绩,并且打印出来,单个要打印出所有的信息 在添加几个 and 就可以啦. select student.gender,student.sname from student whe ...
- centos7 安装 transmission
貌似官方文档 注意:是centos7才能用此方法 Step 1. First, you need to enable EPEL repository on your system. yum insta ...
- Ubuntu 清除缓存 apt-get命令参数
整理了Ubuntu Linux操作系统下apt-get命令的详细说明,分享给大家.常用的APT命令参数:apt-cache search package 搜索包apt-cache show packa ...