仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 961|回复: 9
打印 上一主题 下一主题

[CentOS(社区)] 来一发CentOS下Git办事器装置教程

[复制链接]
老尸 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-14 20:17:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
欢迎大家来到仓酷云论坛!装置yum源
yum-yinstallhttp://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
vim/etc/yum.repos.d/epel.repo
baseurl往失落正文
正文mirrorlist

装置git情况所需的包
yum-yinstalllibicu-develpatchgcc-c++readline-develzlib-devellibffi-developenssl-develmakeautoconfautomakelibtoolbisonlibxml2-devellibxslt-devellibyaml-develzlib-developenssl-develcpioexpat-develgettext-develcurl-develperl-ExtUtils-CBuilderperl-ExtUtils-MakeMaker

移除呆板上现有的gitruby
yum-yremovegitruby

装置git
mkdir/tmp/git&&cd/tmp/git
wgethttps://www.ckuyun.com/pub/software/scm/git/git-1.8.4.1.tar.gz
tar-zxvfgit-1.8.4.1.tar.gz
cdgit-1.8.4.1/
makeprefix=/usr/localall
makeprefix=/usr/localinstall
ln-fs/usr/local/bin/git*/usr/bin/

装置ruby
mkdir/tmp/ruby&&cd/tmp/ruby
curl--progressftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz|tarxz
cdruby-2.0.0-p353/
./configure--disable-install-rdoc
make&&makeinstall
gemsource-rhttps://rubygems.org/
gemsource-ahttp://ruby.taobao.org/
geminstallbundler--no-ri--no-rdoc
ln-s/usr/local/bin/ruby/usr/bin/ruby
ln-s/usr/local/bin/gem/usr/bin/gem
ln-s/usr/local/bin/bundle/usr/bin/bundle

新建git账号并同意sudo
useradd--commentGitLabgit
echo"gitALL=(ALL)NOPASSWD:ALL">>/etc/sudoers

装置git-shell
su-git
sudo-ugit-Hgitclonehttps://gitlab.com/gitlab-org/gitlab-shell.git-bv1.8.0
cdgitlab-shell/
sudo-ugit-Hcpconfig.yml.exampleconfig.yml
vimconfig.yml
修正gitlab域名
gitlab_url:"http://localhost/"
如:
gitlab_url:"http://gitlab.example.com/“
:wq!
sudo-ugit-H./bin/install

利用mysql并创建gitlab数据库,本机假如没有mysql间接yum装置便可
sudoyum-yinstallmysqlmysql-develmysql-server
sudo/etc/init.d/mysqldstart
mysql-uroot-p
CREATEUSERgituser@localhostIDENTIFIEDBYgitpasswd;
CREATEDATABASEIFNOTEXISTS`gitlabhq_production`DEFAULTCHARACTERSET`utf8`COLLATE`utf8_unicode_ci`;
GRANTSELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTERON`gitlabhq_production`.*TOgituser@localhost;
q

测试gituser上岸数据库是不是一般
sudo-ugit-Hmysql-ugituser-p-Dgitlabhq_production

装置redis
sudoyum-yinstallredis
sudo/etc/init.d/redisstart
sudochkconfigredison

装置gitlab
cd/home/git
sudo-ugit-Hgitclonehttps://gitlab.com/gitlab-org/gitlab-ce.git-b6-4-stablegitlab
cd/home/git/gitlab
sudo-ugit-Hcpconfig/gitlab.yml.exampleconfig/gitlab.yml
vimconfig/gitlab.yml
修正git域名,下面git-shell设置文件内里界说的
gitlab:
##Webserversettings
host:gitlab.example.com
port:80
https:false
修正gitpath
git:
bin_path:/usr/local/bin/git
:wq!

增加响应文件的权限、新建需要的文件及复制设置文件
chown-Rgitlog/
chown-Rgittmp/
chmod-Ru+rwXlog/
chmod-Ru+rwXtmp/
sudo-ugit-Hmkdir/home/git/gitlab-satellites
sudo-ugit-Hmkdirtmp/pids/
sudo-ugit-Hmkdirtmp/sockets/
sudochmod-Ru+rwXtmp/pids/
sudochmod-Ru+rwXtmp/sockets/
sudo-ugit-Hmkdirpublic/uploads
sudochmod-Ru+rwXpublic/uploads/
sudo-ugit-Hcpconfig/unicorn.rb.exampleconfig/unicorn.rb
sudo-ugit-Hcpconfig/initializers/rack_attack.rb.exampleconfig/initializers/rack_attack.rb

设置gitlab全局账号
sudo-ugit-Hgitconfig--globaluser.name"GitLab"
sudo-ugit-Hgitconfig--globaluser.email"gitlab@localhost"
sudo-ugit-Hgitconfig--globalcore.autocrlfinput

设置数据库毗连文件信息,以下是我数据库信息设置:
sudo-ugitcpconfig/database.yml.mysqlconfig/database.yml
sudo-ugit-Hvimconfig/database.yml
#
#PRODUCTION
#
production:
adapter:mysql2
encoding:utf8
reconnect:false
database:gitlabhq_production
pool:10
username:gituser
password:"gitpasswd”
#host:localhost
#socket:/tmp/mysql.sock

#
#Developmentspecific
#
development:
adapter:mysql2
encoding:utf8
reconnect:false
database:gitlabhq_development
pool:5
username:gituser
password:"gitpasswd”
#socket:/tmp/mysql.sock

#Warning:Thedatabasedefinedas"test"willbeerasedand
#re-generatedfromyourdevelopmentdatabasewhenyourun"rake".
#Donotsetthisdbtothesameasdevelopmentorproduction.
test:&test
adapter:mysql2
encoding:utf8
reconnect:false
database:gitlabhq_test
pool:5
username:gituser
password:"gitpasswd”
#socket:/tmp/mysql.sock

装置gems
cd/home/git/gitlab
vimGemfile
修正source"https://rubygems.org/"
为source"http://ruby.taobao.org/"
vimGemfile.lock
修正remote:https://rubygems.org/
为remote:http://ruby.taobao.org/
:wq
sudo-ugit-Hbundleinstall--deployment--withoutdevelopmenttestpostgresaws
如呈现此类毛病Couldnotfindmodernizr-2.6.2inanyofthesources,则修正:
vimGemfile
修正:gem"modernizr","2.6.2"
为gem"modernizr-rails","2.7.1"
:wq
vimGemfile.lock
修正:modernizr(2.6.2)
为:modernizr-rails(2.7.1)
修正:modernizr(=2.6.2)
为:modernizr-rails(=2.7.1)
:wq
再次运转:sudo-ugit-Hbundleinstall--deployment--withoutdevelopmenttestpostgresaws

初始化数据库
sudo-ugit-Hbundleexecrakegitlab:setupRAILS_ENV=production
Doyouwanttocontinue(yes/no)?yes
初始化完成后最初两行就是你gitlab默许的用户名暗码

设置启动及日记切割文件
sudocplib/support/init.d/gitlab/etc/init.d/gitlab
sudocplib/support/init.d/gitlab.default.example/etc/default/gitlab
sudocplib/support/logrotate/gitlab/etc/logrotate.d/gitlab

测试情况信息
sudo-ugit-Hbundleexecrakegitlab:env:infoRAILS_ENV=production

装置nginx
sudoyum-yinstallnginx
以下是我nginx主设置文件内容
cat/etc/nginx/nginx.conf|grep-v"^#"|grep-v"^$"
userrootgit;
worker_processes2;
pid/var/run/nginx.pid;
events{
worker_connections1024;
}
http{
include/etc/nginx/mime.types;
default_typeapplication/octet-stream;
log_formatmain$remote_addr-$remote_user[$time_local]"$request"
$status$body_bytes_sent"$http_referer"
"$http_user_agent""$http_x_forwarded_for";
upstreamgitlab{
serverunix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}
server{
listen*:80default_server;
server_namegitlab.example.com;
server_tokensoff;
root/home/git/gitlab/public;
client_max_body_size5m;
access_log/var/log/nginx/gitlab_access.log;
error_log/var/log/nginx/gitlab_error.log;
location/{
try_files$uri$uri/index.html$uri.html@gitlab;
}
location@gitlab{
proxy_read_timeout300;
proxy_connect_timeout300;
proxy_redirectoff;
proxy_set_headerX-Forwarded-Proto$scheme;
proxy_set_headerHost$http_host;
proxy_set_headerX-Real-IP$remote_addr;
proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
proxy_passhttp://gitlab;
}
}
#tcp_nopushon;
#keepalive_timeout0;
#gzipon;

#Loadconfigfilesfromthe/etc/nginx/conf.ddirectory
#Thedefaultserverisinconf.d/default.conf
}
变动权限及启动nginx
sudonginx-t
sudochown-Rgit.git/var/lib/nginx/
sudo/etc/init.d/nginxstart

拉取gitlab静态资本文件
sudo-ugit-Hbundleexecrakeassets:precompileRAILS_ENV=production

启动gitlab
sudo/etc/init.d/gitlabstart

反省各个组件是不是一般事情
sudo-ugit-Hbundleexecrakegitlab:checkRAILS_ENV=production

统统一般的话利用你的扫瞄器会见gitlab吧(域名会见,修正hosts文件先)
http://gitlab.example.com
账号暗码为下面初始化数据后显现的账号暗码
admin@local.host/5iveL!fe

到此,gitlab装置完成
欢迎大家来到仓酷云论坛!
金色的骷髅 该用户已被删除
沙发
发表于 2015-1-15 18:24:55 | 只看该作者

来一发CentOS下Git办事器装置教程

我也来顶一下..
冷月葬花魂 该用户已被删除
板凳
发表于 2015-1-19 19:30:09 | 只看该作者
安装一个新的软件时先看README,再看INSTALL然后看FAQ,最后才动手安装,这样遇到问题就知道为什么。如果Linux说明文档不看,结果出了问题再去论坛来找答案反而浪费时间。
柔情似水 该用户已被删除
地板
发表于 2015-1-28 10:11:57 | 只看该作者
我是学习嵌入式方向的,这学期就选修了这门专业任选课。
谁可相欹 该用户已被删除
5#
发表于 2015-2-5 22:30:57 | 只看该作者
这也正是有别的OS得以存在的原因,每个系统都有其自身的优点。?
只想知道 该用户已被删除
6#
发表于 2015-2-14 00:39:03 | 只看该作者
学习Linux应具备的。[书籍+网络资源]
变相怪杰 该用户已被删除
7#
发表于 2015-3-4 03:41:25 | 只看该作者
Linux?最大的优点在于其作为服务器的强大功能,同时支持多种应用程序及开发工具,所以Linux操作系统有着广泛的应用空间。
再现理想 该用户已被删除
8#
发表于 2015-3-11 16:10:14 | 只看该作者
众所周知,目前windows操作系统是主流,在以后相当长的时间内不会有太大的改变,其方便友好的图形界面吸引了众多的用户。
小妖女 该用户已被删除
9#
发表于 2015-3-19 06:09:35 | 只看该作者
这也正是有别的OS得以存在的原因,每个系统都有其自身的优点。?
简单生活 该用户已被删除
10#
发表于 2015-3-27 09:09:35 | 只看该作者
说实话小时候没想过搞IT,也计算机了解也只是一些皮毛,至于什么UNIX,Linux,听过没见过,就更别说用过了。?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-5-2 04:02

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表