centos6.8安装 gitlab 9.3.5及使用

环境准备:

[root@caosm03 conf]# cat /etc/issue
CentOS release 6.8 (Final)
Kernel \r on an \m
注意:这个需要配置好主机名不然安装的时候会出现地址错误
[root@caosm03 caosm]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.24.130 caosm03.com 

1.安装配置依赖项

[root@caosm03 ~]#yum install curl openssh-server openssh-clients postfix cronie  -y
[root@caosm03 ~]#service postfix start  #GitLab使用postfix发送邮件
[root@caosm03 ~]#chkconfig postfix on   #设置postfix开机自启动
[root@caosm03 ~]#lokkit -s http -s ssh  #配置iptables开放http和ssh端口,这里需要注意,腾讯云安全组选择那里要选择开放所有端口
#这一步可能会显示failed ip6tables start,这个不需要管,直接运行下面查看是否打开端口就可以了  

输入命令查看是否打开http和ssh端口

[root@caosm03 ~]# iptables -L

Chain INPUT (policy ACCEPT)

target prot opt source destination

ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

ACCEPT icmp -- anywhere anywhere

ACCEPT all -- anywhere anywhere

ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh

ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http

REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)

target prot opt source destination

REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)

target prot opt source destination

2.下载RPM包,并上传到服务器 (我这里是选择的下载rpm包,也有其他的方式,就是下载他的安装脚本或者镜像等方式,如果不想用rpm安装,可以自行搜索其它方式,官网也都有说明)

国内镜像下载地址: https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/ (Centos 6.8 64位)

打开后可以看到各个版本的rpm包,我是选择的 9.3.5版本,点击相应rpm包进行下载

复制下载地址链接
[root@caosm03 ~]#wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-9.3.5-ce.0.el6.x86_64.rpm
[root@caosm03 ~]#rpm -ivh  gitlab-ce-9.3.5-ce.0.el6.x86_64.rpm
[root@caosm03 ~]#gitlab-ctl reconfigure

3.启动gitlab

[root@caosm03 ~]#gitlab-ctl reconfigure

4.使用浏览器访问GitLab (这里访问你的服务器IP地址:80端口)

首次访问GitLab,系统会让你重新设置管理员的密码,设置成功后会返回登录界面。

默认的管理员账号是root,如果你想更改默认管理员账号,请输入上面设置的新密码登录系统后修改帐号名。

.上面的步骤执行完后应该就是可以使用了,可是因为我的服务器只有1G内存,所以浏览器访问的时候,时不时的会报502错误,这里我们需要增加服务器虚拟内存可以解决。 (对于502错误,也有可能是服务器端口占用的原因,不过我的服务器没有安装其他东西,所以不会出现端口占用的情况)
502
GitLab is not responding.
Please contact your GitLab administrator if this problem persists.

5.增加服务器内存

我这里使用的事虚拟机 给虚拟机直接添加内存
另外一种方式增加swap分区
dd if=/dev/zero of=/var/swap bs=1024 count=2048000 #增加2G左右SWAP
mkswap /var/swap #设置交换文件
swapon /var/swap #激活启用交换分区
echo "/var/swap swap swap defaults 0 0"  >> /etc/fstab

6.说明

缺点:这种方式虽然说简单方便,但是定制型很差,默认只能使用postgre和nginx
主配置文件:/etc/gitlab/gitlab.rb   //可以自定义一些邮件服务等
日志地址:/var/log/gitlab/    // 对应各服务
服务地址:/var/opt/gitlab/   // 对应各服务的主目录
仓库地址:/var/opt/gitlab/git-data //记录项目仓库等提交信息
重置配置:gitlab-ctl reconfigure    //不要乱用,会重置为最原始的配置的
重启服务:gitlab-ctl  stop/start/restart  //启动命令
默认安装:postgres、nginx、redis、unicorn ......

gitlab客户端配置及基本使用

1.客户端默认安装即可。

2.创建密钥

$ ssh-keygen  -t rsa -C caoshouming@kanfanews.com
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/PM/.ssh/id_rsa):
/c/Users/PM/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/PM/.ssh/id_rsa.
Your public key has been saved in /c/Users/PM/.ssh/id_rsa.pub.

3.拷贝密钥到gitlab 上面。

打开路径拷贝id_rsa.pub

[root@caosm03 ~]# cat  ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEApA9i1/CL6qcN3T+9jRH5BTgss7nlv3f7hj7n57N8a5M6EngZ0tfyTlpmiQdA6ghWv4jLKTar64TiIf2+CenTSt0qNu485zQ5TpP4vUuuZ5hrD31V+DWg5+ls9v9SF0hABzQPVbCkxjV6kbCY7sCpw/pM85bemw5CvuCL9gdZIkkF7h08qPOWvIbljxxExgs5eS22Ys4ZxANlSYzsHstp6jxq296PSzoloLgW+x5OlR5rHvgowuRuv3sQn3sCaEEvt0EYVUdBwEbOivAJkZjFNORl2EX+u7uIjU4r9Sg5vqSEOM6GWVRDjFIzt4/46fGhJAzScKeuHkEobA/yrNVoNQ== caoshouming@kanfanews.com

4.配置服务端密钥

登陆自己的用户,设置ssh密钥。密钥里面复制,标题写好自己标识。增加密钥即可。

5.客户端进行下载测试

创建测试目录 在git 客户端里面切换到目录里面

$ cd e:
PM@kanfa-caosm MINGW64 /e
$cd www
$ git clone git@gitlab.kanfanews.com:php/doc.git
Cloning into 'doc'...
remote: Counting objects: 1535, done.
remote: Compressing objects: 100% (429/429), done.
remote: Total 1535 (delta 365), reused 728 (delta 326)
Receiving objects: 100% (1535/1535), 1.96 MiB | 3.94 MiB/s, done.
Resolving deltas: 100% (787/787), done.**注意: git 下载的路径可以从web 上面进行查询 下载整个项目,自己的账户需要有管理员的权限才能下载,否则下载失败提示没有权限**

6.维护命令

查看状态
sudo gitlab-ctl status
/# 启动Gitlab所有组件
sudo gitlab-ctl start
/# 停止Gitlab所有组件
sudo gitlab-ctl stop
/# 重启Gitlab所有组件
sudo gitlab-ctl restart

7.gitlab 数据备份和恢复

配置文件再/etc/gitlab/ 下面,将所有的配置用tar备份即可[root@caosm03 init.d]# cd /etc/gitlab/
[root@localhost gitlab]# ls
gitlab.rb  gitlab-secrets.json  trusted-certs

备份data (以包安装的方式)

[root@localhost ~]# sudo gitlab-rake gitlab:backup:create
Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... [DONE]
done
Dumping repositories ..
备份目录在:
[root@caosm03 backups]# pwd
/var/opt/gitlab/backups
[root@caosm03 backups]# ls
1512644923_2017_12_07_9.3.5_gitlab_backup.tar # 这个是备份出来的文件

恢复数据 (针对以包安装的方式)

[root@caosm03 ~]# sudo gitlab-ctl stop unicorn
[root@caosm03 ~]# sudo gitlab-ctl stop sidekiq
[root@caosm03 ~]# sudo gitlab-ctl status
[root@caosm03 ~]# sudo gitlab-rake gitlab:backup:restore 1512644923_2017_12_07
注意:这里的默认恢复指定的文件名称是1512644923_2017_12_07_9.3.5_gitlab_backup.tar
和默认格式不一致:这里需要对文件进行重命名不然恢复不成功!!!

本文转自 Innocence_caosm 51CTO博客,原文链接:http://blog.51cto.com/innocence/2048486,如需转载请自行联系原作者

centos6.8安装 gitlab 9.3.5及使用相关推荐

  1. centos6/7安装gitlab

    CentOS/RHEL 6/7安装gitlab 新建 /etc/yum.repos.d/gitlab-ce.repo,内容为 你的CentOS/RHEL版本:centos6 1 [gitlab-ce] ...

  2. 在centos6.5中安装 GitLab 全过程和问题记录

    在centos6.5中安装 GitLab 全过程和问题记录 如果你想省事,使用最新版本的gitlab,请下载一键安装包,一键安装 脚本:https://bitnami.com/stack/gitlab ...

  3. CentOS6中安装、配置、启动GitLab以及遇到的那些坑

    场景 GitLab是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务. GitLab和GitHub一样属于第三方基于Git开发的作品,免费且开源(基于MIT ...

  4. CentOS6.x下GitLab安装

    2019独角兽企业重金招聘Python工程师标准>>> 一.GitLab简介 GitLab是利用 Ruby on Rails 一个开源的版本管理系统,实现一个自托管的Git项目仓库, ...

  5. centos6安装GitLab全程详解和常见问题解决

    GitLab,是一个使用 Ruby on Rails 开发的开源应用程序,与Github类似,能够浏览源代码,管理缺陷和注释,非常适合在团队内部使用. 官方只提供了Debian/Ubuntu系统下的安 ...

  6. CentOS6.5Minimal安装Gitlab7.5

    文章出处:http://www.restran.net/2015/04/09/gilab-centos-installation-note/ 在 CentOS 6.5 Minimal 系统环境下,用源 ...

  7. CentOS7 安装 Gitlab

    GitLab,是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目. 它拥有与Github类似的功能,能够浏览源代码, ...

  8. gitlab linux版本下载,Linux安装GitLab版本控制软件

    Linux安装GitLab版本控制软件 系统环境:centos6.5 IP地址:192.168.1.243 内存:至少为1G,之前虚拟机的内存只有512M,安装的时候一直报错,日了Dog了. 安装成功 ...

  9. centos安装gitlab详解-2017

    一, 服务器快速搭建gitlab方法 可以参考gitlab中文社区 的教程 centos7安装gitlab:https://www.gitlab.cc/downloads/#centos7 cento ...

最新文章

  1. Pinterest基于AWS规模化使用Apache Kafka的实践经验
  2. 机器人动力学简化模型(Euler-Lagrange equation)
  3. torch.unsqueeze()和torch.unsqueeze()
  4. ng build command not found(ng命令到底是什么鬼)
  5. 刚刚出炉的Asp.net网站部署视频教程
  6. Backtrader多周期回测
  7. oracle不同环境数据迁移,生产环境下,oracle不同用户间的数据迁移。第一部分
  8. Fffmpeg:从AVFrame中由YUV获取RGB
  9. python向数据库中添加参数_python往mysql数据库中写入数据和更新插入数据
  10. 10款最佳SQL Server服务器监控工具
  11. 动手深度学习 李沐 pytorch版本 基于Win10环境配置
  12. 如何在庞大的ip地址库中快速定位到对应的ip地址所对应的归属地?
  13. 中点圆c语言程序,[图形学] 画圆(基于中点算法)
  14. [VT虚拟化驱动]安装DPC回调检测CPU对VT的支持
  15. streamFile
  16. 黄斑裂孔易致失明,年长者和高度近视者尤其要注意!
  17. 10款网站后台管理系统模板_bootstrap网站后台模板_html后台模板下载(四)
  18. 常用相似性、相关性度量指标
  19. win10计算机未连接到网络适配器,windows10系统下网络适配器显示未连接如何解决...
  20. 红海有鱼群,共话医疗器械行业之渠道开发

热门文章

  1. matlab mesh与surf比较
  2. Ellipse(椭圆)
  3. 分贝dB与放大倍数的转换关系及对照表
  4. 【 C 】联合(union)或共用体(union)
  5. 正交频分复用(OFDM)初步(原理)
  6. Google推出开源空间音频编码引擎Songbird
  7. iOS:分页控件UIPageControl的使用
  8. linux信号机制 - 用户堆栈和内核堆栈的变化【转】
  9. 我的Debian 8.0 (jessie)配置文档
  10. HDU 1052 Tian Ji -- The Horse Racing