BLOG main image
분류 전체보기 (313)
교육 (13)
NEIS (6)
Edufine (0)
Programmer (5)
Android Programming (1)
Internet W3 (18)
JAVA Programming (9)
JSP/Servlet (1)
Framework (7)
Spring For Beginner (4)
eGovFrame (10)
MEAN Stack (2)
NodeJS (5)
SublimeText (30)
SublimeText_Tips (18)
Eclipse (16)
JavaScript (8)
jQuery (12)
jQuery_tips (1)
Ajax (3)
DWR(Direct Web Remote) (4)
JSON(JS Object Notation) (4)
Oracle (2)
MySQL (28)
OS (16)
Download (3)
Life (10)
Favorit Site (1)
Books (2)
Healthy (1)
Stocks (1)
HTML5/CSS (1)
Python (4)
Security (7)
CISSP (0)
Ruby On Rails (5)
일기장 (0)
영어 교과서(중2) (3)
알고리즘 (0)
Go Lang (3)
VB 2010 (12)
C# (1)
정보보안기사(네트워크보안) (0)
업무 활용 엑셀 (11)
틈틈이 활용팁 (14)
하루 하루 살아가며 ……. (2)
기술 (1)
파이썬 & 데이터분석 (1)
Visitors up to today!
Today hit, Yesterday hit
daisy rss
tistory 티스토리 가입하기!
2016. 9. 19. 11:01

루비온레일즈는 ....

개발속도가 빠르다. 접속속도는 느리다.(체감) .. 극복할 수 있을까...

 

루비온레일즈 최강의 학습사이트를 발견했다.

 

http://codelion.net/ 

 

참 잘 정리되어 있다. 각설하고 설치에 대한 POST 를 시작한당.

 

RubyInstallers 다운

 

Ruby 버전이 날이 갈수록 업데이트 되면서 설치시 생기지 않던 오류가 발생했다.

그래서 포스팅 한다.

 

Ruby 를 다운 받는다. (http://rubyinstaller.org/downloads/)

2016. 9. 19. 기준 Ruby 안정버전은 2.3.1 이다.

본인의 운영체제가 32비트인지 64비트인지 확인해서 적절한 파일을 다운 받는다.

설치한다.

 

루비 소스코드는 https://www.ruby-lang.org/ko/downloads/ 에서 취득할 수 있다.

루비의 인스톨러는 다음 URL 에서 다운받는다.

 

http://rubyinstaller.org/downloads/

 

설치한다. 설치시 Installation Destination and Optional Task 에서 모두 체크하도록 하자.

 

 

 

DEVELOPMENT KIT 다운로드

 

Ruby 버전에 맞게 다운 받는다.

 

2.0 이상의 경우 운영체제 별로 다운로드 파일이 다르다는 점을 유의한다.

 

Development Kit

For use with Ruby 1.8.7 and 1.9.3:

For use with Ruby 2.0 and above (32bits version only):

For use with Ruby 2.0 and above (x64 - 64bits only)

다운받은 Devkit 을 자동 압축해제를 해서 편의상 Ruby\devkit 에 압축해제 하도록 하자.

 

 

압축해제가 완료되면,

 

CMD 창을 통해 C:\ruby23\devkit 폴더로 이동한 뒤

 

ruby dk.rb init

ruby dk.rb install

 

을 순서대로 입력하여 설치된 Ruby가 Devkit 을 바라보도록 설정한다.

 

E:\lang\devkit>ruby dk.rb init
[INFO] found RubyInstaller v1.9.3 at E:/lang/ruby193

Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.

E:\lang\devkit>ruby dk.rb install
[INFO] Updating convenience notice gem override for 'E:/lang/ruby193'
[INFO] Installing 'E:/lang/ruby193/lib/ruby/site_ruby/devkit.rb'

 

그 다음 RubyGems를 업데이트 해 준다.

 

  E:\> gem update 

 

여기까지 아무 에러메시지 없이 완료되었다면 설치는 끝났다! 하지만, 아래와 같은 오류메시지를 만났다면 추가작업이 필요하다.

 

 E:\> gem update 

Updating installed gems
Updating bigdecimal
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
E:\lang\devkit\bin\rm.exe: *** Couldn't reserve space for cygwin's heap (0x60E90000 <0x2660000>) in child, Win32 error 0
E:\lang\devkit\bin\mkdir.exe: *** Couldn't reserve space for cygwin's heap (0x60E90000 <0x2690000>) in child, Win32 error 0
E:\lang\devkit\bin\install.exe: *** Couldn't reserve space for cygwin's heap (0x60E90000 <0x26F0000>) in child, Win32 error 0 

 

이 오류는 devkit의 기반인 MinGW의 msys-1.0.dll 파일의 메모리 관련 오류인데 MinGW의 고질적인 문제라고 한다. DLL파일의 Rebase를 통해 해결할 수 있는데 이를 위해서는 Windows용 Git의 설치가 필요하다. Git 자체가 필요하다기 보다는 같이 설치되는 Utility 중 하나를 활용하기 위함이다.

Git 이 설치되어 있지 않다면, 설치한다. 

https://git-scm.com/

https://git-scm.com/downloads

Git이 설치된 디렉토리의 bin 디렉토리를 보면 rebase.exe 라는 파일이 존재하는데, 이 파일로 devkit의 msys-1.0.dll 파일을 Rebase 할 수 있다. 편의상 Git이 E:\git에 설치되어 있다고 가정하겠다.

 E:\git\bin\rebase.exe -b 0x64000000 E:\ruby22\devkit\bin\msys-1.0.dll

 

아무 내용없이 프롬프트가 떨어졌다면 성공적으로 DLL Rebase가 된 것이다. 이 후, 다시 gem update를 실행하여 설치를 마친다.

 

SQLite3 다운로드 및 설치

 

다운로드 주소 : http://www.sqlite.org/download.html

 

다운받을 파일

 

Precompiled Binaries for Windows
sqlite-dll-win32-x86-3140200.zip
(424.03 KiB)
32-bit DLL (x86) for SQLite version 3.14.2.
(sha1: 526ad97088413a0a7261c50fb6a104f49b9f306c)
sqlite-dll-win64-x64-3140200.zip
(701.68 KiB)
64-bit DLL (x64) for SQLite version 3.14.2.
(sha1: 68791d12664c5efcb3cdf0d1d2d9e5e15b51ec06)
sqlite-tools-win32-x86-3140200.zip
(1.52 MiB)
A bundle of command-line tools for managing SQLite database files, including the command-line shell program, the sqldiff.exe program, and the sqlite3_analyzer.exe program.
(sha1: 7a86471aa30a563cbe068744306e61468046bb65)

 

- 압축해제하면 sqlite3.exe 파일이 있을 텐데, 이를 Ruby 바이너리 폴더(c:\ruby22\bin) 으로 옮긴다.

- 설치 후 sqlite3 -version 으로 설치된 버전정보를 확인한다.

 

Node.js 설치

https://nodejs.org/en/

 

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.

Download for Windows (x86) : https://nodejs.org/dist/v4.2.4/node-v4.2.4-x86.msi

Other Downloads : https://nodejs.org/en/download/

 

 

ruby on rails 설치

 

 

c:\gem install rails 

 

시간이 조금 걸린다. 

 

설치가 완료되면, rails -v 명령어로 설치 버전 정보를 확인한다. 

 

 

최종 프로젝트 생성(구동할 서버루트)

 

여기까지 오류없이 잘 설치가 되었으면 90% 완료된 것이다.

그럼 이제 www 에서 htdocs 역할을 하는 프로젝트를 생성해보자...

 

생성방법은 c:\rails new 프로젝트이름 하면 해당 프로젝트 이름으로 폴더가 생성이 된다.

 

나는 c:\workspace 폴더에서 rails new helloworld 를 실행하였다.

 

그리고 생성이 완료되면 생성된 프로젝트 폴더로 이동하여 rails server 명령을 실행한다.

 

http://localhost:3000 으로 접속하여 웹페이이지를 확인하자

 

 

 

설치시 발생하는 오류 해결하기

 

오류메시지 #1.

 

rails new project_name 과정에서 발생하는 오류이다. 간혹 gem update 시에도 발생한다.

 

Couldn't reserve space for cygwin's heap

 

해결방법

 

E:\git\bin\rebase.exe -b 0x64000000 E:\ruby22\devkit\bin\msys-1.0.dll

 

자세한 설명은 위에 작성되어 있다.

 

오류메시지 #2.

 

rails server 로 해당 프로젝트를 구동하면 다음과 같은 오류가 발생한다.

ruby 2.3 이상 버전에서 발생하는 것으로 판단되면 ruby 2.2 에서는 문제없이 구동된다.

 

lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x64-mingw32/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError) 오류 발생시

 

gem install 'sqlite3'를 통해 기본적으로 설치되는 sqlite는 ruby 2.2 까지의 sqlite3_native.so 파일을 제공한다. 하지만, ruby 2.3 을 설치한후 rails server 를 실행하면 위와 같은 오류가 발생하는데, 이는 ruby 2.3 버전에 맞는 sqlite3_native 모듈을 설치해줘야 한다.

sqlite_native 모듈을 어디에서 찾는가 ? 그것은 바로 gem install 을 통해 sqlite3-static 버전을 설치하면 sqlite3 1.3.10의 기본 제공되던 sqlite3가 3.xx.xx 대로 설치가 된다.

 

sqlite3-static 설치 : gem install sqlite3-static

 

64비트 세팅시

 

C:\Ruby23-x64\lib\ruby\gems\2.3.0\gems\sqlite3-static-3.14.1\lib\sqlite3\sqlite3_native.so

 

파일을 아래 경로에 복사한다.

 

C:\Ruby23-x64\lib\ruby\gems\2.3.0\gems\sqlite3-1.3.11-x64-mingw32\lib\sqlite3

 

32비트 세팅시

 

C:\Ruby23\lib\ruby\gems\2.3.0\gems\sqlite3-static-3.14.1\lib\sqlite3\sqlite3_native.so

 

파일을 아래 경로에 복사한다.

 

C:\Ruby23\lib\ruby\gems\2.3.0\gems\sqlite3-1.3.11-x86-mingw32\lib\sqlite3

 

아래 파일을 다운받아 파일이름을 sqlite3_native.so 로 변경후 해당 폴더에 복사한다.

 

sqlite3_native.so 64비트용sqlite3_native_x64.so

 

sqlite3_native.so 32비트용 sqlite3_native_x86.so

 

오류메시지 #3.

 

웹서버 실행(rails server) 후 오류시

Could not load 'active_record/connection_adapters/sqlite3_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.

 

위 오류는 오류 #2 번을 해결하기 위해 구글링을 한 결과 다음과 같이 해결하라는 잘못된 검색결과에 따른 조치의 오류이다.

무슨 이야기 인가 하면,

 

오류 # 2번에 대해 구글링하면 다음처럼 조치하라고 나온다.

 

관련 URL : http://stackoverflow.com/questions/17643897/cannot-load-such-file-sqlite3-sqlite3-native-loaderror-on-ruby-on-rails

 

C:\Ruby23-x64\lib\ruby\gems\2.3.0\specifications\sqlite3-1.3.11-x64-mingw32.gemspec 파일을 열어서

 

  s.require_paths = ["lib"] 이 부분을

  s.require_paths = ["lib\sqlite3_native"] 로 바꾸라고 나오는데. 이는 잘못된 설정인 것이다.

 

gem 파일은 수정하지 않도록 원상복구 시킨다.

 

# 관련 추천 도서

 

 

퍼펙트 루비 온 레일즈 | 야마다 요시히로 저/윤인성 역 | 제이펍

 

오류처리에 대한 사항은 인색하리만큼 없다...

 

설치과정만 무사히 마치고 첫 페이지를 볼 수 있다면,

 

그 다음부터는  진도가 팍팍 나간다 ... 이제 겨우 3장(?)

 

사무실에서 눈치보면서 한줄한줄 밑줄 작업중이다..

 

루비온레일즈는 MVC 플랫폼에 최적화된(?) 언어라고 한다.

 

책 또한 4장 모델(Model), 5장 (View), 6장 컨트롤러(Controller), 7장 라우터 로 구성되어 있따.

 

번역도 잘 되어 있고, 번역서라 그런지 저자의 피드백은 별로 없는것 같다.

 

그래도 20대 중반의 윤인성 역자님 책을 좋아한다.

 

모덴 웹을 위한 Node.js 프로그래밍 도 좋다. ^^;;; 육아일기 써야 하는데 이런거 쓴당 ...

반응형