CentOS/Redflag7.3安装qemu5.0记录

编程

安装其实挺简单,下载源码编译即可

git clone https://gitlab.com/qemu-project/qemu.git

cd qemu

git submodule init

git submodule update --recursive

git checkout xxxxxx # 对应版本号

mkdir build

cd build

../configure --enable-debug

make -j2

make install # 安装

安装完后可以看到各种命令

[root@test build]# qemu-

qemu-aarch64 qemu-img qemu-mipsn32el qemu-riscv64 qemu-system-arm qemu-system-mips64el qemu-system-s390x qemu-tilegx

qemu-aarch64_be qemu-io qemu-nbd qemu-s390x qemu-system-cris qemu-system-mipsel qemu-system-sh4 qemu-x86_64

qemu-alpha qemu-m68k qemu-nios2 qemu-sh4 qemu-system-hppa qemu-system-moxie qemu-system-sh4eb qemu-xtensa

qemu-arm qemu-microblaze qemu-or1k qemu-sh4eb qemu-system-i386 qemu-system-nios2 qemu-system-sparc qemu-xtensaeb

qemu-armeb qemu-microblazeel qemu-ppc qemu-sparc qemu-system-lm32 qemu-system-or1k qemu-system-sparc64

qemu-cris qemu-mips qemu-ppc64 qemu-sparc32plus qemu-system-m68k qemu-system-ppc qemu-system-tricore

qemu-edid qemu-mips64 qemu-ppc64abi32 qemu-sparc64 qemu-system-microblaze qemu-system-ppc64 qemu-system-unicore32

qemu-ga qemu-mips64el qemu-ppc64le qemu-storage-daemon qemu-system-microblazeel qemu-system-riscv32 qemu-system-x86_64

qemu-hppa qemu-mipsel qemu-pr-helper qemu-system-aarch64 qemu-system-mips qemu-system-riscv64 qemu-system-xtensa

qemu-i386 qemu-mipsn32 qemu-riscv32 qemu-system-alpha qemu-system-mips64 qemu-system-rx qemu-system-xtensaeb

但是安装这个软件,又需要各种其他的依赖

比方说Python3

# 依赖安装,视情况而定

yum -y install zlib-devel libffi-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

yum install gcc -y

# 下载安装包

wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz

mv Python-3.7.4.tgz /usr/local/

mkdir /usr/local/python3

cd /usr/local/

tar -xvf Python-3.7.4.tgz

cd /usr/local/Python-3.7.4/

# 编译安装

./configure --prefix=/usr/local/python3

make & make install

ln -s /usr/local/python3/bin/python3 /usr/bin/python3

比方说 Ninja

apt install re2c

git clone git://github.com/ninja-build/ninja.git && cd ninja

./configure.py --bootstrap

sudo cp ninja /usr/bin/

ninja --version # 查看安装版本

比方说gcc7.5(要求版本大于某个特定版本号)

# 安装相关依赖

sudo yum -y update

sudo yum -y install bzip2 wget gcc gcc-c++ gmp-devel mpfr-devel libmpc-devel make

sudo yum -y install zlib

sudo yum -y install zlib-devel

# 下载安装包

wget https://ftp.gnu.org/gnu/gcc/gcc-7.5.0/gcc-7.5.0.tar.gz

tar -zxvf gcc-7.5.0.tar.gz

cd gcc-7.5.0

# 其他依赖

./contrib/download_prerequisites

mkdir gcc-build-7.5

cd gcc-build-7.5

# 编译

../configure --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --enable-gnu-indirect-function --with-tune=generic --disable-multilib

make -j4

make install

gcc -v

# 检查动态库 & 查找新生成的动态库

strings /usr/lib64/libstdc++.so.6 | grep GLIBC

find / -xdev -name "libstdc++.so*"

# 链接新的动态库

cp /usr/local/lib64/libstdc++.so.6.0.24 /usr/lib64/

rm -rf /usr/lib64/libstdc++.so.6

ln -s /usr/local/lib64/libstdc++.so.6.0.24 /usr/lib64/libstdc++.so.6

# 添加环境变量

# 在PATH里面追加 /usr/local/bin

# 添加 LD_LIBRARY_PATH、CC、CXX

# bash_profile 类似于

PATH=$PATH:$HOME/.local/bin:$HOME/bin:/usr/local/bin

LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH

CC=/usr/local/bin/gcc

CXX=/usr/local/bin/g++

export PATH

export LD_LIBRARY_PATH

export CC

export CXX

# 生效环境变量

source ~/.bash_profile

比如glib2和glib2-devel

yum install -y glib2 glib2-devel

比如 libmount-devel pixman-devel

yum install -y libmount-devel pixman-devel

参考

https://cloud.tencent.com/developer/article/1693084

https://www.cnblogs.com/music-liang/p/12900457.html

https://www.cnblogs.com/from-zero/p/14327440.html

以上是 CentOS/Redflag7.3安装qemu5.0记录 的全部内容, 来源链接: utcz.com/z/520012.html

回到顶部