一、首先在Centos下安装git
方法1:
1、安装git的依赖包
  yum install -y curl curl-devel zlib-devel openssl-devel perl cpio expat-devel gettext-devel
2、下载git包并安装
  wget uk/projects/git-snapshots/git/
  tar -zxvf
  cd git-xxx-xx-xx
  ./configure  --编译
  make | make install --安装
方法2:
1、添加EPEL(Extra Packages for Enterprise Linux) repository:
CentOS5.x 32-bit(x86/i386) :
rpm -Uvh http:///pub/epel/5/arch.rpm
CentOS5.x 64-bit(x64):
rpm -Uvh /pub/epel/5/x86_arch.rpm
CentOS6.x32-bit (x86/i386):
rpm -Uvh /pub/epel/6/arch.rpm
CentOS6.x 64-bit(x64):
rpm -Uvh /pub/epel/6/x86_arch.rpm
2、安装
    yum install git
3、检验
    git --version
二、Gitorious安装
1、yum update;  -- 升级系统
2、yum -y groupinstall "Development tools" "Development Libraries"; --安装所需安装包
3、yum install -y git git-svn pcre pcre-devel zlib zlib-devel sendmail java-1.6.0-openjdk vim-* apg
  git-core libyaml libyaml-devel GeoIP-devel memcached ImageMagick  ImageMagick-devel 
  readline-devel glibc-devel sphinx ;
4、安装ruby,Gitorious要求ruby的版本>=1.86(包含rubygems)
  wget lecode/files/ruby-enterprise-1.8.7-2011.
  tar -zxvf ruby-enterprise-1.8.7-2011.
  cd ruby-enterprise-1.8.7-2011.03
  ./installer
  cd /opt
  ln -s ruby-enterprise-1.8.7-2011.03 ruby
5、安装需求的gems
  gem update --system  -- 升级rubygems
6、安装需要的gem包
  gem install --no-ri --no-rdoc rails mongrelmime-types textpow chronic ruby-hmac daemons mime-types oniguruma passenger textpow chronic BlueCloth ruby-yadis ruby-openid geoip ultrasphinx  rspec rspec-rails RedCloth echoe hoe diff-lcsstompserver json mysql
7、替换rack的版本: gem install --no-ri --no-doc -v 1.0.1 rack
8、安装mysql
  yum install mysql mysql-server mysql-devel
9、开启服务
  /sbin/service mysqld start  || /etc/init.d/mysqld start
10、给root用户设置密码 (mysql的密码)
  mysqladmin -u root password 'mapgis';
11、登录mysql,创建数据库
  mysql -u root -p;
  输入密码:mapgis
  create  database  gitorious;
  create  database  gitorious_test;
  create  database  gitorious_dev;
  create  user 'git'@'localhost'  identified by '<password>';
  grant all  on gitorious.*  to 'git'@'localhost';
  grant all  on gitorious_test.*  to 'git'@'localhost';
  grant all  on gitorious_dev.*  to 'git'@'localhost';
  flush privileges;
  exit;
12、添加用户git 作为Gitorious的使用者
  adduser  --create-home git
13、下载Gitorious的源代码
  su git
  cd /var/www
  git clone git:///gitorious/mainline.git gitorious
  cd gitorious
  mkdir -p tmp/pids
  exit -- #back to root
  建立软连接
  ln -s /var/www/gitorious/script/gitorious  /usr/local/bin/gitorious
  cd /var/www/gitorious/
  chmod ug+x script/*
  chmod -R g+w config/log/public/tmp/
  su git   
  给Repositoriesand  Tarballs建立目录
  mkdir /var/git
  mkdir /var/git/repositories
  mkdir /var/git/tarballs   
  mkdir /var/git/tarball-work
  exit
  更改application目录的拥有者
  chown -R git:git  /var/git /var/www/gitorious
14、安装web服务器
  yum install -y httpd httpd-devel
15、安装和配置passenger
  find / -name passenger-install-apache2-module
  执行passenger-install-apache2-module
  a、cd /etc/httpd/conf
      f
      在f 中添加如下内容
LoadModule passenger_module/usr/local/ruby/ruby1.8.7/lib/ruby/gems/1.8/gems/passenger-2.2.11/
ext/apache2/mod_passenger.so
PassengerRoot /usr/local/ruby/ruby1.8.7/lib/ruby/gems/1.8/gems/passenger-2.2.11 
PassengerRuby /usr/local/ruby/ruby1.8.7/bin/ruby
centos安装vim命令 在/etc/httpd/f 中
<Vitualloalhost *:80>
    ServerName localhost
    DocumentRoot /var/www/gitorious/public
    <Directory /var/www/gitorious/public>
        AllowOverride all
        Options -MultiViews
<Vituallocalhost>
16、su git
    vi ~/.bashrc,添加以下内容
    export RUBY_HOME=/usr/local/ruby/ruby1.8.7
    export GEM_HOME=$RUBY_HOME/lib/ruby/gems/1.8/gems
    export PATH=$RUBY_HOME/bin:$PATH
    执行 source ~/.bashrc
    mkdir ~/.ssh
    chmod 700 ~/.ssh
    touch ~/.ssh/authorized-keys
    chmod 600 ~/.ssh/authorized_keys
    exit #back to root   
    vim /var/www/gitorious/doc/templates/centos/git-daemon
    RUBY_HOME="/usr/local/ruby/ruby1.8.7"
    GITORIOUS_HOME="/var/www/gitorious"
 
    vim /var/www/gitorious/doc/templates/centos/git-ultrasphinx
    GITORIOUS_HOME="/var/www/gitorious"
 
    vim /var/www/gitorious/doc/templates/centos/git-poller

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。