修改debian8更新源
deb http://ftp.cn.debian.org/debian/ jessie main contrib non-free
更新系统
安装常用软件
# apt-get install vnc4server
# vncpasswd
# vncserver
# apt-get install xfce4
# apt-get install xrdp
# apt-get install iceweasel
# dpkg-reconfigure locales
选择:
en_US.UTF-8
zh_CN.GB2312
zh_CN.UTF-8
zh_CN.GBK
zh_TW.BIG5
zh_TW.UTF-8
默认:
zh_CN.UTF-8
# apt-get install xfonts-intl-chinese xfonts-wqy ttf-wqy-zenhei fonts-wqy-zenhei ttf-wqy-microhei fonts-wqy-microhei
# apt-get install fcitx fcitx-pinyin fcitx-table-wubi ibus-pinyin ibus-table-wubi
# vim /etc/X11/Xsession.d/95xchinput_start
export GTK_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
export QT_IM_MODULE=fcitx
/usr/bin/fcitx &
# chmod +x /etc/X11/Xsession.d/95xchinput_start
# reboot
安装虚拟化软件
# apt-get install qemu
# apt-get install libvirt-bin
# apt-get install virt-manager
开启包转发
net.ipv4.ip_forward=1
修改时区
Asia/Shanghai
桥接网络配置
auto br0
bridge_ports eno1
iface br0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
br0 Link encap:Ethernet HWaddr f0:1f:af:e4:8f:b0
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::f21f:afff:fee4:8fb0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4857340 errors:0 dropped:282 overruns:0 frame:0
TX packets:2771394 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5522849817 (5.5 GB) TX bytes:173500148 (173.5 MB)
bridge name bridge id STP enabled interfaces
br0 8000.f01fafe48fb0 no eno1
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.1.1 0.0.0.0 UG 0 0 0 br0
link-local * 255.255.0.0 U 1000 0 0 br0
192.168.1.0 * 255.255.255.0 U 0 0 0 br0
建立虚拟机平台步骤说明
# qemu-img create -f qcow2 debian8.qcow2 50G
虚拟机的磁盘扩容方法
方法一:
直接添加另外一块硬盘,比如创建数据盘,然后添加至虚拟机:
# qemu-img create -f qcow2 data.qcow2 5T
登录到虚拟机中,首先查看是否能新识别硬盘,例如/dev/vdb:
# fdisk -l
然后对其进行格式化:
# mkfs.ext4 /dev/vdb
接下来,新建一个目录用来挂载新的硬盘:
# mkdir /test
# mount /dev/vdb /test
最后,将该挂载添加到开机启动中:
# blkid /dev/vdb
/dev/vdb: UUID="19fc1d1d-7891-4e22-99ef-ea3e08a61840" TYPE="ext4"
# vim /etc/fstab
UUID=19fc1d1d-7891-4e22-99ef-ea3e08a61840 /test ext4 defaults 1 2
方法二:
关闭虚拟机,直接拉升原有磁盘空间,命令如下:
qemu-img resize [-q] filename [+ | -]size
例如:
# qemu-img create -f qcow2 data.qcow2 1G
# qemu-img resize data.qcow2 +1G
# qemu-img info data.qcow2
镜像格式转换:
qemu-img convert [-c] [-p] [-q] [-n] [-f fmt] [-t cache] [-T src_cache] [-O output_fmt] [-o options] [-s snapshot_id_or_name] [-l snapshot_param] [-S sparse_size] filename [filename2 [...]] output_filename
vmdk –-> qcow2:
# qemu-img convert -f vmdk -O qcow2 test.vmdk test_converted.qcow2
qcow2 –-> raw:
# qemu-img convert -f qcow2 -O raw image.qcow2 image_converted.raw
(责任编辑:IT) |