Linux使用错误小结(CentOS)- yum更新软件失败

yum使用条件:yum的使用要保证internet网络连通,和“cat /etc/resolv.conf”文件下存在“nameserver 8.8.8.8”才可正常更新。 
yum,是Yellow dog Updater, Modified 的简称,是杜克大学为了提高RPM 软件包安装性而开发的一种软件包管理器。
yum 的宗旨是自动化地升级,安装/移除rpm 包,收集rpm 包的相关信息,检查依赖性并自动提示用户解决。自动解决包的倚赖性问题,便于管理大量系统的更新问题。yum 的关键之处是要有可靠的repository。
以下文件在重启系统(CentOS)
重启网路服务,修改“cat /etc/sysconfig/network-scripts/ifcfg-enp0s3”文件后:
[root@localhost install-files]# service network restart
会导致,“cat /etc/resolv.conf”此文件更新,“nameserver 8.8.8.8”自动删除。
配置如下( confA1):
[root@localhost install-files]# cat /etc/resolv.conf 
# Generated by NetworkManager
search lan
nameserver fd7b:ac2f:6d73::1
nameserver 8.8.8.8
问题1:
如果在配置:
[root@localhost install-files]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
配置:DNS=192.168.10.1
则会导致“cat /etc/resolv.conf”文件异常更新,如下:
# Generated by NetworkManager
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
解决1:
应该注释:“cat /etc/sysconfig/network-scripts/ifcfg-enp0s3”文件:
#DNS=192.168.10.1
然后重启网路服务生效“service network restart”,
然后,类似以上( confA1)的配置,就可以ok使用。
问题2
One of the configured repositories failed (未知),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:
 ....
 Cannot find a valid baseurl for repo: base/7/x86_64
解决2:“cat /etc/resolv.conf”文件中增加“nameserver 8.8.8.8”解决。
问题3
[root@localhost log]# yum install telnet
Loaded plugins: fastestmirror
http://mirrors.btte.net/centos/7.1.1503/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.btte.net; Unknown error"
Trying other mirror.
http://mirrors.neusoft.edu.cn/centos/7.1.1503/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.neusoft.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.hust.edu.cn/centos/7.1.1503/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.hust.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.nwsuaf.edu.cn/centos/7.1.1503/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.nwsuaf.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.pubyun.com/centos/7.1.1503/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.pubyun.com; Unknown error"
Trying other mirror.
http://mirrors.opencas.cn/centos/7.1.1503/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.opencas.cn; Unknown error"
Trying other mirror.
http://mirror.neu.edu.cn/centos/7.1.1503/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.neu.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.sina.cn/centos/7.1.1503/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.sina.cn; Unknown error"
Trying other mirror.
…………………………
解决3:修改好ip能上网: CentOS配置ip[快速配置]

  • 12
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CentOS是一个非常强大的Linux操作系统,其使用广泛,存储库中也包含了很多应用程序和软件。但是,在某些情况下,你可能需要访问其他存储库或通过其他方式安装特定软件包。为此,你需要将Linux系统向CentOS Base写入Yum源。下面是关于如何将LinuxCentOS Base写入Yum源的一些重要步骤。 1. 在CentOS上创建一个新的yum仓库 在本地计算机上创建一个新的yum仓库,确保你已经登录到这台CentOS系统,并可以执行root级别的命令,这是管理系统所必需的。 2. 编辑/创建一个repo文件 编辑或创建一个‘.repo’文件,该文件包含将添加到Linux操作系统中的yum存储库url。可以使用以下命令从终端编辑器中打开新的repo文件: vi /etc/yum.repos.d/new-repo.repo 3. 在该文件中添加仓库 添加新的yum存储库的URL和名称。这可以使用以下命令来完成: [nameofrepo] name=Description of the repository baseurl=http://path/to/repo enabled=1 gpgkey=file:///path/to/RPM-GPG-KEY-repo gpgcheck=1 你需要三点: 名称-自己选择你想要的名字,最好是有意义的。 仓库的URL-你将使用该URL添加仓库。 是否启用-这将检查方括号中的“repo = enabled”值是否设置为“1”。 4. 关闭文件并保存更改 退出/保存新的repo文件并关闭编辑器 5. 使用yum命令安装软件包 你现在已经写入了CentOS Base的yum存储库,可以使用yum命令来安装新的软件包。使用以下命令: yum install nameofpackage 写入Linux操作系统的CentOS Base Yum存储库是执行许多任务的必要步骤。这是一项非常简单的任务,可以在几个步骤内完成。这种方法需要注意检查,以确保系统是否存在任何安全问题,因此建议先进行尝试,并检查是否有任何错误或其他问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值