You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 6 and 7, the commands below will also open HTTP and SSH access in the system firewall.
If you are not comfortable installing the repository through a piped script, you can find the entire script here and select and download the package manually and install using gitlab/gitlab-ce
On your first visit, you'll be redirected to a password reset screen to provide the password for the initial administrator account. Enter your desired password and you'll be redirected back to the login screen.
The default account's username is root. Provide the password you created earlier and login. After login you can change the username if you wish.
gitlab preinstall: Automatically backing up only the GitLab SQL database (excluding everything else!)
Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... pg_dump: [archiver (db)] connection to database "gitlabhq_production" failed: could not connect to server: 没有那个文件或目录
Is the server running locally and accepting
connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
Backup failed
[FAILED]
gitlab preinstall:
gitlab preinstall: Backup failed! If you want to skip this backup, run the following command and
gitlab preinstall: try again:
gitlab preinstall:
gitlab preinstall: sudo touch /etc/gitlab/skip-auto-migrations
gitlab preinstall:
error: %pre(gitlab-ce-8.15.2-ce.0.el6.x86_64) scriptlet failed, exit status 1
Error in PREIN scriptlet in rpm package gitlab-ce-8.15.2-ce.0.el6.x86_64
error: install: %pre scriptlet failed (2), skipping gitlab-ce-8.15.2-ce.0.el6
gitlab-ce-8.11.5-ce.0.el6.x86_64 was supposed to be removed but is not!
Verifying : gitlab-ce-8.11.5-ce.0.el6.x86_64 1/2
Verifying : gitlab-ce-8.15.2-ce.0.el6.x86_64 2/2
Failed:
gitlab-ce.x86_64 0:8.11.5-ce.0.el6
# 重新安装命令
yum reinstall gitlab-ce
# or
yum install gitlab-ce
...
gitlab: Thank you for installing GitLab!
gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND:
sudo gitlab-ctl reconfigure
gitlab: GitLab should be reachable at http://114.55.148.71:8081
gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
gitlab: And running reconfigure again.
gitlab:
gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme
gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab:
gitlab: GitLab now ships with a newer version of PostgreSQL (9.6.1), and will be used
gitlab: as the default in the next major relase. To upgrade, RUN THE FOLLOWING COMMANDS:
sudo gitlab-ctl pg-upgrade
gitlab: For more details, please see:
gitlab: https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server
gitlab:
清理 : gitlab-ce-8.11.5-ce.0.el6.x86_64 2/2
Found /etc/gitlab/skip-auto-migrations, exiting...
Verifying : gitlab-ce-8.15.2-ce.0.el6.x86_64 1/2
Verifying : gitlab-ce-8.11.5-ce.0.el6.x86_64 2/2
更新完毕:
gitlab-ce.x86_64 0:8.15.2-ce.0.el6
完毕!
chown -R root:root /usr/local/nginx/proxy_temp
# 编辑 nginx.conf
sudo vi /usr/local/nginx/conf/nginx.conf
# 在第一行添加
user root;
webhooks 错误
错误显示不允许发送本地请求
Url is blocked: Requests to the local network are not allowed
解决方法,在设置中设置允许本地连接即可
admin => Settings => Outbound requests
服务无法启动
[root@localhost gitlab]# gitlab-ctl status
fail: alertmanager: runsv not running
fail: gitaly: runsv not running
fail: gitlab-monitor: runsv not running
fail: gitlab-workhorse: runsv not running
fail: logrotate: runsv not running
fail: nginx: runsv not running
fail: node-exporter: runsv not running
fail: postgres-exporter: runsv not running
fail: postgresql: runsv not running
fail: prometheus: runsv not running
fail: redis: runsv not running
fail: redis-exporter: runsv not running
fail: sidekiq: runsv not running
fail: unicorn: runsv not running
CentOS7安装维护Gitlab
目录
官方安装
下面是官网复制过来的官方安装方法,最简单的安装,在我大天朝,只能望天兴叹,你可翻墙安装或者略过这里,看下面的。
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 6 and 7, the commands below will also open HTTP and SSH access in the system firewall.
If you are not comfortable installing the repository through a piped script, you can find the entire script here and select and download the package manually and install using
gitlab/gitlab-ce
On your first visit, you'll be redirected to a password reset screen to provide the password for the initial administrator account. Enter your desired password and you'll be redirected back to the login screen.
The default account's username is root. Provide the password you created earlier and login. After login you can change the username if you wish.
第三方镜像安装
编辑源
新建 /etc/yum.repos.d/gitlab-ce.repo,内容为
使用清华大学 TUNA 镜像源 打开网址将内容复制到
gitlab-ce.repo
文件中,编辑路径vim /etc/yum.repos.d/gitlab-ce.repo
更新本地YUM缓存
安装社区版
更改配置
配置并启动GitLab
登录GitLab
Docker安装
Docker 安装 Gitlab 教程
卸载
运维
服务管理
日志查看
重置管理员密码
Gitlab管理员密码忘记,怎么重置密码,Gitlab 修改root用户密码,How to reset your root password。
使用rails工具打开终端
查询用户的email,用户名,密码等信息,id:1 表示root账号
重新设置密码
保存密码
user.save!
完整的操作ruby脚本
备份恢复
使用Gitlab一键安装包安装Gitlab非常简单, 同样的备份恢复与迁移也非常简单,用一条命令即可创建完整的Gitlab备份:
修改备份文件默认目录
修改
/etc/gitlab/gitlab.rb
来修改默认存放备份文件的目录:创建备份
以上命令将在
/var/opt/gitlab/backups
目录下创建一个名称类似为xxxxxxxx_gitlab_backup.tar的压缩包, 这个压缩包就是Gitlab整个的完整部分, 其中开头的xxxxxx是备份创建的时间戳。修改后使用gitlab-ctl reconfigure命令重载配置文件。
开始备份
这里放你的备份文件文件夹,和仓库源文件。
自动备份
通过crontab使用备份命令实现自动备份
上面两行保存之后,重新载入配置
service crond reload # or systemctl reload crond.service
备份保留七天
设置只保存最近7天的备份,编辑 /etc/gitlab/gitlab.rb 配置文件,找到如下代码,删除注释
#
保存重新加载gitlab配置文件
开始恢复
迁移如同备份与恢复的步骤一样, 只需要将老服务器
/var/opt/gitlab/backups
目录下的备份文件拷贝到新服务器上的/var/opt/gitlab/backups
即可(如果你没修改过默认备份目录的话)。 然后执行恢复命令。如果修改了,首先进入备份 gitlab 的目录,这个目录是配置文件中的
gitlab_rails['backup_path']
,默认为/var/opt/gitlab/backups
。然后停止 unicorn 和 sidekiq ,保证数据库没有新的连接,不会有写数据情况。
判断是执行实际操作的gitlab相关用户:git,没有得到足够的权限。依次执行命令:
如果备份文件报没有权限,通过
ls -al
查看权限是不是git
,而不是root
,通过下面方式给git
用户权限连接数据库
修改
pg_hba.conf
配置如果不希望允许所有IP远程访问,则可以将上述配置项中的0.0.0.0设定为特定的IP值。
重启
postgresql
数据库查看
/etc/passwd
文件里边gitlab
对应的系统用户一些常规目录
使用HTTPS
直接将nginx配置复制到你自己的nginx配置中,停掉gitlab的nginx
将你的SSL证书配置复制进去
编辑
vi /usr/local/nginx/conf/nginx.conf
你的nginx配置,引用你复制过来的配置。同时要把
/var/opt/gitlab/nginx/conf/nginx.conf
中的一些变量复制到自己的nginx配置中nginx.conf
暴力升级
暴力升级前先备份,然后停止所有服务运行,记得备份的良好习惯
直接编辑源 /etc/yum.repos.d/gitlab-ce.repo,安装 GitLab 社区版
注意:
10.7
版本升级到11.x
版本需要先升级到10.8
版本# 安装指定版本 10.8 的版本 sudo yum install gitlab-ce-10.8.0-ce.0.el6
安装完成记得将所有服务启起来哦
安装过如果报错,查看提示根据提示操作,版本跨度太大会报错哦。
看上面一堆错误,瞬间就懵逼了,看到一条救星命令让我尝试运行
sudo touch /etc/gitlab/skip-auto-migrations
于是我二逼的重新yum install gitlab-ce
运行了,结果真的安装成功了,😄。重启配置,可以解决大部分
502
错误。优化内存使用
修改配置文件
/etc/gitlab/gitlab.rb
错误处理
解决80端口被占用
nginx配置解决
80
端口被占用nginx配置检查和立即生效
头像无法正常显示
原因:gravatar被墙
解决办法:
编辑 /etc/gitlab/gitlab.rb,将
# gitlab_rails['gravatar_plain_url'] = 'http://gravatar.duoshuo.com/avatar/%{hash}?s=%{size}&d=identicon'
修改为:
然后在命令行执行:
internal API unreachable
这个错误是一个自己制造的坑,我克隆和提交都没有办法搞,但是网站能正常运行,尝试了非常多的方法,最终我的问题是
22
端口没有隐射出去,好尴尬。解决办法:https://gitlab.com/gitlab-org/gitlab-ce/issues/33702
通过防火墙规则 127.0.0.1
proxy_temp 目录没有权限
以下方式解决
webhooks 错误
错误显示不允许发送本地请求
解决方法,在设置中设置允许本地连接即可
服务无法启动
Omnibus gitlab do not restart on CentOS7
开机自动启动服务
如果
gitlab-runsvdir.service
服务没有响应,你可能要看一下内存是否满了,需要释放内存,老的版本需要 2G 内存,新版本需要至少 4G 内存。其它错误
上面错误是数据库没有启动,我不知道如何启动,我重启了服务器,然后好球了。😆
https://gitlab.com/gitlab-org/gitlab-ce/issues/2052#note_1667899
参考资料
The text was updated successfully, but these errors were encountered: