热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Ubuntu10.04+MySQL+Nginx安装与集成Redmine1.4

一、安装mysqlwww.linuxidc.com@linux:~$sudoapt-getinstallmysql-serverlibmysqlclient-dev二、安装nginx(安装步骤进行至passengernginx模块时,发现可以先不着急安装nginx,彼时一起安装)www.linuxidc.com@linux:~$sudoapt-getins
一、安装 mysql 
www.linuxidc.com @linux:~$ sudo apt-get install mysql-server libmysqlclient-dev


二、安装 nginx(安装步骤进行至passenger nginx 模块时,发现可以先不着急安装nginx,彼时一起安装)
www.linuxidc.com @linux:~$ sudo apt-get install nginx


三、安装ruby 1.8
www.linuxidc.com @linux:~$ sudo apt-get install ruby1.8


四、安装 RubyGems 1.8.24
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.zip\
www.linuxidc.com @linux:~$ tar -zxf ./rubygems-1.8.24.tgz 
www.linuxidc.com @linux:~$ cd rubygems-1.8.24/
www.linuxidc.com @linux:~/rubygems-1.8.24$ ruby ./setup.rb 


五、配置RubyGems(你懂的)
www.linuxidc.com @linux:~$ gem sources --clear-all
www.linuxidc.com @linux:~$ gem source --add http://ruby.taobao.org/
www.linuxidc.com @linux:~$ gem sources --update


六、安装bundle
www.linuxidc.com @linux:~/rubygems-1.8.24$ sudo gem install bundle


七、下载redmine 1.4
www.linuxidc.com @linux:~$  git clone https://github.com/redmine/redmine.git -b 1.4-stable ./redmine_1.4
www.linuxidc.com @linux:~$ sudo mv ./redmine_1.4/ /opt/
www.linuxidc.com @linux:~$ cd /opt/redmine_1.4/
www.linuxidc.com @linux:/opt/redmine_1.4$ rm ./.git -Rf


八、安装redmine 1.4 依赖包
#确保以下依赖包已经正常安装,以免反复
sudo apt-get install ruby1.8-dev libmagick9-dev libsqlite3-dev  libpq-dev
#其实使用mysql时这两个包 libsqlite3-dev  libpq-dev 并非必须,可以修改Gemfile来避免检查这两个包。
#如果将来希望使用“scrum-pm” 插件,在Redmine Gemfile中添加以下几行,是个好主意!


www.linuxidc.com @linux:/opt/redmine_1.4$ bundle install

Issue A:
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
How:
www.linuxidc.com @linux:/opt/redmine_1.4$ sudo apt-get installruby1.8-dev 

Issue B:
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
How:
www.linuxidc.com @linux:/opt/redmine_1.4$ sudo apt-get install libpq-dev

Issue C:
Can't install RMagick 2.13.1. Can't find Magick-config in ...
How:
www.linuxidc.com @linux:/opt/redmine_1.4$ sudo apt-get installlibmagick9-dev

Issue D: 
sqlite3.h is missing. Try 'port install sqlite3 +universal'
How:
www.linuxidc.com @linux:/opt/redmine_1.4$ sudo apt-get installlibsqlite3-dev


九、安装与配置redmine数据库
root@simba-laptop:/opt/redmine_1.4# mysql -u root -p
create database redmine character set utf8;  
create user 'redmine'@'localhost' identified by 'my_password';  
grant all privileges on redmine.* to 'redmine'@'localhost';  

root@simba-laptop:/opt/redmine_1.4# rake generate_session_store
root@simba-laptop:/opt/redmine_1.4# RAILS_ENV=production rake db:migrate

Issue A:
rake aborted!
no such file to load -- net/https
How:
root@simba-laptop:/opt/redmine_1.4#  apt-get install libopenssl-ruby1.8

www.linuxidc.com @linux:/opt/redmine_1.4$ RAILS_ENV=production rake redmine:load_default_data


十、配置权限
www.linuxidc.com @linux:/opt/redmine_1.4$ sudo useradd nginx -U
www.linuxidc.com @linux:/opt/redmine_1.4$ sudo chown -R nginx:nginx files log tmp public/plugin_assets
www.linuxidc.com @linux:/opt/redmine_1.4$ sudo chmod -R 755 files log tmp public/plugin_assets


十一、试运行
www.linuxidc.com @linux:/opt/redmine_1.4$ su - nginx
$ bash
nginx@simba-laptop:/opt/redmine_1.4$ cd /opt/redmine_1.4/
nginx@simba-laptop:/$ cd /opt/redmine_1.4/
nginx@simba-laptop:/opt/redmine_1.4$ ruby script/server webrick -e production


十二、集成至Nginx
#安装passenger
www.linuxidc.com @linux:/opt/redmine_1.4$ sudo gem install passenger

#确保以下依赖包已经正常安装,避免反复
www.linuxidc.com @linux:/opt/redmine_1.4$ sudo apt-get install libcurl4-openssl-dev
www.linuxidc.com @linux:/opt/redmine_1.4$ passenger-install-nginx-module 

Issue:看来不先安装Nginx也没问题:
Automatically download and install Nginx?

Nginx doesn't support loadable modules such as some other web servers do,
so in order to install Nginx with Passenger support, it must be recompiled.

Do you want this installer to download, compile and install Nginx for you?

1. Yes: download, compile and install Nginx for me. (recommended)
   The easiest way to get started. A stock Nginx 1.2.2 with Passenger
   support, but with no other additional third party modules, will be
   installed for you to a directory of your choice.

2. No: I want to customize my Nginx installation. (for advanced users)
   Choose this if you want to compile Nginx with more third party modules
   besides Passenger, or if you need to pass additional options to Nginx's
   'configure' script. This installer will  1) ask you for the location of
   the Nginx source code,  2) run the 'configure' script according to your
   instructions, and  3) run 'make install'.

Whichever you choose, if you already have an existing Nginx configuration file,
then it will be preserved.

Enter your choice (1 or 2) or press Ctrl-C to abort: 1


#开始自行下载、编译并安装Nginx,等待完成

#链接remine到 Nginx 默认主目录
www.linuxidc.com @linux:~$ sudo ln -s /opt/redmine_1.4/public/ /var/www/redmine

#编辑Nginx配置文件
www.linuxidc.com @linux:/opt$ sudo vim /opt/nginx/conf/nginx.conf
#参考配置如下:
  1.   user  nginx;  
  2.     worker_processes  1;  
  3.   
  4.   
  5.     #error_log  logs/error.log;  
  6.     #error_log  logs/error.log  notice;  
  7.     #error_log  logs/error.log  info;  
  8.   
  9.   
  10.     #pid        logs/nginx.pid;  
  11.   
  12.   
  13.     events   
  14.     {  
  15.         worker_connections  1024;  
  16.     }  
  17.   
  18.   
  19.   
  20.   
  21.     http   
  22.     {  
  23.         passenger_root /usr/lib/ruby/gems/1.8/gems/passenger-3.0.15;  
  24.         passenger_ruby /usr/bin/ruby1.8;  
  25.   
  26.   
  27.         include       mime.types;  
  28.         default_type  application/octet-stream;  
  29.   
  30.   
  31.         #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '  
  32.         #                  '$status $body_bytes_sent "$http_referer" '  
  33.         #                  '"$http_user_agent" "$http_x_forwarded_for"';  
  34.   
  35.   
  36.         #access_log  logs/access.log  main;  
  37.   
  38.   
  39.         sendfile        on;  
  40.         #tcp_nopush     on;  
  41.   
  42.   
  43.         #keepalive_timeout  0;  
  44.         keepalive_timeout  65;  
  45.   
  46.   
  47.         #gzip  on;  
  48.   
  49.   
  50.         server   
  51.         {  
  52.             listen       80;  
  53.             server_name  localhost;  
  54.             root /var/www;  
  55.   
  56.   
  57.             #charset koi8-r;  
  58.   
  59.   
  60.             #access_log  logs/host.access.log  main;  
  61.   
  62.   
  63.             location /   
  64.             {  
  65.                 root   html;  
  66.                 index  index.html index.htm;  
  67.             }  
  68.   
  69.   
  70.             location /redmine  
  71.             {  
  72.                 passenger_enabled on;  
  73.                 passenger_base_uri /redmine;  
  74.             }  
  75.   
  76.   
  77.   
  78.   
  79.             #error_page  404              /404.html;  
  80.   
  81.   
  82.             # redirect server error pages to the static page /50x.html  
  83.             #  
  84.             error_page   500 502 503 504  /50x.html;  
  85.             location = /50x.html   
  86.             {  
  87.                 root   html;  
  88.             }  
  89.         }  
  90.     }
#启动Nginx
www.linuxidc.com @linux:/opt$ sudo nginx

#测试
http://localhost/redmine


十三、安装插件
1、Redmine Sprints
#下载插件
www.linuxidc.com @linux:/opt/redmine_1.4$ sudo git clone git://github.com/software-project/scrum-pm.git vendor/plugins/redmine_sprints
www.linuxidc.com @linux:/opt/redmine_1.4/vendor/plugins$ sudo git clone git://github.com/technoweenie/attachment_fu.git  vendor/plugins/attachment_fu

#修改权限
www.linuxidc.com @linux:/opt/redmine_1.4$ cd vendor/plugins/
www.linuxidc.com @linux:/opt/redmine_1.4/vendor/plugins$ sudo chown -Rf nginx:nginx ./redmine_sprints/
www.linuxidc.com @linux:/opt/redmine_1.4/vendor/plugins$ chown -Rf nginx:nginx ./attachment_fu/

#关于此插件依赖包
建议体检修改Redmine Gemfile,在其中中添加以下几行:
gem "googlecharts", :require => "gchart"
gem "mini_magick"


2、code review
#下载redmine_code_review 并将其解压到 redmin/vendor/plugins
www.linuxidc.com @linux:/opt/redmine_1.4$ cd vendor/plugins/
www.linuxidc.com @linux:/opt/redmine_1.4$ cd vendor/plugins/ sudo chown -Rf nginx:nginx ./redmine_code_review/
sudo rake db:migrate_plugins RAILS_ENV=production

推荐阅读
author-avatar
傅笑寒
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有