더북(TheBook)

리눅스에서 설치하기

리눅스 배포판 중 하나인 우분투에서 설치하는 방법을 알아보자. 그림 1-2에 있는 다운로드 화면에서 ‘Download R for Linux’를 클릭한 후 다음 화면에 있는 ‘ubuntu’ 링크를 클릭한다.

그림 1-6 우분투 다운로드 링크

링크를 클릭하면 그림 1-7에 보인 것과 같은 apt-get 소스 목록이 나타난다. 이 중 자신의 버전에 맞는 항목을 골라 apt-get 소스 파일을 업데이트해야 한다.

그림 1-7 우분투 apt-get 소스 목록

예를 들어, 우분투 Precise의 사용자는 다음과 같이 /etc/apt/sources.list.d 디렉터리에 r.list라는 파일을 작성한다.

$ cd /etc/apt/sources.list.d
$ cat > r.list
deb http://cran.nexr.com/bin/linux/ubuntu precise/
^D (CTRL+D)

설치에 필요한 명령들은 다음과 같다. 이 중 apt-key는 새로 추가한 apt-get 소스를 접근하는 데 필요한 명령이다. 이 명령은 리눅스 다운로드 페이지 하단에 설명되어 있다.

$ sudo apt-key adv --keyserver keyserver.ubuntu.com —recv-keys E084DAB9
$ sudo apt-get update
$ sudo apt-get install r-base

설치가 완료되면 콘솔에서 R을 입력해 잘 실행되는지 확인한다.

$ R

R version 3.1.1 (2014-07-10) -- "Sock it to Me"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale 

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

이것으로 기본적인 설치는 끝났지만 R의 실행 속도를 더 빠르게 하고자 하는 독자는 다음 내용을 참고하기 바란다.

신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.