centos7.6 x86_84上qemu kvm 安装kylin server v10系统(kunpeng920 arm64)

本文宿主机为centos7.6(x86_64上,vmware创建),然后在centos7.6使用qemu kvm安装kylin 服务器v10系统(kunpeng920 arm64)。

一、安装

1、编译安装qemu

(1)、下载qemu源码

[root@mylocalhost home]# wget https://download.qemu.org/qemu-5.0.0.tar.bz2

(2)、解压

[root@mylocalhost home]# ls
qemu-5.0.0.tar.bz2
[root@mylocalhost home]# tar xf qemu-5.0.0.tar.bz2 
[root@mylocalhost home]# ls
qemu-5.0.0  qemu-5.0.0.tar.bz2
[root@mylocalhost home]# cd qemu-5.0.0

(3)编译qemu,支持arm


[root@mylocalhost qemu-5.0.0]# ./configure --enable-kvm --enable-debug --target-list=aarch64-softmmu
[root@mylocalhost qemu-5.0.0]# make -j4
[root@mylocalhost qemu-5.0.0]# 

(4)、安装qemu

[root@mylocalhost qemu-5.0.0]# make install

安装完成,可以看到:

[root@mylocalhost qemu-5.0.0]# which qemu-system-aarch64 
/usr/local/bin/qemu-system-aarch64

2、安装麒麟v10

(1)、下载qemu_efi.fd,虚拟机引导启动

[root@mylocalhost qemu-5.0.0]# 
[root@mylocalhost qemu-5.0.0]# mkdir kylinv10
[root@mylocalhost qemu-5.0.0]# cd kylinv10/
[root@mylocalhost kylinv10]# wget https://releases.linaro.org/components/kernel/uefi-linaro/latest/release/qemu64/QEMU_EFI.fd
HTTP request sent, awaiting response... 200 OK
Length: 2097152 (2.0M) [binary/octet-stream]
Saving to: ‘QEMU_EFI.fd’

100%[==================================================================>] 2,097,152    108KB/s   in 27s    

2021-02-20 17:53:34 (75.1 KB/s) - ‘QEMU_EFI.fd’ saved [2097152/2097152]

[root@mylocalhost kylinv10]# ls
QEMU_EFI.fd
[root@mylocalhost kylinv10]# 

(2)、制作硬盘,并把麒麟v10系统镜像也拷贝到当前目录下

[root@mylocalhost kylinv10]# qemu-img create -f qcow2 kylin_arm64.qcow2 50G
Formatting 'kylin_arm64.qcow2', fmt=qcow2 size=53687091200 cluster_size=65536 lazy_refcounts=off refcount_bits=16
[root@mylocalhost kylinv10]# cp /mnt/hgfs/iso/other/Kylin-Server-10-SP1-Release-Build04-20200711-arm64.iso .
[root@mylocalhost kylinv10]# ll -th
total 4.0G
-rwxr-xr-x. 1 root root 4.0G Feb 20 18:03 Kylin-Server-10-SP1-Release-Build04-20200711-arm64.iso
-rw-r--r--. 1 root root 193K Feb 20 17:57 kylin_arm64.qcow2
-rw-r--r--. 1 root root 2.0M Jan 28  2018 QEMU_EFI.fd
[root@mylocalhost kylinv10]# 

(3)qemu-system-aarch64创建kylin v10 虚拟机系统

[root@mylocalhost kylinv10]# qemu-system-aarch64 -m 2048 -cpu cortex-a72 -smp 4 -M virt -bios QEMU_EFI.fd -nographic -drive if=none,file=kylin_arm64.qcow2,id=hd0 -device virtio-blk-device,drive=hd0  -drive if=none,file=Kylin-Server-10-SP1-Release-Build04-20200711-arm64.iso,id=cdrom,media=cdrom -device virtio-scsi-device -device scsi-cd,drive=cdrom -net nic -net user,hostfwd=tcp::2222-:22

(4)配置虚拟机系统

按照安装向导一步一步的安装就行,中括号里为!的都要设置下。

最后如下图,就可以安装了:

我的配置过程:

================================================================================
================================================================================
Installation

1) [x] Language settings                 2) [x] Time settings
       (Simplified Chinese (China))             (Asia/Shanghai timezone)
3) [x] Installation source               4) [x] Software selection
       (Local media)                            (Minimal Install)
5) [!] Installation Destination          6) [x] Kdump
       (No disks selected)                      (Kdump is enabled)
7) [ ] Network configuration             8) [!] Root password
       (Not connected)                          (Password is not set.)
9) [!] User creation
       (No user will be created)

Please make a selection from the above ['b' to begin installation, 'h' to help,
'q' to quit, 'r' to refresh]: 4
================================================================================
================================================================================
Software selection

Base environment

1) [x] Minimal Install                  4) [ ] Basic Web Server
2) [ ] Server                           5) [ ] Virtualization Host
3) [ ] File and Print Server            6) [ ] Server with UKUI GUI

Please make a selection from the above ['c' to continue, 'h' to help, 'q' to
quit, 'r' to refresh]: c
================================================================================
================================================================================
Software selection

Add-ons for selected environment

1) [ ] Standard                         7) [ ] Network Servers
2) [ ] Debugging Tools                  8) [ ] Scientific Support
3) [ ] Container Management             9) [ ] Security Tools
4) [ ] Development Tools                10) [ ] System Tools
5) [ ] Headless Management              11) [ ] Smart Card Support
6) [ ] Legacy UNIX Compatibility        12) [ ] Graphical Administration Tools

Please make a selection from the above ['c' to continue, 'h' to help, 'q' to
quit, 'r' to refresh]: 2
================================================================================
================================================================================
Software selection

Add-ons for selected environment

1) [ ] Standard                         7) [ ] Network Servers
2) [x] Debugging Tools                  8) [ ] Scientific Support
3) [ ] Container Management             9) [ ] Security Tools
4) [ ] Development Tools                10) [ ] System Tools
5) [ ] Headless Management              11) [ ] Smart Card Support
6) [ ] Legacy UNIX Compatibility        12) [ ] Graphical Administration Tools

Please make a selection from the above ['c' to continue, 'h' to help, 'q' to
quit, 'r' to refresh]: 4
================================================================================
================================================================================
Software selection

Add-ons for selected environment

1) [ ] Standard                         7) [ ] Network Servers
2) [x] Debugging Tools                  8) [ ] Scientific Support
3) [ ] Container Management             9) [ ] Security Tools
4) [x] Development Tools                10) [ ] System Tools
5) [ ] Headless Management              11) [ ] Smart Card Support
6) [ ] Legacy UNIX Compatibility        12) [ ] Graphical Administration Tools

Please make a selection from the above ['c' to continue, 'h' to help, 'q' to
quit, 'r' to refresh]: 10
================================================================================
================================================================================
Software selection

Add-ons for selected environment

1) [ ] Standard                         7) [ ] Network Servers
2) [x] Debugging Tools                  8) [ ] Scientific Support
3) [ ] Container Management             9) [ ] Security Tools
4) [x] Development Tools                10) [x] System Tools
5) [ ] Headless Management              11) [ ] Smart Card Support
6) [ ] Legacy UNIX Compatibility        12) [ ] Graphical Administration Tools

Please make a selection from the above ['c' to continue, 'h' to help, 'q' to
quit, 'r' to refresh]: c
================================================================================
================================================================================
Installation

1) [x] Language settings                 2) [x] Time settings
       (Simplified Chinese (China))             (Asia/Shanghai timezone)
3) [!] Installation source               4) [!] Software selection
       (Processing...)                          (Processing...)
5) [!] Installation Destination          6) [x] Kdump
       (No disks selected)                      (Kdump is enabled)
7) [ ] Network configuration             8) [!] Root password
       (Not connected)                          (Password is not set.)
9) [!] User creation
       (No user will be created)

Please make a selection from the above ['b' to begin installation, 'h' to help,
'q' to quit, 'r' to refresh]: 5
Probing storage...
================================================================================
================================================================================
Installation Destination

1) [x] : 50 GiB (vda)

1 disk selected; 50 GiB capacity; 50 GiB free ...

Please make a selection from the above ['c' to continue, 'h' to help, 'q' to
quit, 'r' to refresh]: c
================================================================================
================================================================================
Partitioning Options

1) [ ] Replace Existing Linux system(s)
2) [ ] Use All Space
3) [ ] Use Free Space
4) [ ] Manually assign mount points (EXPERIMENTAL)

Installation requires partitioning of your hard drive. Select what space to use
for the install target or manually assign mount points.

Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to
refresh]: 1
================================================================================
================================================================================
Partitioning Options

1) [x] Replace Existing Linux system(s)
2) [ ] Use All Space
3) [ ] Use Free Space
4) [ ] Manually assign mount points (EXPERIMENTAL)

Installation requires partitioning of your hard drive. Select what space to use
for the install target or manually assign mount points.

Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to
refresh]: c
================================================================================
================================================================================
Partition Scheme Options

1) [ ] Standard Partition
2) [ ] Btrfs
3) [x] LVM
4) [ ] LVM Thin Provisioning

Select a partition scheme configuration.

Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to
refresh]: c
Generating updated storage configuration
Checking storage configuration...

================================================================================
================================================================================
Installation

1) [x] Language settings                 2) [x] Time settings
       (Simplified Chinese (China))             (Asia/Shanghai timezone)
3) [x] Installation source               4) [x] Software selection
       (Local media)                            (Minimal Install)
5) [x] Installation Destination          6) [x] Kdump
       (Automatic partitioning                  (Kdump is enabled)
       selected)
7) [ ] Network configuration             8) [!] Root password
       (Not connected)                          (Password is not set.)
9) [!] User creation
       (No user will be created)

Please make a selection from the above ['b' to begin installation, 'h' to help,
'q' to quit, 'r' to refresh]: 8
================================================================================
================================================================================
Root password

Please select new root password. You will have to type it twice.

Password: 
Password (confirm): 
================================================================================
================================================================================
Question

   The password you have provided is weak: The password contains less than 3
   character classes
   Would you like to use it anyway?

Please respond 'yes' or 'no': yes
================================================================================
================================================================================
Installation

1) [x] Language settings                 2) [x] Time settings
       (Simplified Chinese (China))             (Asia/Shanghai timezone)
3) [x] Installation source               4) [x] Software selection
       (Local media)                            (Minimal Install)
5) [x] Installation Destination          6) [x] Kdump
       (Automatic partitioning                  (Kdump is enabled)
       selected)
7) [ ] Network configuration             8) [x] Root password
       (Not connected)                          (Password is set.)
9) [ ] User creation
       (No user will be created)

Please make a selection from the above ['b' to begin installation, 'h' to help,
'q' to quit, 'r' to refresh]: b
================================================================================
Progress

.
Setting up the installation environment
.
Configuring storage
..
Creating disklabel on /dev/vda
[ 1936.041304][  3]  vda:
[ 1940.288587][  1]  vda:  3:log  4:storage-log  5:program->Switch tab: Alt+Tab 
[ 1942.224417][  1]  vda: vda1
[ 1948.353606][  3]  vda: vda1
Creating xfs on /dev/vda2 vda1 vda2
Creating lvmpv on /dev/vda3da1 vda2
[ 1976.064171][  0]  vda: vda1 vda2 vda3
Creating swap on /dev/mapper/klas-swap opened block device exclusively vda3 [2562 lvm].
Creating xfs on /dev/mapper/klas-rootusive opened block device for write vda3 [2587 lvm].
Creating efi on /dev/vda1
[ 2039.967812][  1] VFS: Open an exclusive opened block device for write vda [2458 anaconda].
[ 2040.022596][  0] VFS: Open an exclusive opened block device for write vda3 [2458 anaconda].
[ 2040.382793][  3] VFS: Open an exclusive opened block device for write vda3 [2458 anaconda].
[ 2046.290410][  3] VFS: Open an exclusive opened block device for write vda [2458 anaconda].
[ 2046.358795][  1] VFS: Open an exclusive opened block device for write vda3 [2458 anaconda].
[ 2046.591474][  1] VFS: Open an exclusive opened block device for write vda3 [2458 anaconda].
[ 2050.083316][  2] VFS: Open an write opened block device exclusively dm-2 [2458 anaconda].
[ 2050.169952][  2] Adding 2199488k swap on /dev/mapper/klas-swap.  Priority:-2 extents:1 across:2199488k FS
[ 2059.729863][  1] XFS (dm-3): Mounting V5 Filesystem
[ 2059.823790][  1] XFS (dm-3): Ending clean mount
[ 2071.774432][  1] XFS (vda2): Mounting V5 Filesystem
[ 2071.870976][  3] XFS (vda2): Ending clean mount
Running pre-installation scripts
.
Discovering realm to join
.
Running pre-installation tasks
......
Installing.
Starting package installation process
Downloading packages
Preparing transaction from installation source

(5)、安装完成,按enter键重启虚拟机

 

二、桥接模式网络配置

1、宿主机上

a、停止NetworkManager服务

[root@localhost ~]# systemctl stop NetworkManager
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# systemctl disable NetworkManager
Removed /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service.
Removed /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
[root@localhost ~]# 

b、修改ifcfg-xxx文件

(1)、修改宿主机原网络配置文件

[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# cp ifcfg-enp33 ifcfg-enp33.bak
[root@localhost network-scripts]# vi ifcfg-enp33

将IPADDR、NETMASK、GATEWAY三项删掉,添加以下内容:

BRIDGE="br1"

(2)、配置网桥

[root@localhost network-scripts]#  vi ifcfg-br1 
BOOTPROTO=static
NAME=br1
DEVICE=br1
TYPE=Bridge
ONBOOT=yes
IPADDR=192.168.xx.xx
NETMASK=255.255.255.0
GATEWAY=192.168.xx.xxx

 

2、虚拟机内部网络配置

修改/etc/sysconfig/network-scripts/ifcfg-xxx,配置ip跟宿主机同一网段即可。

 

3、网桥设置

[root@localhost ~]# ip tuntap add dev tap0 mod tap
[root@localhost ~]# brctl addif br1 tap0
[root@localhost ~]# 
[root@localhost ~]# ifconfig tap0 0.0.0.0 promisc up
[root@localhost ~]# 
[root@localhost ~]# 

 

4、重启网络服务


[root@localhost ~]# service network restart
[root@localhost ~]#

到此,网络配置完成,可以ssh连上了。

 

 

 

 

 

 

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值