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. 22. 17:33

CentOS 7 에서 RubyOnRails 설치하기


일반계정으로 로그인한다. 


1)Ruby Version Manager(RVM) 설치 (참고: https://rvm.io/)


    $ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3


    $ \curl -sSL https://get.rvm.io | bash -s stable


    $ source ~/.profile


   $ rvm install 2.0.0  // 설치가 안되면


http://www.ruby-lang.org/ko/downloads/  에서 ruby-2.0.0-p645.tar.gz 다운받아서 컴파일 한다.


 $ tar -zxvf ruby-2.0.0-p645.tar.gz

 $ cd ruby-2.0.0-p645

 $ ./configure    // 컴파일시 오류가 발생할 경우 gcc 가 설치되지 않아서이다.

 $ make

 $ su

 $ make install


에러 메시지 : configure: error: no acceptable C compiler found in $PATH


gcc로 시작하는 내용이 없다면 설치되어 있지 않는 것이다.
그럼 설치되어 있지 않을 것이다. 설치되어 있다면 gcc가 설치된 경로를 PATH에 추가해 주어야한다.
/etc/profile 에 추가해주면 된다.


  # yum -y install gcc 



2) 레일즈 설치하기


$ gem install rails --version 4.0.1 --no-ri --no-rdoc  // 시간이 좀 오래 걸린다.


$ rails new www --skip-bundle

$ cd www

$ bundle install 이때 오류가 발생한다.

오류 발생 #1


Building native extensions.  This could take a while...

ERROR:  Error installing json:

        ERROR: Failed to build gem native extension.


/usr/bin/ruby extconf.rb

mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h


Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/json-1.8.1 for inspection.

Results logged to /usr/lib64/ruby/gems/1.8/gems/json-1.8.1/ext/json/ext/generator/gem_make.out


해결방법 : ruby-devel 을 설치한다.


$ sudo yum install ruby-devel

$ gem install json -v 1.8.1

$ gem install sqlite3 -v '1.3.11'

$ yum install sqlite-devel

$ yum install nodejs

$ bundle install 


오류 #2

Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.

/usr/local/share/gems/gems/abrt-0.1.0/lib/abrt.rb:6:in `require': cannot load such file -- abrt/handler (LoadError)

    from /usr/local/share/gems/gems/abrt-0.1.0/lib/abrt.rb:6:in `block in <top (required)>'

/usr/local/share/gems/gems/execjs-2.3.0/lib/execjs/runtimes.rb:45:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

    from /usr/local/share/gems/gems/execjs-2.3.0/lib/execjs.rb:5:in `<module:ExecJS>'


해결방법 : nodejs 가 설치되지 않아서 발생되는 오류이다. 


nodejs 설치하기

https://node.js.org/download/release/v4.5.0/ 에서 node-v4.5.0-linux-x64.tar.gz 다운받는다.


다운받은 파일을 압축해제 하고 /usr/llocal/node 로 이동한다. 


mv node-v4.5.0-linux-x64 /usr/local/node


vi 로 /etc/profile 를 편집하여 아래 내용을 삽입한다. 


export NODE_HOME=/usr/local/node

export PATH=$PATH:$NODE_HOME/bin


:wq!

$ source /etc/profile


$ rails s (서버를 기동한다.)


추가 : 


$ gem list --remote --all sqlite


*** REMOTE GEMS ***

sqlite (2.0.1, 2.0.0, 1.3.1, 1.3.0, 1.2.9.1, 1.2.0, 1.1.3, 1.1.2, 1.1.1, 1.1)

sqlite-ruby (2.2.3, 2.2.2, 2.2.1, 2.2.0, 2.1.0, 2.0.3, 2.0.2)

sqlite3-ruby (1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.0, 1.0.1, 1.0.0, 0.9.0, 0.6.0, 0.5.0)


$ gem install sqlite3-ruby -v 1.2.3


반응형
2016. 9. 21. 15:03

이것이 리눅스다. - 한빛미디어

 

동영상 URL : https://goo.gl/ubGrxD

반응형

'OS > Unix/Linux' 카테고리의 다른 글

리눅스 표준 입출력 리다이렉션  (0) 2015.09.04
리눅스 파일 보안  (0) 2015.09.04
리눅스 Alias - 별칭 사용하기  (0) 2015.09.04
리눅스 시간관리  (0) 2015.09.04
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 프로그래밍 도 좋다. ^^;;; 육아일기 써야 하는데 이런거 쓴당 ...

반응형
2016. 9. 13. 17:08

[오류 #1]

Couldn’t reserve space for cygwin’s heap 오류 발생시

 

1. Git 설치 후

  - C:\Program Files (x86)\Git\bin>rebase.exe -b 0x50000000 msys-1.0.dll
  - tasklist /m msys-1.0.dll

 

msys-1.0.dll 파일은 devkit 설치후 devkit\bin 폴더에 있다. 이 폴더의 파일을 rebase한다.

 

※ 참고 : http://morphys.tistory.com/entry/Windows에-Ruby-설치하기

 

[오류 #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 설치법

SQLite3 bindings with embedded SQLite library.

Homepage: https://github.com/Instabridge/sqlite3-ruby-static

Platform: Rubygems

Language: C

License: BSD-3-Clause

View on registry: https://rubygems.org/gems/sqlite3-static

Documentation: http://www.rubydoc.info/gems/sqlite3-static/3.14.1

Install: gem install sqlite3-static

 

설치하고 나면

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

 

sqlite3-static-3.14.1.gem sqlite3_native.so

 

위 모듈은 64비트 모듈이다. 32비트에 다운받아 넣으면 안된다. ㅠ.ㅠ

위 모듈을 다운받아 해당 경로에 넣어도 된다. ^^

 

복사가 끝나면 해당 프로젝트 폴더에서 rails server 를 실행한다.

http://localhost:3000 접속을 시도한다.

 

[오류 #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번에 대해 구글링하면 다음처럼 조치하라고 나온다.

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 파일은 수정하지 않도록 원상복구 시킨다.

 

오류 #2와 오류 #3의 근본적인 문제는 ruby 2.3 에 대한 sqlite3 모듈이 지원이 안되었기 때문으로 보인다. 번거롭겠지만 sqlite3_static 을 설치해서 sqlite3_native.so 모듈을 추출하자.

 

기본 gem install sqlite3 로 설치되는 sqlite3 1.3.11 을 sqlite3 3.14.x 로 업그레이드 하는 법은 없을까?

 

ㅠ.ㅠ

 

 

 

반응형
2016. 9. 8. 13:28

MySQL 서버 설정시 여러가지 이유로 한글문제가 발생할 수 있습니다. MySQL 서버의 캐릭터셋을 utf8 로 설정하는 방법입니다.

우분투의 경우는 /etc/mysql/my.cnf 에 위치하는 MySQL 서버 설정파일의 mysqld 항목에 아래와 같이 추가해 줍니다. 클라이언트 쪽의 환경에 따라서 다양한 현상들이 발생할 수 있습니다만, 아래와 같이 설정하면 대부분 해결이 됩니다. 특히 character-set-client-handshake 이 항목을 FALSE 로 해 둘 경우 도움이 되는 경우가 많습니다.

 

 [mysqld]
character-set-client-handshake = FALSE
init_connect = "SET collation_connection = utf8_general_ci"
init-connect = 'SET NAMES utf8'
character-set-server = utf8
collation-server = utf8_general_ci

 

출처 : https://www.fun25.co.kr/blog/mysql-server-character-set-utf8-setup/?page=7&category=001

반응형