We wanted to setup local copy of cran to speed up installs of packages behind the corporate proxy.
Following instructions given on website.
Create simple script
Install Apache http server
sync.sh has contents
rsync -rvCtL --delete --include="*.tar.gz" --include="PACKAGES*" --exclude="*/*" cran.r-project.org::CRAN/src/contrib /var/www/cran
Above script just deletes all the old packges , copies new ones into folder /var/www/cran
You can choose any other location
Rsync used to stop many times due to connection or other issues so i just added it in loop , if exist is not clean run again
call.sh has contents
./sync.sh
while [ $? -ne 0 ]; do
./sync.sh
done
Now just schedule the script call.sh via cron to run at regular intervals , the official website say to run every 2 days.
http://cran.r-project.org/mirror-howto.html
You can now use the above location in contrib url for R packages