debian10 制作动态扩容根分区镜像

环境说明:centos 7 主机使用kvm创建openstack动态扩容根分区镜像。

安装kvm包

yum install -y qemu-kvm qemu-kvm-tools libvirt virt-manager virt-install libguestfs-tools

创建kvm网络环境

cat <<EOF | tee /etc/sysconfig/network-scripts/ifcfg-eth0 >> /dev/null
BOOTPROTO=static
DEVICE=eth0
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED=no
EOF

cat <<EOF | tee /etc/sysconfig/network-scripts/ifcfg-br0 >> /dev/null
TYPE=Bridge
BOOTPROTO=static
IPV4_FAILURE_FATAL=no
NAME=br0
DEVICE=br0
ONBOOT=yes
IPADDR=192.168.100.100
NETMASK=255.255.255.0
GATEWAY=192.168.100.2
DNS1=223.5.5.5
EOF

systemctl restart network

上传centos ISO镜像

自行上传镜像到宿主机上。本教程将镜像上传到 /opt/image 目录。

创建qcow2文件

mkdir /opt/images
qemu-img create -f qcow2 /opt/images/Debian-10.9.0-amd64.qcow2 10G

启动kvm虚机

systemctl start libvirtd
virt-install --virt-type kvm --name Debian10 --ram 1024 --cdrom=/opt/image/debian-10.9.0-amd64-DVD-1.iso --disk path=/opt/images/Debian-10.9.0-amd64.qcow2 --network bridge=br0 --graphics vnc,listen=0.0.0.0 --noautoconsole

安装系统自行决定怎么安装,分区最好手动分区。
安装好系统,是让 reboot 重启系统。重启后kvm虚拟机不会启动系统。需要手动启动系统。

virsh list --all
virsh start Debian10
wget https://www.realvnc.com/download/file/vnc.files/VNC-Server-6.2.1-Linux-x64.deb
sudo dpkg -i VNC-Server-6.2.1-Linux-x64.deb
rm -rf VNC-Server-6.2.1-Linux-x64.deb

cat << EOF | sudo tee /etc/apt/sources.list >> /dev/null
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
EOF

wget https://az764295.vo.msecnd.net/stable/507ce72a4466fbb27b715c3722558bb15afa9f48/code_1.57.1-1623937013_amd64.deb
sudo dpkg -i code_1.57.1-1623937013_amd64.deb
rm -rf code_1.57.1-1623937013_amd64.deb

sudo apt install -y vim curl telnet traceroute autocutsel

sudo apt install -y flameshot
# 启动指令
flameshot gui
# 设置快捷键
Setting - Keyboard - Customer Shortcuts

# https://github.com/elmar/autocutsel-debian/tree/master
wget https://github.com/elmar/autocutsel-debian/archive/refs/heads/master.zip
unzip master.zip

sudo apt install -y fcitx
wget https://ime.sogouimecdn.com/202106250002/2613c0aff1bc1ab79199d2af3f89b3ff/dl/index/1612260778/sogoupinyin_2.4.0.3469_amd64.deb
sudo dpkg -i sogoupinyin_2.4.0.3469_amd64.deb


vncserver apt源 vscode vim curl telnet traceroute autocutsel 截图 搜狗

debian10 制作动态扩容根分区镜像

上一篇:几种设计思想


下一篇:LeetCode-019-删除链表的倒数第 N 个结点