20150413数据训练营

时间:2022-05-10 18:54:44

Install Rstudio on Mac or Windows

从下面网页链接中选区需要的安装包进行安装:
http://www.rstudio.com/products/rstudio/download/

Installers for Supported Platforms

Installers  Size    Date    MD5
RStudio 0.98.1103 - Windows XP/Vista/7/8    47.4 MB 2015-03-07  65b22a3836cbba7117c131c2efa489ac
RStudio 0.98.1103 - Mac OS X 10.6+ (64-bit) 43.7 MB 2015-03-07  94d897bdd3e954473654ec7a67dd4e83
RStudio 0.98.1103 - Debian 6+/Ubuntu 10.04+ (32-bit)    49.5 MB 2015-03-07  723fdcb28dac8cd004c06855d1421c24
RStudio 0.98.1103 - Debian 6+/Ubuntu 10.04+ (64-bit)    51.4 MB 2015-03-07  4426d2797e27c7b6dd0394c180685a8e
RStudio 0.98.1103 - Fedora 13+/RedHat 7+/openSUSE 11.4+ (32-bit)    49.9 MB 2015-03-07  c3c286b2d29edbd9b6b8c01585c7531d
RStudio 0.98.1103 - Fedora 13+/RedHat 7+/openSUSE 11.4+ (64-bit)    51.5 MB 2015-03-07  e39c8ec071df40eb7a567db819246001

mac的dmg包:
http://download1.rstudio.org/RStudio-0.98.1103.dmg
windows的exe包:
http://download1.rstudio.org/RStudio-0.98.1103.exe

Install R on ubuntu

apt 源替换成交大源

sed -i "s/us.archive.ubuntu.com/ftp.sjtu.edu.cn/g" /etc/apt/sources.list

apt源更新

apt-get update 
Ign http://ftp.sjtu.edu.cn trusty InRelease
Ign http://ftp.sjtu.edu.cn trusty-updates InRelease
Hit http://ftp.sjtu.edu.cn trusty Release.gpg
Hit http://ftp.sjtu.edu.cn trusty-updates Release.gpg
Hit http://ftp.sjtu.edu.cn trusty Release
Hit http://ftp.sjtu.edu.cn trusty-updates Release                              
Hit http://ftp.sjtu.edu.cn trusty/main Sources                                 
Hit http://ftp.sjtu.edu.cn trusty/universe Sources                             
Hit http://ftp.sjtu.edu.cn trusty/main amd64 Packages                          
Hit http://ftp.sjtu.edu.cn trusty/universe amd64 Packages                      
Hit http://ftp.sjtu.edu.cn trusty/main Translation-en                          
Hit http://ftp.sjtu.edu.cn trusty/universe Translation-en                      
Hit http://ftp.sjtu.edu.cn trusty-updates/main Sources                         
Hit http://ftp.sjtu.edu.cn trusty-updates/universe Sources                     
Hit http://ftp.sjtu.edu.cn trusty-updates/main amd64 Packages                  
Hit http://ftp.sjtu.edu.cn trusty-updates/universe amd64 Packages              
Hit http://ftp.sjtu.edu.cn trusty-updates/main Translation-en                  
Hit http://ftp.sjtu.edu.cn trusty-updates/universe Translation-en              
Ign http://ftp.sjtu.edu.cn trusty/main Translation-en_US                       
Ign http://ftp.sjtu.edu.cn trusty/universe Translation-en_US
Ign http://security.ubuntu.com trusty-security InRelease  
Hit http://security.ubuntu.com trusty-security Release.gpg
Hit http://security.ubuntu.com trusty-security Release
Hit http://security.ubuntu.com trusty-security/main Sources
Get:1 https://get.docker.com docker InRelease      
Hit http://security.ubuntu.com trusty-security/universe Sources      
Hit http://security.ubuntu.com trusty-security/main amd64 Packages        
Ign https://get.docker.com docker InRelease                         
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit https://get.docker.com docker Release.gpg
Hit https://get.docker.com docker Release
Hit https://get.docker.com docker/main amd64 Packages                          
Get:2 https://get.docker.com docker/main Translation-en_US                     
Ign https://get.docker.com docker/main Translation-en_US                       
Ign https://get.docker.com docker/main Translation-en
Reading package lists... Done

r-base 安装

apt-get install -y r-base
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  autoconf automake autotools-dev binutils build-essential cdbs cpp cpp-4.8
  debhelper dh-apparmor dh-translations dpkg-dev fakeroot fontconfig
  fontconfig-config fonts-dejavu-core g++ g++-4.8 gcc gcc-4.8 gettext gfortran
  gfortran-4.8 intltool intltool-debian libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan0 libasprintf-dev
  libatomic1 libauthen-sasl-perl libblas-dev libblas3 libbz2-dev libc-dev-bin
  libc6-dev libcairo2 libcloog-isl4 libcroco3 libdatrie1 libdpkg-perl
  libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libencode-locale-perl
  libfakeroot libfile-basedir-perl libfile-desktopentry-perl
  libfile-fcntllock-perl libfile-listing-perl libfile-mimeinfo-perl
  libfont-afm-perl libfontconfig1 libfontenc1 libgcc-4.8-dev libgettextpo-dev
  libgettextpo0 libgfortran-4.8-dev libgfortran3 libgl1-mesa-dri
  libgl1-mesa-glx libglapi-mesa libgmp10 libgomp1 libgraphite2-3 libharfbuzz0b
  libhtml-form-perl libhtml-format-perl libhtml-parser-perl
  libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl
  libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
  libhttp-negotiate-perl libice6 libio-html-perl libio-socket-inet6-perl
  libio-socket-ssl-perl libisl10 libitm1 libjbig0 libjpeg-dev libjpeg-turbo8
  libjpeg-turbo8-dev libjpeg8 libjpeg8-dev liblapack-dev liblapack3 libllvm3.4
  liblwp-mediatypes-perl liblwp-protocol-https-perl libmail-sendmail-perl
  libmailtools-perl libmpc3 libmpfr4 libncurses5-dev libnet-http-perl
  libnet-smtp-ssl-perl libnet-ssleay-perl libpango-1.0-0 libpangocairo-1.0-0
  libpangoft2-1.0-0 libpaper-utils libpaper1 libpciaccess0 libpcre3-dev
  libpcrecpp0 libpixman-1-0 libpng12-dev libquadmath0 libreadline-dev
  libreadline6-dev libsm6 libsocket6-perl libstdc++-4.8-dev
  libsys-hostname-long-perl libtcl8.5 libthai-data libthai0 libtiff5
  libtinfo-dev libtk8.5 libtsan0 libtxc-dxtn-s2tc0 libunistring0 liburi-perl
  libutempter0 libwww-perl libwww-robotrules-perl libx11-xcb1 libxaw7
  libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0
  libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1
  libxdamage1 libxfixes3 libxft2 libxi6 libxinerama1 libxml-parser-perl
  libxmu6 libxpm4 libxrandr2 libxrender1 libxshmfence1 libxss1 libxt6 libxtst6
  libxv1 libxxf86dga1 libxxf86vm1 linux-libc-dev m4 make manpages-dev
  po-debconf python-scour r-base-core r-base-dev r-base-html r-cran-boot
  r-cran-class r-cran-cluster r-cran-codetools r-cran-foreign
  r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-matrix r-cran-mgcv
  r-cran-nlme r-cran-nnet r-cran-rpart r-cran-spatial r-cran-survival
  r-doc-html r-recommended tcl8.5 tk8.5 unzip x11-common x11-utils
  x11-xserver-utils xbitmaps xdg-utils xterm zip zlib1g-dev
Suggested packages:
  autoconf2.13 autoconf-archive gnu-standards autoconf-doc libtool
  binutils-doc devscripts cpp-doc gcc-4.8-locales dh-make apparmor-easyprof
  debian-keyring g++-multilib g++-4.8-multilib gcc-4.8-doc libstdc++6-4.8-dbg
  gcc-multilib automake1.9 flex bison gdb gcc-doc gcc-4.8-multilib libgcc1-dbg
  libgomp1-dbg libitm1-dbg libatomic1-dbg libasan0-dbg libtsan0-dbg
  libbacktrace1-dbg libquadmath0-dbg binutils-gold gettext-doc
  gfortran-multilib gfortran-doc gfortran-4.8-multilib gfortran-4.8-doc
  libgfortran3-dbg libdigest-hmac-perl libgssapi-perl glibc-doc libglide3
  libdata-dump-perl libcrypt-ssleay-perl ncurses-doc ttf-baekmuk
  ttf-arphic-gbsn00lp ttf-arphic-bsmi00lp ttf-arphic-gkai00mp
  ttf-arphic-bkai00mp libstdc++-4.8-doc libauthen-ntlm-perl make-doc
  libmail-box-perl python-rsvg python-cairo ess r-doc-info r-doc-pdf r-mathlib
  texlive-base texlive-latex-base texlive-generic-recommended
  texlive-fonts-recommended texlive-fonts-extra texlive-extra-utils
  texlive-latex-recommended texlive-latex-extra texinfo texi2html
  tcl-tclreadline mesa-utils nickle cairo-5c xorg-docs-core gvfs-bin
  xfonts-cyrillic
The following NEW packages will be installed:
  autoconf automake autotools-dev binutils build-essential cdbs cpp cpp-4.8
  debhelper dh-apparmor dh-translations dpkg-dev fakeroot fontconfig
  fontconfig-config fonts-dejavu-core g++ g++-4.8 gcc gcc-4.8 gettext gfortran
  gfortran-4.8 intltool intltool-debian libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan0 libasprintf-dev
  libatomic1 libauthen-sasl-perl libblas-dev libblas3 libbz2-dev libc-dev-bin
  libc6-dev libcairo2 libcloog-isl4 libcroco3 libdatrie1 libdpkg-perl
  libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libencode-locale-perl
  libfakeroot libfile-basedir-perl libfile-desktopentry-perl
  libfile-fcntllock-perl libfile-listing-perl libfile-mimeinfo-perl
  libfont-afm-perl libfontconfig1 libfontenc1 libgcc-4.8-dev libgettextpo-dev
  libgettextpo0 libgfortran-4.8-dev libgfortran3 libgl1-mesa-dri
  libgl1-mesa-glx libglapi-mesa libgmp10 libgomp1 libgraphite2-3 libharfbuzz0b
  libhtml-form-perl libhtml-format-perl libhtml-parser-perl
  libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl
  libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
  libhttp-negotiate-perl libice6 libio-html-perl libio-socket-inet6-perl
  libio-socket-ssl-perl libisl10 libitm1 libjbig0 libjpeg-dev libjpeg-turbo8
  libjpeg-turbo8-dev libjpeg8 libjpeg8-dev liblapack-dev liblapack3 libllvm3.4
  liblwp-mediatypes-perl liblwp-protocol-https-perl libmail-sendmail-perl
  libmailtools-perl libmpc3 libmpfr4 libncurses5-dev libnet-http-perl
  libnet-smtp-ssl-perl libnet-ssleay-perl libpango-1.0-0 libpangocairo-1.0-0
  libpangoft2-1.0-0 libpaper-utils libpaper1 libpciaccess0 libpcre3-dev
  libpcrecpp0 libpixman-1-0 libpng12-dev libquadmath0 libreadline-dev
  libreadline6-dev libsm6 libsocket6-perl libstdc++-4.8-dev
  libsys-hostname-long-perl libtcl8.5 libthai-data libthai0 libtiff5
  libtinfo-dev libtk8.5 libtsan0 libtxc-dxtn-s2tc0 libunistring0 liburi-perl
  libutempter0 libwww-perl libwww-robotrules-perl libx11-xcb1 libxaw7
  libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0
  libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1
  libxdamage1 libxfixes3 libxft2 libxi6 libxinerama1 libxml-parser-perl
  libxmu6 libxpm4 libxrandr2 libxrender1 libxshmfence1 libxss1 libxt6 libxtst6
  libxv1 libxxf86dga1 libxxf86vm1 linux-libc-dev m4 make manpages-dev
  po-debconf python-scour r-base r-base-core r-base-dev r-base-html
  r-cran-boot r-cran-class r-cran-cluster r-cran-codetools r-cran-foreign
  r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-matrix r-cran-mgcv
  r-cran-nlme r-cran-nnet r-cran-rpart r-cran-spatial r-cran-survival
  r-doc-html r-recommended tcl8.5 tk8.5 unzip x11-common x11-utils
  x11-xserver-utils xbitmaps xdg-utils xterm zip zlib1g-dev
0 upgraded, 199 newly installed, 0 to remove and 51 not upgraded.
Need to get 99.8 MB of archives.
After this operation, 309 MB of additional disk space will be used.

r-base-dev 安装

如果需要对r进行开发对话需要安装dev包

apt-get install -y r-base-dev

RStudio Server 安装

参考:http://www.rstudio.com/products/rstudio/download-server/

$ sudo apt-get install gdebi-core
$ sudo apt-get install libapparmor1 # Required only for Ubuntu, not Debian
$ wget http://download2.rstudio.org/rstudio-server-0.98.1103-amd64.deb
$ sudo gdebi rstudio-server-0.98.1103-amd64.deb

安装好后验证安装一下:

rstudio-server verify-installation

即可从

http://<server-ip>:8787

访问网页版的R。

用户采用后台创建:
比如创建用户testr

# useradd testr
# passwd testr
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

更多细节配置等可以从下列网页获取:
https://support.rstudio.com/hc/en-us/sections/200150693-RStudio-Server