不知道同事为什么执着于Redmine,倒是给了一台旧机器让我帮忙安装,记录一下遇到的一些坑,兴许能帮到需要的朋友。
安装Ruby
windows的话可以直接通过RubyInstaller进行安装。
Linux可以从源码安装。
系统是redhat,编译之前yum检查一下是否存在依赖项
yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel
不知道怎么搞的,yum
一直提示以下信息:
Error Message:
Abuse of Service detected for server xxxx
Error Class Code: 49
排查太麻烦,重新装了一次yum。
删除原来的yum
rpm -aq|grep yum|xargs rpm -e --nodeps
相关rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-60.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
安装
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-3.2.29-60.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
找了个可以用的yum源,放到/etc/yum.repos.d/
下,执行
yum clean all
yum makecache
再次执行后发现换了个提示
RHN yum command: Unable to read consumer identity Warning and Solution
按以下步骤操作解决问题
修改
- /etc/yum/pluginconf.d/product-id.conf
- /etc/yum/pluginconf.d/subscription-manager.conf
把里面的enabled改成0
保存退出并执行
rm -rf /var/cache/yum/*
yum clean all
好了,安装ruby
tar zxvf ruby.tar.gz
cd ruby
./configure
make
make install
ruby -v
export PATH=/usr/local/ruby/bin:$PATH
安装Redmine
tar zxvf redmine-2.6.2.tar.gz
mkdir /var/www/redmine
cd redmine-2.6.2
cp -av redmine-2.6.2/* /var/www/redmine
话说需要配置个数据库,刚好机器上带MySQL,给redmine创建库和用户
create database redmine character set utf8;
create user ‘redmine‘@‘localhost‘ identified by ‘my_password‘;
grant all privileges on redmine.* to ‘redmine‘@‘localhost‘ identified by ‘my_password‘;
修改下redmine里的数据库配置,修改名称和配置
cd /var/www/redmine/config
cp database.yml.example database.yml
用bundler搞依赖管理
gem install bundler
cd /var/www/redmine
bundle install
出现以下提示
linking shared-object fiddle.so
/usr/bin/ld: ./libffi-3.2.1/.libs/libffi.a(rawapi.o): relocation RX866432 against `.text‘ can not be used when making a shared object; recompile with -fPIC
./libffi-3.2.1/.libs/libffi.a: could not read symbols: Bad value
recompile with -fPIC
?
安装libffi-dev可以解决这个问题,参考https://github.com/sstephenson/ruby-build/issues/690#issuecomment-68113987
创建表
rake db:migrate RAILS_ENV="production"
加载默认配置
rake redmine:load_default_data RAILS_ENV="production"
启动
ruby script/rails server webrick -e production