首页 技术 正文
技术 2022年11月6日
0 收藏 443 点赞 328 浏览 3377 个字

本文章转载自:http://www.cnblogs.com/fanjingfeng/p/6665597.html

一, 服务器快速搭建gitlab方法

可以参考gitlab中文社区 的教程

centos7安装gitlab:https://www.gitlab.cc/downloads/#centos7

centos6安装gitlab:https://www.gitlab.cc/downloads/#centos6

如下方法按照官网来操作,手工安装过于麻烦。当前测试平台为小鸟云的三个月centos 7测试机.

1. 安装配置依赖项

如想使用Postfix来发送邮件,在安装期间请选择’Internet Site’. 您也可以用sendmai或者 配置SMTP服务使用SMTP发送邮件.在 Centos 6 和 7 系统上, 下面的命令将在系统防火墙里面开放HTTP和SSH端口.

centos 安装giblab

sudo yum install curl policycoreutils openssh-server openssh-clients
sudo systemctl enable sshd
sudo systemctl start sshd
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld

centos 安装giblab

这里可以自己yum 一个iptables做处理,一样的效果。 2. 添加GitLab仓库,并安装到服务器上

curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce

如果你不习惯使用命令管道的安装方式, 你可以在这里下载 安装脚本 或者 手动下载您使用的系统相应的安装包(RPM/Deb) 然后安装

curl -LJO https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-XXX.rpm
rpm -i gitlab-ce-XXX.rpm

3. 启动GitLab

  1. sudo gitlab-ctl reconfigure

下边就可以访问了: centos 安装giblab重置下密码。登录效果如下: centos 安装giblab

注意事项以及异常故障排查:

1,按照该方式,我安装了一个确实没问题,只不过是英文版。没有经过汉化。

2,默认安装登录需要重置root密码。可以自己单独设置一个复杂密码后登录。

3,gitlab本身采用80端口,如安装前服务器有启用80,安装完访问会报错。需更改gitlab的默认端口。 修改vim /etc/gitlab/gitlab.rb: external_url ‘http://localhost:90’

4,unicorn本身采用8080端口,如安装前服务器有启用8080,安装完访问会报错。需更改unicorn的默认端口。 修改 /etc/gitlab/gitlab.rb: unicorn[‘listen’] = ‘127.0.0.1’ unicorn[‘port’] = 3000

5,每次重新配置,都需要执行sudo gitlab-ctl reconfigure  使之生效。

6,日志位置:/var/log/gitlab 可以进去查看访问日志以及报错日志等,供访问查看以及异常排查。 gitlab-ctl tail #查看所有日志 gitlab-ctl tail nginx/gitlab_access.log #查看nginx访问日志

二,gitlab中文汉化 1,需要下载汉化包,我们这里直接到去git一个。如果没安装git的请自行yum或apt-get 一个git。 比如我们现在到/usr/local/src,执行如下命令去git clone包:

  1. git clone https://github.com/larryli/gitlabhq.git

2,停止当前gitlab

  1. gitlab-ctl stop
  2. \cp /usr/local/src/gitlabhq/* /opt/gitlab/embedded/service/gitlab-rails/ -rf

其中有两个提示我们可以忽略: cp: cannot overwrite non-directory `/opt/gitlab/embedded/service/gitlab-rails/log’ with directory `./log’ cp: cannot overwrite non-directory `/opt/gitlab/embedded/service/gitlab-rails/tmp’ with directory `./tmp’ 好了,汉化完成,重新启动gitlab,汉化完成。

三,日常管理

gitlab-ctl start|stop|status|restart 比如查看状态:

    1. [root@21yunwei gitlab]# gitlab-ctl status
    2. run: gitlab-workhorse: (pid 19922) 665s; run: log: (pid 19159) 725s
    3. run: logrotate: (pid 19179) 723s; run: log: (pid 19178) 723s
    4. run: nginx: (pid 19166) 724s; run: log: (pid 19165) 724s
    5. run: postgresql: (pid 19026) 760s; run: log: (pid 19025) 760s
    6. run: redis: (pid 18943) 766s; run: log: (pid 18942) 766s
    7. run: sidekiq: (pid 19149) 732s; run: log: (pid 19148) 732s
    8. run: unicorn: (pid 20257) 642s; run: log: (pid 19116) 734s

四,启动日志

Recipe: gitlab::redis-exporter

* ruby_block[reload redis-exporter svlogd configuration] action create
– execute the ruby block reload redis-exporter svlogd configuration
Recipe: gitlab::prometheus
* service[prometheus] action restart
– restart service service[prometheus]
* ruby_block[reload prometheus svlogd configuration] action create
– execute the ruby block reload prometheus svlogd configuration
Recipe: gitlab::postgres-exporter
* service[postgres-exporter] action restart
– restart service service[postgres-exporter]
* ruby_block[reload postgres-exporter svlogd configuration] action create
– execute the ruby block reload postgres-exporter svlogd configuration

Running handlers:
Running handlers complete
Chef Client finished, 256/510 resources updated in 02 minutes 05 seconds
gitlab Reconfigured!

看到gitlab Reconfigured! 说明启动成功!

要是一直卡到ruby_block[supervise_redis_sleep] action run 运行一下命令

解决方案:

1、按住CTRL+C强制结束;

2、运行:sudo systemctl restart gitlab-runsvdir;

3、再次执行:sudo gitlab-ctl reconfigure

解决方案来源:https://gitlab.com/gitlab-org/omnibus-gitlab/issues/160

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,111
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,584
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,431
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,203
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,838
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,922