- Tải RubyInstaller và cài đặt, chọn thiết lập biến môi trường trong quá trình cài đặt để có thể sử dụng lệnh của Ruby trên Command line bất cứ đâu. { ví dụ: Ruby 1.9.3-p545 }
- Tải Development Kit (cùng trang với RubyInstaller) với phiên bản tương ứng { ví dụ: DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe }
- Cài đặt Development Kit
- Giải nén file vừa tải { C:\ruby_dk }
- Mở command line [cmd] (thao tác nhanh: Windows + R -> Open: cmd -> OK/Enter)
- Nhảy đến thư mục vừa giải nén Development Kit bằng lệnh cd { cd C:\ruby_dk }
- cmd: ruby dk.rb init
- Sau đó chạy tiếp lệnh cmd: ruby dk.rb install
- Cài đặt Rails
- cmd: gem install rails
- Nếu lệnh chạy thất bại (do lỗi kết nối chẳng hạn) thì bạn chạy lại nó thêm lần nữa
- Tạo sườn ứng dụng
- cmd: rails new your_path { rails new helloworld }
- Lưu ý: nếu your_path bạn không để đường dẫn đầy đủ { C:\abc\helloworld } thì sẽ tạo thư mục ứng dụng trong thư mục hiện hành của cmd
- Tương tự, nếu có lỗi kết nối xảy ra bạn chịu khó chạy lại câu lệnh
- Lỗi quá trình cài đặt Bundle, bạn cd đến thư mục your_path và chạy lệnh bundle install { cd helloworld -> bundle install }
- Khởi động server
- cd đến thư mục ứng dụng { cd helloworld }
- cmd: rails server
- Trên trình duyệt, gõ địa chỉ http://localhost:3000
Sẵn đây mình tập viết tiếng Anh luôn ^^!
++ Brief instruction in English (How to install Ruby on Rails on Windows)
- Download RubyInstaller for Windows and corresponding Development Kit at HERE (notice RubyInstaller version vs Development Kit version)
- Install RubyInstaller (choose Add Ruby executables to your PATH option for using Ruby command everywhere)
- Install Development Kit
- Extract downloaded file to somewhere
- cd to it (open command line panel: Windows + R -> Open: cmd -> OK/Enter)
- ruby dk.rb init
- ruby dk.rb install
- Install Rails
- gem install rails
- If there is any failure i.e connection problem, run it again :)
- Create your application skeleton
- rails new your_path
- If bundle installation fails, cd to your application folder and run bundle install until no error
- Start server
- cd to your application folder
- rails server
- Browser address: http://localhost:3000
No comments:
Post a Comment