自定义创建新的虚拟机
选择硬件兼容性
创建空白硬盘,稍后选择 iso 文件创建系统。
选择操作系统类型
为虚拟机命名
选择处理器配置
选择虚拟机内存
选择虚拟机网络类型
选择 I/O 控制器类型
选择磁盘类型
创建虚拟机磁盘
选择磁盘空间容量
指定磁盘文件
确定虚拟机配置
选择 ISO 映像
查看本机电脑网络 IP 和 GATEWAY
修改网口配置文件
[root@redhat6 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
HWADDR="00:0C:29:E3:81:B9"
NM_CONTROLLED="yes"
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.69.153
NETMASK=255.255.255.0
GATEWAY=192.168.69.163
DNS1=8.8.8.8
重启网络服务
[root@redhat6 ~]# service network restart
正在关闭接口 eth0: [确定]
关闭环回接口: [确定]
弹出环回接口: [确定]
弹出界面 eth0: [确定]
查看虚拟机 IP
[root@redhat6 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:E3:81:B9
inet addr:192.168.69.153 Bcast:192.168.69.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fee3:81b9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:46678 errors:0 dropped:0 overruns:0 frame:0
TX packets:28406 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:20947540 (19.9 MiB) TX bytes:4178874 (3.9 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:23 errors:0 dropped:0 overruns:0 frame:0
TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2464 (2.4 KiB) TX bytes:2464 (2.4 KiB)
测试虚拟机与宿主机通信
[root@redhat6 ~]# ping 192.168.69.152
PING 192.168.69.152 (192.168.69.152) 56(84) bytes of data.
64 bytes from 192.168.69.152: icmp_seq=1 ttl=64 time=0.301 ms
64 bytes from 192.168.69.152: icmp_seq=2 ttl=64 time=0.446 ms
64 bytes from 192.168.69.152: icmp_seq=3 ttl=64 time=0.415 ms
64 bytes from 192.168.69.152: icmp_seq=4 ttl=64 time=0.399 ms
64 bytes from 192.168.69.152: icmp_seq=5 ttl=64 time=0.434 ms
^C
--- 192.168.69.152 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4580ms
rtt min/avg/max/mdev = 0.301/0.399/0.446/0.051 ms
测试虚拟机与网关通信
[root@redhat6 ~]# ping 192.168.69.163
PING 192.168.69.163 (192.168.69.163) 56(84) bytes of data.
64 bytes from 192.168.69.163: icmp_seq=1 ttl=64 time=72.6 ms
64 bytes from 192.168.69.163: icmp_seq=2 ttl=64 time=7.22 ms
64 bytes from 192.168.69.163: icmp_seq=3 ttl=64 time=55.3 ms
64 bytes from 192.168.69.163: icmp_seq=4 ttl=64 time=64.0 ms
64 bytes from 192.168.69.163: icmp_seq=5 ttl=64 time=58.1 ms
^C
--- 192.168.69.163 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4481ms
rtt min/avg/max/mdev = 7.220/51.484/72.638/22.910 ms
测试虚拟机与互联网通信
[root@redhat6 ~]# ping baidu.com
PING baidu.com (39.156.66.10) 56(84) bytes of data.
64 bytes from 39.156.66.10: icmp_seq=1 ttl=48 time=35.1 ms
64 bytes from 39.156.66.10: icmp_seq=2 ttl=48 time=92.3 ms
64 bytes from 39.156.66.10: icmp_seq=3 ttl=48 time=91.7 ms
64 bytes from 39.156.66.10: icmp_seq=4 ttl=48 time=114 ms
64 bytes from 39.156.66.10: icmp_seq=5 ttl=48 time=105 ms
^C
--- baidu.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4449ms
rtt min/avg/max/mdev = 35.118/87.775/114.482/27.663 ms
查看系统 ssh 服务状态
[root@redhat6 ~]# service sshd status
openssh-daemon (pid 1878) 正在运行...
使用 XShell 连接虚拟机
使用 Xftp 连接虚拟机
RedHat 的 yum 源是收费的,没有成功注册 RH 的机器是不能正常使用 yum 的,因此配置其他的 yum 源。
查看本地 yum 程序
[root@redhat6 ~]# rpm -qa|grep yum
yum-metadata-parser-1.1.2-16.el6.x86_64
yum-3.2.29-17.el6.noarch
yum-utils-1.1.30-6.el6.noarch
yum-rhn-plugin-0.9.1-26.el6.noarch
卸载本地 yum 程序
# 卸载本地yum,不检查依赖性,卸载yum程序
[root@redhat6 ~]# rpm -qa|grep yum|xargs rpm -e --nodeps
# 查看本地 yum 程序
[root@redhat6 ~]# rpm -qa|grep yum
网站推荐
yum 及其依赖包
python-iniparse-0.3.1-2.1.el6.noarch.rpm
python-urlgrabber-3.9.1-11.el6.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-3.2.29-73.el6.centos.noarch.rpm
yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm
下载 rpm 示例
注意:Edge 在 IE 模式下打开连接即可下载。
Distribution 和 Site 不限定没有进行测试,我选择的是 Distribution 为 CentOS,Site 为 ftp.pbone.net 的 rpm 包。
先安装两个依赖包
[root@redhat6 3.2.29]# cd /opt/applications/yum/3.2.29/
[root@redhat6 3.2.29]# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
[root@redhat6 3.2.29]# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
再安装 yum 包
[root@redhat6 3.2.29]# rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm
注意:这两个 rpm 包一起安装(网上说是由于依赖的关系)
出现依赖问题
warning: yum-3.2.29-73.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
python-urlgrabber >= 3.9.1-10 is needed by yum-3.2.29-73.el6.centos.noarch
安装缺少的依赖包(目录 3 中已经包含此缺少的依赖包)
[root@redhat6 3.2.29]# rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm
注意:安装错误提示缺少 python-urlgrabber 的版本 >=3.9.1-10,我安装了一个 python-urlgrabber-3.9.1-10.fc15.noarch.rpm 包,依然会报错,初步怀疑是因为下载的包不是 el6 的。
出现依赖冲突
file /usr/lib/python2.6/site-packages/urlgrabber/grabber.py from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
查询并卸载冲突程序
[root@redhat6 ~]# rpm -qa|grep python-urlgrabber
python-urlgrabber-3.9.1-8.el6.noarch
[root@redhat6 ~]# rpm -e python-urlgrabber-3.9.1-8.el6.noarch
[root@redhat6 ~]# rpm -qa|grep python-urlgrabber
再次安装 yum 包
[root@redhat6 3.2.29]# rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm
进入 yum 源配置目录
[root@redhat6 3.2.29]# cd /etc/yum.repos.d/
[root@redhat6 yum.repos.d]# ls
redhat.repo rhel-source.repo
备份源配置文件
[root@redhat6 yum.repos.d]# cp rhel-source.repo rhel-source.repo.bak
修改 rhel-source.repo 文件
[root@redhat6 yum.repos.d]# vim rhel-source.repo
[aliyun]
name=redhat6-aliyun
baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
enabled=1
gpgcheck=0
清除 yum 源配置缓存
[root@redhat6 yum.repos.d]# yum clean all
测试命令 1
[root@redhat6 yum.repos.d]# yum install yum
测试命令 2
[root@redhat6 yum.repos.d]# yum install telnet
已加载插件:fastestmirror, product-id, subscription-manager
Updating Red Hat repositories.
Repository 'local': Error parsing config: Error parsing "gpgcheck = '0 #\xe6\x98\xaf\xe5\x90\xa6\xe4\xbd\xbf\xe7\x94\xa8\xe6\x95\xb0\xe5\xad\x97\xe7\xad\xbe\xe5\x90\x8d 0\xe8\xa1\xa8\xe7\xa4\xba\xe4\xb8\x8d\xe4\xbd\xbf\xe7\x94\xa8 1\xe8\xa1\xa8\xe7\xa4\xba\xe4\xbd\xbf\xe7\x94\xa8'": invalid boolean value
设置安装进程
Loading mirror speeds from cached hostfile
解决依赖关系
--> 执行事务检查
---> Package telnet.x86_64 1:0.17-65.el7_8 will be 安装
--> 处理依赖关系 libc.so.6(GLIBC_2.15)(64bit),它被软件包 1:telnet-0.17-65.el7_8.x86_64 需要
--> 执行事务检查
---> Package glibc.x86_64 0:2.12-1.25.el6 will be 升级
--> 处理依赖关系 glibc = 2.12-1.25.el6,它被软件包 glibc-common-2.12-1.25.el6.x86_64 需要
---> Package glibc.x86_64 0:2.17-317.el7 will be an update
--> 执行事务检查
---> Package glibc-common.x86_64 0:2.12-1.25.el6 will be 升级
---> Package glibc-common.x86_64 0:2.17-317.el7 will be an update
--> 处理依赖关系 /usr/bin/bash,它被软件包 glibc-common-2.17-317.el7.x86_64 需要
--> 执行事务检查
---> Package bash.x86_64 0:4.1.2-8.el6 will be 升级
---> Package bash.x86_64 0:4.2.46-34.el7 will be an update
--> 处理 bash-4.2.46-34.el7.x86_64 与 filesystem < 3 的冲突
--> 使用新的信息重新计算依赖关系
--> 执行事务检查
---> Package filesystem.x86_64 0:2.4.30-2.1.el6 will be 升级
---> Package filesystem.x86_64 0:3.2-25.el7 will be an update
--> 完成依赖关系计算
依赖关系解决
=================================================================================================================================================================================================================
软件包 架构 版本 仓库 大小
=================================================================================================================================================================================================================
正在安装:
telnet x86_64 1:0.17-65.el7_8 aliyun 64 k
正在升级:
filesystem x86_64 3.2-25.el7 aliyun 1.0 M
为依赖而更新:
bash x86_64 4.2.46-34.el7 aliyun 1.0 M
glibc x86_64 2.17-317.el7 aliyun 3.6 M
glibc-common x86_64 2.17-317.el7 aliyun 11 M
事务概要
=================================================================================================================================================================================================================
Install 1 Package(s)
Upgrade 4 Package(s)
总下载量:17 M
确定吗?[y/N]:N
在用户的命令下退出
Your transaction was saved, rerun it with:
yum load-transaction /tmp/yum_save_tx-2023-03-11-06-07TQENYl.yumtx
查看 yum 相关包
[root@redhat6 yum.repos.d]# rpm -qa|grep yum
yum-metadata-parser-1.1.2-16.el6.x86_64
yum-3.2.29-73.el6.centos.noarch
yum-plugin-fastestmirror-1.1.30-37.el6.noarch
查看 yum 版本
[root@redhat6 yum.repos.d]# yum --version
3.2.29
Installed: rpm-4.8.0-16.el6.x86_64 at 2023-03-09 06:36
Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> at 2011-03-09 06:32
Committed: Panu Matilainen <[email protected]> at 2011-03-09
Installed: subscription-manager-0.95.11-1.el6.x86_64 at 2023-03-09 06:38
Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> at 2011-05-04 19:02
Committed: Adrian Likins <[email protected]> at 2011-05-04
Installed: yum-3.2.29-73.el6.centos.noarch at 2023-03-10 16:09
Built : CentOS BuildSystem <http://bugs.centos.org> at 2016-05-11 20:37
Committed: Johnny Hughes <[email protected]> at 2016-05-10
Installed: yum-plugin-fastestmirror-1.1.30-37.el6.noarch at 2023-03-10 16:09
Built : CentOS BuildSystem <http://bugs.centos.org> at 2016-05-10 21:04
Committed: Valentina Mukhamedzhanova <[email protected]> at 2016-02-10
在网上找到一个源配置文件的内容,修改后,执行 yum install yum
命令报错。
Cannot retrieve repository metadata (repomd.xml) for repository: extras. Please verify its path and
怀疑为 baseurl 的链接内容有误。
linux——rhel安装yum yum源使用的几个报错小总结 - 爱码网 (likecs.com)