Redmine Redmine 入门系列——一 Ubuntu 下安装 Redmine

bernardlai · 发布于 2016年3月11日 · 91 次阅读
53642

[i=s] 本帖最后由 行者赖 于 2016-3-11 17:28 编辑

[align=center] 安装Redmine [/align]

验证环境:Ubuntu12.04或者14.04 中间件:Apache2、Mysql2、Ruby on Rails

步骤一:安装mysql并创建redmine实例 为防止mysql版本问题,如果系统中有安装失败的mysql先卸载mysql。 sudo apt-get remove --purge mysql-server sudo apt-get remove mysql-server sudo apt-get remove mysql-common 安装mysql sudo apt-get install mysql-server mysql-client 初始化root用户密码 创建redmine数据库并授权 [code]mysql -u root –p GRANT ALL PRIVILEGES ON . TO root@"%" IDENTIFIED BY "password"; create database redmine character set utf8; CREATE USER redmine IDENTIFIED BY 'password'; grant all PRIVILEGES on redmine.* to redmine@'%' identified by 'password'; flush privileges; exit;[/code] 以上内容在mysql中执行。 更改mysql配置,允许所有ip访问。 [code]sudo vi /etc/./mysql/my.cnf bind-address = 0.0.0.0[/code] 可以根据安全策略进行调整 步骤二:安装redmine主程序及结合mysql的模块 更新ruby到1.9.3 [code]sudo apt-add-repository ppa:brightbox/ruby-ng sudo apt-get update sudo apt-get install ruby rubygems ruby-switch sudo apt-get install ruby1.9.1[/code] 更换gem源(rubygems源可以不删除) [code]sudo gem sources -l sudo gem sources --remove http://rubygems.org/ sudo gem sources -a https://ruby.taobao.org//code][

安装gem插件 [code]sudo gem install bundler sudo gem install rake -v 10.4.2 sudo gem install i18n -v 0.7.0 sudo gem install json -v 1.8.3 sudo gem install minitest -v 5.8.1 sudo gem install thread_safe -v 0.3.5 sudo gem install tzinfo -v 1.2.2 sudo gem install activesupport -v 4.2.4 sudo gem install builder -v 3.2.2 sudo gem install erubis -v 2.7.0 sudo gem install mini_portile -v 0.6.2 sudo gem install nokogiri -v 1.6.6.2 sudo gem install rails-deprecated_sanitizer -v 1.0.3 sudo gem install rails-dom-testing -v 1.0.7 sudo gem install loofah -v 2.0.3 sudo gem install rails-html-sanitizer -v 1.0.2 sudo gem install actionview -v 4.2.4 sudo gem install rack -v 1.6.4 sudo gem install rack-test -v 0.6.3 sudo gem install actionpack -v 4.2.4 sudo gem install globalid -v 0.3.6 sudo gem install activejob -v 4.2.4 sudo gem install mime-types -v 2.6.2 sudo gem install mail -v 2.6.3 sudo gem install actionmailer -v 4.2.4 sudo gem install actionpack-action_caching -v 1.1.1 sudo gem install actionpack-xml_parser -v 1.0.2 sudo gem install activemodel -v 4.2.4 sudo gem install arel -v 6.0.3 sudo gem install activerecord -v 4.2.4 sudo gem install coderay -v 1.1.0 sudo gem install colorize -v 0.7.7 sudo gem install polyglot -v 0.3.5 sudo gem install bundler -v 1.10.6 sudo gem install thor -v 0.19.1 sudo gem install railties -v 4.2.4 sudo gem install sprockets -v 3.4.0 sudo gem install sprockets-rails -v 2.3.3 sudo gem install rails -v 4.2.4 sudo gem install deface -v 1.0.1 sudo gem install docile -v 1.1.5 sudo gem install tilt -v 2.0.1 sudo gem install haml -v 4.0.7 sudo gem install sexp_processor -v 4.6.0 sudo gem install ruby_parser -v 3.7.1 sudo gem install html2haml -v 2.0.0 sudo gem install haml-rails -v 0.9.0 sudo gem install mixlib-shellout -v 2.2.1 sudo gem install terminal-table -v 1.5.2 sudo gem install jenkins_api_client -v 1.3.0 sudo gem install jquery-rails -v 3.1.4 sudo gem install multi_json -v 1.11.2 sudo gem install mysql2 -v 0.3.20 sudo gem install net-ldap -v 0.3.1 sudo gem install protected_attributes -v 1.1.3 sudo gem install ruby-openid -v 2.3.0 sudo gem install rack-openid -v 1.4.2 sudo gem install rbpdf -v 1.18.6 sudo gem install redcarpet -v 3.3.3 sudo gem install request_store -v 1.0.5 sudo gem install require_patch -v 0.1.0 sudo gem install rmagick -v 2.15.4 sudo gem install rubyzip -v 1.1.7 sudo gem install simplecov-html -v 0.9.0 sudo gem install simplecov -v 0.9.2 sudo gem install simplecov-rcov -v 0.2.3 sudo gem install will_paginate -v 3.0.7 sudo gem install mini_portile2 -v '2.0.0' sudo gem install rufus-scheduler [/code] 以上gem可以在使用时进行安装。 解压缩最新版本的redmine到/usr/share/redmine [code]sudo bundle install --without development test sudo bundle install --without development test rmagick[/code] 执行数据库脚本 [code]bundle exec rake db:migrate RAILS_ENV=production[/code] 设置Session存储 [code]bundle exec rake generate_secret_token[/code] 以上步骤为3.0,其他版本参考官方文档。 安装插件 上传插件到plugins下面 sudo chown -R redmine:redmine . bundle install --without development test bundle exec rake redmine:plugins:migrate RAILS_ENV=production 注意redmine的启动用户的权限

步骤三:配置apache2和passanger 卸载旧的apache2(如果apache2没有更改过不用次步骤) [code]sudo apt-get remove apache2 sudo apt-get remove apache2.2-common sudo find /etc -name "apache" |xargs sudo rm -rf sudo rm -rf /var/www sudo rm -rf /etc/libapache2-mod-jk #su root #dpkg -l |grep apache2|awk '{print $2}'|xargs dpkg -P[/code] 安装新的apache2 [code]sudo apt-get install apache2.2-common sudo apt-get install apache2 sudo apt-get install libapache2-mod-passenger sudo apt-get install libaprutil1-dev sudo apt-get install libapr1-dev sudo apt-get install apache2-threaded-dev[/code] 更改redmine程序文件夹的权限 [code]sudo chown -R www-data:www-data /usr/share/redmine sudo chmod -R 755 /usr/share/redmine[/code] 创建redmine程序文件夹 [code]sudo ln -s /usr/share/redmine/public /var/www/redmine[/code] 安装并配置passenger [code]sudo gem install passenger sudo apt-get install libaprutil1-dev sudo apt-get install apache2-threaded-dev sudo apt-get install libapr1-dev[/code]

注意以下为libsqlite3-dev安装失败的强制安装方法 #sudo dpkg --force-depends --purge libsqlite3-0:amd64 [code]sudo dpkg --purge --force-depends libsqlite3-0 sudo apt-get install libsqlite3-0 sudo apt-get install -f sudo apt-get install libsqlite3-dev[/code] 注意以上为libsqlite3-dev安装失败的强制安装方法 sudo passenger-install-apache2-module 选择1 修改以下文件,注意路径需要根据实际情况调整。 sudo gedit /etc/apache2/mods-enabled/passenger.conf PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-5.0.25 PassengerDefaultRuby /usr/local/bin/ruby

sudo gedit /etc/apache2/mods-enabled/passenger.load
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-5.0.21/buildout/apache2/mod_passenger.so 或者直接修改/etc/apache2/apache2.cnf 修改配置文件 [code]sudo gedit /etc/apache2/sites-enabled/000-default ServerAdmin webmaster@localhost

Do not restart application nor spawner

#RailsAppSpawnerIdleTime 0 #PassengerPoolIdleTime 0 #PassengerSpawnMethod direct
PassengerMaxPreloaderIdleTime 0 PassengerMinInstances 1

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ErrorLog /var/log/apache2/error.log
#其他配置 foo...

DocumentRoot /var/www
Options +ExecCGI -MultiViews
AllowOverride all
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on

[/code] 重启apache2服务 [code]sudo service apache2 restart[/code]

暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册