项目

常规

配置文件

操作

如何在 Ubuntu lucid 服务器上安装 Redmine

Redmine 安装

  1. 安装 LAMP 堆栈
    $ sudo tasksel install lamp-server
    
  2. 安装所需的软件包
    $ sudo apt-get install build-essential subversion llibmysqlclient15-dev libdigest-sha1-perl libgemplugin-ruby libgemplugin-ruby1.8 libruby-extras libruby1.8-extras rails rake ruby rubygems rubygems1.8 ruby1.8-dev libopenssl-ruby1.8 
    
  3. 安装所需的 Ruby gem
    $ sudo gem install rails -v=2.3.11 --no-ri --no-rdoc
    $ sudo gem install rake -v=0.8.7 --no-ri --no-rdoc
    $ sudo gem uninstall rake -v=0.9.2 
    $ sudo gem install i18n -v=0.4.2 --no-ri --no-rdoc
    $ sudo gem install mysql --no-ri --no-rdoc
    
  4. 将 Redmine 下载到 /user/share/redmine 目录
    $ sudo svn co http://redmine.rubyforge.org/svn/branches/1.2-stable /usr/share/redmine
    
  5. 创建一个空 MySQL 数据库并为其创建一个名为 redmine 的配套用户。
    $ mysql -u root -p
    (enter the mysql root user password)
    > create database redmine character set utf8;
    > create user 'redmine'@'localhost' identified by '[password]';
    > grant all privileges on redmine.* to 'redmine'@'localhost' identified by '[password]';
    > exit
    
  6. 将 config/database.yml.example 复制到 config/database.yml 中,并编辑该文件以配置“生产”环境的数据库设置。
    $ sudo cp /usr/share/redmine/config/database.yml.example /usr/share/redmine/config/database.yml
    
    $ sudo nano /usr/share/redmine/config/database.yml
    
    Modify to the following and save (ctrl+x)
    
    production:
      adapter: mysql
      socket: /var/run/mysqld/mysqld.sock
      database: redmine
      host: localhost
      username: redmine
      password: [password]
      encoding: utf8
    
  7. 生成会话存储密钥。
    $ cd /usr/share/redmine
    
    $ sudo rake generate_session_store
    
  8. 在应用程序根目录下运行以下命令以生成数据库结构
    $ cd /usr/share/redmine
    
    $ sudo rake db:migrate RAILS_ENV="production" 
    
  9. 通过运行以下命令,在数据库中插入默认配置数据
    $ sudo RAILS_ENV=production rake redmine:load_default_data
    
  10. 设置权限
    $ cd /usr/share/redmine
    $ sudo chown -R www-data:www-data files log tmp public/plugin_assets
    $ sudo chmod -R 755 files log tmp public/plugin_assets
    
  11. 使用 webrick web 服务器进行测试
    $ cd /usr/share/redmine
    
    $ ruby script/server webrick -e production
    
    Point your web browser at http://[my server ip]:3000
    
    You should now see the application welcome page.
    

Apache 集成

  1. 安装所需的软件包
    $ sudo apt-get install libapache2-mod-passenger
    
  2. 添加指向公共 redmine web 目录的符号链接
    $ sudo ln -s /usr/share/redmine/public /var/www/redmine
    
  3. 配置 Passanger 作为 www-data 运行
    $ sudo nano /etc/apache2/mods-available/passenger.conf
    
    Add the follow line and save (ctrl+x)
    
    PassengerDefaultUser www-data
    
  4. 创建一个新的 Apache 站点文件
     
    $ sudo nano /etc/apache2/sites-available/redmine 
    

    添加以下内容并保存(ctrl+x)
    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
            DocumentRoot /var/www
            ServerName myservername
    
            RewriteEngine on
            RewriteRule   ^/$  /redmine  [R]
    
            <Directory /var/www/redmine>
                    RailsBaseURI /redmine
                    PassengerResolveSymlinksInDocumentRoot on
            </Directory>
    
            ErrorLog /var/log/apache2/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/access.log combined
    </VirtualHost>
    

    针对 SSL,请添加以下文本
    <VirtualHost *:443>
            ServerAdmin webmaster@localhost
            DocumentRoot /var/www
            ServerName myservername
    
            SSLEngine On
            SSLCertificateFile /etc/apache2/ssl/redmine.pem
    
            RewriteEngine on
            RewriteRule   ^/$  /redmine  [R]
    
            <Directory /var/www/redmine>
                    RailsBaseURI /redmine
                    PassengerResolveSymlinksInDocumentRoot on
            </Directory>
    
            ErrorLog /var/log/apache2/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/access.log combined
    </VirtualHost>
    
  5. 启用 Redmine 网站
    $ sudo a2dissite default
    $ sudo a2ensite redmine
    
  6. 启用 Passenger 和 Rewite 模块并重新启动 Apache
     
    $ sudo a2enmod passenger
    $ sudo a2enmod rewrite
    $ sudo /etc/init.d/apache2 restart
    
  7. 测试安装情况
    Open up your favorite web browser and goto
    
    http://[my site or ip]/redmine
    

Mercurial 集成

  1. 安装最新的 Mercurial 版本
    $ sudo apt-get install python-software-properties
    $ sudo add-apt-repository ppa:mercurial-ppa/releases
    $ sudo apt-get update
    $ sudo apt-get install mercurial libapache-dbi-perl libapache2-mod-perl2
    
  2. 创建 hg web 目录
    $ sudo mkdir -p /var/www/hg/repos
    
  3. 创建 web cgi 脚本文件
    $ sudo nano /var/www/hg/hgwebdir.cgi
    
    Add the following and save
    
    #!/usr/bin/env python
    #
    from mercurial import demandimport; demandimport.enable()
    from mercurial.hgweb.hgwebdir_mod import hgwebdir
    import mercurial.hgweb.wsgicgi as wsgicgi
    application = hgwebdir('hgweb.config')
    wsgicgi.launch(application)
    
  4. 创建 cgi web 配置文件
    $ sudo nano /var/www/hg/hgweb.config
    
    Add the following and save
    
    [paths]
    /=/var/www/hg/repos/**
    
    [web]
    allow_push = *
    push_ssl = false
    allowbz2 = yes
    allowgz = yes
    allowzip = yes
    
  5. 设置权限
    $ sudo chown -R www-data:www-data /var/www/hg
    $ sudo chmod gu+x /var/www/hg/hgwebdir.cgi
    
  6. 创建 Apache 配置文件
    $ sudo nano /etc/apache2/conf.d/hg.config
    
    Add the following and save
    
    PerlLoadModule Apache::Redmine
    ScriptAlias /hg  "/var/www/hg/hgwebdir.cgi" 
    <Location /hg  >
        AuthType Basic
        AuthName "Mercurial" 
        Require valid-user
    
        #Redmine auth
        PerlAccessHandler Apache::Authn::Redmine::access_handler
        PerlAuthenHandler Apache::Authn::Redmine::authen_handler
        RedmineDSN "DBI:mysql:database=redmine;host=localhost" 
        RedmineDbUser "redmine" 
        RedmineDbPass "password" 
    </Location>
    
  7. 添加指向 Redmine.pm 的符号链接
    $ sudo ln -s /usr/share/redmine/extra/svn/Redmine.pm /usr/lib/perl5/Apache/Redmine.pm
    $ sudo ln -s /usr/share/redmine/extra/svn/Redmine.pm /usr/lib/perl5/Apache2/Redmine.pm  
    
  8. 启用所需的 Apache 模块并重新启动 Apache
    $ sudo /etc/init.d/apache2 restart
    
  9. 在 Redmine 中创建一个新的测试存储库和项目
    $ sudo hg init /var/www/hg/repos/test
    $ sudo chown -R www-data:www-data /var/www/hg/repos/test
    
    Create a new project with and identifier 'test'
    
    In the project Settings > Repository set
    SCM: Mercurial
    Path to repository: /var/www/hg/repos/test
    Press the 'Create' button
    
    Goto to the Repository tab of the test project
    
  10. 在网络浏览器中查看测试存储库
    > http://[my site name]/hg/test
    

Subversion 集成

  1. 安装最新的 Mercurial 版本
    $ sudo apt-get install subversion libapache2-svn libapache-dbi-perl libapache2-mod-perl2
    
  2. 创建 svn 存储库目录
    $ sudo mkdir /var/www/svn
    
  3. 设置权限
    $ sudo chown -R www-data:www-data /var/www/svn
    
  4. 添加指向 Redmine.pm 的符号链接
    $ sudo ln -s /usr/share/redmine/extra/svn/Redmine.pm /usr/lib/perl5/Apache/Redmine.pm
    $ sudo ln -s /usr/share/redmine/extra/svn/Redmine.pm /usr/lib/perl5/Apache2/Redmine.pm  
    
  5. 创建 Apache 配置文件
    $ sudo nano /etc/apache2/conf.d/svn.config
    

    添加以下内容并保存
       PerlLoadModule Apache::Redmine
       <Location /svn>
         DAV svn
         SVNParentPath "/var/www/svn" 
         Order deny,allow
         Deny from all
         Satisfy any
    
         PerlAccessHandler Apache::Authn::Redmine::access_handler
         PerlAuthenHandler Apache::Authn::Redmine::authen_handler
         AuthType Basic
         AuthName "Redmine Subversion Repository" 
    
         #read-only access    
         <Limit GET PROPFIND OPTIONS REPORT>
            Require valid-user
            Allow from 127.0.0.1
            # Allow from another-ip
             Satisfy any
         </Limit>
         # write access
         <LimitExcept GET PROPFIND OPTIONS REPORT>
           Require valid-user
         </LimitExcept>
    
         ## for mysql
         RedmineDSN "DBI:mysql:database=redmine;host=localhost" 
         RedmineDbUser "redmine" 
         RedmineDbPass "password" 
      </Location>
    
  6. 启用所需的 Apache 模块并重新启动 Apache
    $ sudo a2enmod dav_svn
    $ sudo /etc/init.d/apache2 restart
    
  7. 创建一个新的测试存储库
    $ sudo svn create /var/www/svn/test
    $ sudo chown -R www-data:www-data /var/www/svn/test
    

电子邮件集成

  1. 安装并配置 Sendmail
    $ sudo apt-get install sendmail
    $ sudo sendmailconfig
    
    (Answer Yes to all questions which you will be asked)
    
  2. 更新 Redmine 配置文件
    $ sudo nano /usr/share/redmine/config/configuration.yml
    
    Add the following text and save
    
     production:
       email_delivery:
         delivery_method: :sendmail
    

Dimitry Profus 更新 大约 13 年前 · 22 次修订