Cod*_*Med 8 yum terminal centos node.js
在一个CentOS 7服务器,我试图安装版5.x的Node.js,但由于某些原因,yum不停地尝试安装版本0.x,并返回一个错误,当它不能找到的版本0.x在5.x下载站点。该错误表明yum正在将版本0.x文件名与版本5.xurl 连接起来。我认为这yum表明 CentOS 7 机器上的配置有问题。 安装 5.x 版需要对以下内容进行哪些具体更改?
根错误消息是:
Error downloading packages:
nodejs-0.10.42-1nodesource.el7.centos.x86_64: [Errno 256] No more mirrors to try.
Run Code Online (Sandbox Code Playgroud)
可以在以下链接中查看我的以下代码源自的发布者页面。此外,早先尝试遵循其他链接中的说明可能会导致一些复杂情况。为了探索早期尝试的可能残余,我目前正在运行以下命令并等待结果:grep -rnw '/path/to/somewhere/' -e "pattern"
这是用于设置节点源位置的终端输出:
[root@localhost tmp]# curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
## Installing the NodeSource Node.js 5.x repo...
## Inspecting system...
+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m
## Confirming "el7-x86_64" is supported...
+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Downloading release setup RPM...
+ mktemp
+ curl -sL -o '/tmp/tmp.sH82u4Gpap' 'https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Installing release setup RPM...
+ rpm -i --nosignature --force '/tmp/tmp.sH82u4Gpap'
## Cleaning up...
+ rm -f '/tmp/tmp.sH82u4Gpap'
## Checking for existing installations...
+ rpm -qa 'node|npm' | grep -v nodesource
## Run `yum install -y nodejs` (as root) to install Node.js 5.x and npm.
## You may also need development tools to build native addons:
## `yum install -y gcc-c++ make`
Run Code Online (Sandbox Code Playgroud)
以下是/tmp执行上述命令后文件夹的内容列表:
[root@localhost tmp]# ls -al
total 8
drwxrwxrwt. 13 root root 320 Feb 14 06:13 .
dr-xr-xr-x. 19 root root 4096 Jan 29 20:54 ..
drwx------. 2 user user 60 Feb 13 20:05 .esd-1000
drwxrwxrwt. 2 root root 40 Feb 13 20:04 .font-unix
prw-------. 1 root root 0 Feb 13 20:05 hogsuspend
drwxrwxrwt. 2 root root 80 Feb 13 20:05 .ICE-unix
srwxrwxrwx. 1 mongod mongod 0 Feb 13 20:04 mongodb-27017.sock
drwx------. 2 user user 40 Dec 31 1969 orbit-user
drwx------. 2 user user 60 Feb 13 20:05 ssh-AmQyH8IIEC2m
drwx------. 3 root root 60 Feb 13 20:05 systemd-private-74534ca9946043cc88dbe52a38b4344d-colord.service-hDR3Cd
drwx------. 3 root root 60 Feb 13 20:04 systemd-private-74534ca9946043cc88dbe52a38b4344d-rtkit-daemon.service-ZAQmPk
drwxrwxrwt. 2 root root 40 Feb 13 20:04 .Test-unix
drwx------. 2 user user 40 Feb 13 20:08 tracker-extract-files.1000
-r--r--r--. 1 root root 11 Feb 13 20:05 .X0-lock
drwxrwxrwt. 2 root root 60 Feb 13 20:05 .X11-unix
drwxrwxrwt. 2 root root 40 Feb 13 20:04 .XIM-unix
Run Code Online (Sandbox Code Playgroud)
以下是尝试nodejs使用安装的结果yum:
[root@localhost tmp]# yum install -y nodejs
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.lax.hugeserver.com
* epel: mirror.sfo12.us.leaseweb.net
* extras: mirror.keystealth.org
* updates: mirror.supremebytes.com
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.42-1nodesource.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================================================================
Installing:
nodejs x86_64 0.10.42-1nodesource.el7.centos nodesource 4.5 M
Transaction Summary
================================================================================================================================================================================
Install 1 Package
Total download size: 4.5 M
Installed size: 16 M
Downloading packages:
No Presto metadata available for nodesource
nodejs-0.10.42-1nodesource.el7 FAILED
https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodejs-0.10.42-1nodesource.el7.centos.x86_64.rpm: [Errno 14] HTTPS Error 404 - Not Found ] 0.0 B/s | 0 B --:--:-- ETA
Trying other mirror.
To address this issue please refer to the below knowledge base article
https://access.redhat.com/articles/1320623
If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/
Error downloading packages:
nodejs-0.10.42-1nodesource.el7.centos.x86_64: [Errno 256] No more mirrors to try.
[root@localhost tmp]#
Run Code Online (Sandbox Code Playgroud)
作为记录,gedit /etc/yum.repos.d/nodesource-el.repo显示以下内容:
[nodesource]
name=Node.js Packages for Enterprise Linux 7 - $basearch
baseurl=https://rpm.nodesource.com/pub_5.x/el/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
[nodesource-source]
name=Node.js for Enterprise Linux 7 - $basearch - Source
baseurl=https://rpm.nodesource.com/pub_5.x/el/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
gpgcheck=1
Run Code Online (Sandbox Code Playgroud)
我怀疑问题可能是由于之前运行过其他命令而导致的:
curl --silent --location rpm.nodesource.com/setup | bash -
Run Code Online (Sandbox Code Playgroud)
我猜潜在的问题是 yum 如何坚持这些结果 curl --silent --location ... | bash - commands
控制案例:
在不同的虚拟机上完全全新安装 CentOS 7,以下三个简单的命令成功安装了正确的当前版本的 nodejs 5.x:
# cd /tmp
# curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
# yum install -y nodejs
# node --version
v5.6.0
Run Code Online (Sandbox Code Playgroud)
控制案例的这些结果表明问题在于出现问题的机器中 yum 的配置方式。 那么需要对有问题的机器做哪些具体的修改,让yum配置生成正确的下载url呢? 将所有内容移植到不同的 VM 是不合理的。当然,这只是 yum 配置中的一两行,可以更改以解决此问题。
Fah*_*tha 13
这似乎是一个缓存问题,尽管目前还不清楚出了什么问题。在聊天中与海报进行了一些对话后,运行yum clean all解决了问题。
海报指出了以下内容:
[root@localhost yum]# ls /var/cache/yum/x86_64/7/nodesource/packages
nodejs-0.10.42-1nodesource.el7.centos.x86_64.rpm
[root@localhost yum]# yum clean all
[root@localhost yum]# ls /var/cache/yum/x86_64/7/nodesource/packages
[root@localhost yum]# yum install -y nodejs
.... much terminal output during successful install
[root@localhost yum]# node --version
v5.6.0
Run Code Online (Sandbox Code Playgroud)
所以yum clean all删除了已经存储在缓存中的过时包。
我对基于 Red Hat 的发行版没有足够的知识或经验来说明这里出了什么问题,因此将避免进一步评论。
小智 6
这是我必须做的...
首先,从 EPEL 中删除安装的 nodejs 包:
sudo yum remove nodejs
Run Code Online (Sandbox Code Playgroud)
列出您的 yum 存储库:
yum repolist
Run Code Online (Sandbox Code Playgroud)
这是我的节点回购条目的样子:
Run Code Online (Sandbox Code Playgroud)nodesource/x86_64 Node.js Packages for Enterprise Linux 7 - x86_64
如果您好奇,请列出节点存储库中的包:
yum --disablerepo="*" --enablerepo="nodesource" list available
Run Code Online (Sandbox Code Playgroud)
然后仅使用节点存储库执行 yum install:
yum --disablerepo="*" --enablerepo="nodesource" install nodejs
Run Code Online (Sandbox Code Playgroud)
我怀疑 node 存储库中使用的编号方案没有将 nodejs 用作 EPEL 存储库中包的替代品,但这只是猜测。