git clone https://github.com/ucare-uchicago/femu.git cd femu mkdir build-femu # Switch to the FEMU building directory cd build-femu # Copy femu script cp ../femu-scripts/femu-copy-scripts.sh . ./femu-copy-scripts.sh . # only Debian/Ubuntu based distributions supported sudo ./pkgdep.sh
1.2 编译安装 femu
1
./femu-compile.sh
1.3 准备虚拟机镜像
使用官方镜像
1 2 3 4
mkdir -p ~/images/ cd ~/images wget http://people.cs.uchicago.edu/~huaicheng/femu/femu-vm.tar.xz tar xJvf femu-vm.tar.xz
自制镜像
1 2 3 4 5 6 7 8 9
# Download a Ubuntu server ISO file mkdir -p ~/images/ cd ~/images wget https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/16.04/ubuntu-16.04.7-server-amd64.iso sudo apt-get install qemu-system-x86 # Create a QCOW2 disk image qemu-img create -f qcow2 femu.qcow2 80G # install guest OS to femu.qcow2 (You need a GUI environment to prepare the VM image) sudo qemu-system-x86_64 -cdrom ubuntu-16.04.7-server-amd64.iso -hda femu.qcow2 -boot d -net nic -net user -m 4096 -localtime -smp 4 -cpu host -enable-kvm
虚拟机创建完成后,可使用以下命令验证系统是否正确安装
1
sudo qemu-system-x86_64 -hda femu.qcow2 -net nic -net user -m 4096 -localtime -smp 4 -cpu host -enable-kvm