首页 > 代码库 > Ubuntu+apache安装redmin

Ubuntu+apache安装redmin

0 切换到root

sudo su

1 依赖包

sudo apt-get install mysql-server libmysqlclient-dev git-core subversion imagemagick libmagickwand-dev libcurl4-openssl-dev
sudo apt-get install apache2 libapache2-mod-passenger
sudo apt-get install mysql-server mysql-client 

2 安装ruby

gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
curl -L https://get.rvm.io | bash -s stable --ruby=2.0.0
source /usr/local/rvm/scripts/rvm
//这样就安装好rvm了
echo [[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm" >> ~/.bashrc
//这一步是改成国内的源
sed -i .bak s!ftp.ruby-lang.org/pub/ruby!ruby.taobao.org/mirrors/ruby! $rvm_path/config/db 
//然后安装ruby
rvm requirements
rvm install 2.3.0
//然后安装passenger
gem install passenger --no-ri --no-rdoc
passenger-install-apache-module

3 安装redmine

tar -xvf redmine-3.3.3
cd redmine-3.3.3
gem install bundler             //安装bundler,好处是不需要使用gem 一个一个的安装模块,坏处的不能控制版本。官网http://gembundler.com/
bundle install

4 准备数据库

create database redmine character set utf8;
create user redmine@localhost identified by redmine;//在数据库中创建redmine用户,密码也是redmine
grant all privileges on redmine.* to redmine@localhost;

5 配置数据库连接

5 配置数据库连接
cd config
cp database.yml.example database.yml    //配置redmine连接MySQL
vim database.yml
//修改为:
production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: redmine
  encoding: utf8
//其他参考此项

6 Session store secret generation

cd ..
rake generate_secret_token       //生成config/initializers/secret_token.rb文件,在redmine 2.1.4中,这个文件事先是不存在的,如果事先有,删除掉。

7  Database schema objects creation

RAILS_ENV=production rake db:migrate   //初始化数据库,创建表

8 Database default data set

RAILS_ENV=production rake redmine:load_default_data   //插入缺省数据,选择zh

9 File system permissions

mkdir tmp tmp/pdf public/plugin_assets              //主要是修改文件夹权限,如果有了可以不创建,只修改权限和属主
chown -R apache:apache files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets

10 和apache整合

//在/etc/apache2/mods-available/passenger.conf中覆盖
   <IfModule mod_passenger.c>
     PassengerRoot /usr/local/rvm/gems/ruby-2.3.0/gems/passenger-5.1.2
     PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.3.0/wrappers/ruby
   </IfModule>
//在/etc/apache2/mods-available/passenger.load中覆盖
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.3.0/gems/passenger-5.1.2/buildout/apache2/mod_passenger.so

11 配置web目录

sudo ln -s /redmine安装目录/public /var/www/html/redmine
//在 /etc/apache2/sites-available/000-default.conf中配置
        <Directory /var/www/html/redmine>
            Options -MultiViews
            PassengerAppEnv development
            RailsBaseURI /redmine
            PassengerResolveSymlinksInDocumentRoot on
            Order deny,allow
            allow from all
        </Directory>

12 注意事项

执行 touch /redmin安装目录/tmp/restart.txt就是重启passenger

13 Congratulation!

技术分享

 

Ubuntu+apache安装redmin