The Windows version of R has a direct installation package, which is very convenient to download and install. However, for centos6 and later versions, you cannot directly install R through Yum and need to compile it yourself.
1. install various software with Yum before Compilation
(1) install gcc
> yum install gcc
(2) install g ++
> Yum install gcc-C ++ # Otherwise, the error "Configure: Error: C ++ Preprocessor"/lib/CPP "fails sanity check" is reported.
(3) install gfortran
> Yum install gcc-gfortran. # Otherwise, the error "Configure: Error: No f77 compiler found" is reported.
(4) install Readline
> Yum install Readline-devel # Otherwise, the error "-with-Readline = Yes (default) and headers/libs are not available" is reported.
(5) install libxt
> Yum install libxt-devel # Otherwise, the error "Configure: Error:-with-x = Yes (default) and X11 headers/libs are not available" is reported.
2. Download the installation package of R
My version is 3.0.2. You can run the following command:
> wget http://cran.rstudio.com/src/base/R-3/R-3.0.2.tar.gz
3. decompress the r installation package
> tar -xzvf R-3.0.2.tar.gz
4. modify the configuration file
> Cd R-3.0.2>./configure-Prefix =/installation directory-
5. Complete Compilation and Installation
If no error is reported (warning does not count), even if it succeeds, you can run the command> make, and then> make install directly. It may take 10 minutes to complete the make process.
6. Enter R for testing
Next, you should be able to directly use R in shell to enter R. If not, use VI/etc/profile to modify the path of the Environment Variable path and add: Export Path = $ path: /usr/local/bin. Do not forget source/etc/profile!