Install Windows as guest OS on remote Ubuntu Server using VirtualBox

Installing a Windows VM on desktop Linux using VirtualBox is trivial, but installing and using Windows guest (which inherently requires a GUI) on a remote Ubuntu Server host (which usually does not have GUI) is not immediately so. I just got this problem the other day and below are my steps to solve it

# install additional dependencies
sudo apt-get install virtualbox-ext-pack virtualbox-guest-additions-iso
# use a variable to store VM name as we have to reuse it several times
VM='Windows7-64bit'
# create a VM (valid ostype values from `VBoxManage list ostypes`)
VBoxManage createvm --name "$VM" --ostype Windows7_64 --register
# set usable memory to 4 GB
VBoxManage modifyvm "$VM" --memory 4096
# create a hard disk (40 GB)
VBoxManage createhd --filename "$VM.vdi" --size 40960
# Attach the hard disk to the VM
VBoxManage storagectl "$VM" --name "SATA Controller" --add sata --controller IntelAHCI
VBoxManage storageattach "$VM" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$VM.vdi"
# Create a DVD drive with the installation media
VBoxManage storagectl "$VM" --name "IDE Controller" --add ide
VBoxManage storageattach "$VM" --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium /path/to/windows_installer.iso
# Enable VirtualBox Remote Display Protocol
VBoxManage modifyvm "$VM" --vrde on
VBoxManage modifyvm "$VM" --vrdeport 5555
# List host's network interfaces
ifconfig
# Setup bridged network on VM ($host_iface must be a valid interface on the host as shown by ifconfig comand)
VBoxManage modifyvm "$VM" --nic1 bridged --bridgeadapter1 $host_iface
# Power on
VBoxManage startvm "$VM" --type headless 

At this point, the VM is started on remote Ubuntu Server host and is booting into Windows 7 installer via virtual DVD drive. To view the console/GUI of the VM, install some RDP client on your local machine (I recommend Remmina) and connect to remote host's port 5555

sudo apt-add-repository -y ppa:remmina-ppa-team/remmina-next
sudo apt-get install remmina remmina-plugin-rdp libfreerdp-plugins-standard

You'll notice that remote mouse position is out of sync with local. Try to finish installation (tip: the installer is keyboard-friendly) then mount and install VirtualBox Guest Additions

VBoxManage storageattach "$VM" --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium /usr/share/virtualbox/VBoxGuestAdditions.iso

References

This post is the combination of the below articles and my experience stumbling around to install a fresh Windows 7 64-bit OS on a Ubuntu Server

Bình luận


White
{{ comment.user.name }}
Bỏ hay Hay
{{comment.like_count}}
Male avatar
{{ comment_error }}
Hủy
   

Hiển thị thử

Chỉnh sửa

White

hai-ld

2 bài viết.
1 người follow
Kipalog
{{userFollowed ? 'Following' : 'Follow'}}
Cùng một tác giả
White
2 0
rsync between two remote hosts When you need to rsync between two remote hosts which can't connect to each other, but you can SSH login into both ...
hai-ld viết 2 năm trước
2 0
Bài viết liên quan
White
0 4
fCC: Technical Documentation Page note So I have finished the HTML part of this exercise and I want to come here to lament about the lengthy HTML ...
HungHayHo viết 1 năm trước
0 4
{{like_count}}

kipalog

{{ comment_count }}

bình luận

{{liked ? "Đã kipalog" : "Kipalog"}}


White
{{userFollowed ? 'Following' : 'Follow'}}
2 bài viết.
1 người follow

 Đầu mục bài viết

Vẫn còn nữa! x

Kipalog vẫn còn rất nhiều bài viết hay và chủ đề thú vị chờ bạn khám phá!