Slackware服务器中R无法安装GitHub包:出现name lookup timeout错误
Hey there, let's break down why you're hitting that "name lookup timed out" error when installing rCharts from GitHub on your Slackware server—especially since it works smoothly on your Windows laptop. Here are the most likely culprits and fixes to try:
Your Slackware server's DNS settings might be misconfigured, making it unable to resolve GitHub's API domain.
- First, test if the server can reach GitHub's API: Run
nslookup api.github.comorping api.github.comin the terminal. If you get "unknown host" or timeouts, DNS is the problem. - Fix it by updating your
/etc/resolv.confwith reliable DNS servers. Add these lines:
Retest the lookup after this—you should get valid IP addresses for GitHub's API.echo "nameserver 8.8.8.8" >> /etc/resolv.conf echo "nameserver 1.1.1.1" >> /etc/resolv.conf
Slackware's firewall (like iptables) or your server's network environment (e.g., corporate firewall, VPS security group) might be blocking outbound requests to GitHub.
- Test this by temporarily disabling the firewall:
- For iptables:
service iptables stop - For firewalld:
service firewalld stop
- For iptables:
- Try running
devtools::install_github('ramnathv/rCharts@dev')again. If it works, you'll need to add a rule to allow HTTPS (port 443) traffic toapi.github.comin your firewall settings.
Your Windows laptop might be using a proxy to access GitHub, but your server isn't set up with the same proxy details.
- If your network requires a proxy, configure it in R first:
ReplaceSys.setenv(http_proxy = "http://your-proxy-address:port") Sys.setenv(https_proxy = "http://your-proxy-address:port")your-proxy-address:portwith your actual proxy info, then retry the installation.
If all else fails, skip the GitHub API lookup entirely by installing from a local zip:
- Download the dev branch of rCharts on your server:
wget https://github.com/ramnathv/rCharts/archive/refs/heads/dev.zip - Unzip the file:
unzip dev.zip - Install the package locally in R:
install.packages("./rCharts-dev", repos = NULL, type = "source")
内容的提问来源于stack exchange,提问作者Pribadi Pramudya

