下载安装包
https://blog.csdn.net/Allen_sina/article/details/125221421
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/8/gitlab-ce-15.0.2-ce.0.el8.x86_64.rpm/download.rpm
安装gitlab
yum install policycoreutils-python-utils
rpm -Uvh gitlab-ce-15.0.2-ce.0.el8.x86_64.rpm
更新配置(初始化已经安装好的GitLab(这个也要花点时间的)
gitlab-ctl reconfigure
启动gitlab
gitlab-ctl start
查看gitlab运行状态
gitlab-ctl status
到这一步就证明安装成功了
防火墙允许http访问
firewall-cmd --permanent --add-service=http //允许http访问
firewall-cmd --zone=public --add-port=8600/tcp --permanent //开放自己的端口
systemctl restart firewalld
修改端口号
vim /etc/gitlab/gitlab.rb
并将external_url 里面的内容更换为自己在的ip和端口 切记(这个ip一定是你服务器的ip 不要在服务器使用命令ifconfig-a 去查看ip 那个ip是不对的。)
查看root密码
cat /etc/gitlab/initial_root_password
第八步:重新加载配置文件
gitlab-ctl reconfigure
部分显示如下:
报错如下:
Running handlers:
There was an error running gitlab-ctl reconfigure:
execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8] (postgresql::enable line 74) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
STDOUT: The files belonging to this database system will be owned by user "gitlab-psql".
This user must also own the server process.
STDERR: initdb: invalid locale settings; check LANG and LC_* environment variables
---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1
解决办法:
执行如下代码:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
source ~/.bashrc
重新执行如下: gitlab-ctl reconfigure
如果卡住如下:
ruby_block[wait for gitlab-workhorse service socket] action run
按住ctrl + c 退出
执行如下代码: systemctl restart gitlab-runsvdir
第九步:重启gitlab
sudo gitlab-ctl restart
第十步:访问(将external_url里面的输入到浏览器里面即可)
附属命令 如下:
firewall-cmd --list-ports 查看开放了哪写端口命令
firewall-cmd --zone=public --add-port=7070/tcp --permanent
firewall-cmd --reload #开放某个端口 并重新加载
sudo gitlab-ctl start # 启动所有 gitlab 组件;
sudo gitlab-ctl stop # 停止所有 gitlab 组件;
sudo gitlab-ctl restart # 重启所有 gitlab 组件;
sudo gitlab-ctl status # 查看服务状态;
sudo gitlab-ctl reconfigure # 重新配置更新
sudo vim /etc/gitlab/gitlab.rb # 修改默认的配置文件;
gitlab-rake gitlab:check SANITIZE=true --trace # 检查gitlab;
sudo gitlab-ctl tail # 查看日志;
1、软件的卸载主要是使用rpm来进行的。卸载软件首先要知道软件包在系统中注册的名称。键入命令:
#rpm -q -a
2. rpm -qa | grep gitlab 查找gitlab 是否安装 如果安装使用
3、确定了要卸载的软件的名称,就可以开始实际卸载该软件了。键入命令
#rpm -e [package name]
3. 查看防火墙状态
firewall-cmd --state
- 关闭防火墙 systemctl stop firewalld
如何配置自己的redis
gitlab_rails['redis_host'] = '127.0.0.1'
gitlab_rails['redis_port'] = 6379
gitlab_rails['redis_password'] = 'redis314..' #访问redis的密码
如何修改默认的gitlab密码
sudo gitlab-rails console
1.
用户名方式:user = User.find_by_username 'root'
id方式:or user = User.find(1)
邮箱方式:or user = User.find_by(email: 'user@example.com')
2. 设置密码:
user.password = 'root123456'
user.password_confirmation = 'root123456'
user.save!
密码设置成功!
gitlab-ctl reconfigure
gitlab-ctl start