redmine3.3安裝筆記

e71hao發表於2016-11-11
    本筆記是記錄redmine在linux centos6.8 x86_64下的安裝過程。redmine 是ruby寫的專案管理工具,中間需要用到web伺服器webrick,其中webrick在redmine已經有了,另外需要安裝的是mysql、ruby、bundler。

     1.在官網下載redmine3.3.1到linux下。解壓後目錄:
[root@wiki redmine-3.3.1]# ls
app           bin     config.ru        db   extra  Gemfile       lib  plugins  Rakefile     script  tmp
appveyor.yml  config  CONTRIBUTING.md  doc  files  Gemfile.lock  log  public   README.rdoc  test    vendor

    2.檢視安裝檔案install  ,$redmine_home/doc/install檔案:

點選(此處)摺疊或開啟

  1. == Redmine installation
  2. Redmine - project management software
  3. Copyright (C) 2006-2016 Jean-Philippe Lang
  4. http://www.redmine.org/
  5. == Requirements
  6. * Ruby >= 1.9.3
  7. * RubyGems
  8. * Bundler >= 1.5.0
  9. * A database:
  10.   * MySQL (tested with MySQL 5.1)
  11.   * PostgreSQL (tested with PostgreSQL 9.1)
  12.   * SQLite3 (tested with SQLite 3.7)
  13.   * SQLServer (tested with SQLServer 2012)
  14. Optional:
  15. * SCM binaries (e.g. svn, git...), for repository browsing (must be
  16.   available in PATH)
  17. * ImageMagick (to enable Gantt export to png images)
告訴我們,至少要ruby1.9版本以上,mysql5.1以上。ruby1.9以上gem.
rubygems,bundler是ruby的打包安裝器,類似rpm和yum。

3.安裝ruby ,請網上百度搜尋關鍵字:“ruby 2.2 安裝”。這裡我只說下重點:ruby安裝有依賴包,請先安裝ruby依賴包,否則會出現如下錯誤:
  1. ERROR:  Loading command: install (LoadError)  
  2. no such file to load — zlib  
  3. ERROR:  While executing gem … (NameError)  
  4. uninitialized constant Gem::Commands::InstallCommand 

4.ruby 安裝好後,有個源要更改,否則gem 安裝東西的時候,特別慢。gem是什麼玩意?就是從遠端伺服器搜尋ruby包,下載本地安裝的工具,類似yum,rpm。
 gem sources --add http://gems.ruby-china.org/ --remove https://rubygems.org/  

5.ruby安裝好後,安裝bundler. bundler的官網是http://bundler.io/




==================分割線=======================
以上軟體都準備好之後,可以按照install,往下安裝。
以下是摘錄redmine軟體解壓,找到安裝檔案install:
3. Configure the database parameters in config/database.yml
在config中copy一份database.yml.example,然後根據情況更改。

點選(此處)摺疊或開啟

  1.   production:
  2.   adapter: mysql2
  3.   database: redmine
  4.   host: localhost
  5.   username: redmine
  6.   password: "redmine123"
  7.   encoding: utf8
在這裡,你可能會疑惑mysql2是什麼意思?其實這是ruby連線mysql的一種驅動程式。如下
[root@wiki config]# gem list |grep mysql
mysql2 (0.4.5, 0.3.21)
驗證:你需要在本地驗證測試一下,看看能不能連線上資料庫,mysql -uredmine  -predmine123.
4. Install the required gems by running:
     bundle install --without development test
在這個步驟,你會看到bundle 在刷刷的安裝程式,把相互依賴的程式都安裝了,類似yum,類似perl的cpanm。是不是很爽?
你還會看到,ruby通過mysql2連線程式連線到mysql資料庫,然後插入了很多表,很多資料。看下都有哪些表:

點選(此處)摺疊或開啟

  1. mysql> show tables;
  2. +-------------------------------------+
  3. | Tables_in_redmine |
  4. +-------------------------------------+
  5. | attachments |
  6. | auth_sources |
  7. | boards |
  8. | changes |
  9. | changeset_parents |
  10. | changesets |
  11. | changesets_issues |
  12. | comments |
  13. | custom_field_enumerations |
  14. | custom_fields |
  15. | custom_fields_projects |
  16. | custom_fields_roles |
  17. | custom_fields_trackers |
  18. | custom_values |
  19. | documents |
  20. | email_addresses |
  21. | enabled_modules |
  22. | enumerations |
  23. | groups_users |
  24. | import_items |
  25. | imports |
  26. | issue_categories |
  27. | issue_relations |
  28. | issue_statuses |
  29. | issues |
  30. | journal_details |
  31. | journals |
  32. | member_roles |
  33. | members |
  34. | messages |
  35. | news |


5. Generate a session store secret
  bundle exec rake generate_secret_token
在這個步驟我報錯,不過我忽略了
7. Setting up permissions (Windows users have to skip this section)
我跳過,因為我全部都是在root下執行
8. Test the installation by running the WEBrick web server
   
   Under the main application directory run:
     ruby bin/rails server -e production
在這個步驟,請在redmine的安裝目錄下執行。就是ruby啟動了自動的web伺服器:webrick,可以看到,這個werick只是繫結在127.0.0.1 IP上監聽的,其他機器訪問不到,需要把上面命令稍微改造下:
 nohup ruby bin/rails server -e production --binding=172.16.0.200  &
加引數--binding
好啦,大功告成,用瀏覽器登入看看:


最後在總結下:redmine是用ruby寫的,不熟悉ruby的朋友 ,能花個半天時間熟悉ruby,gem,bundler,安裝定能事半功倍。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30393770/viewspace-2128287/,如需轉載,請註明出處,否則將追究法律責任。

相關文章