欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

kvm离线方式安装

程序员文章站 2024-02-20 21:07:16
...

1.离线下载rpm包

[[email protected] ~]# yum install  qemu-kvm  libvirt virt-install   --downloadonly  --downloaddir=/tmp/kvm
[[email protected] kvm]# ls kvm
autogen-libopts-5.18-5.el7.x86_64.rpm                nmap-ncat-6.40-19.el7.x86_64.rpm
cyrus-sasl-2.1.26-23.el7.x86_64.rpm                  osinfo-db-20190805-2.el7.noarch.rpm
cyrus-sasl-gssapi-2.1.26-23.el7.x86_64.rpm           osinfo-db-tools-1.1.0-1.el7.x86_64.rpm
genisoimage-1.1.11-25.el7.x86_64.rpm                 python-backports-1.0-8.el7.x86_64.rpm
gnutls-dane-3.3.29-9.el7_6.x86_64.rpm                python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
gnutls-utils-3.3.29-9.el7_6.x86_64.rpm               python-ipaddr-2.1.11-2.el7.noarch.rpm
libarchive-3.1.2-14.el7_7.x86_64.rpm                 python-ipaddress-1.0.16-2.el7.noarch.rpm
libevent-2.0.21-4.el7.x86_64.rpm                     python-requests-2.6.0-9.el7_8.noarch.rpm
libosinfo-1.1.0-5.el7.x86_64.rpm                     python-six-1.9.0-2.el7.noarch.rpm
libpcap-1.5.3-12.el7.x86_64.rpm                      python-urllib3-1.10.2-7.el7.noarch.rpm
libusal-1.1.11-25.el7.x86_64.rpm                     unbound-libs-1.6.6-5.el7_8.x86_64.rpm
libvirt-bash-completion-4.5.0-33.el7_8.1.x86_64.rpm  virt-install-1.5.0-7.el7.noarch.rpm
libvirt-client-4.5.0-33.el7_8.1.x86_64.rpm           virt-manager-common-1.5.0-7.el7.noarch.rpm
libvirt-libs-4.5.0-33.el7_8.1.x86_64.rpm             yajl-2.0.4-4.el7.x86_64.rpm
libvirt-python-4.5.0-1.el7.x86_64.rpm
........

2.安装createrepo

[[email protected] ~]# yum install   -y createrepo
[[email protected] ~]# createrepo  /tmp/kvm

repodata     #多了repodata目录
autogen-libopts-5.18-5.el7.x86_64.rpm                nmap-ncat-6.40-19.el7.x86_64.rpm
cyrus-sasl-2.1.26-23.el7.x86_64.rpm                  osinfo-db-20190805-2.el7.noarch.rpm
cyrus-sasl-gssapi-2.1.26-23.el7.x86_64.rpm           osinfo-db-tools-1.1.0-1.el7.x86_64.rpm
genisoimage-1.1.11-25.el7.x86_64.rpm                 python-backports-1.0-8.el7.x86_64.rpm
gnutls-dane-3.3.29-9.el7_6.x86_64.rpm                python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
gnutls-utils-3.3.29-9.el7_6.x86_64.rpm               python-ipaddr-2.1.11-2.el7.noarch.rpm
libarchive-3.1.2-14.el7_7.x86_64.rpm                 python-ipaddress-1.0.16-2.el7.noarch.rpm
libevent-2.0.21-4.el7.x86_64.rpm                     python-requests-2.6.0-9.el7_8.noarch.rpm
libosinfo-1.1.0-5.el7.x86_64.rpm                     python-six-1.9.0-2.el7.noarch.rpm
libpcap-1.5.3-12.el7.x86_64.rpm                      python-urllib3-1.10.2-7.el7.noarch.rpm
libusal-1.1.11-25.el7.x86_64.rpm                     
libvirt-bash-completion-4.5.0-33.el7_8.1.x86_64.rpm  unbound-libs-1.6.6-5.el7_8.x86_64.rpm
libvirt-client-4.5.0-33.el7_8.1.x86_64.rpm           virt-install-1.5.0-7.el7.noarch.rpm
libvirt-libs-4.5.0-33.el7_8.1.x86_64.rpm             virt-manager-common-1.5.0-7.el7.noarch.rpm
libvirt-python-4.5.0-1.el7.x86_64.rpm                yajl-2.0.4-4.el7.x86_64.rpm
.............

3.打包,准备

[[email protected] ~]#  tar -cvf  kvm.tar     /tmp/kvm    

下载离线包,放置到要安装命令的服务器上

[[email protected] ~]# tar -xvf kvm.tar   -C  /opt/

4.指定本地源

[[email protected] ~]# vim /etc/yum.repos.d/CentOS-Media.repo
[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///opt/kvm
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

更新源

[[email protected] ~]# yum update

下载安装命令

[[email protected] ~]# yum install  qemu-kvm  libvirt virt-install 

补充

如果出现以下错误:
Error: Package: virt-manager-common-1.5.0-7.el7.noarch (c7-media)
Requires: libxml2-python
Error: Package: python-requests-2.6.0-9.el7_8.noarch (c7-media)
Requires: python-chardet >= 2.2.1-1
缺少libxml2-python、python-chardet
请在:https://pkgs.org/ 搜索下载rpm包。安装后,再次执行install命令

[[email protected] ~]# rpm -ivh  python-chardet-2.2.1-3.el7.noarch.rpm
[[email protected] ~]# rpm -ivh  libxml2-python-2.9.1-6.el7.4.x86_64.rpm
相关标签: linux应用