本篇主要說明如何在uBuntu安裝redmine,備份redmine資料庫,設定e-mail讓redmine可以發mail給使用者。
版本:Redmine 1.4.4.stable,ruby 1.9.3p194 (2012–04–20 revision 35410)
最後更新日期:2013/8/22
安裝Apache, mod-passenger, and MySQL
首先安裝apache和mod-passenger( 主要是用來做Ruby應用程式的佈署,比如說Ruby on Raila的Framework)
$ sudo apt-get install apache2 libapache2-mod-passenger
再來安裝MySQL
$ sudo apt-get install mysql-server mysql-client
在完裝完MySQL後,會跳出一個window需要輸入DB的root登入密碼。然後在第2個畫面輸入密碼做確認。
Package configuration
┌────────────────────┤ Configuring mysql-server-5.5 ├─────────────────────┐
│ While not mandatory, it is highly recommended that you set a password │
│ for the MySQL administrative "root" user. │
│ │
│ If this field is left blank, the password will not be changed. │
│ │
│ New password for the MySQL "root" user: │
│ │
│ _______________________________________________________________________ │
│ │
│ <Ok> │
│ │
└─────────────────────────────────────────────────────────────────────────┘
┌────┤ Configuring mysql-server-5.5 ├──────────┐
│ │
│ Repeat password for the MySQL "root" user. │
│ │
│ │
│ ____________________________________________ │
│ │
│ <Ok> │
│ │
└──────────────────────────────────────────────┘
安裝redmine package
接下來開始安裝redmine
$ sudo apt-get install redmine redmine-mysql
安裝完成後會跳出一個畫面問說要不要去設定database。在這𥚃我們選擇Yes
┌──────────────────────────┤ Configuring redmine ├──────────────────────────┐
│ │
│ The redmine/instances/default package must have a database installed and │
│ configured before it can be used. This can be optionally handled with │
│ dbconfig-common. │
│ │
│ If you are an advanced database administrator and know that you want to │
│ perform this configuration manually, or if your database has already │
│ been installed and configured, you should refuse this option. Details │
│ on what needs to be done should most likely be provided in │
│ /usr/share/doc/redmine/instances/default. │
│ │
│ Otherwise, you should probably choose this option. │
│ │
│ Configure database for redmine/instances/default with dbconfig-common? │
│ │
│ <Yes> <No> │
│ │
└───────────────────────────────────────────────────────────────────────────┘
然後下一個畫面會問說要用哪一種database。因為我們安裝的是MySQL,所以常然選擇MySQL
┌──────────────────────────┤ Configuring redmine ├──────────────────────────┐
│ The redmine/instances/default package can be configured to use one of │
│ several database types. Below, you will be presented with the available │
│ choices. │
│ │
│ Database type to be used by redmine/instances/default: │
│ │
│ sqlite3 │
│ pgsql │
│ mysql │
│ │
│ │
│ <Ok> <Cancel> │
│ │
└───────────────────────────────────────────────────────────────────────────┘
下一個畫面需要輸入MyAQL DB的密碼,輸入剛剛安裝MySQL時輸入的root密碼
┌──────────────────────────┤ Configuring redmine ├──────────────────────────┐
│ Please provide the password for hte administrative account with which │
│ this package should create its MySQL database and user. │
│ │
│ Password of the database's administrative user: │
│ │
│ ******__________________________________________________________________ │
│ │
│ <Ok> <Cancel> │
│ │
└───────────────────────────────────────────────────────────────────────────┘
下一個畫面要求輸入一個密碼來保護redmine的DB(與MySQL的root密碼不同)。輸入一個密碼給redmine DB。
┌──────────────────────────┤ Configuring redmine ├──────────────────────────┐
│ Please provide a password for redmine/instances/default to register with │
│ the database server. If left blank, a random password will be │
│ generated. │
│ │
│ MySQL application password for redmine/instances/default: │
│ │
│ *******__________________________________________________________________ │
│ │
│ <Ok> <Cancel> │
│ │
└───────────────────────────────────────────────────────────────────────────┘
接下來會再要求確認一次redmine DB的密碼
┌────┤ Configuring redmine ├─────┐
│ │
│ │
│ Password confirmation: │
│ │
│ *******_______________________ │
│ │
│ <Ok> <Cancel> │
│ │
└────────────────────────────────┘
到這邊就算是將套件安裝完成,接下來就開始設定其他的項目。
設定Apache
需要設定2個檔案:
/etc/apache2/mods-available/passenger.conf
/etc/apache2/sites-available/default
首先來修改passenger.conf
$ sudo vi /etc/apache2/mods-available/passenger.conf
修改內容如下:
<IfModule mod_passenger.c>
PassengerDefaultUser www-data
PassengerRoot /usr
PassengerRuby /usr/bin/ruby
</IfModule>
再來建立redmine的space到apache的www中:
$ sudo ln -s /usr/share/redmine/public /var/www/redmine
下一步是設定/etc/apache2/sites-available/default
之前我們已經將redmine的space做了symlink到/var/www/redmine,這𥚃要建立一台redmine的server連結到/var/www/redine,修改內容如下:
$ sudo vi /etc/apache2/sites-available/default
<Directory /var/www/redmine>
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>
然後再重啟apache
$ sudo service apache2 restart
用本機測試redmine是否已經正確設定並正常的工作
$ firefox http://127.0.0.1/redmine
看到redmine首頁後,可以點選右上角的Sign In,並以admin登入,預設密碼為admin。
Note: 這個密碼與安裝redmine DB時輸入的密碼不同。
強烈建議登入後修改admin的密碼,以確保系統安全。
設定e-mail
使用G-Mail
Note(2013/8/21):新版本的redmine/ruby不可安裝action_mailer_optional_tls
使用新版本的redmine/ruby時,已經不再使用email.yml,而是使用configuration.yml。
先將configuration.yml.example拷貝一份到/etc/redmine/default
$ cd /usr/share/redmine/config
$ sudo cp ./configuration.yml.example /etc/redmine/default/configuration.yml
接下來使用vim修改configuration.yml(在etc/redmine/default目錄下)
$ cd /etc/redmine/default
$ sudo vim configuration.yml
將default區塊修改如下:(縮排的空格很重要,務必要照原本的example的格式,否則會有問題)
default:
email_delivery:
delivery_method: :smtp
smtp_settings:
tls: true
enable_starttls_auto: true
address: "smtp.gmail.com"
port: 587
domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps
authentication: :plain
user_name: "your_email@gmail.com"
password: "your_password"
修改完存檔後,需要修改這個檔案的owner及權限
$ sudo chown root:www-data configuration.yml
$ sudo chmod 0640 configuration.yml
重新啟動apache
$ sudo service apache2 restart
FAQ
為何已經將administration/Settings/Display的預設語言改為中文,但顯示界面還是英文?
每個使用者可以設定自已的使用界面語言。到MyAccount,在Language選項改為中文即可。
發生An error occurred while sending mail (Expected …/version.rb to define VERSION),要如何處理?
參考文章
官方文件-安裝redmine in uBuntu
英文版的安裝文件Step By Step,我的這一篇大部份也是參考這一份來做的。除了mail的設定部份,文件中所描述的大部份都是可行的。
官方網站for mail configuration
由官方所提供的Email configuration設置。建構中。
Redmine+Apache+SVN+Postfix完整配置指南
由葵中劍Blog發表,雖然是2010的文章,用的是較舊的版,還是可以用來參考。
另一個安裝redmine的網站文件
以question/answer的方式提供plug-in,svn,mail的設定方式,很有參考性。