gitlab常用操作
Easul Lv6

gitlab

安装

旧版本可能有问题,可以用新版本进行安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 以下均在root下操作,或者普通用户加sudo也可以
# 安装常用软件
yum -y install curl postfix policycoreutils-python openssh-server wget
# 设置postfix开机启动
systemctl enable postfix
# 启动postfix
systemctl start postfix
# 如果启动报错Failed to start Postfix Mail Transport Agent.
# 则进行如下设置
vi /etc/postfix/main.cf

inet_protocols = ipv4
inet_interfaces = all

# 下载gitlab的rpm包
mkdir ~/software && cd ~/software
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.9.1-ce.0.el7.x86_64.rpm
# 使用rpm安装本地rpm包
rpm -ivh gitlab-ce-14.9.1-ce.0.el7.x86_64.rpm
# 修改配置文件
vi /etc/gitlab/gitlab.rb

# ip可以写域名或本机IP,端口号随便写
external_url 'http://ip:端口号'
# 下边的设置新版本已经没有了
# 这个端口不可以和上边相同
# 在Advanced settings下
unicorn['port'] = 28080

# 初始化gitlab并启动,时间比较长,耐心等待
gitlab-ctl reconfigure
# 停止服务
gitlab-ctl stop
# 查看服务状态
gitlab-ctl status
# 启动服务
gitlab-ctl start
# 重启服务
gitlab-ctl restart

登录

1
2
3
4
5
6
7
8
9
10
11
12
13
# 初始密码查看
cat /etc/gitlab/initial_root_password
# 修改root用户密码
# 进入控制台
gitlab-rails console
# 查询root用户账号信息并赋值给u
u=User.find(1)
# 设置密码
u.password='test123456'
# 保存设置
u.save!
# 退出控制台
exit

修改gitlab的root密码

详细操作

基本操作可以参考Gitlab的安装及使用。可以添加邮件服务或者用户操作等。
如果进行使用的时候,最好结合使用人数进行相关的配置,如内存大小,CPU核心数等(在/etc/gitlab/gitlab.rb
可以参考gitlab内存消耗过大

卸载

1
2
3
4
5
6
7
8
9
10
11
# 停止gitlab
gitlab-ctl stop
# 卸载gitlab,如果是ee版本就写gitlab-ee
rpm -e gitlab-ce
# 停掉gitlab的相关进程
ps -ef| grep gitlab |grep -v grep|cut -c 9-15|xargs kill -9
# 删除gitlab相关文件
find / -name *gitlab*|xargs rm -rf
find / -name gitlab |xargs rm -rf
# 如果root下有gitlab的配置文件也一并删除
ls /root/gitlab*

CentOs 7 安装 GitLab、完全卸载GitLab

相关问题

  • invalid locale settings; check LANG and LC_* environment variables

    1
    2
    3
    # 字符集问题,在命令行设置字符集
    export LC_CTYPE=en_US.UTF-8
    export LC_ALL=en_US.UTF-8

    参考

  • 卡在ruby_block[wait for redis service socket] action run

    1
    2
    3
    4
    # 可以再开一个窗口,运行如下命令
    sudo /opt/gitlab/embedded/bin/runsvdir-start
    # 再次执行
    gitlab-ctl reconfigure

    gitlab reconfigure卡住

gitea

搭建很简单,可以作为备用选择

 评论