当前位置: 首页 > news >正文

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

http://www.lryc.cn/news/460893.html

相关文章:

  • java基础(5)继承与多态
  • Flink消费Kafka实时写入Doris
  • 实现Web QQ音乐打开现有新标签页切换音乐
  • 从底层结构开始学习FPGA(15)----时钟结构(通俗版)
  • MacOS Sublime Text 解决中乱码
  • Python画笔案例-084 绘制 3D立方体
  • “八股文”面试:助力、阻力还是空谈?
  • 如何实现弹出式窗口
  • Lua 函数
  • HTML_文本标签
  • 基于SpringBoot+Vue+uniapp的诗词学习系统的详细设计和实现(源码+lw+部署文档+讲解等)
  • 健康睡眠的重要性
  • 知道ip地址怎么看网络地址
  • 精心整理85道Java微服务面试题(含答案)
  • MongoDB聚合管道(Aggregation Pipeline)
  • 移情别恋c++ ദ്ദി˶ー̀֊ー́ ) ——6.vector(无习题)
  • SpringBoot技术支持的桂林景点导航
  • 利用vmware在移动硬盘安装Ubuntu2go
  • Spring Boot:中小型医院网站的敏捷开发
  • 241011-在jupyter中实现文件夹压缩后下载
  • .NET 一款用于转储指定进程内存的工具
  • Splunk 修补关键漏洞,包括远程代码执行漏洞
  • 搭建一个vue3+vite框架
  • 【含文档】基于Springboot+Vue的公交管理系统(含源码+数据库+lw)
  • 自闭症儿童能否适应学校生活:提供专业辅助,助力顺利融入
  • MQTTnet.Server同时支持mqtt及websocket协议
  • 【数据结构】二叉树(一)遍历
  • 【C++ 贪心】1616. 分割两个字符串得到回文串|1868
  • 识别秒拨风险的具体方法及策略
  • [Python]如何在Ubuntu中建置python venv虛擬環境,並安裝TensorFlow和OpenCV函式庫?