1GitLab简介
GitLab时基于Git开源的代码仓库,它基于Rnby on Rails 开发,界面美观,使用方便 ,如果想在局域网搭建一个远程Git远程仓库,或许GitLab就是不错的选择。团队成员可以利用内置的简单聊天程序(Wall)进行交流。它还提供一个代码片段收集功能可以轻松实现代码复用,日后有需要的时候进行查找。
官网:安装地址https://about.gitlab.com/installation/#centos-7
2 创建vi /etc/yum.repos.d/gitlab-ce.repo 文件
[root@VM_0_3_centos gitlab]# vi /etc/yum.repos.d/gitlab-ce.repo
添加下面内容
[gitlab-ce]
name=gitlab-ce
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
3安装 yum install gitlab-ce
[root@VM_0_3_centos gitlab]# yum install gitlab-ce^C
4 查询状态可以用 gitlab-ctl tail
[root@VM_0_3_centos gitlab]# gitlab-ctl tail
如果出现下面的错误说明:1,系统内存小了,2,unicorn的端口被占用
解决:增加至少2G的内存配置 ,修改vi /etc/gitlab/gitlab.rb 添加 或修改 unicorn['port'] = 6020
[root@VM_0_3_centos gitlab]# gitlab-ctl tail
NING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
2018-09-13_06:52:31.43899 24806:M 13 Sep 14:52:31.438 # Server started, Redis version 3.2.11
2018-09-13_06:52:31.43899 24806:M 13 Sep 14:52:31.438 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
2018-09-13_06:52:31.43900 24806:M 13 Sep 14:52:31.438 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
2018-09-13_06:52:31.43901 24806:M 13 Sep 14:52:31.438 * DB loaded from disk: 0.000 seconds
2018-09-13_06:52:31.43901 24806:M 13 Sep 14:52:31.438 * The server is now ready to accept connections at /var/opt/gitlab/redis/redis.socket
==> /var/log/gitlab/gitlab-rails/api_json.log <==
# Logfile created on 2018-09-13 14:34:07 +0800 by logger.rb/56815
==> /var/log/gitlab/gitlab-rails/gitlab-rails-db-migrate-2018-09-13-14-31-01.log <==
rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:51:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => gitlab:db:configure
(See full trace by running task with --trace)
==> /var/log/gitlab/gitlab-rails/production_json.log <==
# Logfile created on 2018-09-13 14:34:07 +0800 by logger.rb/56815
==> /var/log/gitlab/gitlab-rails/gitlab--bash: [root@VM_0_3_centos: command not found
[root@VM_0_3_centos gitlab]# ==> /var/log/gitlab/gitlab-shell/gitlab-shell.log <==
-bash: ==: No such file or directory
[root@VM_0_3_centos gitlab]#
[root@VM_0_3_centos gitlab]# ==> /var/log/gitlab/redis/current <==
-bash: ==: No such file or directory
[root@VM_0_3_centos gitlab]# 2018-09-13_06:52:31.43897 `-._ `-.__.-' _.-'
-bash: -._: command not found
-bash: 2018-09-13_06:52:31.43897: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_06:52:31.43898 `-._ _.-'
> 2018-09-13_06:52:31.43899 `-.__.-'
> 2018-09-13_06:52:31.43899
> 2018-09-13_06:52:31.43899 24806:M 13 Sep 14:52:31.438 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
> 2018-09-13_06:52:31.43899 24806:M 13 Sep 14:52:31.438 # Server started, Redis version 3.2.11
> 2018-09-13_06:52:31.43899 24806:M 13 Sep 14:52:31.438 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
> 2018-09-13_06:52:31.43900 24806:M 13 Sep 14:52:31.438 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
> 2018-09-13_06:52:31.43901 24806:M 13 Sep 14:52:31.438 * DB loaded from disk: 0.000 seconds
> 2018-09-13_06:52:31.43901 24806:M 13 Sep 14:52:31.438 * The server is now ready to accept connections at /var/opt/gitlab/redis/redis.socket
>
> ==> /var/log/gitlab/gitlab-rails/api_json.log <==
> # Logfile created on 2018-09-13 14:34:07 +0800 by logger.rb/56815
>
> ==> /var/log/gitlab/gitlab-rails/gitlab-rails-db-migrate-2018-09-13-14-31-01.log <==
> rake aborted!
> PG::ConnectionBad: could not connect to server: No such file or directory
> Is the server running locally and accepting
> connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
> /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:51:in `block (3 levels) in <top (required)>'
-bash: command substitution: line 1: unexpected EOF while looking for matching `''
-bash: command substitution: line 3: syntax error: unexpected end of file
-bash: /sys/kernel/mm/transparent_hugepage/enabled as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
2018-09-13_06:52:31.43901 24806:M 13 Sep 14:52:31.438 * DB loaded from disk: 0.000 seconds
2018-09-13_06:52:31.43901 24806:M 13 Sep 14:52:31.438 * The server is now ready to accept connections at /var/opt/gitlab/redis/redis.socket
==> /var/log/gitlab/gitlab-rails/api_json.log <==
# Logfile created on 2018-09-13 14:34:07 +0800 by logger.rb/56815
==> /var/log/gitlab/gitlab-rails/gitlab-rails-db-migrate-2018-09-13-14-31-01.log <==
rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:51:in `block (3 levels) in <top (required)>: No such file or directory
[root@VM_0_3_centos gitlab]# /opt/gitlab/embedded/bin/bundle:23:in `load'
> /opt/gitlab/embedded/bin/bundle:23:in `<main>'
> Tasks: TOP => gitlab:db:configure
> (See full trace by running task with --trace)
>
> ==> /var/log/gitlab/gitlab-rails/production_json.log <==
> # Logfile created on 2018-09-13 14:34:07 +0800 by logger.rb/56815
>
> ==> /var/log/gitlab/gitlab-rails/gitlab-rails-db-migrate-2018-09-13-14-40-56.log <==
> rake aborted!
> PG::ConnectionBad: could not connect to server: No such file or directory
> Is the server running locally and accepting
> connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
> /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:51:in `block (3 levels) in <top (required)>'
-bash: command substitution: line 1: unexpected EOF while looking for matching `''
-bash: command substitution: line 3: syntax error: unexpected end of file
-bash: main: No such file or directory
--trace)
==> /var/log/gitlab/postgresql/current <==
2018-09-13_10:48:10.69888 LOG: database system is shut down
2018-09-13_10:48:11.74756 FATAL: could not map anonymous shared memory: Cannot allocate memory
2018-09-13_10:48:11.74758 HINT: This error us[root@VM_0_3_centos gitlab]# /opt/gitlab/embedded/bin/bundle:23:in `load'
> /opt/gitlab/embedded/bin/bundle:23:in `<main>'
> Tasks: TOP => gitlab:db:configure
> (See full trace by running task with --trace)
>
> ==> /var/log/gitlab/gitlab-rails/grpc.log <==
> # Logfile created on 2018-09-13 14:34:07 +0800 by logger.rb/56815
>
> ==> /var/log/gitlab/gitlab-rails/production.log <==
>
> ==> /var/log/gitlab/gitlab-rails/gitlab-rails-db-migrate-2018-09-13-14-45-50.log <==
> rake aborted!
> PG::ConnectionBad: could not connect to server: No such file or directory
> Is the server running locally and accepting
> connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
> /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:51:in `block (3 levels) in <top (required)>'
-bash: command substitution: line 1: unexpected EOF while looking for matching `''
-bash: command substitution: line 3: syntax error: unexpected end of file
-bash: main: No such file or directory
[root@VM_0_3_centos gitlab]# /opt/gitlab/embedded/bin/bundle:23:in `load'
> /opt/gitlab/embedded/bin/bundle:23:in `<main>'
> Tasks: TOP => gitlab:db:configure
> (See full trace by running task with --trace)
>
> ==> /var/log/gitlab/postgresql/current <==
> 2018-09-13_10:48:10.69888 LOG: database system is shut down
> 2018-09-13_10:48:11.74756 FATAL: could not map anonymous shared memory: Cannot allocate memory
> 2018-09-13_10:48:11.74758 HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 525615104 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
-bash: syntax error near unexpected token `('
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:11.74758 LOG: database system is shut down
-bash: 2018-09-13_10:48:11.74758: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:12.82613 FATAL: could not map anonymous shared memory: Cannot allocate memory
-bash: 2018-09-13_10:48:12.82613: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:12.82615 HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 525615104 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
-bash: 2018-09-13_10:48:12.82615: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:12.82615 LOG: database system is shut down
-bash: 2018-09-13_10:48:12.82615: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:13.98983 FATAL: could not map anonymous shared memory: Cannot allocate memory
-bash: 2018-09-13_10:48:13.98983: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:13.98984 HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 525615104 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
-bash: 2018-09-13_10:48:13.98984: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:13.98985 LOG: database system is shut down
-bash: 2018-09-13_10:48:13.98985: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:15.04171 FATAL: could not map anonymous shared memory: Cannot allocate memory
-bash: 2018-09-13_10:48:15.04171: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:15.04173 HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 525615104 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
-bash: 2018-09-13_10:48:15.04173: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:15.04173 LOG: database system is shut down
-bash: 2018-09-13_10:48:15.04173: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:16.09743 FATAL: could not map anonymous shared memory: Cannot allocate memory
-bash: 2018-09-13_10:48:16.09743: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:16.09746 HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 525615104 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
-bash: 2018-09-13_10:48:16.09746: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:16.09747 LOG: database system is shut down
-bash: 2018-09-13_10:48:16.09747: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:17.16110 FATAL: could not map anonymous shared memory: Cannot allocate memory
-bash: 2018-09-13_10:48:17.16110: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:17.16112 HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 525615104 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
-bash: 2018-09-13_10:48:17.16112: command not found
[root@VM_0_3_centos gitlab]# 2018-09-13_10:48:17.16113 LOG: database system is shut down
-bash: 2018-09-13_10:48:17.16113: command not found
5 执行重启 刷新配置
gitlab-ctl reconfigure
gitlab-ctl restart
6,地址直接访问