Knowlege: Using vnc for Guest Installs

Disclaimer: While the following instructions are specific to Red Hat Enterprise Linux, they can be applied to other Linux distributions with a few modifications.

Starting a vnc Server for Installs

The text-based installers are usually identical in terms of supported features for most linux distributions.
However, Red Hat's RHEL graphical installer offers additional features and options to choose from. To be able to take advantage of this enriched installer on a platform like IBM Z which has no graphical console by default, a vnc
server can be started during install.
To do so, run virt-install with a so-called kickstart response file, and make sure vnc is specified.
Here is an example kickstart file rh.ks:
   vnc
   install
   ignoredisk --only-use=vda
   clearpart --all
   autopart
   bootloader --location=mbr --driveorder=vda
   rootpw <your_pw>
   timezone Europe/Athens
   reboot
   %packages
   @Core
   %end
Next, trigger an install using virt-install as usual, specifying rh.ks:
   virt-install --name rhel75 --disk size=6 --memory=2000 --vcpus=2 \
   --location=/var/lib/libvirt/images/RHEL-ALT-7.5-20180308.0-Server-s390x-dvd1.iso \
   --network type=direct,source=virbr0,model=virtio --initrd-inject=rh.ks \
   --extra-args "inst.ks=file:///rh.ks"
   [...]
   Starting installer, one moment...
   [...]
   Starting VNC...
   The VNC server is now running.
   Please manually connect your vnc client to 192.168.122.63:1 to begin the install.
 

Note that the port listed in the message above can be misleading: The vnc server uses a port range starting at 5900. So while the message lists port 1 for the vnc server, in reality the port used by vnc is port 5900+1=5901. However, some clients will map port 1 to 5901 automatically, hence a connection to port 1 would work, too.

Connecting a vnc Client

Since virt-install uses NAT by default, we cannot access the private net address 192.168.122.63 directly. Instead, we have to set up SSH port forwarding to reach the guest's IP in private subnet 192.168.0.0/16 from a workstation. To avoid any conflicts, we map port 5901 to an arbitrary port (e.g. 9997) on the workstation.
Here is a sketch illustrating the setup:
To configure, proceed as follows:
  1. On the workstation,use
       ssh -L 9997:192.168.122.63:5901 <host>
    to map the guest vnc server's port to local port 9997.
    Note that you can use an arbitrary account on the host for port forwarding. Which can be helpful in case your admin disabled root logins using ssh.
  2. Then point the vnc client on the workstation to 127.0.0.1:9997.
As you can see, there are no changes on the host required at all.
You should be greeted by the installer's welcome screen:

No comments:

Post a Comment