gitlab在线部署

友情提示

gitlab下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.11.8-ce.0.el7.x86_64.rpm(清华大学开源软件镜像站)

1:下载gitlab

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.11.8-ce.0.el7.x86_64.rpm

2:安装gitlab

rpm -ivh gitlab-ce-11.11.8-ce.0.el7.x86_64.rpm

3:编辑/etc/gitlab/gitlab.rb修改gitlab配置

external_url 'http://192.168.109.130'

4:邮箱配置

gitlab_rails['smtp_enable']= true
gitlab_rails['smtp_address']="smtp.qq.com"              #根据邮箱更改
gitlab_rails['smtp_port']= 465                          #根据邮箱更改
gitlab_rails['smtp_user_name']="XXXXXXXX@qq.com"        #根据邮箱更改
gitlab_rails['smtp_password']= "XXXXXXXXXX"             #邮箱认证码
gitlab_rails['smtp_domain']= "qq.com"                   #根据邮箱更改
gitlab_rails['smtp_authentication']= :login
gitlab_rails['smtp_enable_starttls_auto']= true
gitlab_rails['smtp_tls']= true
gitlab_rails['gitlab_email_from']="XXXXXXX@qq.com"      #根据邮箱更改
user["git_user_email"]="XXXXXXXXX@qq.com"               #根据邮箱更改

5:gitlab生效配置文件

gitlab-ctl reconfigure

6:重启gitlab

gitlab-ctl restart

7:查看gitlab进程

ps aux |grep gitlab
root       4327  0.0  0.0   4380   168 ?        Ss   Aug21   0:04 runsvdir -P /opt/gitlab/service log: ...........................................................................................................................................................................................................................................................................................................................................................................................................
gitlab-+   4387  4.7  0.1  41528  4356 ?        Ssl  Aug21  43:41 /opt/gitlab/embedded/bin/redis-server 127.0.0.1:0
root       4405  0.0  0.0   4372   380 ?        S    Aug21   0:00 svlogd -tt /var/log/gitlab/redis
root       4522  0.0  0.0   4372   240 ?        S    Aug21   0:00 svlogd -tt /var/log/gitlab/gitaly
gitlab-+   4751  0.0  0.9 1054548 38040 ?       Ss   Aug21   0:04 /opt/gitlab/embedded/bin/postgres -D /var/opt/gitlab/postgresql/data
gitlab-+   4753  0.0  0.4 1054788 17264 ?       Ss   Aug21   0:02 postgres: checkpointer process   
gitlab-+   4754  0.0  0.2 1054548 8048 ?        Ss   Aug21   0:04 postgres: writer process   
gitlab-+   4755  0.0  0.3 1054548 11828 ?       Ss   Aug21   0:04 postgres: wal writer process   
gitlab-+   4756  0.0  0.0 1055152 1316 ?        Ss   Aug21   0:08 postgres: autovacuum launcher process   
gitlab-+   4757  0.0  0.0  32860  1000 ?        Ss   Aug21   0:25 postgres: stats collector process   
root       4806  0.0  0.0   4372   176 ?        S    Aug21   0:00 svlogd -tt /var/log/gitlab/postgresql
git        5110  0.1  0.0  11688   796 ?        Ss   Aug21   1:09 /bin/bash /opt/gitlab/embedded/bin/gitlab-unicorn-wrapper
root       5136  0.0  0.0   4372   268 ?        S    Aug21   0:00 svlogd -tt /var/log/gitlab/unicorn
git        5143  0.1  2.7 703256 106632 ?       Sl   Aug21   1:01 unicorn master -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git        5194  3.5 11.9 1156456 460652 ?      Ssl  Aug21  32:48 sidekiq 5.2.7 gitlab-rails [0 of 25 busy]
root       5215  0.0  0.0   4372   368 ?        S    Aug21   0:00 svlogd -tt /var/log/gitlab/sidekiq
root       5268  0.0  0.0   4228    24 ?        Ss   Aug21   0:00 runsv gitlab-workhorse
root       5329  0.0  0.0   4372   248 ?        S    Aug21   0:00 svlogd -tt /var/log/gitlab/gitlab-workhorse
root       5358  0.0  0.0  39384   644 ?        Ss   Aug21   0:00 nginx: master process /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx
gitlab-+   5359  0.0  0.0  46048  1340 ?        S    Aug21   0:00 nginx: worker process
gitlab-+   5360  0.0  0.0  45936   892 ?        S    Aug21   0:01 nginx: worker process
gitlab-+   5361  0.0  0.0  46020  1388 ?        S    Aug21   0:02 nginx: worker process
gitlab-+   5362  0.0  0.0  46044  1176 ?        S    Aug21   0:02 nginx: worker process
gitlab-+   5363  0.0  0.0  41612   544 ?        S    Aug21   0:02 nginx: cache manager process
root       5382  0.0  0.0   4372   164 ?        S    Aug21   0:00 svlogd -tt /var/log/gitlab/nginx
root       5440  0.0  0.0   4372   164 ?        S    Aug21   0:00 svlogd -tt /var/log/gitlab/logrotate
root       5528  0.0  0.0   4372   232 ?        S    Aug21   0:00 svlogd -tt /var/log/gitlab/node-exporter
root       5588  0.0  0.0   4228    48 ?        Ss   Aug21   0:00 runsv gitlab-monitor
root       5603  0.0  0.0   4372   260 ?        S    Aug21   0:00 svlogd -tt /var/log/gitlab/gitlab-monitor
root       5669  0.0  0.0   4372   256 ?        S    Aug21   0:00 svlogd -tt /var/log/gitlab/redis-exporter
root       5797  0.0  0.0   4372   232 ?        S    Aug21   0:00 svlogd -tt /var/log/gitlab/prometheus
git        5832  0.3 11.2 1041112 434608 ?      Sl   Aug21   2:57 unicorn worker[0] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git        5838  0.3 10.6 1035988 411964 ?      Sl   Aug21   3:16 unicorn worker[1] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git        5841  0.3 11.1 1023700 431864 ?      Sl   Aug21   3:03 unicorn worker[2] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git        5847  0.3 11.3 1023700 438324 ?      Sl   Aug21   3:12 unicorn worker[3] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git        5850  0.3 10.9 925396 421488 ?       Sl   Aug21   2:56 unicorn worker[4] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
root       5930  0.0  0.0   4372   272 ?        S    Aug21   0:00 svlogd -tt /var/log/gitlab/alertmanager
gitlab-+   6011  0.0  0.3 1164288 13924 ?       Ss   Aug21   0:02 postgres: gitlab gitlabhq_production [local] idle
root       6023  0.0  0.0   4372   316 ?        S    Aug21   0:00 svlogd -tt /var/log/gitlab/postgres-exporter
gitlab-+   6107  0.0  0.4 1167088 15668 ?       Ss   Aug21   0:03 postgres: gitlab gitlabhq_production [local] idle
git        6109  0.1  0.1 396588  4148 ?        Ssl  Aug21   1:17 /opt/gitlab/embedded/bin/gitaly-wrapper /opt/gitlab/embedded/bin/gitaly /var/opt/gitlab/gitaly/config.toml
git        6117  0.9  0.6 762296 25476 ?        Sl   Aug21   8:33 /opt/gitlab/embedded/bin/gitaly /var/opt/gitlab/gitaly/config.toml
git        6145  0.1  0.3 578664 13200 ?        Ssl  Aug21   1:11 /opt/gitlab/embedded/bin/gitlab-workhorse -listenNetwork unix -listenUmask 0 -listenAddr /var/opt/gitlab/gitlab-workhorse/socket -authBackend http://localhost:8080 -authSocket /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket -documentRoot /opt/gitlab/embedded/service/gitlab-rails/public -pprofListenAddr  -prometheusListenAddr localhost:9229 -secretPath /opt/gitlab/embedded/service/gitlab-rails/.gitlab_workhorse_secret -config config.toml
gitlab-+   6160  0.4  0.3 114776 12500 ?        Ssl  Aug21   4:33 /opt/gitlab/embedded/bin/node_exporter --web.listen-address=localhost:9100 --collector.mountstats --collector.runit --collector.runit.servicedir=/opt/gitlab/sv --collector.textfile.directory=/var/opt/gitlab/node-exporter/textfile_collector
git        6167  2.8  0.8 2454236 34240 ?       Sl   Aug21  26:01 ruby /opt/gitlab/embedded/service/gitaly-ruby/bin/gitaly-ruby 6117 /tmp/gitaly-ruby368174194/socket.0
git        6169  2.8  1.4 2457712 54264 ?       Sl   Aug21  25:45 ruby /opt/gitlab/embedded/service/gitaly-ruby/bin/gitaly-ruby 6117 /tmp/gitaly-ruby368174194/socket.1
git        6185  3.8  0.8 516208 31552 ?        Ssl  Aug21  35:25 puma 3.12.0 (tcp://localhost:9168) [gitlab-monitor]
gitlab-+   6195  0.2  0.3 493196 12492 ?        Ssl  Aug21   2:20 /opt/gitlab/embedded/bin/redis_exporter --web.listen-address=localhost:9121 --redis.addr=unix:///var/opt/gitlab/redis/redis.socket
gitlab-+   6212  1.7  3.1 1221704 122776 ?      Ssl  Aug21  15:49 /opt/gitlab/embedded/bin/prometheus --web.listen-address=localhost:9090 --storage.tsdb.path=/var/opt/gitlab/prometheus/data --config.file=/var/opt/gitlab/prometheus/prometheus.yml
gitlab-+   6283  1.0  0.1 731836  7500 ?        Ssl  Aug21   9:27 /opt/gitlab/embedded/bin/alertmanager --web.listen-address=localhost:9093 --storage.path=/var/opt/gitlab/alertmanager/data --config.file=/var/opt/gitla/alertmanager/alertmanager.yml
gitlab-+   6341  0.3  0.2 334276  8840 ?        Ssl  Aug21   3:16 /opt/gitlab/embedded/bin/postgres_exporter --web.listen-address=localhost:9187 --extend.query-path=/var/opt/gitlab/postgres-exporter/queries.yaml
gitlab-+   6347  0.2  0.2 1160592 7948 ?        Ss   Aug21   2:00 postgres: gitlab-psql postgres [local] idle
gitlab-+   6358  0.1  0.2 1161472 9704 ?        Ss   Aug21   1:45 postgres: gitlab gitlabhq_production [local] idle
gitlab-+   6359  0.0  0.1 1159756 6328 ?        Ss   Aug21   0:37 postgres: gitlab gitlabhq_production [local] idle
gitlab-+   6360  0.1  0.1 1160180 7052 ?        Ss   Aug21   1:21 postgres: gitlab gitlabhq_production [local] idle
gitlab-+   6481  0.0  0.3 1165528 14632 ?       Ss   Aug21   0:02 postgres: gitlab gitlabhq_production [local] idle
gitlab-+   7176  0.0  0.3 1162200 12928 ?       Ss   Aug21   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+   7311  0.0  0.4 1165600 15468 ?       Ss   Aug21   0:02 postgres: gitlab gitlabhq_production [local] idle
gitlab-+   7314  0.0  0.4 1167760 16424 ?       Ss   Aug21   0:02 postgres: gitlab gitlabhq_production [local] idle
gitlab-+   9774  0.0  0.3 1161740 13376 ?       Ss   Aug21   0:01 postgres: gitlab gitlabhq_production [local] idle
gitlab-+   9776  0.0  0.4 1165696 16224 ?       Ss   Aug21   0:01 postgres: gitlab gitlabhq_production [local] idle
gitlab-+  31236  0.0  0.3 1164988 14640 ?       Ss   Aug21   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+  77502  0.0  0.3 1161688 12896 ?       Ss   Aug21   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+  77524  0.0  0.4 1168000 18336 ?       Ss   Aug21   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+  77525  0.0  0.3 1166728 15044 ?       Ss   Aug21   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+  77531  0.0  0.3 1162392 14684 ?       Ss   Aug21   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+ 100312  0.0  0.2 1160152 10736 ?       Ss   Aug21   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+ 100313  0.0  0.2 1160344 10760 ?       Ss   Aug21   0:00 postgres: gitlab gitlabhq_production [local] idle
root     126023  0.0  0.0  11680  1456 ?        Ss   Aug21   0:00 /bin/sh /opt/gitlab/embedded/bin/gitlab-logrotate-wrapper
root     129337  0.0  0.0 112708   972 pts/1    S+   00:01   0:00 grep --color=auto gitlab

8:目录介绍

/etc/gitlab         #配置文件路径
/run/gitlab         #运行PID目录
/opt/gitlab         #安装目录
/var/opt/gitlab     #数据目录
/var/log/gitlab     #日志目录

9:gitlab常用命令

git config --global user.name "Administrator"    #设置全局用户名
git config --global user.email "admin@example.com"   #设置全局邮箱
git config --global --list  #列出全局用户设置
git clone http://192.168.109.130/test_dev/test1_mo.git  #clone项目到本地
git add README.md  #指定添加文件(目录)或当前目录下所有数据到暂存区
git commit -m "add README"  #提交文件到本地工作区(本地仓库)
git status   #查看本地工作区和暂存区的状态
git push -u origin master  #提交代码到服务器
git pull #从gitlab更新代码到本地
git log #查看操作日志
git reflog  #获取每次提交的ID,可以使用--hard根据提交的ID进行版本回滚
git reset --hard XXXXX #回退到指定ID的版本
git branch  #查看当前所处的分支
git checkout -b develop #创建并切换到一个新分支
git checkout develop  #切换分支

  • 12
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
GitLab私有部署是指将GitLab这个开源的源码控制系统设置在一个组织内部的服务器上,以便控制访问权限并保护代码库的安全。以下是私有GitLab部署的基本步骤: 1. **硬件准备**:选择一台适合的服务器,确保它有足够的存储空间、处理能力以及网络带宽。 2. **安装系统**:在服务器上安装操作系统,如Ubuntu或CentOS,并更新到最新版本。 3. **安装依赖**:安装必要的软件包,如Apache或Nginx作为Web服务器,PostgreSQL或MySQL作为数据库服务器。 4. **下载GitLab安装包**:从GitLab官方网站下载适用于您的操作系统的二进制包。 5. **配置环境变量**:设置环境变量,包括gitlab_rails['db_adapter']、gitlab_rails['db_name']等,根据实际数据库信息配置。 6. **初始化数据库**:按照指示创建GitLab所需的数据库结构。 7. **配置文件**:编辑GitLab的配置文件(通常为`/etc/gitlab/gitlab.rb`),设置监听地址、SSL证书、SMTP邮件服务器等。 8. **启动服务**:完成配置后,通过命令行启动GitLab服务,例如运行`sudo gitlab-ctl reconfigure`。 9. **安全设置**:设置用户认证机制,可能是基于自定义的LDAP、内置的devise,或者添加防火墙规则限制外部访问。 10. **访问验证**:在Web浏览器中输入服务器地址和端口(默认是HTTP://your-server.com:8080 或 HTTPS://your-server.com:443)验证能否正常访问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值