Skip to main content

Linux Tools VM

Overview

This Ubuntu VM image will be staged with packages used to support multiple lab exercises.

Deploy this VM on your assigned cluster if directed to do so as part of Lab Setup.

Upload Linux Tools VM Image

caution

Check if ubuntu 24.04 image exists first before deploying.

If you are in a lab environment, only one participant needs to add this.

  1. In Prism Central > Select Compute and Storage > Images

  2. Click on Add Image

  3. Select the URL radio button and paste the following image URL

    https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img
  4. Click on Upload File and in the description add your Initials

  5. Click on Next and select Place Image Directly on cluster

  6. Click on Save

Deploying Linux Tools VM

caution

Only deploy the VM once with a username (see Lookup tool) in the VM name.

  1. In Prism Central > select Menu > Compute and Storage > VMs, and click Create VM

  2. Fill out the following fields:

    • Name - ocpuserXX-Linux-ToolsVM
    • Description - (Optional) Description for your VM.
    • Number of VMs - 1
    • CPU(s) - 6
    • Number of Cores per CPU - 1
    • Memory - 8 GiB
  3. Click Next

  4. Under Disks select Attach Disk

    • Type - DISK
    • Operation - Clone from Image
    • Image - ubuntu-24.04-server-cloudimg-amd64.img
    • Capacity - 100 GiB
    • Bus Type - leave at default SCSI Setting
  5. Click Save

  6. Under Networks select Attach to Subnet

    • VLAN Name - primary-XXX-XXXX
    • Network Connection State - Connected
    • Assignment Type - Assign with DHCP
  7. Click Save

  8. Click Next at the bottom

  9. In Management section

    • Categories - leave blank

    • Timezone - leave at default UTC

    • Guest Customization -

      • Script Type - Cloud-init (Linux)

      • Configuration Method - Custom Script

        You will need to create ssh key-pair to use in the cloud-init yaml content (script)

        Do you need to create a SSH key pair?
        Execute the following commands in a terminal you are in a Linux / Mac environment to generate a private key.

        Use PowerShell in windows environments.

        ssh-keygen -t rsa -b 2048 -C "Created for Linux Tools VM"

        # follow prompts
        # do not specify passphrase
        # once completed run the following command

        cat id_rsa.pub

        # copy the contents of the id_rsa.pub file to your cloudinit yaml file
      • Paste the following script in the script window once you have access to your ssh key-pair.

        Remember to change to your hostname ocpuserXX-LinuxToolsVM
        #cloud-config
        hostname: ocpuserXX-LinuxToolsVM # << Change to your user name >>
        package_update: true
        package_upgrade: true
        package_reboot_if_required: true
        packages:
        - open-iscsi
        - nfs-common
        - git
        - jq
        - bind-utils
        - nmap
        - docker.io
        users:
        - default
        - name: ubuntu
        groups: sudo
        shell: /bin/bash
        sudo:
        - 'ALL=(ALL) NOPASSWD:ALL'
        ssh-authorized-keys:
        - ssh-rsa AAAAB3Nxxxxxxxx ... # << Paste your SSH public key >>
        runcmd:
        - systemctl stop ufw && systemctl disable ufw
        - usermod -aG docker ubuntu
        - 'curl -Lo /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl'
        - chmod +x /usr/local/bin/kubectl
        - 'curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash'
        - 'su - ubuntu -c "curl -fsSL https://raw.githubusercontent.com/ariesbabu/ocp-gitp/refs/heads/main/docs/toolsvms/install_vscode_tools.sh | bash"'
        - eject
        - reboot
  1. Click on Next

  2. Click Create VM at the bottom

  3. Go back to Prism Central > Menu > Compute and Storage > VMs

  4. Select your ocpuserXX-Linux-ToolsVM

  5. Under Actions drop-down menu, choose Power On

    caution

    It may take up to 10 minutes for the VM to be ready. The VM will reboot once to finish the installation process.

    You can watch the console of the VM from Prism Central to make sure all the cloudinit script has finished running.

    Cloudinit logs are stored in /var/log/cloud-init.log

    Logon to the tools VM using SSH

    ssh -l ubuntu _your_jumphost_ip # Get the IP address of the jumphost VM from Prism UI

    Monitor the cloudinit process logs

    tail -f /var/log/cloud-init.log
  6. Get the IP address of the jumphost VM from Prism UI

Connect to you Jumpbox using VSCode

Connect to you Jumpbox using VSCode on Browser using Password

caution

The code-server will take a few minutes to come online.

  1. In you browser visit the following URL

    https://_your_jumphost_ip
  2. Enter _password as the password

  3. Open the following file in VSCode Explorer window

    /home/ubuntu/.config/code-server/config.yaml
  1. Change the password to your desired password

    bind-addr: 0.0.0.0:443  # Only bind to localhost
    auth: password
    password: _desired_password # Replace with a strong password
    cert: true
  2. Restart VSCode server daemon

    sudo systemctl restart code-server@$USER
    caution

    This will take a minute or so

  3. Connect to VSCode on the browser and login using the new password

VSCode Terminal

From now we will work on the browser to access VSCode environment and Terminal

  1. From VSCode hamburger menu

  2. Choose Terminal > New Terminal

  3. For best visibility, place the Terminal on the right instead of the bottom

  4. Choose hamburger menu > View

  5. Choose Appearance > Panel Position > Right as shown here

    This setup allows to explore the files, edit it in VSCode editor and also execute commands.

Now the jumphost VM is ready with all the tools to deploy other sections on this site.