1.
yum install gcc* libicu* -y
yum install mysql-devel -y
yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker -y
yum install gettext-devel -y
yum install curl-devel -y
mkdir -p /opt/src /opt/soft
cd /opt/src
tar xf git-2.6.2.tar.xz
cd git-2.6.2
./configure --prefix=/opt/soft/git --with-curl --with-expat
make && make install
echo 'export PATH=/opt/soft/git/bin:$PATH' >> /etc/profile
source /etc/profile
git --version
git clone https://github.com/gitlabhq/gitlab-shell.git gitlab-shell
還有redis改bind ip
2.yum install mysql mysql-server mysql-devel -y
3.
tar xf ruby-2.2.3.tar.gz
cd ruby-2.2.3
./configure --prefix=/opt/soft/ruby --disable-install-rdoc
echo 'export PATH=/opt/soft/ruby/bin:$PATH' >> /etc/profile
4.
gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/
gem install bundler --no-ri --no-rdoc
5.
tar zxf node-v4.2.2-linux-x64.tar.gz
mv node-v4.2.2-linux-x64 /opt/soft/nodejs
echo 'export PATH=/opt/soft/nodejs/bin:$PATH' >> /etc/profile
6.
tar xf go1.5.1.linux-amd64.tar
mv go /opt/soft/
echo 'export GOROOT=/opt/soft/go' >> /etc/profile
echo 'export GOARCH=amd64' >> /etc/profile
echo 'export GOOS=linux' >> /etc/profile
echo 'export GOBIN=$GOROOT/bin' >> /etc/profile
echo 'export GOPATH=/opt/soft/go/code/go' >> /etc/profile
echo 'export PATH=$GOBIN:$PATH' >> /etc/profile
7.
create database gitlab;
grant all privileges on gitlab.* to gitlab@'localhost' identified by 'gitlab';
8.
useradd -d /opt/git git
chmod 755 /opt/git
su - git
git clone https://gitlab.com/larryli/gitlab.git -b 8-0-zh gitlab
cd gitlab/
cp config/gitlab.yml.example config/gitlab.yml
cp config/secrets.yml.example config/secrets.yml
cp config/unicorn.rb.example config/unicorn.rb
cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
cp config/resque.yml.example config/resque.yml
cp config/database.yml.mysql config/database.yml
mkdir /opt/git/gitlab-satellites/
9.修改配置檔案,因為預設是在 git 賬号下的 home 目錄,我們這裡是在 /opt/git
mkdir -p /opt/git/gitlab-satellites /opt/git/gitlab-shell /opt/git/repositories /opt/git/gitlab-shell/hooks/
10.
redis://192.168.1.100:6379
11.bundle exec rake gitlab:shell:install[v2.6.6] REDIS_URL=redis://192.168.1.100:6379
bundle exec rake gitlab:shell:install[v2.6.6] REDIS_URL=redis://192.168.1.100:6379 RAILS_ENV=production
bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=lansgg123
<code>server {</code>
<code> </code><code>listen </code><code>8580</code><code>;</code>
<code> </code><code>server_name _;</code>
<code>if</code> <code>($time_iso8601 ~ </code><code>"^(d{4})-(d{2})-(d{2})T(d{2}):(d{2}):(d{2})"</code><code>)</code>
<code>{</code>
<code>set</code> <code>$year1 $</code><code>1</code><code>;</code>
<code>set</code> <code>$month1 $</code><code>2</code><code>;</code>
<code>set</code> <code>$day1 $</code><code>3</code><code>;</code>
<code>set</code> <code>$hour1 $</code><code>4</code><code>;</code>
<code>set</code> <code>$minutes1 $</code><code>5</code><code>;</code>
<code>set</code> <code>$seconds1 $</code><code>6</code><code>;</code>
<code>}</code>
<code>access_log </code><code>/</code><code>opt</code><code>/</code><code>log</code><code>/</code><code>gitlab</code><code>-</code><code>$year</code><code>-</code><code>$month</code><code>-</code><code>$day.log;</code>
<code>error_log </code><code>/</code><code>opt</code><code>/</code><code>log</code><code>/</code><code>gitlab</code><code>-</code><code>$year</code><code>-</code><code>$month</code><code>-</code><code>$day.error;</code>
<code> </code><code>root </code><code>/</code><code>opt</code><code>/</code><code>git</code><code>/</code><code>gitlab</code><code>/</code><code>public;</code>
<code> </code>
<code> </code><code>location </code><code>/</code>
<code> </code><code>{</code>
<code> </code><code>try_files $uri $uri</code><code>/</code><code>index.html $uri.html @gitlab;</code>
<code> </code><code>}</code>
<code> </code><code>location </code><code>/</code><code>uploads</code><code>/</code>
<code> </code><code>proxy_read_timeout </code><code>300</code><code>;</code>
<code> </code><code>proxy_connect_timeout </code><code>300</code><code>;</code>
<code> </code><code>proxy_redirect off;</code>
<code> </code><code>proxy_set_header Host $http_host;</code>
<code> </code><code>proxy_set_header X</code><code>-</code><code>Real</code><code>-</code><code>IP $remote_addr;</code>
<code> </code><code>proxy_set_header X</code><code>-</code><code>Forwarded</code><code>-</code><code>For $proxy_add_x_forwarded_for;</code>
<code> </code><code>proxy_set_header X</code><code>-</code><code>Forwarded</code><code>-</code><code>Proto $scheme;</code>
<code> </code><code>proxy_set_header X</code><code>-</code><code>Frame</code><code>-</code><code>Options SAMEORIGIN;</code>
<code> </code><code>proxy_pass http:</code><code>/</code><code>/</code><code>gitlab;</code>
<code> </code><code>location @gitlab</code>
<code> </code><code>location ~ [</code><code>-</code><code>\</code><code>/</code><code>\w\.]</code><code>+</code><code>\.git\</code><code>/</code>
<code> </code><code>proxy_buffering off;</code>
<code> </code><code>proxy_pass http:</code><code>/</code><code>/</code><code>gitlab</code><code>-</code><code>git</code><code>-</code><code>http</code><code>-</code><code>server;</code>
<code> </code><code>location ~ ^</code><code>/</code><code>(assets)</code><code>/</code>
<code> </code><code>root </code><code>/</code><code>opt</code><code>/</code><code>git</code><code>/</code><code>gitlab</code><code>/</code><code>public;</code>
<code> </code><code>#gzip_static on;</code>
<code> </code><code>expires </code><code>max</code><code>;</code>
<code> </code><code>add_header Cache</code><code>-</code><code>Control public;</code>
<code> </code><code>error_page </code><code>502</code> <code>/</code><code>502.html</code><code>;</code>
<code> </code><code>}</code>
<code>gitlab建立檔案報錯Commit was rejected by pre</code><code>-</code><code>receive hook</code>
<code>/</code><code>home</code><code>/</code><code>git</code><code>/</code><code>gitlab</code><code>/</code><code>config</code><code>/</code><code>gitlab.yml</code>
<code>gitlab:</code>
<code>## Web server settings (note: host is the FQDN, do not include http://)</code>
<code>host: </code><code>172.18</code><code>.</code><code>84.17</code>
<code> </code><code>port: </code><code>80</code> <code># Set to 443 if using HTTPS, see installation.md#using-https for additional HTTPS configuration details</code>
<code>https: false </code><code># Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details</code>
<code>[root@solr2 git]</code><code># cat /home/git/gitlab-shell/config.yml</code>
<code>-</code><code>-</code><code>-</code>
<code>user: git</code>
<code>gitlab_url: http:</code><code>/</code><code>/</code><code>172.18</code><code>.</code><code>84.17</code><code>/</code>
<code>http_settings:</code>
<code>self_signed_cert: true</code>
<code>repos_path: </code><code>"/home/git/repositories/"</code>
<code>auth_file: </code><code>"/home/git/.ssh/authorized_keys"</code>
<code>redis:</code>
<code>bin</code><code>: </code><code>"/usr/bin/redis-cli"</code>
<code>namespace: resque:gitlab</code>
<code>socket: </code><code>"/var/run/redis/redis.sock"</code>
<code>log_level: INFO</code>
<code>audit_usernames: false</code>
or https
<code>gitlab_url: https:</code><code>/</code><code>/</code><code>172.18</code><code>.</code><code>84.17</code><code>/</code>
cat /etc/profile
export JAVA_HOME=/usr/java/jdk
export JRE_HOME=/usr/java/jdk/jre
exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export PATH=/root/shell:$JAVA_HOME/bin:$PATH
export ANDROID_SDK_HOME=/usr/java/android-sdk-linux
export GRADLE_HOME=/usr/java/gradle-3.3
export MAVEN_HOME=/usr/java/apache-maven-3.3.9
export PATH=/usr/local/apr/bin:$MAVEN_HOME/bin:$PATH
export PATH=$ANDROID_SDK_HOME/tools:$ANDROID_SDK_HOME/platform-tools:$GRADLE_HOME/bin:/usr/local/apr/bin:/usr/java/apache-maven-3.3.9/bin:/root/shell:/usr/java/jdk/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/git/bin
export MAVEN_OPTS="-Xms1024m -Xmx1024m"
本文轉自 liqius 51CTO部落格,原文連結:http://blog.51cto.com/szgb17/1956912,如需轉載請自行聯系原作者