gitlab的配置文件|怎么配置gitlab gitlab

❶ gitlab怎么配置ldaps

、ldap安装 2、gitlab安装 3、gitlab修改配置vim /srv/gitlab/config/gitlab.rbgitlab_rails['ldap_enabled'] = truegitlab_rails['ldap_servers'] = YAML.load <<-'EOS'main: # 'main' is the GitLab 'provider ID' of this LDAP serverlabel: 'LDAP'host: '10.7.30.63'port: 389uid: 'cn'bind_dn: 'cn=Manager,dc=xinhua,dc=org'password: '111111'encryption: 'plain' # "start_tls" or "simple_tls" or "plain"verify_certificates: trueactive_directory: trueallow_username_or_email_login: truelowercase_usernames: falseblock_auto_created_users: falsebase: 'cn=Manager,dc=xinhua,dc=org'user_filter: ''attributes:username: ['uid', 'userid', 'sAMAccountName']email: ['mail', 'email', 'userPrincipalName']name: 'cn'first_name: 'givenName'last_name: 'sn'EOS

❷ 如何用gitlab 做配置管理

进入JENKINS_HOME目录,找到config.xml文件,找到了和节点。节点代表是否使用用户权限,节点代表用户权限是怎么划分的。下面提供2种方法:1、恢复默认设置直接删除和节点 2、配置管理员权限这种方法适用于已经存在一堆的权限,重新配置麻烦。在节点中添加内容如下:hudson.model.Hudson.Administer:anonymoushudson.model.Hudson.ConfigureUpdateCenter:anonymoushudson.model.Hudson.Read:anonymoushudson.model.Hudson.RunScripts:anonymoushudson.model.Hudson.UploadPlugins:anonymous

❸ macosx下,搭建gitlab的配置问题,请大牛们帮忙看看什么问题

方案一基于SSH直接搭建Git支持的协议主要是四种:本地:需要文件共享系统,权限不好控制HTTP:速度慢SSH:同时支持读写操作,不支持匿名的读取(Git默认协议)GIT:最快从搭建的难易程度和特点综合筛选,最合适的还是ssh,并且大部分服务器上基本都有ssh服务,所以省去了不少麻烦。一个最基本的思路是给每一个人一个ssh帐号,这样大家就可以通过用户名和口令来访问了,但是显然这不是一个好的选择,这个做法有些多余,并且对于repo的权限很难管理。在使用Github的时候,会利用rsa.pub公钥/私钥的方式,这样在服务端拥有用户的公钥(*.pub)之后就可以,跨过繁琐的口令,直接认证提交了,而服务端也会根据不同的用户身份,对其权限有着更加灵活的管理。因此也采用这种方式。服务端为了使远程库访问更加直观,先在服务器上创建一个名为git的账户,这样以后clone的时候就如下面的格式了:[email protected]:some.git创建新的用户,创建repo等目录$sudoadsergit$sugit$cd~$mkdirrepos在HOME下的.ssh目录,如果没有则创建,创建一个authorized_keys文件,这个文件就是用来管理所有git用户的公钥的,也就是这里面的用户对于项目有着R+W的权限。客户端对于每一个客户端,需要生成一对密钥和公钥,如果是Github用户,那么.ssh目录下,一定有id_rsa.pub和id_rsa两个文件,其中第一个是系统生成的公钥,另一个是自己要保存好的密钥。如果没有的话,可以在终端执行:ssh-keygen来生成,完成后,将自己的公钥提交给管理员,这就是一个注册的行为。完成最后一步,管理员将团队成员的公钥添加到authorized_keys中,比如将同学susie加入:$catsusie.pub>>authorized_keys至此,大家可以通过[email protected]:repos/some.git来访问公共的版本库了。问题安全问题,成员可以登录git用户的shell,细节权限如分支等不好控制管理麻烦,新建repo,或者增加成员比较麻烦,尤其是修改的时候方案二使用Gitolite服务Gitolite也是基于SSH协议构建的方便管理gitrepo的应用,可以通过其源码安装.安装安装按照官方给定的文档就可以轻易的实现:$gitclonegit://github.com/sitaramc/gitolite$mkdir-p$HOME/bin$gitolite/install-to$HOME/bin$gitolitesetup-pkYourName.pub如果执行最后一条命令的时候,gitolite不识别,则可以通过下面两种方式解决:将gitolite添加到PATH里面通过$HOME/bin/gitolitesetup-pkYourName.pub执行至此,gitolite在服务端,搭建完毕,会发现此时HOME目录下增加了一个文件projects.list和一个目录repositories,后者就是我们的版本仓库了,每当新建repo的时候,就会在其中创建。使用是时候说一下gitolite的管理模式了,他会创建一个gitolite-admin的repo,管理员就是通过像这个repo提交配置文件而实现对git服务器的控制的。首先,将这个repo导入到我们的workspace:在此之前,需要配置本地的ssh,gitolite要求管理员的本地密钥和其注册公钥的名字一致,比如安装的时候指定-pk后面为admin.pub则管理员本地需要由admin对应的私钥。我们可以通过~/.ssh/config来进行配置(注:有些系统可以用conf,MacOSX下无效,只能用config)..comport22identityfile~/.ssh/admin这样,当访问gitolite的时候就会自动根据配置文件执行,配置完成后可以根据下面的命令,将gitolite-admin转移到本地。gitclonegitolite:gitolite-admin.git克隆完成后,可以发现,gitolite-admin下面有两个目录,其中conf保存配置文件,可以通过编辑里面的gitolite.conf文件,管理git服务器,keydir目录保存用户的公钥pub文件。当讲修改后的repo提交的时候,gitolite就会自动的应用这些配置,管理过程就方便了很多。配置规则打开gitolite.conf文件可以看到其中的示例:Toaddnewusersalice,bob,andcarol,'keydir'asalice.pub,bob.pub,andcarol.pubrespectively.Toaddanewrepo'foo',editthefile'conf/gitolite.conf'andaddlineslikethis:repofooRW+=aliceRW=bobR=carol上面的配置文件就是新建了一个repofoo,并且添加了三位项目成员,每一个人的权限不同。提交push后,管理便生效了。可视化可能会需要一个web界面来管理这些项目,目前知道的有三种方式:git源码中自带的组件,cgi脚本实现,使用gitolite服务gitlab开源框架,基于ROR,新版本不再使用gitolite服务FB开源PHP框架phabricator,功能高端上档次

❹ gitlab 在内网服务器,怎么使用

ubuntu 13/pub/ruby/1/gitlabhq/gitlab-shell/',本地局域网安装的话默认localhost就行/gitlabhq/gitlabhq.git gitlab# 进入 gitlab 目录cd /home/git/gitlab# 切换到 gitlab 的 5.3 分支.sudo -u git -H git checkout 5-3-stablecd /home/git/gitlab# 复制 gitlab 的示例配置文件到指定目录sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml# 如果用的不是本地服务器,更改 localhost 为 gitlab 的服务器域名sudo -u git -H gedit config/gitlab.yml# 确保当前用户对 gitlab 的 log 和 tmp 文件有读写权限.sudo chown -R git log/sudo chown -R git tmp/sudo chmod -R u+rwX log/sudo chmod -R u+rwX tmp/# 创建一个我不认识的目录…汗!sudo -u git -H mkdir /home/git/gitlab-satellites# 再创建两个我不认识的目录…并且确保 当前用户对他有读写权限.sudo -u git -H mkdir tmp/pids/sudo -u git -H mkdir tmp/sockets/sudo chmod -R u+rwX tmp/pids/sudo chmod -R u+rwX tmp/sockets/# 创建公共的上传备份目录,并确保当前用户对其有读写权限.否则备份会失败.sudo -u git -H mkdir public/uploadssudo chmod -R u+rwX public/uploads# 复制示例配置文件到制定目录sudo -u git -H cp config/puma.rb.example config/puma.rb# 找到其中有一行 # workers 2,去掉前面的 # 并将 2 改为 3.sudo -u git -H gedit config/puma.rb# 配置 gitlab 的全局设置.sudo -u git -H git config –global user.name GitLabsudo -u git -H git config –global user.email [email protected]# 复制示例Mysql配置文件到指定目录sudo -u git cp config/database.yml.mysql config/database.yml# 修改里面的 root 为 gitlab, 密码为创建的 gitlab mysql 用户密码sudo gedit config/database.yml# 安装一个我不认识的东西…我没脸翻译了…大哥你还是看原版教程吧cd /home/git/gitlabsudo gem install charlock_holmes –version '0.6.9.4'sudo -u git -H bundle install –deployment –without development test postgressudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=proction# 下载 gitlab 的 开始/停止 脚本,并且加入当前用户的可执行权限.sudo cp lib/support/init.d/gitlab /etc/init.d/gitlabsudo chmod +x /etc/init.d/gitlab# 添加 gitlab 的开机启动sudo update-rc.d gitlab defaults 21# 检查 gitlab 的状态和环境配置是否正确.sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=proction# 启动 gitlabsudo service gitlab start# 或者sudo /etc/init.d/gitlab restart# 再次检查 gitlab 的状态,如果全部绿色,说明 gitlab 配置成功.不知道为什么,我要运行这个命令两次才会全绿sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=proction七. 配置 Nginx# 软件源安装Nginxsudo apt-get install nginx# 复制 gitlab 的示例配置到指定目录sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlabsudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab# 修改配置文件.更改其中的 YOUR_SERVER_FQDN 为你的 gitlab 服务器全称域名或者本机IP地址,修改 listen 为 *:80sudo gedit /etc/nginx/sites-available/gitlab# 重启 nginx 服务器sudo service nginx restart# 打开浏览器输入本机 IP,用下面的用户密码登录既可[email protected]!fe

❺ 如何在ubuntu server 14.04下安装gitlab中文版

安装步骤有:1. 依赖包2. ruby3. 用户创建4. 数据库初始化5. redis6. gitlab源码7. apache本文可能会用到VPN连接,在命令行下创建VPN连接的方法如下:sudo apt-get install pptp-linuxsudo pptpsetup –create VPN名称 –server 服务器地址 –username 用户名 –password 密码 [–encrypt] –start以上命令会创建一个设备,如果没有其他的拨号设备,这个设备会是ppp0,用ifconfig可以看到,“–encrypt”选项可选,因为有的服务器不支持,会提示MPPE required but peer negotiation failed,创建时带上“–start”选项可以看到连接的情况。pptpsetup创建的VPN连接重启后会失效,如果想在不重启的情况下删除VPN连接:sudo pptpsetup –delete VPN名称创建VPN连接后还需要使能,并且添加到路由列表:sudo pon VPN名称sudo route add default dev ppp0禁用VPN连接的方法是:sudo poff VPN名称下面开始正文:1. 依赖包我装的是ubuntu server 14.04,安装的时候可以选是否安装LAMP(Linux+Apache+MySQL+PHP),如果没装,可以用下面的命令装:sudo tasksel install lamp-server安装的时候会提示输入MySQL的root密码,下面要用。接下来是依赖关系:sudo apt-get install flex bison ruby build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils pkg-config cmake libkrb5-dev nodejs git-core注意:这里面装了ruby,应该是1.9.1版本的,gitlab需要2.0以上的ruby,但是安装2.0以上的ruby需要低版本的ruby,所以我们先装上,一会儿卸掉。另外,ubuntu 14.04的软件库里有ruby 2.0,但是实测不能用,所以还是从源码装ruby吧。2. ruby下载,编译,安装(安装前删掉ruby 1.9.1):curl -L –progress http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz | tar xzcd ruby-2.1.5./configure –prefix=/usr –disable-install-rdocmakesudo apt-get autoremove rubysudo make install然后安装bundler:sudo gem install bundler –no-ri –no-rdoc3. 用户创建为gitlab创建一个git用户:sudo adser –disabled-login –gecos 'GitLab' git4. 数据库初始化官方指南用的是PostgreSQL,不过官方也有MySQL的说明:http://doc.gitlab.com/ce/install/database_mysql.htmlsudo apt-get install -y mysql-server mysql-client libmysqlclient-devmysql -u root -p输入MySQL的root密码登陆,然后:mysql> CREATE USER 'git'@'localhost' IDENTIFIED BY '$password';记得把上面这句的"$password"换成实际的密码,然后:mysql> SET storage_engine=INNODB;mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_proction` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON `gitlabhq_proction`.* TO 'git'@'localhost';mysql> \q5. RedisRedis貌似是用来存key的数据库吧,不知道,反正按步骤安装:sudo apt-get install redis-serversudo cp /etc/redis/redis.conf /etc/redis/redis.conf.origsed 's/^port .*/port 0/' /etc/redis/redis.conf.orig | sudo tee /etc/redis/redis.confecho 'unixsocket /var/run/redis/redis.sock' | sudo tee -a /etc/redis/redis.confecho 'unixsocketperm 770' | sudo tee -a /etc/redis/redis.confsudo service redis-server restartsudo usermod -aG redis git6. gitlab源码gitlab源码默认是安装在/home/git/gitlab,如果要更改,请参照官方手册。获取中文版源码的过程如下:cd /home/gitsudo -u git -H git clone https://gitlab.com/larryli/gitlab.git不知道是因为GFW还是什么,git clone这个版本库可慢可慢了,我用了VPN,速度会快点。git clone完以后可以checkout你想要的版本,在本文编写的时间(2015年4月22日),可以:sudo -u git -H git checkout 7-7-zh然后配置源码cd /home/git/gitlabsudo -u git -H cp config/gitlab.yml.example config/gitlab.ymlsudo chown -R git log/sudo chown -R git tmp/sudo chmod -R u+rwX,go-w log/sudo chmod -R u+rwX tmp/sudo -u git -H mkdir /home/git/gitlab-satellitessudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellitessudo chmod -R u+rwX tmp/pids/sudo chmod -R u+rwX tmp/sockets/sudo chmod -R u+rwX public/uploadssudo -u git -H cp config/unicorn.rb.example config/unicorn.rbsudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rbsudo -u git -H git config –global user.name "GitLab"sudo -u git -H git config –global user.email "[email protected]"sudo -u git -H git config –global core.autocrlf inputsudo -u git -H cp config/resque.yml.example config/resque.yml当然,你可以把[email protected]改成你的email;上面的那些yml文件里面的配置基本都不用更改;然后,配置数据库用户名和密码:sudo -u git cp config/database.yml.mysql config/database.ymlsudo -u git -H editor config/database.ymlsudo -u git -H chmod o-rwx config/database.yml然后,安装gems:sudo -u git -H bundle install –deployment –without development test postgres aws这一步必须使用VPN,因为万恶的GFW屏蔽了rubygems.org,所以会提示connection reset by peer之类的,这部时间也会比较久,如果你的机器是多核的,也可以加上和make相同-jN参数,N等于核数。(2015年5月2日追加)发现淘宝做了个rubygrems.org的国内镜像,http://ruby.taobao.org/,可以参照上面的内容设置,加快gems安装速度。再接下来安装gitlab shell:sudo -u git -H bundle exec rake gitlab:shell:install[v2.6.0] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=proctionsudo -u git -H editor /home/git/gitlab-shell/config.yml把gitlab的url改成http://localhost/或者你的域名。在接下来初始化数据库:sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=proction加入启动项:sudo cp lib/support/init.d/gitlab /etc/init.d/gitlabsudo update-rc.d gitlab defaults 21初始化日志:sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab检查应用状态:sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=proction编译附件:sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=proction启动gitlab服务:sudo service gitlab start7. apache下载apache的配置文件:https://gitlab.com/gitlab-org/gitlab-recipes/blob/master/web-server/apache/gitlab-apache2.4.conf将其中的“ProxyPassReverse http://gitlab.example.com/”改成“ProxyPassReverse http://localhost/”或者你的域名,将其中的“/var/log/httpd/logs/”改为“/var/log/apache2/”。用命令来说:wget https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/web-server/apache/gitlab-apache2.4.confmv gitlab-apache2.4.conf 001-gitlab.confeditor 001-gitlab.conf (进行上述修改)sudo cp 001-gitlab.conf /etc/apache2/sites-availablecd /etc/apache2/sites-enabledsudo rm 000-default.confsudo ln -s ../sites-available/001-gitlab.conf 001-gitlab.conf另外,还需要使能代理模块以实现反向代理功能,不然会提示“ProxyPassReverse”无效之类的。cd /etc/apache2/mods-enabledsudo ln -s ../mods-available/proxy.conf proxy.confsudo ln -s ../mods-available/proxy.load proxy.loadsudo ln -s ../mods-available/proxy_connect.load proxy_connect.loadsudo ln -s ../mods-available/proxy_http.load proxy_http.loadsudo ln -s ../mods-available/rewrite.load rewrite.load重启apache:sudo service apache2 restart然后,检查下配置是否正确:sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=proction如果都是绿色的结果,那就可以访问了。登陆用户名:root,初始密码:5iveL!fe最后配置一下邮件,修改/home/git/gitlab/config/gitlab.yml,里面的“email_from:”为一个有效的email地址;修改/home/git/gitlab/config/environments/proction.rb,里面的 “config.action_mailer.delivery_method=”为“:smtp”;最后:cd /home/git/gitlab/config/initializerssudo -u git -H cp smtp_settings.rb.sample smtp_settings.rb然后把文件的里的内容修改正确了,再重启一下gitlab服务就行了:sudo service gitlab restart

❻ 如何清空gitlab服务器的配置文件

方法/步骤1、登陆github到个人主页,点击“Repositories”,就能看到你自己创建或者“Fork”的项目。2、找到你要删除的“Repositories”(或者也可以说是项目),点击进入。3、找到该Repositories页面右下方的“Settings”,如图中标示,点击“Settings”进入(这个时候有可能会提示让你输入密码)。4、进到“Settings”之后,点选左边框中的“Options”(一般默认也是这个选项),然后拉到最下,就可以看到“Delete this repository”了。5、点击“Delete this repository”,弹出对话框,需要你填写要删除的这个“Repositories”名字,不填写的话是不能删除的,我这里的名字是“Test”,然后就可以删除整个项目了。

❼ gitlab 怎么修改单个文件大小

gitlab默认上传文件最大10M,如果大于10M,则需要做如下修改:vim app/models/note.rb找到如下行:validates :attachment, file_size: { maximum: 10.megabytes.to_i }将10改为你想要的大小;如果httpserver使用提nginx,则修改配置文件nginx.conf,在http中加入 client_max_body_size 50m, 这个值默认是1M。此外,如果用eclipse的插件上传,报如下错:Can't connect to any repository: http://10.210.92.69/bcop/bcop_si.git (An internal Exception occurred ring push: http://10.210.92.69/bcop/bcop_si.git: 411 Length Required)做如下修改:Eclipse>Preferences>Team>Git>Configuration>Add EntryEnter http.postBuffer as key and 524288000 as value (if 500M is enough)

❽ 怎么配置gitlab gitlab

GitLab是由Ruby语言开发的基于Linux的Git服务器,是我见过的最强大的Git服务器。发现它之后,立即决定将Git服务器换成GitLab。但安装好GitLab之后面临一个问题,如何将服务器上的git项目直接导入到GitLab,之前的Git服务器是由是git+apache搭建的(详见在Linux上用Apache搭建Git服务器)。在网上发现了这篇文档——Import bare repositories into your GitLab instance,并按之进行了操作。1)设置存放代码库的主目录vi /etc/gitlab/gitlab.rb比如这里设置为:git_data_dir "/gitlab/repos"2)访问刚搭建的GitLab站点,创建一个group,比如cnblogs。这时会在 /gitlab/repos 下创建 /gitlab/repos/repositories/cnblogs 文件夹。然后在/gitlab/repos/repositories/创建一个文件夹,比如cnblogs3)将现有的所有git项目文件复制到这个文件夹cp -r /data/git/* /gitlab/repos/repositories/cnblogs4)修改一下复制过来的文件夹的所有者:chown -R git:git /gitlab/repos/repositories/cnblogs5)运行GitLab导入命令cd /var/opt/gitlabgitlab-rake gitlab:import:repos等了一段时间之后,显示done,却一个项目也没导入进来。经研究发现,在导入时,GitLab只认文件夹名以.git结尾的项目。于是,将要导入的项目文件夹名称加上.git后缀,再次进行导入。结果显示导入成功,比如:Processing cnblogs/CNBlogsJob.git * Created CNBlogsJob (cnblogs/CNBlogsJob.git)Done!可以是GitLab站点上却看不到已导入的项目。多次努力,也没能解决这个问题。后来,实在没办法,改为手动导入,导入方法如下:1)在GitLab站点上创建与要导入的项目同名的项目。2)进入刚创建的项目文件夹cd /gitlab/repos/repositories/cnblogs/项目名称.git3)删除该文件下的所有文件rm -rf *4)将要导入的项目文件夹下的所有文件复制过来cp -r /data/git/CNBlogsJob/* /gitlab/repos/repositories/cnblogs/CNBlogsJob.git就这样将项目一个一个地导入进来。5)导入完成后,修改一下导入的所有项目的文件所有者chown -R git:git /gitlab/repos/repositories/cnblogs如果不修改所有者,客户端无法进行git push。就这样手动地完成了现有Git项目的导入。备注:操作系统是CentOS 6.2,GitLab版本是7.8.4。

❾ 如何在 CentOS 上安装 Gitlab

#gitlab基于ruby开发模仿Github的版本控制软件,因为是开源的,,但是我们确实有这样的需求,相比Gtihub来说可以减少很多成本.#从安装ruby、git、数据库、web、和gitlab到访问,一定要有耐心.#安装环境##[[email protected] config]# uname -r##2.6.32-279.el6.x86_64##[[email protected] config]# cat /etc/redhat-release##CentOS release 6.3 (Final)一.安装依赖## 安装epel-releaseyum -y install http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm#安装ruby依赖包## packages (from rvm install message):yum -y install libicu-devel patch gcc-c++ readline-devel zlib-devel libffi-devel openssl-devel make autoconf automake libtool bison libxml2-devel libxslt-devel libyaml-devel mysql-devel#安装或者更新gityum -y remove gityum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMakerwget http://git-core.googlecode.com/files/git-1.8.3.4.tar.gztar -zxf git-1.8.3.4.tar.gzcd git-1.8.3.4make prefix=/usr allmake prefix=/usr installcd ..#安装前版本[[email protected] ~]# git –versiongit version 1.7.1#安装后版本[[email protected] ~]# git –versiongit version 1.8.3.4二.安装RVM#RVM工具curl -L get.rvm.io | bash -s stable #出现以下信息为安装成功 # Administrator,## Thank you for using RVM!# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!## ~Wayne, Michal & team.#加载RVM,改名(使用淘宝源)source /etc/profile.d/rvm.shcp /usr/local/rvm/config/db /usr/local/rvm/config/db.bksed -i 's#ftp.ruby-lang.org/pub/ruby#ruby.taobao.org/mirrors/ruby#' /usr/local/rvm/config/dbsed -i 's#cache.ruby-lang.org/pub/ruby#ruby.taobao.org/mirrors/ruby#' /usr/local/rvm/config/db#安装libyaml(防止后期报错,可不装)rvm pkg install libyaml三.安装ruby#安装ruby#rvm install 2.0.0-p247 –with-libyaml-dir=/usr/local/rvm/usr#rvm –default use 2.0.0-p247rvm install 2.0.0-p353 –with-libyaml-dir=/usr/local/rvm/usrrvm –default use 2.0.0-p353#引用淘宝ruby源gem sources –remove https://rubygems.org/gem sources -a http://ruby.taobao.org/gem sources -l#安装bundlergem install bundler –no-ri –no-rdoc四.安装gitlab-shell#创建用户gitadser –system –create-home –comment 'GitLab' git#复制gitlab-shell到本地su – git -c "git clone https://github.com/gitlabhq/gitlab-shell.git"su – git -c "cd gitlab-shell;git checkout v1.7.0"##修改配置文件su – git -c "cp gitlab-shell/config.yml.example gitlab-shell/config.yml"##安装su – git -c "gitlab-shell/bin/install"五.安装Redis和mysql#安装Redis,据说高级特性需要yum -y install redis ;service redis start ; chkconfig redis on#安装mysql#安装Mysql数据库.略过,以及数据库操作##yum install -y mysql-server mysql-devel ; chkconfig mysqld on ; service mysqld start#编译安装宣告下变量##export PATH="/opt/mysql/bin:$PATH"##echo "export PATH="/opt/mysql/bin:$PATH"">>/etc/profile##修改root密码#echo "UPDATE mysql.user SET Password=PASSWORD('$MYSQL_ROOT_PW') WHERE User='root'; FLUSH PRIVILEGES;" | mysql -u root##创建gitlab数据库#echo "CREATE DATABASE IF NOT EXISTS gitlabhq_proction DEFAULT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';" | mysql -u rootCREATE DATABASE IF NOT EXISTS gitlabhq_proction DEFAULT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';##创建连接数据库用户grant all on gitlabhq_proction.* to [email protected] identified by '123456';六.安装gitlab#复制GitLab到本地su – git -c "git clone https://github.com/gitlabhq/gitlabhq.git gitlab"## 检查su – git -c "cd gitlab;git checkout 5-4-stable"#以下操作在/home/git/gitlabcd /home/git/gitlab### 复制配置文件su git -c "cp config/gitlab.yml.example config/gitlab.yml"### 修改配置文件主机名(可以不做)sed -i "s/ host: localhost/ host: gitlab.test/g" config/gitlab.yml### 修改邮件地址sed -i "s/from: [email protected]/from: [email protected]/g" config/gitlab.yml#修改puma.rb文件su git -c "cp config/puma.rb.example config/puma.rb"sed -i "s/0.0.0.0:9292/127.0.0.1:3000/g" /home/git/gitlab/config/puma.rbsed -i "s/# bind/bind/g" /home/git/gitlab/config/puma.rb#为git用户授权su git -c "chown -R git /home/git/gitlab/log/;chmod -R u+rwx /home/git/gitlab/log/;chown -R git /home/git/gitlab/tmp/;chmod -R u+rwx /home/git/gitlab/tmp/;mkdir /home/git/gitlab-satellites;mkdir /home/git/gitlab/tmp/pids/;chmod -R u+rwx /home/git/gitlab/tmp/pids/;mkdir /home/git/gitlab/tmp/sockets/;chmod -R u+rwx /home/git/gitlab/tmp/sockets/;mkdir /home/git/gitlab/public/uploads;chmod -R u+rwX /home/git/gitlab/public/uploads"### 复制数据配置文件su git -c "cp config/database.yml.mysql config/database.yml"### 设置mysql用户和密码sed -i "s/root/gitlab/g" config/database.ymlsed -i "s/secure password/123456/g" config/database.yml### 配置git用户su git -c 'git config –global user.name "GitLab"'su git -c 'git config –global user.email "[email protected]$GL_HOSTNAME"'七.安装 Gems## 安装gem install charlock_holmes –version '0.6.9'#bundle使用淘宝源,并且安装(时间长.)sed -i '1s/https/http/g' /home/git/gitlab/Gemfilesed -i '1s/rubygems/ruby.taobao/g' /home/git/gitlab/Gemfile#安装bundlesu git -c "bundle install –deployment –without development test postgres"八.初始化数据库#初始化数据库export force=yessu git -c "bundle exec rake gitlab:start RAILS_ENV=proction"su git -c "bundle exec rake gitlab:setup RAILS_ENV=proction"#初始化在数据库里添加数据,最后后会出现:#用户名:[email protected]#密 码:5iveL!fe#su git -c "bundle exec rake gitlab:env:info RAILS_ENV=proction"九.启动脚本#curl –output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab-centos#chmod +x /etc/init.d/gitlabcurl –output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-1-stable/init.d/gitlabchmod +x /etc/init.d/gitlab#在17行后添加2行内容sed -i "17 a source /etc/profile.d/rvm.shnrvm use 1.9.3-p448" /etc/init.d/gitlab#或者复制##cp /home/git/gitlab/lib/support/init.d/gitlab /etc/init.d/#添加到开机启动项chkconfig gitlab on#启动/etc/init.d/gitlab start十.配置web站点#配置nginx#安装nginx,(编译安装和rpm都能实现)# yum -y install nginx#下载nginx下的gitlab.conf文件curl –output /etc/nginx/conf.d/gitlab.conf https://raw.github.com/gitlabhq/gitlab-recipes/5-1-stable/nginx/gitlab#修改下server标签监听端口和域名vim /etc/nginx/conf.d/gitlab.conf server {listen 80; server_name gitlab.wine.cn;#..略..}更改安装目录权限# chown -R git:git /etc/nginx#更改nginx所属用户#注意:#需要nginx用户改为git,否则会出现502访问错误.vim /etc/nginx/nginx.conf#user nginx;user git;/etc/init.d/gitlab start/etc/init.d/nginx start#然后访问gitlab.wine.cn#####以下是报错环节,没怎么整理很乱###################[[email protected] init.d]# sh gitlab startCould not find mysql2-0.3.11 in any of the sourcesRun `bundle install` to install missing gems.#解决


赞 (0)