Virtual Machines on Joule
Christopher Brooks, 15 Mar 2011
Last updated: 2 Jun 2017
Joule has Hyper-V installed, so we can run
virtual machines
See Mac VM for Mac.
Obtaining Red Hat
- See UCB Red Hat Linux
- See Microsoft TechNote: Create Virtual Machines.
Obtaining Centos
- I installed a BitTorrent client to download CentOS
Obtaining ArchLinux
- See website.
Legacy Network Adapter
Step By Step Buid to Install CentOS Linux Virtual Machine in Windows Hyper-V Server suggests
- Create the virtual machine
- Create the Legacy Network Adapter
- Install Centos
- Install Linux Service Integration Component
However, it is best to set up the Virtual Network first
Configure Hyper-V to use a Virtual Network
- Start up Hyper-V Manager with:
Start -> Administrative Tools -> Hyper-V Manager
- In the left hand tree, under "Hyper-V Manager",
select your host.
- Action -> Virtual Network Manager
- Under "Create Virtual Network", be sure "External"
is selected. -> Add
- Enter a name such as Virtual Network Adapter #N
where N corresponds with the active network
adapter of the host.
Don't know which adapter is active, use
Start -> Control Panel -> Network
Note If you already have a virtual machine,
then the host machine will be listed on a different
adapter than the physical adapter. One thing to do
is to go look at the machine. For Joule, the
physical adapter is #3.
- Be sure that "Allow management operating system to share this network adapter" is checked.
- Hit "Apply"
Note your host machine will temporarily
go off the net while the configuration occurs. Merely reconnect after a minute or so.
One way to test the Virtual Network Adapter is
to do the above step, create a virtual machine
without an OS and turn it out. The default
configuration seems to be to get an IP address via
DHCP, so this is a good test.
Create the virtual machine
See
Step by Step Guide to Create Windows Hyper-V Virtual Machine.
- I did not "Change the default Hyper-V folders"
- Start up Hyper-V Manager with:
Start -> Administrative Tools -> Hyper-V Manager
- New -> Virtual Machine
- Name: joulecentos -> Next
- Memory: 4096Mb -> Next
- Configure Networking: select "Local Area Connection 4 Virtual Network" -> Next
- Connect Virtual Disk: Use the default -> Next
- Installation Options: Install an operating system later -> Next
Create the Legacy Network Adapter
The virtual machine needs to be registered with the department so that it can get an IP address.
- Register the virtual machine via the EECS dept.
Register a Device page.
- Enter the make and model of the host machine
- Make the serial number unique by adding something
like "virtual 1" to the serial number of the host machine
- In the comments, note that the new device is a
Hyper-V virtual device on the host machine.
- The MAC Address is tricky. The IRIS form will not
let you enter the MAC address of the host, the form
helps prevent duplicate addresses. I believe that while
adding the legacy network adapter, the MAC Address is
checked. Other Hyper-V machines have mac addresses
that start with
00:15:5D. Vendor/Ethernet/Bluetooth MAC Address Lookup and Search says that addresses that start with 00:15:5D belong to Microsoft, so that is probably a good choice.
Debugging a Legacy Network Adapter
If, after installing an OS, your virtual machine is failing to get an IP address via DHCP, then
install Microsoft Network Monitor and scan the different adapters while
running dhclient
while logged in to
the virtual machine.
Unfortunately, I have not found a way to
cause the virtual machine to use a different legacy adapter.
Install Centos
See
Step By Step Guide To Install CentOS Linux Virtual Machine in Windows Hyper-V Server
Install Linux Service Integration Component
- Download "Linux Integration Components for Windows Server 2008 Hyper-V"
- Click on the
.exe
, which will create
LinuxIC v2.iso
- Using the Hyper-V Manager, mount
LinuxIC v2.iso
- In Hyper-V Manager, click on the virtual machine
and select Action -> Settings.
- Under "IDE Controller 1", click on "DVD Drive", browse
to
LinuxIC v2.iso
and mount it
- See
Step By Step Guide To Install CentOS Linux Virtual Machine in Windows Hyper-V Server
Installing RedHat
- Obtain a
.iso
as above.
- In Hyper-V Manager, mount it by clicking on the virtual machine, selecting Settings -> IDE Controller 1 ->
DVD Drive ~> Media and then browse to the location
of the
.iso
- Reboot and install. Note that you may need to select
the legacy network adapter. If there are two adapters,
try
eth0
and be sure that it is set to automatically connect
Install Linux Service Integration Component
- RedHat 6.0 and 6.1 and Centos 6 require
Linux Integration Services Version 3.1 for Hyper-V
- Download and mount via Hyper-V Manager
- See the pdf for details, but I did:
mount /dev/cdrom /media
cd /media/x86_64
rpm -ivh kmod*
rpm -ivh microsoft-*.x86_64.rpm
reboot
It may be necessary to do
yum update
yum install redhat-rpm-config rpm-build gcc gnu-pg unifdef
Getting the mouse to work
See
http://www.jules.fm/Logbook/files/category-hyper-v.html
Notes about Redhat 6.1
See
UCB RHEL
Installing ArchLinux
- Obtain a
.iso
as above.
- In Hyper-V Manager, mount it by clicking on the virtual machine, selecting Settings -> IDE Controller 1 ->
DVD Drive ~> Media and then browse to the location
of the
.iso
- Start up the VM.
Arch does not provide a wizard that will guide you through the installation process. First, load the necessary modules:
modprobe hv_utils hv_netvsc hv_storvsc
Second, make sure networking is up. Manually run the DHCP Client Deamon:
dhcpcd
Verify the connection using the ping-command. If no IP is obtained, review the networking configuration of your VM in the Hyper-V management tool.
Consult the
Installation Guide to be guided through the process of installing Arch Linux.
Notes
- When using the EXT4 filesystem, the hv_storvsc module attempts to zero out bytes in the image (for security reasons), assuming that the host system has a routine for that, but server 2008 doesn't implement that function. This results in a flood of errors in dmesg. For that reason, it's recommended to use another filesystem, e.g. EXT3.
- Make sure to load the hv_* modules at start-up by editing /etc/mkinitcpio.conf
- Install additional software using Pacman, also see Yaourt
- Automatically start dhcp at boot:
systemctl enable dhcpcd@
(in my installation the network device appeared as enp0s10f0)
- To install packages, use
sudo pacman -S emacs
(see: https://wiki.archlinux.org/index.php/Pacman).
We also have yaourt installed, which provides access to the user
repositories (see: https://wiki.archlinux.org/index.php/Yaourt). Note
that yaourt should not be run as root.
- The ufw firewall is installed to pass traffic on ports 22 and 8078
ptango.eecs.berkeley.edu
is a CNAME to
joulecentos.eecs.berkeley.edu
.
- See Ptango->wiki->Sandbox for
information about the Sandbox.