Build the R language environment in Linux and build the linuxr Language

Source: Internet
Author: User
Tags gfortran

Build the R language environment in Linux and build the linuxr Language

R is the language and operating environment used for statistical analysis and drawing. R is a free, free, and open source software in the GNU system. It is an excellent tool for Statistical Computing and statistical drawing.

Environment setup:

1. Install proj

[root@uvmsvr12 gis]#wget http://download.osgeo.org/proj/proj-4.9.1.tar.gz[root@uvmsvr12 gis]# tar -zxvf proj-4.9.1.tar.gz[root@uvmsvr12 proj-4.9.1]# cd proj-4.9.1[root@uvmsvr12 proj-4.9.1]# ./configure[root@uvmsvr12 proj-4.9.1]# make && make install

After the installation is complete, the. h file (org_proj4_Projections.h, proj_api.h, projects. h) is generated under/usr/local/lib, and the library file is generated under the/usr/lib folder.

Add/usr/local/lib to the environment variable:

[root@uvmsvr12 proj-4.9.1]# vim /etc//ld.so.conf.d/local.conf/usr/local/lib[root@uvmsvr12 proj-4.9.1]#ldconfig -v


2. Install GEOS

[root@uvmsvr12 gis]# wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2[root@uvmsvr12 gis]# tar -jxvf geos-3.4.2.tar.bz2[root@uvmsvr12 gis]# cd geos-3.4.2[root@uvmsvr12 gis]# make && make install


3. Install gdal

[root@uvmsvr12 gis]#wget http://download.osgeo.org/gdal/CURRENT/gdal-1.11.2.tar.gz[root@uvmsvr12 gis]# tar -zxvf gdal-1.11.2.tar.gz[root@uvmsvr12 gis]# cd gdal-1.11.2[root@uvmsvr12 gis]# ./configure --with-geos=/usr/local/bin/geos-config[root@uvmsvr12 gis]# make && make install

Note:

In. /configure check configuration information displays whether the related components are supported. If "GEOS support: no" is displayed, geos is not supported, we need to add the parameter -- with-geos =/usr/local/bin/geos-config.

4. Install the R Language

(1) first install the java environment, such:

##JAVA###export JAVA_HOME=/usr/local/jdkXXXexport JRE_HOME=/usr/local/jdkXXX/jreexport PATH=$JAVA_HOME/bin:$PATHexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

Do not forget source/etc/profile to load environment variables.

(2) install the R Language

[root@uvmsvr12 gis]# yum install gcc-gfortran readline-devel libXt-devel[root@uvmsvr12 gis]# wget http://mirror.bjtu.edu.cn/cran/src/base/R-3/R-3.2.0.tar.gz[root@uvmsvr12 gis]# tar -zxvf R-3.2.0.tar.gz[root@uvmsvr12 gis]# cd R-3.2.0[root@uvmsvr12 gis]# ./configure  --enable-R-shlib  --prefix=/usr/local/R-3.2.0[root@uvmsvr12 gis]# make && make install
Note:

If the error"Configure: error: No F77 compiler found", Yum install gcc-gfortran is required.

If"Configure: error: -- with-readline = yes (default) and headers/libs are not available, configure: error:-with-x = yes (default) and X11 headers/libs are not available", Yum install readline-devel libXt-devel is required.

If you cannot use the R environment tab auto-completion or the up and down arrow keys, you also need to install yum install readline-devel libXt-devel.


Finally, add the execution command of your R language to the environment variable, so that you can directly enter by entering R.

Export PATH =/usr/local/The R-3.2.0/bin: $ PATH

In addition, use the R installation package

[Root @ usvr-115 gis] # RR version 3.2.0 () -- "Full of Ingredients" Copyright (C) 2015 The R Foundation for Statistical ComputingPlatform: x86_64-unknown-linux-gnu (64-bit) R is a free software without any warranty. Under some conditions, you can spread it freely. Use 'license () 'or 'license ()' to view detailed conditions for distribution. R is a cooperation plan with many people contributing to it. 'citation () 'tells you how to correctly reference the R or R package in a publication. Use 'demo () 'to view some demo programs, use 'help ()' to read online help files, or use 'help. start () 'to view help files in the HTML browser. Use 'q () 'to exit R.> install. packages ('rjson ')
Check whether require (rjson) is installed in the package)

If"Geos-config not found" or "gdal-config not found"While our geos-config and gdal-config have been installed under/usr/local/bin. We need to add/usr/local/bin to the environment variable.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.