Ubuntu VM Setup - department-of-veterans-affairs/abd-vro GitHub Wiki

This guide is a supplement to Local Setup for getting a development environment running on a Ubuntu Linux VM.

Rather than getting a development environment working on Windows or WSL2, you may find it easier to work within a virtual machine. The following steps will guide you through requesting and setting up VirtualBox on you VA laptop.

Note: While connected to the VA VPN, some HTTPS requests are intercepted, and the network presents its own certificate. This causes connection failures within the virtual machine. A simple solution is to disconnect from VPN when network issues arise.

Requesting VirtualBox

  1. Navigate to yourIT and select the "Need Something New? Submit a Request" option.
  2. Choose "IT Software or Hardware Request" and fill the request form.
  3. For "Non-Medical Software Details" enter the following as the request for VirtualBox 7.xx (or the latest version): Please install VirtualBox 7.xx software. https://trm.oit.va.gov/ToolPage.aspx?tid=6679, https://www.virtualbox.org/wiki/Downloads
  4. For "Justification" enter the following: VirtualBox is required to conduct official VA business, specifically it facilitates software development for VA.gov, VRO, and other OCTO efforts.
  5. After filling the request form, click the "Order Now" button.
  6. IT will contact you in order to remote into your laptop and install the software. It may take several days for them to service your request.

Installing Ubuntu 22.04

  1. Download the Ubuntu 22.04 ISO from here
  2. From VirtualBox, select the "New" button.
  3. Name your VM and select the ISO Image before moving to the next screen.
  4. VirtualBox has an unattended installation feature that will install and configure the guest OS for you. On the screen, you may setup a username, password, and hostname for your VM. You may also want to install Guest Additions if given the option.
  5. Select a reasonable amount of memory for the VM. (For example, I selected 8192 MB for a host laptop with 16 GB of memory.)
  6. Select a reasonable amount of processors for the VM. (For example, I selected 4 for a host laptop with 8 CPUs.)
  7. On the disk screen, allocate a virtual hard disk with enough space for development. (I created an 80 GB disk.)
  8. On the final screen select the Finish button. VirtualBox will install and configure the guest OS for you.
  9. After the installation is finished, you will want to ensure that Enable Nested VT-x/AMD-V is selected in your VM. Go to Settings > System > Processor and select the approprate checkbox.
  10. Start the VM and log in.
  11. Your user cannot use sudo, but the root account is conifigured with the same password as your username. To add your user to the sudo group, from a terminal type su and enter your password. Then, usermod -aG sudo <your username here>. Type exit to leave the root shell. Afterward, you may need to log out and log in again for sudo to work.

Development Prerequisites (adapted from LHDI Developing on Non-Mac OS)

Git

Install git:

sudo apt install git

Configure your name and email for git:

git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "[email protected]"

VS Code (optional)

Don't install VS Code from the Ubuntu Software app. There are some issues with it that cause problems later with Gradle. Download the Linux x64 .deb file from here instead. Install it with:

sudo apt install <VS Code .deb file>

Java

sudo apt install openjdk-17-jdk

Python Setuptools

pip3 install --upgrade pip setuptools

Docker

Follow the official instructions from Docker:

Docker plugins (such as docker-compose) are not put into the PATH by default, you can link docker-compose to /usr/local/bin to make it easier. You can do similar for other plugins as needed.

sudo ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/local/bin/

Hadolint

  1. Download the latest hadolint-Linux-x86_64 release.
  2. Rename the file hadolint.
  3. chmod +x hadolint
  4. sudo mv hadolint /usr/local/bin

Spectral

Install the binary following the official instructions with this command:

curl -L https://raw.github.com/stoplightio/spectral/master/scripts/install.sh | sudo sh

Shellcheck

sudo apt install shellcheck

Pre-commit

  1. sudo apt install pre-commit
  2. Run pre-commit install from your abd-vro project to install the git hook.

Go

Go is required by some pre-commit hooks. Install it following the Linux instructions here. However, you will need to prefix both commands in step 1 with sudo for it to work properly.

Adr-tools

sudo apt install adr-tools

Kubectl

Follow the offical Install using native package management instructions.

Helm

Follow the From Script offical installation instructions.

Istioctl

Follow the download instructions here. Though in addition to step 2, you can permanently add istioctl to your path with the following command:

echo 'export PATH=$HOME/.istioctl/bin:$PATH' >> ~/.profile

Minikube

Follow the offical installtion steps for Linux here

Codeclimate

Follow the Anywhere installation steps. (This requires Docker to have already been installed.

Mkdocs

sudo apt install mkdocs

Scala

Follow the Linux x86-64 instructions here.

LHDI Lightkeeper

From the offical installation instructions:

  1. Install jq, which is a dependency of the installer script: sudo apt install jq
  2. curl https://[email protected]/department-of-veterans-affairs/lighthouse-di-lightkeeper/main/install.sh | bash -s $GITHUB_ACCESS_TOKEN

Note: For this step to work, GITHUB_ACCESS_TOKEN must be configured as described in Local Setup.