安装环境
- 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.1
- systemctl 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.yml
- gitlab:
- ## Web server settings (note: host is the FQDN, do not include http://)
- host: 192.168.10.100
- port: 80
- https: false
- ……
- email_from: gitlab@192.168.10.100
- 4. 重启gitlab
- gitlab-ctl restar
复制代码 5 创建项目后是这样的
- Command line instructions
- Git 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 master
- Existing 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 master
- Existing 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
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |