[FreeBSD]Redmine2.1 Install(Ruby1.9 + Nginx + MySQL)

Step 0.安裝Nginx

#安裝時記得選取PASSENGER
cd /usr/ports/www/nginx;make install clean

Step 1. 修改/etc/make.conf,預設安裝Ruby1.9

RUBY_DEFAULT_VER=1.9

Step 2. 安裝Ruby1.9套件

#ruby19
cd /usr/ports/lang/ruby19;make install clean

#ruby-gem
cd /usr/ports/devel/ruby-gems;make install clean

#ruby-iconv:編碼套件
cd /usr/ports/converters/ruby-iconv;make install clean

#rubygem-passenger(要選取SYMLINK和NGINX):部署ruby的套件
cd /usr/ports/www/rubygem-passenger/;make install clean

#ruby-rmagick:圖片處理套件
cd /usr/ports/graphics/ruby-rmagick;make install clean

#安裝rails(如沒有gem指令,請先rehash)
gem19 install rails

Step 3. 安裝資料庫

#安裝Mysql(mysql-client一併安裝)
cd /usr/ports/databases/mysql55-server;make install clean

#安裝sqlite3
cd /usr/ports/databases/sqlite3;make install clean

#安裝postgresql92-client
cd /usr/ports/databases/postgresql92-client;make install clean

Step 4.環境基本設定
修改/etc/rc.conf,加入:

mysql_enable="YES"
nginx_enable="YES"

啟動、設定Mysql

#啟動Mysql
/usr/local/etc/rc.d/mysql-server start

#設定Mysql root密碼
mysqladmin -u root -p password 'new_password'

#建立redmine資料庫
mysql -u root -p
mysql> CREATE DATABASE redmine DEFAULT CHARSET utf8;

修改/usr/local/etc/nginx/nginx.conf(以下只列出有修改到的設定,log位置請自行設定)

http {
	passenger_root /usr/local/lib/ruby/gems/1.9/gems/passenger;
	passenger_ruby  /usr/local/bin/ruby19;
	server {
		location / {
			passenger_enabled on;
			passenger_use_global_queue on;
			root   /usr/local/www/redmine/public; #redmine路徑
		}
	}
}

啟動nginx

/usr/local/etc/rc.d/nginx start

Step 5.安裝Redmine
先到此處下載Source到/usr/local/www

bundle安裝

cd YOUR_REDMINE
gem install bundler
bundle install

套用範例設定檔

cd YOUR_REDMINE
#email的設定在此設定
cp config/configuration.yml.example config/configuration.yml
#資料庫設定
cp config/database.yml.example config/database.yml

修改資料庫設定config/database.yml(程式會套用production設定)

production:
  adapter: mysql2 #這裡要改成mysql2(Rails 3之後預設都是mysql2)
  database: redmine
  host: localhost
  username: root
  password: '123'
  encoding: utf8

初始化

cd YOUR_REDMINE

#產生secret token
rake generate_secret_token

#產生資料表
rake db:migrate RAILS_ENV=production

#產生預設設定檔
rake redmine:load_default_data RAILS_ENV=production

Step 6.測試
開啟瀏覽器輸入IP(http://localhost)測試,完成的話就會出現redmine首頁了

[jQuery]滑鼠雙擊(dblclick)

[Android]利用TelephonyManager取得電信資訊