欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 社会 > linux 安装gitlab

linux 安装gitlab

2024/11/8 2:27:23 来源:https://blog.csdn.net/qq_25096749/article/details/142847788  浏览:    关键词:linux 安装gitlab

安装环境

  • CentOS 7.7 (centos6.10会报错)
  • 2g内存
  • 防火墙关闭

安装步骤:

1 安装gitlab
# yum install -y git curl policycoreutils-python openssh-server        # 安装依赖
# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm        # 下载软件包
# yum -y install gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm              # 安装gitlab
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
2 配置gitlab修改成本机ip地址
# vim /etc/gitlab/gitlab.rb               # 编辑配置文件  
external_url 'http://192.168.1.21'        # 改为自己的IP地址# gitlab-ctl reconfigure                  # 第一次使用gitlab需要初始化gitlab服务(时间相对较长)
.........
........
Recipe: gitlab::postgres-exporter* service[postgres-exporter] action restart- restart service service[postgres-exporter]* ruby_block[reload postgres-exporter svlogd configuration] action create- execute the ruby block reload postgres-exporter svlogd configuration
Running handlers:
Running handlers complete
Chef Client finished, 384/541 resources updated in 04 minutes 07 seconds
gitlab Reconfigured!# gitlab-ctl restart        # 重启gitlab服务,gitlab是由多种服务组成的,或者 systemctl start gitlab-runsvdir
ok: run: gitaly: (pid 4123) 1s
ok: run: gitlab-monitor: (pid 4133) 0s
ok: run: gitlab-workhorse: (pid 4136) 1s
ok: run: logrotate: (pid 4144) 0s
ok: run: nginx: (pid 4151) 1s
ok: run: node-exporter: (pid 4156) 0s
ok: run: postgres-exporter: (pid 4165) 1s	
ok: run: postgresql: (pid 4175) 0s
ok: run: prometheus: (pid 4183) 0s
ok: run: redis: (pid 4187) 0s
ok: run: redis-exporter: (pid 4194) 0s
ok: run: sidekiq: (pid 4199) 0s
ok: run: unicorn: (pid 4208) 0s# 停止gitlab
# gitlab-ctl stop
# systemctl stop gitlab-runsvdir# 停止gitlab中的单个服务
gitlab-ctl stop nginx
3 访问 http://你的服务器ip,设置root密码,默认管理员登录名是root(之后就可以自己注册一个普通用户名了)

请添加图片描述

如果遇到 【Whoops, GitLab is taking too much time to respond. Try refreshing the page, or going back and attemp】 就看一下是否有8080占用了gitlab端口

安装汉化补丁,并再次访问

说明:这里如果使用的同样是gitlab10.2.2,下载汉化较慢的话,可以直接下载【gitlab依赖包】

1、下载汉化补丁
[root@gitlab ~]# git clone https://gitlab.com/xhang/gitlab.git
[root@gitlab ~]# cd gitlab    
2、查看全部分支版本
[root@gitlab ~]# git branch -a
3、对比版本、生成补丁包
[root@gitlab ~]# git diff remotes/origin/10-2-stable remotes/origin/10-2-stable-zh > /tmp/10.2.2-zh.diff
4、停止服务器
[root@gitlab ~]# gitlab-ctl stop
5、打补丁
[root@gitlab ~]# patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < /tmp/10.2.2-zh.diff
6、启动和重新配置
[root@gitlab ~]# gitlab-ctl start
[root@gitlab ~]# gitlab-ctl reconfigure

请添加图片描述

4.1 如果服务器更换了ip地址,gitlab配置文件也最好更换
1. 先修改本地的IP地址
vim /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=static
NAME=eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.10.100
NETMASK=255.255.255.0
GATEWAY=192.168.10.1systemctl restart network
2. 修改gitlab.rb,中的WEB页面地址
# vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.10.100'3. 修改gitlab仓库地址
vim /var/opt/gitlab/gitlab-rails/etc/gitlab.ymlgitlab:## Web server settings (note: host is the FQDN, do not include http://)host: 192.168.10.100port: 80https: false……email_from: gitlab@192.168.10.1004. 重启gitlab
gitlab-ctl restar
5 创建项目后是这样的

请添加图片描述
请添加图片描述

Command line instructionsGit global setup
git config --global user.name "Administrator"
git config --global user.email "admin@example.com"Create a new repository
git clone http://gitlab.example.com/dev/my-project1.git
cd my-project1
touch README.md
git add README.md
git commit -m "add README"
git push -u origin masterExisting folder
cd existing_folder
git init
git remote add origin http://gitlab.example.com/dev/my-project1.git
git add .
git commit -m "Initial commit"
git push -u origin masterExisting Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin http://gitlab.example.com/dev/my-project1.git
git push -u origin --all
git push -u origin --tags

第二种安装方法:有的系统可能不支持
https://www.cnblogs.com/laobaozi/p/6638334.html

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com