Ubuntu 14.04.3安装 gitlab-ce_7.10.4(web服务)

前端之家收集整理的这篇文章主要介绍了Ubuntu 14.04.3安装 gitlab-ce_7.10.4(web服务)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1:系统和软件:

  1. root@ubuntu1:/home/ubuntu1# lsb_release -a
  2. No LSB modules are available.
  3. Distributor ID: Ubuntu
  4. Description: Ubuntu 14.04.3 LTS
  5. Release: 14.04
  6. Codename: trusty

2:下载gitlab安装包:

  1. https://about.gitlab.com/downloads/archives/
注:下载相应的系统对应的版本。

3:安装需要的openssh和mail服务:

  1. sudo apt-get install openssh-server
  2. sudo apt-get install postfix
注:邮件选择:No configuration!之后自己配置!

4:安装“gitlab-ce_7.10.4~omnibus-1_amd64.deb”,[内含Ruby、Redis,Nginx和Postgresql]:

  1. sudo dpkg -i gitlab-ce_7.10.4~omnibus-1_amd64.deb

5:配置访问域名端口和邮箱:

  1. sudo vim /etc/gitlab/gitlab.rb
  2.  
  3. #unicorn端口冲突--配置9090,默认8080!
  4. unicorn['port'] = 9090
  5. #配置gitlab的域名或ip和端口或域名(外网)
  6. # external_url 'http://192.168.1.110:8080'
  7. external_url 'http://git.loveshare.me'
  8. #配置邮件
  9. gitlab_rails['smtp_enable'] = true
  10. gitlab_rails['smtp_address'] = "eg.smtp.163.com"
  11. gitlab_rails['smtp_port'] =25
  12. gitlab_rails['smtp_user_name'] = "your email"
  13. gitlab_rails['smtp_password'] = "your passwd"
  14. gitlab_rails['smtp_domain'] = "eg.smtp.163.com"
  15. gitlab_rails['smtp_authentication'] = :login
  16. gitlab_rails['smtp_enable_starttls_auto'] = true
  17. #163邮箱,修改gitlab配置的发信人
  18. gitlab_rails['gitlab_email_from'] = "your email"
  19. user["git_user_email"] = "your email"
注:若Nginx有权限问题问题则将Nginx.conf中启动用户修改成root.

6:GitLab进行重加载gitlab.rb配置启动:

  1. sudo gitlab-ctl reconfigure

7:检测GitLab状态:

  1. sudo gitlab-ctl status
  2. run: logrotate: (pid 16722) 2161s; run: log: (pid 3316) 45362s
  3. run: Nginx: (pid 3297) 45364s; run: log: (pid 3296) 45364s
  4. run: postgresql: (pid 3180) 45383s; run: log: (pid 3179) 45383s
  5. run: redis: (pid 3081) 45389s; run: log: (pid 3080) 45389s
  6. run: sidekiq: (pid 3272) 45370s; run: log: (pid 3271) 45370s
  7. run: unicorn: (pid 3244) 45372s; run: log: (pid 3243) 45372s

注:若状态都为down,则使用,启动:

  1. sudo gitlab-ctl start
  2. ok: run: logrotate: (pid 14246) 1s
  3. ok: run: Nginx: (pid 14249) 0s
  4. ok: run: postgresql: (pid 14257) 0s
  5. ok: run: redis: (pid 14265) 1s
  6. ok: run: sidekiq: (pid 14269) 0s
  7. ok: run: unicorn: (pid 14273) 1s

8:检查GitLab的日志:

  1. sudo gitlab-ctl tail

9:请求git的web版:http://192.168.1.110:8080/

由于GitLab包自带了Ruby、Redis,Nginx和Postgresql,所以也就不需要考虑太多兼容性的问题。

直接Web登录GitLab所在的服务器,并使用帐号root,密码5iveL!fe来登录GitLab{此密码为默认}。

首次登录GitLab会强行让你重置密码,然后就可以进入GitLab了。

10:停止服务

  1. sudo gitlab-ctl stop
  2. ok: down: logrotate: 0s,normally up
  3. ok: down: Nginx: 1s,normally up
  4. ok: down: postgresql: 0s,normally up
  5. ok: down: redis: 1s,normally up
  6. ok: down: sidekiq: 0s,normally up
  7. ok: down: unicorn: 1s,normally up

11.使用Nginx代理域名gitlab外网访问:

  1. # gitlab配置(192.168.1.230)
  2. sudo vim /etc/gitlab/gitlab.rb
  3.  
  4. external_url 'http://git.loveshare.me'
  5. # Nginx配置
  6. server {
  7. listen 80;
  8. server_name git.loveshare.me;
  9. proxy_redirect off;
  10. location / {
  11. proxy_set_header Host $host;
  12. proxy_set_header X-Real-IP $remote_addr;
  13. proxy_set_header REMOTE_HOST $server_name;
  14. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  15. proxy_pass http://192.168.1.230:80;
  16. }
  17. error_page 500 502 503 504 /50x.html;
  18. location = /50x.html {
  19. root html;
  20. }
  21. }

问题1:注:错误码对应解释网易服务器smtp机器要求身份验证帐号和发信帐号必须一致,如果用户发送邮件时,身份验证帐号和发件人帐号是不同的,因此拒绝发送。修改gitlab.rb,修改发信人和身份验证帐号一致,163发信OK。

问题2:Nginx默认监听80端口,unicorn默认监听8080端口,如使用此两个端口请修改配置!

日志附件:

  1. 1
  2.  
  3. root@dubbo:/home/install# sudo dpkg -i gitlab-ce_7.10.4~omnibus-1_amd64.deb
  4. Selecting prevIoUsly unselected package gitlab-ce.
  5. (Reading database ... 56801 files and directories currently installed.)
  6. Preparing to unpack gitlab-ce_7.10.4~omnibus-1_amd64.deb ...
  7. Unpacking gitlab-ce (7.10.4~omnibus-1) ...
  8. Setting up gitlab-ce (7.10.4~omnibus-1) ...
  9. dpkg-query: package 'gitlab' is not installed
  10. Use dpkg --info (= dpkg-deb --info) to examine archive files,
  11. and dpkg --contents (= dpkg-deb --contents) to list their contents.
  12. gitlab: Thank you for installing GitLab!
  13. gitlab: Configure and start GitLab by running the following command:
  14. gitlab:
  15. gitlab: sudo gitlab-ctl reconfigure
  16. gitlab:
  17. gitlab: GitLab should be reachable at http://dubbo
  18. gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
  19. gitlab: And running reconfigure again.
  20. gitlab:
  21. gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme
  22. gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
  23. gitlab:
  24. It looks like GitLab has not been installed yet; skipping the upgrade script.
  25.  
  26. 2
  27.  
  28. root@dubbo:/home/dubbo# netstat -tunlp
  29. Active Internet connections (only servers)
  30. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
  31. tcp 0 0 127.0.0.1:32000 0.0.0.0:* LISTEN 2334/java
  32. tcp 0 0 127.0.0.1:9090 0.0.0.0:* LISTEN 14288/config.ru
  33. tcp 0 0 0.0.0.0:8500 0.0.0.0:* LISTEN 14249/Nginx
  34. tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 958/sshd
  35. tcp 0 0 127.0.0.1:48350 0.0.0.0:* LISTEN 14265/redis-server
  36. tcp6 0 0 :::22 :::* LISTEN 958/sshd
  37.  
  38. 3
  39.  
  40. root@dubbo:/home/dubbo# ps -ef | grep gitlab
  41. root 894 1 0 Jul11 ? 00:00:15 runsvdir -P /opt/gitlab/service log: ...........................................................................................................................................................................................................................................................................................................................................................................................................
  42. root 906 902 0 Jul11 ? 00:00:00 svlogd -tt /var/log/gitlab/sidekiq
  43. root 908 901 0 Jul11 ? 00:00:00 svlogd -tt /var/log/gitlab/Nginx
  44. root 910 899 0 Jul11 ? 00:00:00 svlogd -tt /var/log/gitlab/unicorn
  45. root 911 898 0 Jul11 ? 00:00:02 svlogd -tt /var/log/gitlab/redis
  46. root 915 903 0 Jul11 ? 00:00:00 svlogd -tt /var/log/gitlab/logrotate
  47. root 917 900 0 Jul11 ? 00:00:00 svlogd -tt /var/log/gitlab/postgresql
  48. root 14249 901 0 18:27 ? 00:00:00 Nginx: master process /opt/gitlab/embedded/sbin/Nginx -p /var/opt/gitlab/Nginx
  49. gitlab-+ 14250 14249 0 18:27 ? 00:00:00 Nginx: worker process
  50. gitlab-+ 14251 14249 0 18:27 ? 00:00:00 Nginx: worker process
  51. gitlab-+ 14252 14249 0 18:27 ? 00:00:00 Nginx: worker process
  52. gitlab-+ 14253 14249 0 18:27 ? 00:00:00 Nginx: worker process
  53. gitlab-+ 14254 14249 0 18:27 ? 00:00:00 Nginx: worker process
  54. gitlab-+ 14255 14249 0 18:27 ? 00:00:00 Nginx: worker process
  55. gitlab-+ 14257 900 0 18:27 ? 00:00:00 /opt/gitlab/embedded/bin/postgres -D /var/opt/gitlab/postgresql/data
  56. gitlab-+ 14259 14257 0 18:27 ? 00:00:00 postgres: checkpointer process
  57. gitlab-+ 14260 14257 0 18:27 ? 00:00:00 postgres: writer process
  58. gitlab-+ 14261 14257 0 18:27 ? 00:00:00 postgres: wal writer process
  59. gitlab-+ 14262 14257 0 18:27 ? 00:00:00 postgres: autovacuum launcher process
  60. gitlab-+ 14263 14257 0 18:27 ? 00:00:00 postgres: stats collector process
  61. gitlab-+ 14265 898 0 18:27 ? 00:00:01 /opt/gitlab/embedded/bin/redis-server 127.0.0.1:0
  62. git 14269 902 0 18:27 ? 00:00:12 sidekiq 3.3.0 gitlab-rails [0 of 25 busy]
  63. git 14288 1 0 18:27 ? 00:00:08 unicorn master -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
  64. git 14349 14288 0 18:27 ? 00:00:00 unicorn worker[0] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
  65. git 14352 14288 0 18:27 ? 00:00:00 unicorn worker[1] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
  66. git 14355 14288 0 18:27 ? 00:00:00 unicorn worker[2] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
  67. git 14358 14288 0 18:27 ? 00:00:00 unicorn worker[3] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
  68. git 14361 14288 0 18:27 ? 00:00:00 unicorn worker[4] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
  69. git 14364 14288 0 18:27 ? 00:00:00 unicorn worker[5] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
  70. git 14367 14288 0 18:27 ? 00:00:00 unicorn worker[6] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
  71. gitlab-+ 14377 14257 0 18:27 ? 00:00:00 postgres: gitlab gitlabhq_production [local] idle
  72. gitlab-+ 14382 14257 0 18:27 ? 00:00:00 postgres: gitlab gitlabhq_production [local] idle
  73. gitlab-+ 14385 14257 0 18:27 ? 00:00:00 postgres: gitlab gitlabhq_production [local] idle
  74. gitlab-+ 14554 14257 0 18:28 ? 00:00:00 postgres: gitlab gitlabhq_production [local] idle
  75. gitlab-+ 14753 14257 0 18:30 ? 00:00:00 postgres: gitlab gitlabhq_production [local] idle
  76. root 16860 11942 0 19:05 pts/0 00:00:00 grep --color=auto gitlab

猜你在找的Ubuntu相关文章