ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

安装Qemu-6.1.0

2021-10-09 21:59:59  阅读:1575  来源: 互联网

标签:Qemu rongtao 安装 Installing build 6.1 home qemu


安装Qemu

荣涛
2021年9月23日

1. yum安装

TODO
CentOS8使用yum安装的qemu版本为4.2.0,如果需要最新版本,需要从https://www.qemu.org/download/下载最新源码,编译安装。

2. 源码安装

2.1. 下载

Qemu最新源码下载链接:https://www.qemu.org/download/

CentOS8使用yum安装的qemu版本为4.2.0,如果需要最新版本,需要从https://www.qemu.org/download/下载最新源码,编译安装。

2.2. 编译

wget https://download.qemu.org/qemu-6.1.0.tar.xz
tar xvJf qemu-6.1.0.tar.xz
cd qemu-6.1.0
./configure
make

如果使用GitLab上的master分支,可以:

git clone https://gitlab.com/qemu-project/qemu.git
cd qemu
git submodule init
git submodule update --recursive
./configure
make

当执行./configure会产生如下错误:

[rongtao@bogon qemu-6.1.0]$ ./configure 
Using './build' as the directory for build output

ERROR: Cannot find Ninja

为了确保体系结构、KVM支持、调试功能,可以在配置阶段指令选项:

./configure '--target-list=x86_64-softmmu' '--enable-kvm' '--enable-debug'

安装Ninja见附录。安装Ninja之后,再次./configure,提示仍旧有错误:

$ ./configure 
Using './build' as the directory for build output
The Meson build system
Version: 0.55.3
Source dir: /home/rongtao/qemu-6.1.0
Build dir: /home/rongtao/qemu-6.1.0/build
Build type: native build
Project name: qemu
Project version: 6.1.0
C compiler for the host machine: cc (gcc 8.4.1 "cc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1)")
C linker for the host machine: cc ld.bfd 2.30-93
Host machine cpu family: x86_64
Host machine cpu: x86_64
../meson.build:10: WARNING: Module unstable-keyval has no backwards or forwards compatibility and might not exist in future releases.
Program sh found: YES
Program python3 found: YES (/usr/bin/python3)
Program bzip2 found: YES
C++ compiler for the host machine: c++ (gcc 8.4.1 "c++ (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1)")
C++ linker for the host machine: c++ ld.bfd 2.30-93
Program cgcc found: NO
Library m found: YES
Run-time dependency threads found: YES
Library util found: YES
Run-time dependency appleframeworks found: NO (tried framework)
Found pkg-config: /usr/bin/pkg-config (1.4.2)
Run-time dependency pixman-1 found: NO (tried pkgconfig)

../meson.build:328:2: ERROR: Dependency "pixman-1" not found, tried pkgconfig

A full log can be found at /home/rongtao/qemu-6.1.0/build/meson-logs/meson-log.txt

ERROR: meson setup failed

我们一个一个看。为了清晰,给出截图:

在这里插入图片描述

安装pixman即可,参见附录。接着再次./configure,即可成功。然后进行编译:

$ make
[...]此处省略很多行
[9524/9527] Compiling C object tests/qtest/fdc-test.p/fdc-test.c.o
[9525/9527] Linking target tests/qtest/fdc-test
[9526/9527] Compiling C object tests/qtest/tpm-crb-swtpm-test.p/tpm-tests.c.o
[9527/9527] Linking target tests/qtest/tpm-crb-swtpm-test
  AS      multiboot.o
  BUILD   multiboot.img
  BUILD   multiboot.raw
  SIGN    multiboot.bin
  AS      linuxboot.o
  BUILD   linuxboot.img
  BUILD   linuxboot.raw
  SIGN    linuxboot.bin
  CC      linuxboot_dma.o
  BUILD   linuxboot_dma.img
  BUILD   linuxboot_dma.raw
  SIGN    linuxboot_dma.bin
  AS      kvmvapic.o
  BUILD   kvmvapic.img
  BUILD   kvmvapic.raw
  SIGN    kvmvapic.bin
  AS      pvh.o
  CC      pvh_main.o
  BUILD   pvh.img
  BUILD   pvh.raw
  SIGN    pvh.bin
make[1]: Leaving directory '/home/rongtao/qemu-6.1.0/build'
changing dir to build for make ""...
make[1]: Entering directory '/home/rongtao/qemu-6.1.0/build'
[1/177] Generating qemu-version.h with a meson_exe.py custom command
[2/35] Generating QAPI test (include) with a custom command
make[1]: Leaving directory '/home/rongtao/qemu-6.1.0/build'
$ 

2.3. 安装

$ sudo make install
[...]
changing dir to build for make "install"...
make[1]: Entering directory '/home/rongtao/qemu-6.1.0/build'
[1/144] Generating qemu-version.h with a meson_exe.py custom command
[1/2] Installing files.
Installing subdir /home/rongtao/qemu-6.1.0/qga/run to /usr/local/var/run
Installing trace/trace-events-all to /usr/local/share/qemu
Installing qemu-system-aarch64 to /usr/local/bin
Stripping target 'qemu-system-aarch64' using strip.
Installing qemu-system-alpha to /usr/local/bin
Stripping target 'qemu-system-alpha' using strip.
Installing qemu-system-arm to /usr/local/bin
Stripping target 'qemu-system-arm' using strip.
Installing qemu-system-avr to /usr/local/bin
Stripping target 'qemu-system-avr' using strip.
[...]
Installing /home/rongtao/qemu-6.1.0/build/pc-bios/descriptors/60-edk2-i386.json to /usr/local/share/qemu/firmware
Installing /home/rongtao/qemu-6.1.0/build/pc-bios/descriptors/60-edk2-x86_64.json to /usr/local/share/qemu/firmware
Installing /home/rongtao/qemu-6.1.0/pc-bios/keymaps/sl to /usr/local/share/qemu/keymaps
Installing /home/rongtao/qemu-6.1.0/pc-bios/keymaps/sv to /usr/local/share/qemu/keymaps
make[1]: Leaving directory '/home/rongtao/qemu-6.1.0/build'

查看Qemu版本:

$ qemu-img --version
qemu-img version 6.1.0
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers

安装成功。

3. 参考链接

  1. Documentation/9psetup
  2. https://www.qemu.org/download/

4. 附录

4.1. 安装Ninja

参考链接:How to Install Invoice Ninja on CentOS 7

Ninja下载:RPM包

这里使用RPM包安装,但是安装过程会提示需要Python2.7,正如centos.pkgs.org所说,ninja的依赖为:

emacs-filesystem	-
libc.so.6(GLIBC_2.15)(64bit)	-
libgcc_s.so.1()(64bit)	-
libgcc_s.so.1(GCC_3.0)(64bit)	-
libm.so.6()(64bit)	-
libstdc++.so.6()(64bit)	-
libstdc++.so.6(CXXABI_1.3)(64bit)	-
libstdc++.so.6(GLIBCXX_3.4)(64bit)	-
python(abi)	= 2.7
rtld(GNU_HASH)	-
vim-filesystem	-

直接使用yum安装python2.7就可以了:

$ sudo yum install python2
Last metadata expiration check: 0:47:34 ago on Thu 23 Sep 2021 08:41:15 AM CST.
Dependencies resolved.
=============================================================================================================================
 Package                           Architecture    Version                                          Repository          Size
=============================================================================================================================
Installing:
 python2                           x86_64          2.7.18-4.module_el8.4.0+668+03e3490a             appstream          109 k
Installing dependencies:
 python2-libs                      x86_64          2.7.18-4.module_el8.4.0+668+03e3490a             appstream          6.0 M
 python2-pip-wheel                 noarch          9.0.3-18.module_el8.4.0+642+1dc4fb01             appstream          1.0 M
 python2-setuptools-wheel          noarch          39.0.1-13.module_el8.4.0+642+1dc4fb01            appstream          287 k
Installing weak dependencies:
 python2-pip                       noarch          9.0.3-18.module_el8.4.0+642+1dc4fb01             appstream          1.7 M
 python2-setuptools                noarch          39.0.1-13.module_el8.4.0+642+1dc4fb01            appstream          642 k
Enabling module streams:
 python27                                          2.7                                                                      

Transaction Summary
=============================================================================================================================
Install  6 Packages

Total download size: 9.7 M
Installed size: 37 M
Is this ok [y/N]: y

然后再次安装ninja:

$ sudo rpm -i ninja-build-1.10.2-3.el7.x86_64.rpm

成功。

4.2. 安装pixman

很简单

$ sudo yum install -y pixman pixman-devel

Copyright (C) CESTC Com.

标签:Qemu,rongtao,安装,Installing,build,6.1,home,qemu
来源: https://blog.csdn.net/Rong_Toa/article/details/120679819

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有