Mặc định server đã có sẵn những thành phần sau: 1. CentOS 6.8 2. MySQL 5.6 3. Apache 2.4 4. Ruby 2.3 5. gem 2.0.14 ###1. Cài đặt bundler bundler là gì có thể xem tại đây: http://bundler.io/ ~~~Bash $ gem install bundler ~~~ ###2. Cài đặt passenger **Tải source code của passenger** ~~~Bash $ gem install passenger ~~~ **Complile module passenger cho Apache** Thực hiện lệnh dưới và làm theo hướng dẫn: ~~~Bash $ passenger-install-apache2-module ~~~ > Lỗi gặp phải trong quá trình cài đặt > 1. Không tìm thấy openssl/pem.h > chạy lệnh `yum install openssl-devel` để cài đặt **Load module và thiết lập cho module passenger trong Apache** Tạo file conf với nội dung như sau: _Chú ý: Sau khi complie xong module passenger, chương trình sẽ xuất ra đoạn setting để paste vào file config cho Apache. Tùy vào phiên bản passenger và đường dẫn của ruby mà nội dung được tạo sẽ khác nhau._ ~~~Bash $ vim /etc/conf.d/passenger.conf # Dưới đây là nội dung mà chương trình compile Passenger xuất ra LoadModule passenger_module /usr/local/rvm/gems/ruby-2.4.0/gems/passenger-5.1.8/buildout/apache2/mod_passenger.so PassengerRoot /usr/local/rvm/gems/ruby-2.4.0/gems/passenger-5.1.8 PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.4.0/wrappers/ruby # Dưới đây là nội dung setting thêm # # Passengerが追加するHTTPヘッダを削除するための設定(任意)。 # Header always unset "X-Powered-By" Header always unset "X-Rack-Cache" Header always unset "X-Content-Digest" Header always unset "X-Runtime" # 必要に応じてPassengerのチューニングのための設定を追加(任意)。 # 詳しくはPhusion Passenger users guide(http://www.modrails.com/documentation/Users%20guide%20Apache.html)をご覧ください。 PassengerMaxPoolSize 1 PassengerMaxInstancesPerApp 1 PassengerPoolIdleTime 3600 PassengerHighPerformance on PassengerStatThrottleRate 10 PassengerSpawnMethod smart ~~~ ###3. Cài đặt Redmine **Tải Redmine** ~~~Bash $ wget http://www.redmine.org/releases/redmine-3.3.2.tar.gz $ tar zxvf redmine-3.3.2.tar.gz ~~~ **Chỉnh sửa setting database, configuration** Đổi tên file: * `config/database.yml.example` -> `config/database.yml` * `config/configuration.yml.example` -> `config/configuration.yml` Thay đổi nội dung file `config/database.yml` và `config/configuration.yml` cho phù hợp với thông tin trên server. Setting để gửi mail: Cách làm chi tiết coi tại đây: http://www.redmine.org/projects/redmine/wiki/EmailConfiguration ~~~Ruby # config/configuration.yml email_delivery: delivery_method: :smtp smtp_settings: 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" ~~~ Nếu tài khoản Gmail có bật chế độ xác nhận 2 bước thì phải sử dụng password đăng nhập dành cho app 'Google App password'. **Deploy Redmine bằng bundle** ~~~Bash # 1. Install các gem cần thiết cho Redmine $ bundle install --without development test # 2. Tạo mới secret_token $ bundle exec rake generate_secret_token # 3. Tạo database cho Redmine $ RAILS_ENV=production bundle exec rake db:migrate ~~~ Chú ý: Để thực hiện được lệnh thứ 3, cần thiết lập cho user kết nối với database những quyền sau: * CREATE, ALTER, INDEX, DROP > Lỗi gặp phải trong quá trình cài đặt > 2. Không cài đặt được rmagick > chạy lệnh `yum install ImageMagick ImageMagick-devel` để cài đặt thư viện cần thiết ###4. Thiết lập virtual host cho app Redmine Thêm nội dung sau vào file config virtual host của Apache: ~~~ ServerName redmine.nvb-online.com DocumentRoot /path/to/redmine/public ServerAdmin This email address is being protected from spambots. You need JavaScript enabled to view it. ErrorLog /var/log/httpd/redmine.error_log CustomLog /var/log/httpd/redmine.access_log common ~~~ Restart lại Apache ~~~ $ service httpd restart ~~~ ###5. Truy cập vào redmine Truy cập vào redmine theo đường dẫn đã thiết lập ở bước 4. Nếu cài đặt thành công sẽ xuất hiện màn hình đăng nhập. Thông tin đăng nhập mặc định là: | User name | Password | |-----------|----------| | admin | admin |