关于R以及Rstudio的安装过程 64位ubuntu12.04

来源:互联网 发布:mac系统重装多少钱 编辑:程序博客网 时间:2024/06/03 14:21

首先,要安装R

1. Update the repositories to get the latest R distributions:

Use sudo vi /etc/apt/sources.list to add the following:

1
deb http://cran.stat.ucla.edu/bin/linux/ubuntu precise/

OR

1
sudo add-apt-repository "deb http://cran.stat.ucla.edu/bin/linux/ubuntu precise/"

2. Get the repository SSL key and import it in to apt.

1
2
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -

3. Update the repositories.

1
2
sudo apt-get update
sudo apt-get install r-base

Now you may go to the command prompt and type R to get the R console.


然后,安装ROracle和DBI

wget http://cran.r-project.org/src/contrib/DBI_0.2-7.tar.gz
R CMD INSTALL DBI_0.2-7.tar.gz
wget http://cran.r-project.org/src/contrib/ROracle_1.1-11.tar.gz
R CMD INSTALL --configure-args='--with-oci-inc=/opt/oracle/instantclient_11_2/sdk/
这两个的过程大致是这个样子的,但是,DBI和ROracle的版本可能不一样的。
这个需要到他们的官方网站上去查看:
http://cran.r-project.org/index.html

最后,安装Rstudio server
(千万要注意,linux的版本是64位的,不能够安装成为32位的了)
$ 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.501-amd64.deb
$ sudo gdebi rstudio-server-0.98.501-amd64.deb
就是这些过程,其中,需要补充一个 psmisc_22.21-2_amd64.deb的安装
用wget获取包,再用gdebi进行安装就可以了


其后,这个rstudio server setting的设定:
echo 'rsession-memory-limit-mb=1000' > /etc/rstudio/rserver.conf
echo 'rsession-stack-limit-mb=4' >> /etc/rstudio/rserver.conf
echo 'rsession-process-limit=20' >> /etc/rstudio/rserver.conf
# Only pass below if you will using proxy mode
echo 'www-address=127.0.0.1' >> /etc/rstudio/rserver.conf
groupadd rstudio

Setting auto restart and PATH
ln -s /usr/lib/rstudio-server/extras/init.d/debian/rstudio-server /etc/init.d/rstudio-server
vi /etc/init.d/rstudio-server
# append below line to /usr/lib/rstudio-server/extras/init.d/debian/rstudio-server SCRIPTNAME
ORACLE_BASE=/opt/oracle
ORACLE_HOME=/opt/oracle/instantclient_11_2
TNS_ADMIN=/opt/oracle/network/admin
NLS_LANG=AMERICAN_AMERICA.AL32UTF8

/etc/init.d/rstudio-server restart



Add a user in RStudio
adduser --ingroup rstudio cindy
passwd cindy # setting password
注意,在这个地方,我用的用户名称是tutu,密码吗,你懂的


Update package

Usually it is more good to upgrade the r-base in system wide packages instead of per user.

after run R in root console
update.packages() # select mirror to check
最后检查的时候



http://localhost:8787
登陆上去,就可以看到了
使用linux的用户id和用户的password,当然,如果添加了组,也是可以的。




0 0
原创粉丝点击