1.安装

wget -O gitlab.rpm https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-11.11.3-ce.0.el7.x86_64.rpm/download.rpm
rpm -ivh gitlab.rpm

Gitlab目录

/opt/gitlab #主目录
/etc/gitlab #配置文件目录
/var/log/gitlab #日志目录

安装的同时,还会安装

Packages and dependencies.
Ruby.
Go.
Node.
System users.
Database.
Redis.
GitLab.
NGINX.

启动命令

#启动
gitlab-ctl reconfigure && gitlab-ctl start
#重启
gitlab-ctl reconfigure && gitlab-ctl restart
#查看状态
gitlab-ctl status

2.修改配置

vim /etc/gitlab/gitlab.rb
#external_url
external_url 'http://ip:10000'
#nginx的监听端口,访问要加上
nginx['listen_port'] = 10000

3.访问

用刚刚配置的端口访问即可

4.其他

4.1Nginx配置目录

/var/opt/gitlab/nginx/conf

按上面的配置,gitlab-http.conf的配置为

server {
listen *:10000; server_name 10.130.97.94;
server_tokens off; ## Don't show the nginx version number, a security best practice ## Increase this if you want to upload large attachments
## Or if you want to accept large git objects over http
client_max_body_size 0; ## Real IP Module Config
## http://nginx.org/en/docs/http/ngx_http_realip_module.html ## HSTS Config
## https://www.nginx.com/blog/http-strict-transport-security-hsts-and-nginx/
add_header Strict-Transport-Security "max-age=31536000"; add_header Referrer-Policy strict-origin-when-cross-origin; ## Individual nginx logs for this GitLab vhost
access_log /var/log/gitlab/nginx/gitlab_access.log gitlab_access;
error_log /var/log/gitlab/nginx/gitlab_error.log; if ($http_host = "") {
set $http_host_with_default "10.130.97.94:10000";
} if ($http_host != "") {
set $http_host_with_default $http_host;
} gzip on;
gzip_static on;
gzip_comp_level 2;
gzip_http_version 1.1;
gzip_vary on;
gzip_disable "msie6";
gzip_min_length 10240;
gzip_proxied no-cache no-store private expired auth;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/json application/xml application/rss+xml; ## https://github.com/gitlabhq/gitlabhq/issues/694
## Some requests take more than 30 seconds.
proxy_read_timeout 3600;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_http_version 1.1; proxy_set_header Host $http_host_with_default;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-Proto http; location ~ (.git/git-receive-pack$|.git/info/refs?service=git-receive-pack$|.git/gitlab-lfs/objects|.git/info/lfs/objects/batch$) {
proxy_cache off;
proxy_pass http://gitlab-workhorse;
proxy_request_buffering off;
} location / {
proxy_cache off;
proxy_pass http://gitlab-workhorse;
} location /assets {
proxy_cache gitlab;
proxy_pass http://gitlab-workhorse;
} error_page 404 /404.html;
error_page 500 /500.html;
error_page 502 /502.html;
location ~ ^/(404|500|502)(-custom)?\.html$ {
root /opt/gitlab/embedded/service/gitlab-rails/public;
internal;
} }

其中,请求会被发到gitlab-workhorse

location / {
proxy_cache off;
proxy_pass http://gitlab-workhorse;
}

gitlab-workhorse其实是在nginx.conf

upstream gitlab-workhorse {
server unix:/var/opt/gitlab/gitlab-workhorse/socket;
}

4.2常用命令

gitlab-ctl start #启动全部服务
gitlab-ctl restart #重启全部服务
gitlab-ctl stop #停止全部服务
gitlab-ctl restart nginx #重启单个服务
gitlab-ctl status #查看全部组件的状态
gitlab-ctl show-config #验证配置文件
gitlab-ctl uninstall #删除gitlab(保留数据)
gitlab-ctl cleanse #删除所有数据,重新开始
gitlab-ctl tail <svc_name> #查看服务的日志
gitlab-rails console production #进入控制台 ,可以修改root 的密码

4.3推荐链接

官方文档 https://gitlab.com/gitlab-org/gitlab-foss/blob/master/doc/install/installation.md

https://www.cnblogs.com/ssgeek/p/9328758.html

https://www.jianshu.com/p/8c02c3887889

最新文章

  1. 设计一个自动生成棋盘格子的JS小程序
  2. Linux系统初始流程
  3. Android:The connection to adb is down, and a severe error has occured.解决方法一
  4. iOS开发小技巧--设置cell左右有空隙,设置分割线的新思路,重写setFrame:让别人在外界无法修改控件的大小
  5. GestureDetector.OnGestureListener
  6. 30几个HTML5经典动画应用回顾 让你大饱眼福
  7. nopcommerce 二次开发
  8. python中os.walk()遍历目录中所有文件
  9. Udacity调试课笔记之断言异常
  10. 【玩转Ubuntu】04. Ubuntu上配置git环境
  11. 在Windows下同时安装Python2.x和Python3.x
  12. xtrabackup
  13. 使用Ajax和JSON实现注册时候验证用户名是否存在的功能
  14. bittorrent 学习(一) 种子文件分析与bitmap位图
  15. java 实现serialVersionUID
  16. python 常用库及安装使用
  17. idea 2017破解方法
  18. 在linux下创建自定义service服务
  19. UnicodeDecodeError: &#39;ascii&#39; codec can&#39;t decode byte 0xe0 in position 0
  20. 服务商域名DNS大全

热门文章

  1. redis数据存入乱码问题解决方法
  2. SpringCloud学习笔记(十、SpringCloud Sleuth)
  3. C++ try catch 示例代码
  4. 剑指Offer-18.二叉树的镜像(C++/Java)
  5. php 学习笔记之关于时区的那点事
  6. mysql数据库的批量数据导入与导出,性能提升。
  7. scala java 混合编译配置
  8. pip 设置阿里云源
  9. ICP 匹配定位算法学习记录
  10. 【前端知识体系-JS相关】组件化和React