先标记一下,后续手动验证

http://blog.csdn.net/king_sundi/article/details/7457475

安装Gitorious

Git是一个分布式的版本控制系统,用于Linux内核的管理。在推出后,Git也逐渐被用于其他项目,同样也取得了很大的成功。GitHub则是基于Git版本控制系统的,它提供基于互联网的项目托管服务,但GitHub并不开源,所以我在网上找到了替代GitHub的开源项目托管系统:Gitorious。
安装Gitorious并不是一件轻松的事,所以就写了这篇文章,一则可以帮助那些准备安装Gitorious的兄弟,二则也给自己做个备忘。
一、安装第三方的相关依赖包:
Apache
sudo apt-get install -y build-essential apache2 apache2-threaded-dev libapache2-mod-xsendfile
MySQL
sudo apt-get install -y mysql-server mysql-client
注意:在安装MySQL时,您将会被提示创建MySQL的root用户密码
PHPMyAdmin(可选)
sudo apt-get install -y phpmyadmin
设置时选择apache2、并使用dbconfig-common来配置数据库,并会被提示创建PHPMyAdmin管理员用户密码。
Git
sudo apt-get install -y git-core git-doc
其它依赖包
sudo apt-get install -y libexpat1-dev libxslt1-dev libcurl4-openssl-dev sendmail apg geoip-bin libgeoip1 libgeoip-dev imagemagick libmagick++-dev libpcre3 libpcre3-dev zlib1g zlib1g-dev zip unzip libyaml-dev libonig-dev memcached aspell libaspell-dev aspell-en
Ruby 和 RubyGems
sudo apt-get install -y ruby ruby-dev rubygems libruby libdbd-mysql-ruby libmysql-ruby
sudo REALLY_GEM_UPDATE_SYSTEM=1 gem update –system
sudo gem install –no-ri –no-rdoc rake
sudo gem install –no-ri –no-rdoc daemons
sudo gem install -b –no-ri –no-rdoc rmagick
sudo gem install -b –no-ri –no-rdoc stompserver
sudo gem install -b –no-ri –no-rdoc passenger
sudo gem install -b –no-ri –no-rdoc bundler
Sphinx(俄国人贡献的开源搜索包)
sudo apt-get install -y sphinxsearch
二、下载Gitorious源代码,在这里将Gitorious放置在/var/www/gitoriou:
cd /var/www
sudo chown firehare:firehare /var/www
git clone git://gitorious.org/gitorious/mainline.git gitorious
cd gitorious
git submodule init
git submodule update
sudo ln -s /var/www/gitorious/script/gitorious /usr/bin
第2条语句是为了方便处理,不用老是sudo,所以将/var/www目录的所有者从root改为你的用户名,在这里我使用的是我的用户名firehare。
三、配置初始化服务
在/var/www/gitorious/doc/templates/ubuntu目录中有相应的服务脚本模板。将这些脚本模板拷至/etc/init.d目录中:
cd /var/www/gitorious/doc/templates/ubuntu
sudo cp git-daemon git-ultrasphinx git-poller stomp /etc/init.d
sudo cp gitorious-logrotate /etc/logrotate.d/gitorious
sudo chmod 755 git-daemon git-ultrasphinx git-poller stomp
然后将服务配置成开机启动
sudo update-rc.d stomp defaults
sudo update-rc.d git-daemon defaults
sudo update-rc.d git-ultrasphinx defaults
sudo update-rc.d git-poller defaults
最后由于git-daemon git-ultrasphinx git-poller stomp脚本中的RUBY_HOME路径指向”/opt/ruby-enterprise”,为了方便起见,不一一修改启动脚本,将创建一个链接:
sudo ln -s /usr/ /opt/ruby-enterprise
四、配置Apache
安装Passenger
sudo /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/bin/passenger-install-apache2-module
配置Passenger
sudo vi /etc/apache2/mods-available/passenger.load
然后在新建的passenger.load文件中输入以下文字:
# Did you verify this matches the values from
# the ‘sudo /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/bin/passenger-install-apache2-module’ command ?
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11
PassengerRuby /usr/bin/ruby1.8
启用Apache模块
sudo a2enmod passenger
sudo a2enmod rewrite
sudo a2enmod ssl
sudo /etc/init.d/apache2 restart
创建Gitorious站点文件
sudo vi /etc/apache2/sites-available/gitorious
然后在新建的Gitorious站点文件中输入以下文字:

ServerName git.meranko.net
DocumentRoot /var/www/gitorious/public

# Enable X-SendFile for gitorious repo archiving to work
XSendFile on

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat “%h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\”" combined
LogFormat “%h %l %u %t \”%r\” %>s %b” common
LogFormat “%{Referer}i -> %U” referer
LogFormat “%{User-agent}i” agent

CustomLog /var/log/apache2/gitorious_access.log combined
TransferLog /var/log/apache2/gitorious_access.log
ErrorLog /var/log/apache2/gitorious_error.log

创建Gitorious SSL站点文件
sudo vi /etc/apache2/sites-available/gitorious-ssl
然后在新建的Gitorious站点文件中输入以下文字:

SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
BrowserMatch “.*MSIE.*” nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
DocumentRoot /var/www/gitorious/public

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat “%h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\”" combined
LogFormat “%h %l %u %t \”%r\” %>s %b” common
LogFormat “%{Referer}i -> %U” referer
LogFormat “%{User-agent}i” agent

CustomLog /var/log/apache2/gitorious_ssl_access.log combined
TransferLog /var/log/apache2/gitorious_ssl_access.log
ErrorLog /var/log/apache2/gitorious_ssl_error.log

启用Gitorious和Gitorious SSL网站
sudo a2dissite default
sudo a2dissite default-ssl
sudo a2ensite gitorious
sudo a2ensite gitorious-ssl
sudo /etc/init.d/apache2 restart
五、设置MySQL用户
mysql -u root -p
Enter password: (输入你在安装包时确定的Mysql根用户密码)
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘gitorious’@'localhost’ IDENTIFIED BY ‘<输入密码>‘ WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
六、配置Gitorious
首先确保所有gems版本的正确(安装时会询问你的sudo密码)
cd /var/www/gitorious/
bundle install
bundle pack
再创建git系统用户
sudo adduser –system –home /var/www/gitorious/ –no-create-home –group –shell /bin/bash git
sudo chown -R git:git /var/www/gitorious
然后创建一些Gitorious运行所需的东西
sudo su – git
mkdir .ssh
touch .ssh/authorized_keys
chmod 700 .ssh
chmod 600 .ssh/authorized_keys
mkdir tmp/pids
mkdir repositories
mkdir tarballs
mkdir tmp/tarballs-work
chmod ug+rwx repositories
生成Gitorious的配置文件(注意:当前用户为git)
cp config/database.sample.yml config/database.yml
cp config/gitorious.sample.yml config/gitorious.yml
cp config/broker.yml.example config/broker.yml
在Gitorious的database.yml配置文件中的production段中确保正确的数据库用户名和名字(注意:当前用户为git)
在Gitorious的gitorious.yml配置文件中,要注意以下内容:
确保在production而非test中修改
repository_base_path应该是/var/www/gitorious/repositories
cookie_secret应该设为多于30个字符的字符串,为了方便起见,你可以使用下列命令,然后将其输出复制到这里。
apg -m 64
gitorious_client_port应该设为80
gitorious_host应该设置成客户可以使用的主机名(否则Cookie会出错
archive_cache_dir应该设为/var/www/gitorious/tarballs
archive_work_dir应该设为/var/www/gitorious/tmp/tarballs-work
exception_notification_emails:你的邮箱
hide_http_clone_urls应该设为true(它们需要额外的安装工作)
is_gitorious_dot_org应该设false
public_mode应该设为false
七、创建Gitorious数据库
因为在RubyGems 1.6.0+ 并且 Rails < 2.3.11时存在BUG,本来可以在config/boot.rb文件的顶部添加下列语句来解决,但由于该文件注释要求不要改变,所以就只好麻烦点,添加到Rakefile文件和config/environment.rb文件的require(File.join(File.dirname(__FILE__), ‘config’, ‘boot’))语句上方即可:
require ‘thread’
接下来的工作,我们让rake来做:
export RAILS_ENV=production
bundle exec rake db:create RAILS_ENV=production
bundle exec rake db:migrate RAILS_ENV=production
配置Sphinx搜索守护程序,将address设为localhost
vi /var/www/gitorious/config/ultrasphinx/default.base
# Daemon options
searchd
{
# What interface the search daemon should listen on and where to store its logs
address = localhost
port = 3312
…….
然后继续用rake来为我们配置:
bundle exec rake ultrasphinx:bootstrap RAILS_ENV=production
注意:本人在安装在这一步时出现一个错误,提示如下,详见第12行,于是本人查了一下数据库,打开文件/var/www/gitorious/config/ultrasphinx/production.conf,找到base_tags.name语句,将其改成tags,即可通过:
(in /var/www/gitorious)
Rebuilding configurations for production environment
Available models are Comment, Repository, MergeRequest, and Project
Generating SQL
$ indexer –config ‘/var/www/gitorious/config/ultrasphinx/production.conf’ –all
Sphinx 0.9.9-release (r2117)
Copyright (c) 2001-2009, Andrew Aksyonoff

using config file ‘/var/www/gitorious/config/ultrasphinx/production.conf’…
WARNING: key ‘address’ is deprecated in /var/www/gitorious/config/ultrasphinx/production.conf line 10; use ‘listen’ instead.
indexing index ‘main’…
ERROR: index ‘main’: sql_range_query: Unknown column ‘base_tags.name’ in ‘field list’ (DSN=mysql://gitorious:***@localhost:3306/gitorious_production).
total 0 docs, 0 bytes
total 0.005 sec, 0 bytes/sec, 0.00 docs/sec
total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
Sphinx 0.9.9-release (r2117)
Copyright (c) 2001-2009, Andrew Aksyonoff

using config file ‘/var/www/gitorious/config/ultrasphinx/production.conf’…
WARNING: key ‘address’ is deprecated in /var/www/gitorious/config/ultrasphinx/production.conf line 10; use ‘listen’ instead.
listening on 127.0.0.1:3312
WARNING: index ‘main’: preload: failed to open /var/www/gitorious/db/sphinx//sphinx_index_main.sph: No such file or directory; NOT SERVING
FATAL: no valid indexes to serve
Failed to start
Done
Please restart your application containers
创建Sphinx Cronjob
crontab -e * * * * * cd /var/www/gitorious && /usr/bin/bundle exec
创建管理员用户
env RAILS_ENV=production ruby1.8 script/create_admin
八、重启机器后你就可以在Ubuntu 11.10上完成Gitorious的安装了!OK!打完收功!!

转-Gitorious搭建步骤的更多相关文章

  1. Java Web 环境搭建步骤(超详细,包括前期安装步骤)

    Java Web 环境搭建步骤 安装对应版本的JDK 配置环境变量 本人安装的路径是C盘,在path中加入C:\Program Files\Java\jdk1.8.0_65\bin 测试配置成功,cm ...

  2. Linux vagrant+virtualbox环境搭建步骤

    Linux vagrant+virtualbox环境搭建步骤 Vagrant 是一款用来构建虚拟开发环境的工具,非常适合 php/python/ruby/java 这类语言开发 web 应用. 我们可 ...

  3. SSH三大框架合辑的搭建步骤

    v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VM ...

  4. cocos2d-lua 3.5 android搭建步骤

    cocos2d-lua 3.5 android搭建步骤 如何安装eclipse,jdk,android sdk,ndk这里都不说了,资料很多,而且以前用eclipse搭建cocos2d-x-c++的时 ...

  5. IIS HTTP文件服务器搭建步骤

    利用IIS搭建HTTP文件服务器,可下载.上传(用户名验证) 1.右键网站,添加应用程序 2.物理路径,选择系统的目录配置,上一层 别名:CAPI3FileService 3.效果如下: 4.(以下步 ...

  6. [转]MonkeyRunner在Windows下的Eclipse开发环境搭建步骤(兼解决网上Jython配置出错的问题)

    MonkeyRunner在Windows下的Eclipse开发环境搭建步骤(兼解决网上Jython配置出错的问题)   网上有一篇shangdong_chu网友写的文章介绍如何在Eclipse上配置M ...

  7. mysql 主从搭建步骤

    mysql 主从搭建步骤 1:主库开启master端bin-log 2:主库创建备份用户 3:主库全备 4:从库导入全备数据 5:从库修改change master to信息 6:从库slave st ...

  8. Hadoop集群搭建步骤

    实验性操作是在虚拟机里进行的,除了搭建hadoop本身的操作之外,遇到的其它问题总结如下: 1. 虚拟机挂载windows磁盘: 添加硬件,要保证该硬件此时没有被读写访问等,因为挂载后,该磁盘在宿主机 ...

  9. 在Android Studio上测试运行,Unity发布成Android包的环境搭建步骤

      我用的是unity5.4.3版本,jdk是1.8.0_131版本,Android-SDK是r24.4.1版本,Android-NDK是r13b版本,作者是刚开始写博客,希望对在unity摸索的人有 ...

随机推荐

  1. Java面向对象 包

       Java面向对象  包 知识概要:              (1)包的概念 (2)包的命名 (3)编译执行 (4)导入 (5)包的访问权限 包:   包(package)用于将完成不同功能 ...

  2. nodejs+express-实现文件上传下载管理的网站

    Nodejs+Express-实现文件上传下载管理的网站 项目Github地址(对你有帮助记得给星哟):https://github.com/qcer/updo 后端:基于nodejs的express ...

  3. 【转载】CSS3的calc()使用

    文章转载自 w3cplus http://www.w3cplus.com/ 原文链接:http://www.w3cplus.com/css3/how-to-use-css3-calc-function ...

  4. python识别html主要文本框

    在抓取网页的时候只想抓取主要的文本框,例如 csdn 中的主要文本框为下图红色框: 抓取的思想是,利用bs4查找所有的div,用正则筛选出每个div里面的中文,找到中文字数最多的div就是属于正文的d ...

  5. 80端口被系统服务【kernel&System】占用解决方案

    netstat -ano | findstr port    //查看端口占用情况 tasklist | findstr port   //查看端口被占用的具体服务名 运行net stop http ...

  6. 在Owin Self-Hosing下实现每个请求中共享上下文(数据)

    问题 这几天在做公司的外部WebApi网关,由于使用了OAuth2.0,所以不得不使用Owin来部署网关. 而涉及到请求上下文的问题,为了使业务层能获取到请求头的信息,又不与网关耦合,决定把请求信息写 ...

  7. 双端链表--Java实现

    /*双端链表--比普通链表多了一个指向最后一个节点的引用 * 特点: 链表可以进行尾巴插入--输出顺序和输入顺序一致 * 但是不可以进行尾巴删除因为没有倒数第二节点的引用 * */ public cl ...

  8. 数据库.MongoDB.安装MongoDB数据库

    树莓派安装方法 版本: mongodb 2.4.10 sudo apt-get install mongodb -y 安装完成后,检查命令 mongo 看到下图的内容,表示已安装并启动成功 ===== ...

  9. maven基本基础知识及命令学习-1

    Maven概述:Maven是很有效的项目管理工具,maven是基于项目对象模型(POM),可以通过一小段描述信息来管理项目构建.报告和文档的软件项目管理工具.统一管理环境,架包等. 一 maven下载 ...

  10. Akka(33): Http:Marshalling,to Json

    Akka-http是一项系统集成工具.这主要依赖系统之间的数据交换功能.因为程序内数据表达形式与网上传输的数据格式是不相同的,所以需要对程序高级结构化的数据进行转换(marshalling or se ...