kvm介绍
kvm部署
环境描述
- centos8虚拟机,桥接网卡ip(192.168.161.74/25)
- 关闭firewalld,Selinux
网卡配置
[root@vm3 ~]# cd /etc/sysconfig/network-scripts/
[root@vm3 network-scripts]# ls
ifcfg-br0 ifcfg-ens33
[root@vm3 network-scripts]# vim ifcfg-br0
TYPE=Bridge
BOOTPROTO=static
NAME=br0
DEVICE=br0
ONBOOT=yes
IPADDR=192.168.161.74
NETMASK=225.225.225.128
GATEWAY=192.168.161.1
DNS1=221.161.159.115
[root@vm3 network-scripts]# vi ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=static
NAME=ens33
DEVICE=ens33
ONBOOT=yes
BRIDGE=br0
[root@vm3 network-scripts]# systemctl restart NetworkManager
[root@vm3 network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
link/ether 00:0c:29:32:5b:02 brd ff:ff:ff:ff:ff:ff
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:0c:29:32:5b:02 brd ff:ff:ff:ff:ff:ff
inet 192.168.161.74/25 brd 192.168.161.127 scope global noprefixroute br0
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe32:5b02/64 scope link
valid_lft forever preferred_lft forever
验证CPU是否支持kvm
- vmx(Intel),svm(AMD),下面表示CPU支持kvm
[root@vm3 ~]# egrep -o 'vmx|svm' /proc/cpuinfo
svm
svm
svm
svm
svm
svm
svm
svm
安装KVM
- centos8源里没有qemu-kvm-tools,libvirt-python,bridge-utils软件包
- pkgs.org
## 安装工具包
[root@vm3 yum.repos.d]# yum -y install epel-release ##安装epel源
[root@vm3 yum.repos.d]# yum -y install vim wget net-tools unzip zip gcc gcc-c++
## 安装KVM
[root@vm3 ~]# yum -y install qemu-kvm qemu-img virt-manager libvirt libvirt-client virt-install virt-viewer libguestfs-tools
[root@vm3 opt]# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/qemu-kvm-tools-1.5.3-175.el7.x86_64.rpm
[root@vm3 opt]# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libvirt-python-4.5.0-1.el7.x86_64.rpm
[root@vm3 opt]# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/bridge-utils-1.5-9.el7.x86_64.rpm
[root@vm3 opt]# ls
bridge-utils-1.5-9.el7.x86_64.rpm qemu-kvm-tools-1.5.3-175.el7.x86_64.rpm
libvirt-python-4.5.0-1.el7.x86_64.rpm
[root@vm3 opt]# rpm -ivh libvirt-python-4.5.0-1.el7.x86_64.rpm
warning: libvirt-python-4.5.0-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:libvirt-python-4.5.0-1.el7 ################################# [100%]
[root@vm3 opt]# rpm -ivh --nodeps qemu-kvm-tools-1.5.3-175.el7.x86_64.rpm
warning: qemu-kvm-tools-1.5.3-175.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
file /usr/bin/kvm_stat from install of qemu-kvm-tools-10:1.5.3-175.el7.x86_64 conflicts with file from package kernel-tools-4.18.0-193.el8.x86_64
启动libvirtd服务
[root@vm3 opt]# systemctl enable --now libvirtd
[root@vm3 opt]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 32 192.168.122.1:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 [::]:22 [::]:*
验证安装结果
[root@vm3 ~]# lsmod|grep kvm
kvm_amd 110592 0
ccp 98304 1 kvm_amd
kvm 786432 1 kvm_amd
irqbypass 16384 1 kvm
测试
[root@vm3 ~]# virsh -c qemu:///system list
Id Name State
----------------------------------------------------
[root@vm3 ~]# virsh --version
4.5.0
[root@vm3 ~]# virt-install --version
2.2.1
[root@vm3 ~]# ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-kvm
[root@vm3 ~]# ll /usr/bin/qemu-kvm
lrwxrwxrwx 1 root root 21 Dec 1 16:24 /usr/bin/qemu-kvm -> /usr/libexec/qemu-kvm
查看网桥信息
[root@vm3 network-scripts]# nmcli conn
NAME UUID TYPE DEVICE
br0 d2d68553-f97e-7549-7a26-b34a26f29318 bridge br0
virbr0 38cf1f42-6b5d-4b69-b5c1-8f0879b6ee03 bridge virbr0
ens33 c96bc909-188e-ec64-3a96-6a90982b08ad ethernet ens33
[root@vm3 opt]# yum -y install console-bridge console-bridge-devel
[root@vm3 ~]# bridge link show
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br0 state forwarding priority 32 cost 100
[root@vm3 opt]# rpm -ivh bridge-utils-1.5-9.el7.x86_64.rpm
warning: bridge-utils-1.5-9.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:bridge-utils-1.5-9.el7 ################################# [100%]
[root@vm3 opt]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000c29325b02 no ens33
virbr0 8000.5254001058a1 yes virbr0-nic
KVM web管理界面安装
- kvm 的 web 管理界面是由 webvirtmgr 程序提供
- libvirt-python,libxml2-python,python-websockify在centos8源中没有提供,需单独下载安装
- pkgs.org
安装依赖包
[root@kvm ~]# yum -y install git python2-pip supervisor nginx python2-devel
[root@vm3 yum.repos.d]# wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/p/python-websockify-0.6.0-2.el7.noarch.rpm
[root@vm3 opt]# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libxml2-python-2.9.1-6.el7.5.x86_64.rpm
[root@vm3 opt]# rpm -ivh --nodeps libxml2-python-2.9.1-6.el7.5.x86_64.rpm
warning: libxml2-python-2.9.1-6.el7.5.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:libxml2-python-2.9.1-6.el7.5 ################################# [100%]
[root@vm3 opt]# rpm -ivh --nodeps python-websockify-0.6.0-2.el7.noarch.rpm
warning: python-websockify-0.6.0-2.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:python-websockify-0.6.0-2.el7 ################################# [100%]
升级pip
[root@vm3 webvirtmgr]# pip2 install --upgrade pip
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip2 install --user` instead.
Collecting pip
Downloading https://files.pythonhosted.org/packages/55/73/bce122d1ed0217b3c1a3439ab16dfa94bbeabd0d31755fcf907493abf39b/pip-20.3-py2.py3-none-any.whl (1.5MB)
100% |████████████████████████████████| 1.5MB 20kB/s
Installing collected packages: pip
Found existing installation: pip 9.0.3
Uninstalling pip-9.0.3:
Successfully uninstalled pip-9.0.3
Successfully installed pip-20.3
[root@vm3 webvirtmgr]# pip -V
pip 20.3 from /usr/lib/python2.7/site-packages/pip (python 2.7)
github拉取webvirtmgr代码
[root@vm3 ~]# cd /usr/local/src/
[root@vm3 src]# git clone git://github.com/retspen/webvirtmgr.git
Cloning into 'webvirtmgr'...
remote: Enumerating objects: 5614, done.
remote: Total 5614 (delta 0), reused 0 (delta 0), pack-reused 5614
Receiving objects: 100% (5614/5614), 2.98 MiB | 17.00 KiB/s, done.
Resolving deltas: 100% (3602/3602), done.
[root@vm3 src]# ls
webvirtmgr
[root@vm3 src]# cd webvirtmgr/
[root@vm3 webvirtmgr]# ls
conf dev-requirements.txt interfaces networks serverlog templates
console hostdetail locale README.rst servers Vagrantfile
create images manage.py requirements.txt setup.py vrtManager
deploy instance MANIFEST.in secrets storages webvirtmgr
安装webvirtmgr
[root@vm3 webvirtmgr]# pip install -r requirements.txt
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting django==1.5.5
Downloading Django-1.5.5.tar.gz (8.1 MB)
|████████████████████████████████| 8.1 MB 847 kB/s
Collecting gunicorn==19.5.0
Downloading gunicorn-19.5.0-py2.py3-none-any.whl (113 kB)
|████████████████████████████████| 113 kB 938 kB/s
Collecting lockfile>=0.9
Downloading lockfile-0.12.2-py2.py3-none-any.whl (13 kB)
Using legacy 'setup.py install' for django, since package 'wheel' is not installed.
Installing collected packages: django, gunicorn, lockfile
Running setup.py install for django ... done
Successfully installed django-1.5.5 gunicorn-19.5.0 lockfile-0.12.2
检查sqlite3是否安装
[root@vm3 ~]# python
Python 2.7.17 (default, Jun 5 2020, 03:38:32)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> exit()
初始化账号信息
[root@vm3 webvirtmgr]# python manage.py syncdb
WARNING:root:No local_settings file found.
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table servers_compute
Creating table instance_instance
Creating table create_flavor
You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'root'): root
Email address: 619585019@qq.com
Password:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 6 object(s) from 1 fixture(s)
拷贝webvirtmgr至nginx网页目录
[root@vm3 var]# mkdir /var/www
[root@vm3 var]# cp -r /usr/local/src/webvirtmgr/
conf/ interfaces/ setup.py
console/ locale/ storages/
create/ manage.py templates/
deploy/ MANIFEST.in .travis.yml
dev-requirements.txt networks/ Vagrantfile
.git/ README.rst vrtManager/
.gitignore requirements.txt webvirtmgr/
hostdetail/ secrets/ webvirtmgr.sqlite3
images/ serverlog/
instance/ servers/
[root@vm3 var]# cp -r /usr/local/src/webvirtmgr /var/www/
[root@vm3 var]# chown -R nginx.nginx /var/www/webvirtmgr/
配置密钥认证
- 由于这里webvirtmgr和kvm服务部署在同一台机器,所以这里是本地信任
[root@vm3 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:9H2F9oukeFvvCSZ/RATnFqup18Ky+CpJjIYJB6lyfkE root@vm3.localdomain
The key's randomart image is:
+---[RSA 3072]----+
| . ..o |
| o E ooo|
|. .. . ++.|
|o.... . . . .++ |
|.oo o.o S . .+o .|
| .o.o o . =.o..|
| .. . .. * O.o |
| o o X +..|
| .oo+ .o+ |
+----[SHA256]-----+
[root@vm3 ~]# ls .ssh/
id_rsa id_rsa.pub
[root@vm3 ~]# ssh-copy-id 192.168.161.74
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.161.74 (192.168.161.74)' can't be established.
ECDSA key fingerprint is SHA256:9glxMLsrTMRVp5ZYN2+kb21dBfz+jY2jh8EmxfnGAiI.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.161.74's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '192.168.161.74'"
and check to make sure that only the key(s) you wanted were added.
[root@vm3 ~]# ls .ssh/
authorized_keys id_rsa id_rsa.pub known_hosts
配置端口转发
[root@vm3 ~]# ssh 192.168.161.74 -L localhost:8000:localhost:8000 -L localhost:6080:localhost:60
Last login: Tue Dec 1 19:14:11 2020 from 192.168.161.74
[root@vm3 ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 127.0.0.1:6080 0.0.0.0:*
LISTEN 0 128 127.0.0.1:8000 0.0.0.0:*
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 32 192.168.122.1:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::1]:6080 [::]:*
LISTEN 0 128 [::1]:8000 [::]:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 [::]:22 [::]:*
配置nginx
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
server_name localhost;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
root html;
index index.html index.htm;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
[root@vm3 ~]# vim /etc/nginx/conf.d/webvirtmgr.conf
server {
listen 80 default_server;
server_name $hostname;
#access_log /var/log/nginx/webvirtmgr_access_log;
location /static/ {
root /var/www/webvirtmgr/webvirtmgr;
expires max;
}
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-Proto $remote_addr;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
client_max_body_size 1024M;
}
}
确保bind绑定的是本机8000端口
[root@vm3 ~]# vim /var/www/webvirtmgr/conf/gunicorn.conf.py
.............................................
bind = '0.0.0.0:8000' //确保此处绑定的是本机的8000端口,这个在nginx配置中定义了,被代理的端口
backlog = 2048
..............................................
重启nginx
[root@vm3 ~]# systemctl restart nginx
[root@vm3 ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 127.0.0.1:6080 0.0.0.0:*
LISTEN 0 128 127.0.0.1:8000 0.0.0.0:*
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 128 0.0.0.0:80 0.0.0.0:*
LISTEN 0 32 192.168.122.1:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::1]:6080 [::]:*
LISTEN 0 128 [::1]:8000 [::]:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 [::]:22 [::]:*
设置supervisor
[root@vm3 ~]# vim /etc/supervisord.conf
.........................................................
[program:webvirtmgr]
command=/usr/bin/python2 /var/www/webvirtmgr/manage.py run_gunicorn -c /var/www/webvirtmgr/conf/gunicorn.conf.py
directory=/var/www/webvirtmgr
autostart=true
autorestart=true
logfile=/var/log/supervisor/webvirtmgr.log
log_stderr=true
user=nginx
[program:webvirtmgr-console]
command=/usr/bin/python2 /var/www/webvirtmgr/console/webvirtmgr-console
directory=/var/www/webvirtmgr
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/webvirtmgr-console.log
redirect_stderr=true
user=nginx
启动supervisor并开机自启
[root@vm3 ~]# systemctl enable --now supervisord
Created symlink /etc/systemd/system/multi-user.target.wants/supervisord.service → /usr/lib/systemd/system/supervisord.service.
[root@vm3 ~]# systemctl status supervisord
● supervisord.service - Process Monitoring and Control Daemon
Loaded: loaded (/usr/lib/systemd/system/supervisord.service; enabled; vendor preset:>
Active: active (running) since Tue 2020-12-01 19:41:52 CST; 37s ago
Process: 23000 ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf (code=exited, >
Main PID: 23003 (supervisord)
Tasks: 2 (limit: 12322)
Memory: 41.5M
CGroup: /system.slice/supervisord.service
├─23003 /usr/bin/python3.6 /usr/bin/supervisord -c /etc/supervisord.conf
└─23035 /usr/bin/python2 /var/www/webvirtmgr/manage.py run_gunicorn -c
[root@vm3 ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 127.0.0.1:6080 0.0.0.0:*
LISTEN 0 128 127.0.0.1:8000 0.0.0.0:*
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 128 0.0.0.0:80 0.0.0.0:*
LISTEN 0 32 192.168.122.1:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::1]:6080 [::]:*
LISTEN 0 128 [::1]:8000 [::]:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 [::]:22 [::]:*
配置nginx用户
[root@vm3 ~]# su - nginx -s /bin/bash
[nginx@vm3 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/nginx/.ssh/id_rsa):
Created directory '/var/lib/nginx/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/lib/nginx/.ssh/id_rsa.
Your public key has been saved in /var/lib/nginx/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:pfpJO3CfSpSC7+WHSCKcm9pj/M8Wg4H18liojqKLjWs nginx@vm3.localdomain
The key's randomart image is:
+---[RSA 3072]----+
| |
| . |
| o o . |
| . +.o + |
| . o.B. S |
| = +.*+. |
| + + oo*+o . |
|+EB oo*oo+ |
|@=oo.o+ *+ |
+----[SHA256]-----+
[nginx@vm3 ~]$ touch ~/.ssh/config && echo -e "StrictHostKeyChecking=no\nUserKnownHostsFile=/dev/null" >> ~/.ssh/config
[nginx@vm3 ~]$ cat .ssh/config
StrictHostKeyChecking=no
UserKnownHostsFile=/dev/null
[nginx@vm3 ~]$ chmod 0600 .ssh/config
[nginx@vm3 ~]$ ssh-copy-id root@192.168.161.74
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/var/lib/nginx/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Warning: Permanently added '192.168.161.74' (ECDSA) to the list of known hosts.
root@192.168.161.74's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@192.168.161.74'"
and check to make sure that only the key(s) you wanted were added.
[nginx@vm3 ~]$ exit
logout
[root@vm3 ~]# vim /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
[Remote libvirt SSH access]
Identity=unix-user:root
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
ResultActive=yes
[root@vm3 ~]# chown -R root.root /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
[root@vm3 ~]# systemctl restart nginx
[root@vm3 ~]# systemctl restart libvirtd
[root@vm3 ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 127.0.0.1:6080 0.0.0.0:*
LISTEN 0 128 127.0.0.1:8000 0.0.0.0:*
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 128 0.0.0.0:80 0.0.0.0:*
LISTEN 0 32 192.168.122.1:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::1]:6080 [::]:*
LISTEN 0 128 [::1]:8000 [::]:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 [::]:22
验证
![]()
![]()
KVM web界面管理
创建ssh连接
![]()
![]()
添加存储池
![]()
![]()
添加镜像
![]()
- 上传镜像文件至/var/lib/libvirt/images
[wisan@fyj Downloads]$ scp CentOS-7-x86_64-DVD-2009.iso root@192.168.161.74:/var/lib/libvirt/images
root@192.168.161.74's password:
CentOS-7-x86_64-DVD-2009.iso 100% 4494MB 11.2MB/s 06:41
![]()
![]()
配置网络池
![]()
![]()
![]()
添加虚拟机实例
![]()
![]()
![]()
连接光盘镜像
![]()
设置web连接虚拟机的密码
![]()
启动虚拟机
![]()