gitlab安装-配置-运维

来源:互联网 发布:股票牛人 知乎 编辑:程序博客网 时间:2024/05/22 15:03

1.安装

参考:https://about.gitlab.com/installation/#centos-6

1. Install and configure the necessary dependencies

If you install Postfix to send email please select 'Internet Site' during setup. Instead of using Postfix you can also use Sendmail or configure a custom SMTP server and configure it as an SMTP server.

On CentOS, the commands below will also open HTTP and SSH access in the system firewall.

sudo yum install curl openssh-server openssh-clients postfix cronie

sudo service postfix start

sudo chkconfig postfix on

sudo lokkit -s http -s ssh

2. Add the GitLab package server and install the package

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

sudo yum install gitlab-ce

3. Configure and start GitLab

sudo gitlab-ctl reconfigure

2.配置

参考:http://blog.csdn.net/u011241606/article/details/51471367

1. 配置 gitlab的访问地址

这一步在官方的文档里面没有,但是如果没有配置的话,直接启动GitLab,会出现不正确的FQDN错误,导致无法正常启动。因此必须做配置。

sudo mkdir -p /etc/gitlab

sudo touch /etc/gitlab/gitlab.rb

sudo chmod 600 /etc/gitlab/gitlab.rb

sudo gedit /etc/gitlab/gitlab.rb

external_url改成部署机器的域名或者IP地址:


2. 重新配置gitlab

sudo gitlab-ctl reconfigure

3.打开浏览器登陆

按照上面设置的external_url访问,第一次登陆默认管理员密码和用户名:

Username: root

Password: 5iveL!fe

登陆进去可做修改

3.运维

http://www.mamicode.com/info-detail-1658478.html

 

初次配置服务

sudo gitlab-ctl reconfigure

 

启动服务

sudo gitlab-ctl start

 

停止服务

sudo gitlab-ctl stop

 

重启服务

sudo gitlab-ctl restart

 

检查服务的日志信息

# 检查redis的日志

sudo gitlab-ctl tail redis

 

# 检查postgresql的日志

sudo gitlab-ctl tail postgresql

 

# 检查gitlab-workhorse的日志

sudo gitlab-ctl tail gitlab-workhorse

 

# 检查logrotate的日志

sudo gitlab-ctl tail logrotate

 

# 检查nginx的日志

sudo gitlab-ctl tail nginx

 

# 检查sidekiq的日志

sudo gitlab-ctl tail sidekiq

 

# 检查unicorn的日志

sudo gitlab-ctl tail unicorn


检查服务状态

sudo gitlab-ctl status

 

一般服务状态显示信息

显示格式:

状态 进程名称:(进程ID)运行时间(秒);进程的日志服务进程和运行时间

run: gitlab-workhorse: (pid 11892) 281s; run: log: (pid 8630) 4742472s

run: logrotate: (pid 11904) 280s; run: log: (pid 8631) 4742472s

run: nginx: (pid 11911) 280s; run: log: (pid 8796) 4742455s

run: postgresql: (pid 12866) 18s; run: log: (pid 8627) 4742472s

run: redis: (pid 11989) 249s; run: log: (pid 8638) 4742472s

run: sidekiq: (pid 12850) 20s; run: log: (pid 8634) 4742472s

run: unicorn: (pid 12022) 247s; run: log: (pid 8629) 4742472s

状态 说明

run 运行状态

down 服务停止

 

常见的问题

 

1. gitlab管理员密码忘记,怎么重置密码

 

Gitlab 修改root用户密码

 

使用rails工具打开终端

sudo gitlab-rails console production

查询用户的email,用户名,密码等信息,id:1表示root账号

user = User.where(id: 1).first

重新设置密码

user.password = ‘新密码‘

user.password_confirmation = ‘新密码‘ 

保存密码

user.save!

 

完整的操作ruby脚本

user = User.where(id: 1).first

user.password = ‘新密码‘

user.password_confirmation = ‘新密码‘

user.save!

然后使用重置过的密码重新登录。

原创粉丝点击