1. 程式人生 > >liunx安裝 GitLab(基於映象安裝)

liunx安裝 GitLab(基於映象安裝)

1GitLab簡介

  GitLab時基於Git開源的程式碼倉庫,它基於Rnby on Rails 開發,介面美觀,使用方便 ,如果想在區域網搭建一個遠端Git遠端倉庫,或許GitLab就是不錯的選擇。團隊成員可以利用內建的簡單聊天程式(Wall)進行交流。它還提供一個程式碼片段收集功能可以輕鬆實現程式碼複用,日後有需要的時候進行查詢。

2 建立vi /etc/yum.repos.d/gitlab-ce.repo 檔案

[[email protected]_0_3_centos gitlab]# vi /etc/yum.repos.d/gitlab-ce.repo 

新增下面內容

[gitlab-ce]

name=gitlab-ce

repo_gpgcheck=0

gpgcheck=0

enabled=1

3安裝 yum install gitlab-ce

[[email protected]_0_3_centos gitlab]# yum install gitlab-ce^C

4 查詢狀態可以用  gitlab-ctl tail 

[[email protected]_0_3_centos gitlab]# gitlab-ctl tail

如果出現下面的錯誤說明:1,系統記憶體小了,2,unicorn的埠被佔用

解決:增加至少2G的記憶體配置 ,修改vi /etc/gitlab/gitlab.rb            新增 或修改 unicorn['port'] = 6020

 [[email protected]_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: [
[email protected]
_0_3_centos: command not found [[email protected]_0_3_centos gitlab]# ==> /var/log/gitlab/gitlab-shell/gitlab-shell.log <== -bash: ==: No such file or directory [[email protected]_0_3_centos gitlab]# [[email protected]_0_3_centos gitlab]# ==> /var/log/gitlab/redis/current <== -bash: ==: No such file or directory [[email protected]_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 [[email protected]_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 [[email protected]_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[[email protected]_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 [[email protected]_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 `(' [[email protected]_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 [[email protected]_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 [[email protected]_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 [[email protected]_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 [[email protected]_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 [[email protected]_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 [[email protected]_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 [[email protected]_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 [[email protected]_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 [[email protected]_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 [[email protected]_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 [[email protected]_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 [[email protected]_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 [[email protected]_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 [[email protected]_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 [[email protected]_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,地址直接訪問