问题
I had installed RStudio 0.97.168 on Ubuntu 12.04. When I try to install gstat library I get the below error
install.packages("gstat", dependencies=TRUE)
Warning in install.packages :
cannot open: HTTP status was '407 Proxy Authentication Required'
Warning in install.packages :
cannot open: HTTP status was '407 Proxy Authentication Required'
Warning in install.packages :
unable to access index for repository http://software.rc.fas.harvard.edu/mirrors/R/src/contrib
Warning in install.packages :
package ‘gstat’ is not available (for R version 2.14.1)
I saw solutions like --intenet
and setInternet(TRUE)
which are only applicable for Windows OS.
Please provide help on changes I need to make to get behind my university proxy?
回答1:
You should be able to use the following in your R session:
Sys.setenv(http_proxy="http://user:pass@proxy.dom.com:8080/")
(Obviously, replace with your username, password, proxy server, and port.)
It's important that this is done before you first try to download anything--in other words, done preferably at the start of an R session. From the help page at ?download.file
:
These environment variables must be set before the download code is first used: they cannot be altered later by calling Sys.setenv.
There are ways to make this change "permanent" too, but that might be inconvenient if you are working on a laptop or working with multiple internet connections, some of which requires access via a proxy server, and some which don't.
回答2:
You can try.
R.home()
find file Renviron.site
And add you proxy server address in R_HOME/etc/Renviron.site
http_proxy=http://<<your proxy server address>>/
This steps help me.
来源:https://stackoverflow.com/questions/13264761/r-connect-via-proxy-in-ubuntu