Warning: exif_imagetype(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: exif_imagetype(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_005.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: file_get_contents(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_005.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: exif_imagetype(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: exif_imagetype(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_006.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: file_get_contents(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_006.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: exif_imagetype(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: exif_imagetype(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_007.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: file_get_contents(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_007.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: exif_imagetype(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: exif_imagetype(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_008.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: file_get_contents(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_008.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: exif_imagetype(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: exif_imagetype(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_009.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: file_get_contents(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_009.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: exif_imagetype(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: exif_imagetype(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_010.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: file_get_contents(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_010.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: exif_imagetype(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: exif_imagetype(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_011-1024x546.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: file_get_contents(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_011-1024x546.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: exif_imagetype(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: exif_imagetype(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_012.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: file_get_contents(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_012.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: exif_imagetype(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: exif_imagetype(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_013.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: file_get_contents(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_013.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: exif_imagetype(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: exif_imagetype(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_014-1024x352.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: file_get_contents(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_014-1024x352.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: exif_imagetype(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: exif_imagetype(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_015.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: file_get_contents(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_015.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: exif_imagetype(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: exif_imagetype(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_016-1024x477.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3332

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

Warning: file_get_contents(https://kb.pavietnam.vn/wp-content/uploads/2020/05/Selection_016-1024x477.png): Failed to open stream: no suitable wrapper could be found in /home/kbpavn/public_html/wp-includes/functions.php on line 3352

[DirectAdmin] Hướng dẫn cài đặt Ruby on Rail và Redmine trên Directadmin

  • Friday 08/05/2020

Trước khi P.A Việt Nam hướng dẫn cài đặt Ruby on Rail và Redmine trên DirectAdmin để sử dụng, chúng ta cần tìm hiểu 1 vài khái niệm và thông tin liên quan đến Ruby on Rail và Redmine.

Giới thiệu

Ruby on Rails là web framework được viết trên ngôn ngữ lập trình Ruby và được sử dụng trong việc xây dựng và phát triển các ứng dụng web.

Redmine là một công cụ quản lý vấn đề (issue) dựa trên nền tảng web, có thể áp dụng thực hiện các chức năng quản lý các loại vấn đề: nhiệm vụ, lỗi, yêu cầu hỗ trợ, … của dự án một cách cơ bản. Redmine có ưu thế trong quản lý dự án là đáp ứng sẵn sàng những nội dung được quan tâm cho các vai trò từ quản lý dự án tới các thành viên trong dự án và các cá nhân/nhóm/bộ phận liên quan khác.

DirectAdmin là một công cụ quản trị hosting, trực quan, dễ sử dụng,

Redmine là một công cụ để quản lý dự án, được viết bằng ngôn ngữ Ruby on Rails. Redmine là một ứng dụng open source nên nó miễn phí và được cung cấp bởi GNU General Public License v2 (GPL). Một số tính năng của redmine:

  • Hỗ trợ nhiều project
  • Quản lý kết nối
  • Hệ thống theo dõi tiến độ công việc
  • Quản lý tin tức, tài liệu
  • Hệ thống cảnh báo qua email
  • Hỗ trợ xác thực bằng Ldap
  • Hỗ trợ đa ngôn ngữ
  • Hỗ trợ nhiều database

Thực Hiện

Bài viết này P.A Việt Nam sẽ hướng dẫn cách cài đặt Ruby on Rail và Redmine trên DirectAdmin để hoạt động.

Môi trường hệ thống:

OS: CentOS 6

Control panel: DirectAdmin

Webserver: Apache

PHP: 5.6

Bước 1: Cài đặt các gói cần thiết

yum install -y git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel

Bước 2: Cài đặt rbenv

cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
rbenv install -l

Bước 3: Cài đăt Ruby

rbenv install -v 2.6.6
rbenv rehash
rbenv global 2.6.6

Kiểm tra version Ruby:

ruby -v

Selection 005

Bước 4: Cài đặt Rails

gem install rails

Kiểm tra version Rails:

rails -v

Selection 006

Bước 5: Cài đặt bundler

gem install bundler

Selection 007

Bước 6: Cài đặt passengerpassenger và Apache passenger modude

gem install passenger

Selection 008

passenger-install-apache2-module

Có thể sử dụng các thiết đặt mặc định của module (Enter 2 lần khi được hỏi thông số cài đặt)

Khi module được cài đặt xong, hệ thống sẽ tự động tạo ra đường dẫn tới thư viện của Passenger, cần lưu lại các thông tin này để thêm vào file cấu hình httpd.conf sau này. Tại đây thông số được tạo ra là:

Selection 009

Bước 7: Cài đặt Redmine

Tạo hosting cho domain cần sử dụng trên hệ thống Directadmin, tại đây ta sử dụng domain patestredmine.vn, sử dụng giao diện quản trị của Directadmin:

Selection 010

Truy cập gói host mới tạo và upload source code, sau đó giải nén và copy source code ra public_html

Selection 011

Tạo database cho Redmine trên DirectAdmin sử dụng chức năng MySQL Management

Selection 012

Tạo file kết nối database cho Redmine
Truy cập thư mục của gói hosting thông qua SSH.

Mặc định hệ thống Directadmin khi tạo hosting, các file upload lên hosting sẽ được lưu tại /home/tên_user/domain/tên_domain/public_html.
Trong trường hợp này là /home/patestredm/domains/patestredmine.vn/public_html/

Copy file database.yml.example thành database.yml trong thư mục config của Redmine

cd /home/patestredm/domains/patestredmine.vn/public_html/config
cp database.yml.example database.yml

Tiến hành chỉnh sửa file database.yml và thay đổi thông số kết nối tới Database vừa được tạo:

vi database.yml

Trong trường hợp này là:

production:
adapter: mysql2
database: patestredm_db
host: localhost
username: patestredm_db
password: “123456”
encoding: utf8

Lưu lại các thay đổi.

Quay lại thư mục chính của hosting:

cd /home/patestredm/domains/patestredmine.vn/public_html

Cài đặt các gems cần thiết để sử dụng Redmine:

bundle install --without postgresql sqlite test development

Tạo Secrect token:

rake generate_secret_token

Tạo cấu trúc Database cho Redmine:

rake db:migrate RAILS_ENV="production"

Tạo các thiết đặt mặc định của Redmine trên Database:

rake redmine:load_default_data RAILS_ENV="production"

Bước 8: Cấu hình httpd

Tìm kiếm file httpd được sử dụng bởi hệ thống Directadmin ứng với domain patestredmine.vn

httpd -S | grep patestredmine.vn

Kết quả tìm kiếm được:

Selection 013

Tại đây đường dẫn tới file cấu hình của domain patestredmine.vn là: /usr/local/directadmin/data/users/patestredm/httpd.conf

Tiến hành thêm cấu hình passenger đã được tạo ra từ bước trước vào file cấu hình htttpd trên.

Thêm:

LoadModule passenger_module /root/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/passenger-6.0.4/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /root/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/passenger-6.0.4
PassengerDefaultRuby /root/.rbenv/versions/2.6.6/bin/ruby
</IfModule>

Selection 014

Lưu lại thay đổi, và chỉnh file cấu hình trên sang “Readonly”, tránh trường hợp Directadmin tự động chỉnh sửa file cấu hình trên, dẫn tới mất configure của Passenger.

chattr +i /usr/local/directadmin/data/users/patestredm/httpd.conf

Bước 9: Khởi động lại dịch vụ webserver

/etc/init.d/httpd restart

Hoặc:

service httpd restart

Selection 015

Thông tin đăng nhập mặc định là admin/admin

cài đặt Ruby on Rail và Redmine

Như vậy qua bài viết này P.A Việt Nam đã hướng dẫn cài đặt Ruby on Rail và Redmine trên DirectAdmin để sử dụng.

Mọi chi tiết khác cần hỗ trợ, vui lòng gửi yêu cầu về kythuat@pavietnam.vn hoặc hotline 19009477 ext: 2

Dịch vụ VPS/Server vui lòng tham khảo tại đây.

Xem thêm các hướng dẫn khác liên quan đến dịch vụ VPS/Server tại đây.

Thông tin chương trình khuyến mãi tại P.A Việt Nam tại đây

Rate this post