yum源常见问题及解决方案 ~
yum源常搭建常见问题及解决方案如果虚拟机无法下载软件 可能的原因有:1.真机yum源没有配置好2.真机共享yum源的挂载错误3.真机apache没有开启4.真机火墙没有关闭(或者是真机火墙开着的但未添加http服务到火墙策略中)5.虚拟机的yum源指向错误6.所挂载的镜像本身就有问题排错1:我这里的真机曾经用过7.3版本的镜像资源安装过apache,而此时挂载的是7.2版本的...
·
yum源常搭建常见问题及解决方案
如果虚拟机无法下载软件 可能的原因有:
1.真机yum源没有配置好
2.真机共享yum源的挂载错误
3.真机apache没有开启
4.真机火墙没有关闭(或者是真机火墙开着的但未添加http服务到火墙策略中)
5.虚拟机的yum源指向错误
6.所挂载的镜像本身就有问题
排错1:
我这里的真机曾经用过7.3版本的镜像资源安装过apache,而此时挂载的是7.2版本的镜像资源,若要想重新安装新版本的apache,就必须先卸载原先与系统版本不匹配的apahe,然后再重新安装新版本的apache
[root@foundation66 yum.repos.d]# yum clean all
Loaded plugins: aliases, changelog, kabi, langpacks, ovl, product-id, search-
: disabled-repos, subscription-manager, tmprepo, verify,
: versionlock
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading support for Red Hat kernel ABI
Cleaning repos: source7.2
Cleaning up everything
[root@foundation66 yum.repos.d]# yum repolist
Loaded plugins: aliases, changelog, kabi, langpacks, ovl, product-id, search-
: disabled-repos, subscription-manager, tmprepo, verify,
: versionlock
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading support for Red Hat kernel ABI
source7.2 | 4.1 kB 00:00
(1/2): source7.2/primary_db | 3.6 MB 00:00
(2/2): source7.2/group_gz | 136 kB 00:00
repo id repo name status
source7.2 source7.2 4,620
repolist: 4,620
##报错
[root@foundation66 iso]# yum install httpd -y
@@解决方案:
##卸载原有的与主机版本不对应的apache
[root@foundation66 iso]# yum remove -y httpd-tools-2.4.6-45.el7.x86_64
##重新安装即可
[root@foundation66 iso]# yum install httpd -y
排错2:真机apache未开启,镜像资源无法共享
[root@localhost ~]# yum clean all
Loaded plugins: langpacks
Cleaning repos: rhel7.0
Cleaning up everything
[root@localhost ~]# yum repolist
@@解决方案:
[root@foundation66 ~]# systemctl status httpd
##开启apache
[root@foundation66 ~]# systemctl start httpd
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: langpacks
Cleaning repos: rhel7.0
Cleaning up everything
[root@localhost yum.repos.d]# yum repolist
Loaded plugins: langpacks
rhel7.0 | 4.1 kB 00:00:00
(1/2): rhel7.0/group_gz | 134 kB 00:00:00
(2/2): rhel7.0/primary_db | 3.4 MB 00:00:00
repo id repo name status
rhel7.0 rhel7.0 4,305
repolist: 4,305
排错3:真机防火墙未关闭,当真机用http方式共享镜像资源时被拒绝
[root@localhost Desktop]# yum clean all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: rhel7.2
Cleaning up everything
[root@localhost Desktop]# yum repolist
@@解决方案:
[root@foundation66 ~]# systemctl stop firewalld
[root@foundation66 ~]# systemctl status firewalld
[root@localhost Desktop]# yum clean all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: rhel7.2
Cleaning up everything
[root@localhost Desktop]# yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. rhel7.2 | 4.1 kB 00:00
(1/2): rhel7.2/group_gz | 136 kB 00:00
(2/2): rhel7.2/primary_db | 3.6 MB 00:00
repo id repo name status
rhel7.2 &&&&&&&&&&&&& 4,620
repolist: 4,620
排错4:虚拟机ip设定错误,真机与虚拟机网络不可达,都无法通信(网络位相同的主机才能通信),更谈不上共享镜像资源了
[root@localhost Desktop]# yum clean all
[root@localhost Desktop]# yum repolist
@@解决方案:
[root@localhost Desktop]# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 52:54:00:52:62:54 txqueuelen 1000 (Ethernet)
RX packets 11 bytes 774 (774.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
##添加ip
[root@localhost Desktop]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
#########################
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.234
PREFIX=24
[root@localhost Desktop]# systemctl restart network
[root@localhost Desktop]# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.25.254.234 netmask 255.255.255.0 broadcast 172.25.254.255
inet6 fe80::5054:ff:fe52:6254 prefixlen 64 scopeid 0x20<link>
ether 52:54:00:52:62:54 txqueuelen 1000 (Ethernet)
RX packets 11 bytes 774 (774.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 24 bytes 3029 (2.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost Desktop]# yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel7.2 | 4.1 kB 00:00
(1/2): rhel7.2/group_gz | 136 kB 00:00
(2/2): rhel7.2/primary_db | 3.6 MB 00:00
repo id repo name status
rhel7.2 &&&&&&&&&&&&& 4,620
repolist: 4,620
排错5:虚拟机yum源指向错误
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: langpacks
Cleaning repos: rhel7.0
Cleaning up everything
##说明yum源指向有问题
[root@localhost yum.repos.d]# yum repolist
@@解决方案:
[root@localhost yum.repos.d]# cat rhel7.0.repo
[rhel7.0]
name=rhel7.0
baseurl=http://source7.0 ##发现yum源指向确实有问题
gpgcheck=0
##更正yum源指向
[root@localhost yum.repos.d]# vim rhel7.0.repo
########################
[rhel7.0]
name=rhel7.0
baseurl=http://172.25.254.66/source7.0
gpgcheck=0
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: langpacks
Cleaning repos: rhel7.0
Cleaning up everything
[root@localhost yum.repos.d]# yum repolist
Loaded plugins: langpacks
rhel7.0 | 4.1 kB 00:00:00
(1/2): rhel7.0/group_gz | 134 kB 00:00:00
(2/2): rhel7.0/primary_db | 3.4 MB 00:00:00
repo id repo name status
rhel7.0 rhel7.0 4,305
repolist: 4,305
排错6:真机所共享的镜像本身有问题
[root@localhost ~]# yum clean all
Loaded plugins: langpacks
Cleaning repos: rhel_dvd
Cleaning up everything
[root@localhost ~]# yum repolist
Loaded plugins: langpacks
rhel_dvd | 4.1 kB 00:00
(1/2): rhel_dvd/group_gz | 134 kB 00:00
(2/2): rhel_dvd/primary_db | 3.4 MB 00:00
repo id repo name status
rhel_dvd Remote classroom copy of dvd 4,305
repolist: 4,305
[root@localhost ~]# yum install -y httpd
@@解决方案:
重新下载一个镜像并重新挂载即可
[root@foundation66 Desktop]# mv rhel-server-7.0-x86_64-dvd.iso /iso
mv: overwrite ‘/iso/rhel-server-7.0-x86_64-dvd.iso’? y
[root@foundation66 Desktop]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda13 122268336 79564520 42703816 66% /
devtmpfs 1822536 0 1822536 0% /dev
tmpfs 1837252 520 1836732 1% /dev/shm
tmpfs 1837252 9480 1827772 1% /run
tmpfs 1837252 0 1837252 0% /sys/fs/cgroup
/dev/sda11 505580 150720 354860 30% /boot
/dev/sda1 262144 37528 224616 15% /boot/efi
/dev/loop0 3947824 3947824 0 100% /source7.2
/dev/loop1 3762278 3762278 0 100% /var/www/html/source6.5
/dev/loop2 3704296 3704296 0 100% /var/www/html/source7.3
/dev/loop3 3947824 3947824 0 100% /var/www/html/source7.2
tmpfs 367452 44 367408 1% /run/user/1000
tmpfs 367452 0 367452 0% /run/user/0
/dev/loop4 3654720 3654720 0 100% /var/www/html/source7.0
##卸载
[root@foundation66 Desktop]# umount /var/www/html/source7.0
##重新挂载
[root@foundation66 Desktop]# mount /iso/rhel-server-7.0-x86_64-dvd.iso /var/www/html/source7.0
mount: /dev/loop4 is write-protected, mounting read-only
[root@localhost ~]# yum install -y httpd
补充: 如果执行yum clean all时,没有任何报错,但列出的yum源详细信息中软件包的个数为0,这是怎么回事呢?
很有可能是你配置yum源的文件名称错误,一定要是以.repo结尾系统才能识别到
[root@localhost yum.repos.d]# pwd
/etc/yum.repos.d
# 发现确实是文件名称错误
[root@localhost yum.repos.d]# ls
redhat.repo rhel7.2
# 更改文件名
[root@localhost yum.repos.d]# mv rhel7.2 rhel7.2.repo
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum repolsit
更多推荐
已为社区贡献14条内容
所有评论(0)