Gitlab离线部署
2019-11-10 本文已影响0人
于飞_d529
Gitlab部署
部署服务器
172.29.122.35
版本
12.4.0
安装gitlab
[root@cn2031 Downloads]# rpm -i gitlab-ce-12.4.0-ce.0.el7.x86_64.rpm
warning: gitlab-ce-12.4.0-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
It looks like GitLab has not been configured yet; skipping the upgrade script.
*. *.
*** ***
***** *****
.****** *******
******** ********
,,,,,,,,,***********,,,,,,,,,
,,,,,,,,,,,*********,,,,,,,,,,,
.,,,,,,,,,,,*******,,,,,,,,,,,,
,,,,,,,,,*****,,,,,,,,,.
,,,,,,,****,,,,,,
.,,,***,,,,
,*,.
_______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
\____/_/\__/_____/\__,_/_.___/
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
修改默认配置
vim /etc/gitlab
### Advanced settings
unicorn['listen'] = '127.0.0.1'
unicorn['port'] = 24000
nginx['listen_addresses']=['*']
nginx['listen_port']=24001
修改nginx代理监控端口
vim /opt/gitlab/embedded/conf/nginx.conf
将listen 由80改为24001
使gitlab配置生效
gitlab-ctl reconfigure
查看gitlab运行状态
gitlab-ctl status
如果全部为run,说明正常启动
卸载gitlab
- 停止gitlab
gitlab-ctl stop
- 卸载gitlab
rpm -e gitlab-ce
- 查看gitlab进程
ps aux | grep gitlab
- 杀掉第一个进程
kill -9 18777 #(18777 是第一个进程的pid号,根据显示情况输入)
ps -ef | grep gitlab | xargs kill -s 9
- 删除所有包含gitlab文件
find / -name gitlab | xargs rm -rf
修改gitlab用户密码
[root@cn2031 ~]# gitlab-rails console production
Loading production environment (Rails 4.2.8)
irb(main):002:0> user=User.where(name: "Administrator").first
=> #<User id:1 @root>
irb(main):003:0> user.password='xxxx1234'
=> "xxxx1234"
irb(main):004:0> user.password_confirmation = 'cmcc1234'
=> "cmcc1234"
irb(main):005:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: c19bbd7e-b68e-4989-a8e9-618bd26f240c) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true
irb(main):006:0> quit