部署自己的gitlab服务器

本文涉及的产品
Redis 开源版,标准版 2GB
推荐场景:
搭建游戏排行榜
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 Tair(兼容Redis),内存型 2GB
简介:

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

make && make install

echo 'export PATH=/opt/soft/ruby/bin:$PATH' >> /etc/profile

source /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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
server {
         listen       8580 ;
         server_name _;
if  ($time_iso8601 ~  "^(d{4})-(d{2})-(d{2})T(d{2}):(d{2}):(d{2})" )
{
set  $year1 $ 1 ;
set  $month1 $ 2 ;
set  $day1 $ 3 ;
set  $hour1 $ 4 ;
set  $minutes1 $ 5 ;
set  $seconds1 $ 6 ;
}
access_log   / opt / log / gitlab - $year - $month - $day.log;
error_log    / opt / log / gitlab - $year - $month - $day.error;
         root         / opt / git / gitlab / public;
   
         location  /
         {
             try_files $uri $uri / index.html $uri.html @gitlab;
         }
   
         location  / uploads /
         {
             proxy_read_timeout       300 ;
             proxy_connect_timeout    300 ;
             proxy_redirect          off;
             proxy_set_header    Host                $http_host;
             proxy_set_header    X - Real - IP           $remote_addr;
             proxy_set_header    X - Forwarded - For     $proxy_add_x_forwarded_for;
             proxy_set_header    X - Forwarded - Proto   $scheme;
             proxy_set_header    X - Frame - Options     SAMEORIGIN;
             proxy_pass http: / / gitlab;
         }
   
         location @gitlab
         {
             proxy_read_timeout       300 ;
             proxy_connect_timeout    300 ;
             proxy_redirect          off;
             proxy_set_header    Host                $http_host;
             proxy_set_header    X - Real - IP           $remote_addr;
             proxy_set_header    X - Forwarded - For     $proxy_add_x_forwarded_for;
             proxy_set_header    X - Forwarded - Proto   $scheme;
             proxy_set_header    X - Frame - Options     SAMEORIGIN;
             proxy_pass http: / / gitlab;
         }
   
         location ~ [ - \ / \w\.] + \.git\ /
         {
             proxy_read_timeout       300 ;
             proxy_connect_timeout    300 ;
             proxy_redirect          off;
             proxy_buffering off;
             proxy_set_header    Host                $http_host;
             proxy_set_header    X - Real - IP           $remote_addr;
             proxy_set_header    X - Forwarded - For     $proxy_add_x_forwarded_for;
             proxy_set_header    X - Forwarded - Proto   $scheme;
             proxy_pass http: / / gitlab - git - http - server;
         }
   
         location ~ ^ / (assets) /
         {
             root  / opt / git / gitlab / public;
             #gzip_static on;
             expires  max ;
             add_header Cache - Control public;
         }
   
         error_page  502  / 502.html ;
     }
1
gitlab新建文件报错Commit was rejected by pre - receive hook
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/ home / git / gitlab / config / gitlab.yml
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host:  172.18 . 84.17
  port:  80  # Set to 443 if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
https: false  # Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
[root@solr2 git] # cat /home/git/gitlab-shell/config.yml
- - -
user: git
gitlab_url: http: / / 172.18 . 84.17 /
http_settings:
self_signed_cert: true
repos_path:  "/home/git/repositories/"
auth_file:  "/home/git/.ssh/authorized_keys"
redis:
bin "/usr/bin/redis-cli"
namespace: resque:gitlab
socket:  "/var/run/redis/redis.sock"
log_level: INFO
audit_usernames: false

or https

1
2
3
4
5
6
7
8
9
10
11
12
user: git
gitlab_url: https: / / 172.18 . 84.17 /
http_settings:
self_signed_cert: true
repos_path:  "/home/git/repositories/"
auth_file:  "/home/git/.ssh/authorized_keys"
redis:
bin "/usr/bin/redis-cli"
namespace: resque:gitlab
socket:  "/var/run/redis/redis.sock"
log_level: INFO
audit_usernames: false


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,如需转载请自行联系原作者

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore     ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库 ECS 实例和一台目标数据库 RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
相关文章
|
2天前
|
域名解析 弹性计算 应用服务中间件
使用域名访问部署在ECS上的网站
使用域名访问部署在ECS上的网站
|
14天前
|
并行计算 前端开发 异构计算
告别服务器繁忙,云上部署DeepSeek
本文以 DeepSeek-R1-Distill-Qwen-32B-FP8 为例,向您介绍如何在GPU实例上使用容器来部署量化的 DeepSeek-R1 蒸馏模型。
|
1天前
|
弹性计算 Ubuntu Linux
一键部署OpenWebUI+Ollama到阿里云ECS,轻松运行DeepSeek!(保姆级教程)
在当今数据驱动的时代,快速部署和管理大模型成为企业的关键需求。阿里云提供了一键部署OpenWebUI+Ollama的便捷方案,支持本地大模型运行和管理。用户也可以选择连接阿里云百炼的在线模型。
一键部署OpenWebUI+Ollama到阿里云ECS,轻松运行DeepSeek!(保姆级教程)
|
5天前
|
人工智能 负载均衡 数据可视化
阿里云出手了,DeepSeek服务器拒绝繁忙,免费部署DeepSeek模型671B满血版
阿里云推出免费部署DeepSeek模型671B满血版服务,通过百炼大模型平台,用户无需编码,最快5分钟、最低0元即可完成部署。平台提供100万免费Token,支持DeepSeek-R1和DeepSeek-V3等多款模型调用,有效解决服务器繁忙问题。新手零基础也能轻松上手,享受高效稳定的API调用和自动弹性扩展功能。教程涵盖开通服务、获取API-KEY及配置Chatbox客户端等步骤,详细指引助您快速实现DeepSeek自由。
72 18
|
7天前
|
人工智能 负载均衡 数据可视化
阿里云出手了,基于百炼一键部署DeepSeek满血版,告别服务器繁忙1
阿里云百炼平台推出一键部署DeepSeek-R1满血版671B模型,提供100万免费Token,无需编码,新手5分钟内即可完成部署。通过Chatbox客户端配置API,轻松实现模型调用,解决服务器繁忙问题,支持自动弹性扩展,降低硬件成本。详情及教程见阿里云百炼官网。
168 5
|
9天前
|
Kubernetes 持续交付 数据库
阿里云ACK+GitLab企业级部署实战教程
GitLab 是一个功能强大的基于 Web 的 DevOps 生命周期平台,整合了源代码管理、持续集成/持续部署(CI/CD)、项目管理等多种工具。其一体化设计使得开发团队能够在同一平台上进行代码协作、自动化构建与部署及全面的项目监控,极大提升了开发效率和项目透明度。 GitLab 的优势在于其作为一体化平台减少了工具切换,高度可定制以满足不同项目需求,并拥有活跃的开源社区和企业级功能,如高级权限管理和专业的技术支持。借助这些优势,GitLab 成为许多开发团队首选的 DevOps 工具,实现从代码编写到生产部署的全流程自动化和优化。
|
2天前
|
弹性计算 Ubuntu Docker
在ECS上使用百炼部署满血版deepseek r1
在ECS上使用百炼部署满血版deepseek r1
|
6月前
|
Shell Docker 容器
GitlabCI学习笔记之一:安装Gitlab和GitLabRunner
GitlabCI学习笔记之一:安装Gitlab和GitLabRunner
|
5月前
|
Docker 容器
Docker安装Gitlab和Gitlab-Runner并实现项目CICD
Docker安装Gitlab和Gitlab-Runner并实现项目CICD
|
7月前
|
Devops 持续交付 开发工具
入职必会-开发环境搭建54-GitLab下载和安装
GitLab 是一个基于 web 的 Git 仓库管理工具,提供了代码托管、版本控制、协作开发、持续集成等功能,是一个综合的 DevOps 平台。用户可以使用 GitLab 托管他们的代码仓库,并利用其丰富的功能来管理和协作开发项目。 以下是 GitLab 的一些主要特点和功能。
122 0
入职必会-开发环境搭建54-GitLab下载和安装

热门文章

最新文章