# Virtualization Generate Ubuntu 14.04 image (install libguestfs first): ``` virt-builder ubuntu-16.04 \ --no-check-signature --format qcow2 --size 30G \ --root-password password:rootpass --output ubuntu.qcow2 ## Root is at /dev/vda1 ``` Create the second disk: ``` qemu-img create -f qcow2 ext4.qcow2 80M ``` Boot: ``` qemu-system-x86_64 -enable-kvm \ -m 4G -smp 4 \ -hda ubuntu.qcow2 -hdb ext4.qcow2 \ -device e1000,netdev=net0 \ -nographic -netdev user,id=net0,hostfwd=tcp::5557-:22 ``` After boot, enter the non-graphic shell and add a user. ``` apt-get install sudo openssh-server useradd -G sudo -m user passwd user systemctl start sshd ``` ssh into the VM: ``` ssh -p 5557 user@localhost ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up