版本控制介绍
版本控制是指对软件开发过程中各种程序代码、配置文件及说明文档等文件变更的管理,是软件配置管理的核心思想之一。
安装rpm包与依赖
[root@localhost ~]# wget https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/8/gitlab-ce-13.12.3-ce.0.el8.x86_64.rpm/download.rpm
//安装依赖包
[root@localhost ~]# dnf -y install policycoreutils-python-utils curl openssh-server openssh-clients postfix cronie git
关闭防火墙、开启邮箱服务
[root@localhost ~]# systemctl enable postfix
[root@localhost ~]# systemctl start postfix
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# setenforce 0
sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
安装gitlab
[root@localhost ~]# systemctl enable postfix
Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → /usr/lib/systemd/system/postfix.service.
[root@localhost ~]# systemctl start postfix
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
[root@localhost ~]#
4. 开始安装gitlab!
[root@localhost ~]# rpm -ivh download.rpm
警告:download.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID f37eab47: NOKEY
Verifying... ################################# [100%]
准备中... ################################# [100%]
正在升级/安装...
1:gitlab-ce-13.12.3-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
Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=13-12
修改配置文件为本机ip,重新读取配置文件并重启服务
[root@localhost ~]# sed -i "s#^external_url 'http://gitlab.example.com'#external_url 'http://192.168.10.40'#g" /etc/gitlab/gitlab.rb
[root@localhost ~]# gitlab-ctl reconfigure
[root@localhost ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 51252) 0s
ok: run: gitaly: (pid 51295) 1s
ok: run: gitlab-exporter: (pid 51321) 0s
ok: run: gitlab-workhorse: (pid 51336) 1s
ok: run: grafana: (pid 51364) 0s
ok: run: logrotate: (pid 51412) 1s
ok: run: nginx: (pid 51450) 0s
ok: run: node-exporter: (pid 51463) 0s
ok: run: postgres-exporter: (pid 51468) 0s
查看端口号
[root@host ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 1024 127.0.0.1:9121 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9090 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9187 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9093 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9100 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9229 0.0.0.0:*
LISTEN 0 511 0.0.0.0:80 0.0.0.0:*
LISTEN 0 128 127.0.0.1:9168 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9236 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:3000 0.0.0.0:*
LISTEN 0 100 127.0.0.1:25 0.0.0.0:*
LISTEN 0 511 0.0.0.0:8060 0.0.0.0:*
LISTEN 0 1024 *:9094 *:*
LISTEN 0 128 [::1]:9168 [::]:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 100 [::1]:25 [::]:*
修改密码
[root@localhost ~]# gitlab-rails console -e production
--------------------------------------------------------------------------------
Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
GitLab: 13.12.3 (757327a59bc) FOSS
GitLab Shell: 13.18.0
PostgreSQL: 12.6
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3.6)
irb(main):001:0> user = User.where(id: 1).first
=> #<User id:1 @root>
irb(main):002:0> user.password = 'yangzhenyu'
=> "yangzhenyu"
irb(main):003:0> user.password_confirmation = 'yangzhenyu'
=> "yangzhenyu"
irb(main):004:0> user.save!
Enqueued ActionMailer::MailDeliveryJob (Job ID: 36cdd4b3-19f5-4936-92e8-af0c6a4ed69f) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f91f2532470 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
irb(main):005:0> exit