gitlab部署
//安装yum源
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
[root@localhost ~]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
[root@localhost ~]# sed -i 's|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
[root@localhost ~]# sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
//安装git
[root@localhost ~]# yum -y install epel-release git
//安装依赖包
[root@localhost ~]# yum -y install curl openssh-server openssh-clients postfix cronie postfix cronie policycoreutils-*
//启动postfix服务并设置开机自启
[root@localhost ~]# systemctl restart postfix
[root@localhost ~]# systemctl enable postfix
[root@localhost ~]# rpm -ivh gitlab-ce-13.6.0-ce.0.el8.x86_64.rpm
[root@localhost ~]# rpm -ivh gitlab-ce-13.6.0-ce.0.el8.x86_64.rpm
warning: gitlab-ce-13.6.0-ce.0.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID f27eab47: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:gitlab-ce-13.6.0-ce.0.el8 ################################# [100%]
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
//重载配置文件并重启gitlab
[root@localhost ~]# gitlab-ctl reconfigure
[root@localhost ~]# gitlab-ctl restart
//修改配置文件
[root@localhost ~]# vim /etc/gitlab/gitlab.rb
//查看当前的gitlab版本
[root@localhost ~]# head -5 /opt/gitlab/version-manifest.txt
gitlab-ce 13.6.0
Component Installed Version Version GUID
--------------------------------------------------------------------------------------------------------------------------------------------------
acme-client 2.0.7
//关闭防火墙和seliunx
[root@localhost ~]# vim /etc/selinux/config
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
破解管理员密码
//破解密码
[root@localhost ~]# gitlab-rails console -e production
--------------------------------------------------------------------------------
Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
GitLab: 13.6.0 (6317794da29) FOSS
GitLab Shell: 13.13.0
PostgreSQL: 11.9
--------------------------------------------------------------------------------
irb(main):003:0> user = User.where(id:1).first //id为1的是超级管理员
=> #<User id:1 @root>
irb(main):004:0> user.password = '123123123' /密码必须至少8个字符
=> "123123123"
irb(main):006:0> user.password_confirmation = '123123123' /密码必须至少8个字符
=> "123123123"
irb(main):007:0> user.save! //保存修改,若无问题将返回true
Enqueued ActionMailer::MailDeliveryJob (Job ID: 10264236-7575-452f-a0a5-7551c4fd4e8c) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007fcd4b0d5a28 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
irb(main):008:0> exit
[root@localhost ~]#
汉化
4)汉化
1、下载汉化补丁
[root@node01 ~]# git clone https://gitlab.com/xhang/gitlab.git
[root@node01 ~]# cd gitlab
2、查看全部分支版本
[root@node01 ~]# git branch -a
3、对比版本、生成补丁包
[root@node01 ~]# git diff remotes/origin/10-2-stable remotes/origin/10-2-stable-zh > /tmp/10.2.2-zh.diff
4、停止服务器
[root@node01 ~]# gitlab-ctl stop
5、打补丁
[root@node01 ~]# patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < /tmp/10.2.2-zh.diff
6、启动和重新配置
[root@node01 ~]# gitlab-ctl start
[root@node01 ~]# gitlab-ctl reconfigure
[root@localhost ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:inKD0Od9v/wH61Z1pRTOUx6jnwZm4/Zw4dplWdc8ENQ root@localhost.localdomain
The key's randomart image is:
+---[RSA 3072]----+
| .+++.|
| o+E=|
| B++B|
| . + *.X|
|. . . S + O+|
| . + o . o O..|
| o = o . = o |
| o . . o o . |
| +=o. |
+----[SHA256]-----+
[root@localhost ~]#
[root@localhost .ssh]# cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCsI9HM/WaMi9XTZxrtpG9KTOPkzxG9TXKIFkaMMMpkRET86xhoworbRwnFYKkHD6WpAUsBuDcIJQJ8Y+oBQzNqGl3Ux6plGj2nYMBoMcoYmXiNN8JX91fuSe+lyYQ6YjuK0ya5UDKFV9okTtf1CAxhAO+dw2dnNdaupn7GQAwbnuMTrxXc4YQFcbUoZtIpsn0WeGfF5OeSZyht5Sp3xDvWZSn9Z2ELYKtXfNpJhvprCuUS6WuhoxmdjsE50qQs+beh0G1nTzUIK2f5yOFH5iGBSWEEysuRCuh2EtED55l+bxTaFbtBjpinl2NnQUy4r857FJ4sdItPNQrd+xQWkmhfSxRhG+vBn4lP0O/QL1TIuxHcDO5NYakPcBhFwoigV6pVvb5tvXhTIBfePQOlk19CAOV0weOvHTAer1lkvHMnOog69eQbe75evgYzIfNVWvlJlwBOn0we/5v3hZKrF2Wwhpw7N9/HIfbeep4AgdEZa6uVtigDPGNA1svXCm+vQdk= root@localhost.localdomain
[root@localhost tmp]# git clone http://192.168.236.130/root/rutime.git
Cloning into 'rutime'...
Username for 'http://192.168.236.130': root
Password for 'http://root@192.168.236.130':
warning: You appear to have cloned an empty repository.
[root@localhost tmp]# ls
rutime
[root@localhost rutime]# ls -a
. .. .git