02 Setting Up Unix Environment#

Goal#

Set up a Unix-like development environment on your computer. Depending on your operating system, you’ll follow a different path:

  • macOS: Already Unix-based (just verify)

  • Linux: Already Unix-based (just verify)

  • Windows: Install Ubuntu using Windows Subsystem for Linux (WSL) or VirtualBox

Prerequisites#

  • Internet connection

  • Permission to install software

  • For Windows with VirtualBox: At least 8 GB RAM (16 GB recommended), 20–30 GB free disk space


Steps#

1. Introduction#

Why do you need a Unix environment?

  • Seamless Code Integration: Most scientific code and servers run on Linux/Unix. Your local environment should match production.

  • Consistent File Paths: Unix uses forward slashes (/); Windows uses backslashes (\). Code written on Unix works consistently everywhere.

  • Better Collaboration: Team members on different machines can work on identical environments.

  • Professional Tools: Access to Bash shell, SSH, Git integration, Docker, and open-source utilities.

  • Reduced Bugs: Code tested on Unix works better with our code repositories and CI/CD pipelines.

If you use macOS or Linux, you already have Unix! Just verify in section 2. If you use Windows, you need to set up either WSL (lightweight, recommended) or VirtualBox (full virtual machine).


2. Choose Your Operating System#

macOS Setup#

2.1 Verify Unix Compatibility#

Open Terminal (Cmd+Space, type “Terminal”, press Enter):

uname -s

If output is Darwin, you’re good! macOS is Unix-based. You can proceed to 03 Introduction to the Command Line.

Step 2.3 — Create a New Virtual Machine#

  1. Open VirtualBox.

  2. Click New.

  3. Fill in:

    • Name: Ubuntu

    • Type: Linux

    • Version: Ubuntu (64-bit)

  4. Click Next.

Step 2.4 — Allocate RAM#

  • Choose how much memory to give the VM:

    • 4 GB (4096 MB) minimum

    • 8 GB or more recommended if your system allows

Click Next.

Step 2.5 — Create Virtual Hard Disk#

  1. Select Create a virtual hard disk now.

  2. Choose:

    • Type: VDI (VirtualBox Disk Image)

    • Storage: Dynamically allocated

  3. Set size: 20–40 GB depending on needs.

Click Create.

Step 2.6 — Attach the Ubuntu ISO#

  1. Select your new VM in the VirtualBox list.

  2. Click Settings → Storage.

  3. Under “Controller: IDE,” click the empty disk icon.

  4. On the right, click the small disk icon → Choose a disk file…

  5. Select the Ubuntu ISO you downloaded.

Click OK.


3. Execution#

Step 3.1 — Start the VM#

Click Start and the Ubuntu installer will launch.

Step 3.2 — Install Ubuntu#

When the Ubuntu splash screen appears:

  1. Choose Try or Install Ubuntu.

  2. Select your language.

  3. Click Install Ubuntu.

Follow the installation wizard:

  • Keyboard Layout: Keep default or adjust.

  • Updates and Other Software:

    • Normal installation (recommended)

    • Check “Install third-party software” if needed for Wi-Fi/media

  • Installation Type:

    • Choose Erase disk and install Ubuntu This only affects the VM’s virtual disk, not your real Windows disk.

  • Username and Password: Create a user you’ll use for development.

Click Install Now and wait for installation to complete.

Step 3.3 — Restart#

After installation finishes, restart the VM when prompted. If the ISO boots again by accident, shut down the VM, remove the ISO from Settings → Storage, and start it again.


4. Verification#

After Ubuntu boots into the desktop:

Verify system basics#

Open the terminal (Ctrl+Alt+T):

lsb_release -a

You should see Ubuntu version information.

Verify internet connectivity#

ping -c 3 google.com

Verify package installation works#

sudo apt update && sudo apt upgrade

Optional: verify shared folders (if configured)#

Check /media or /mnt for your Windows-shared folder.


Troubleshooting#

VM won’t start / 64-bit options missing#

  • Enable Virtualization Technology (VT-x/AMD-V) in BIOS.

  • Close software that conflicts with virtualization (e.g., Hyper-V, WSL2, Docker Desktop). You may need to disable Hyper-V in Windows Features.

Ubuntu installation freezes#

  • Increase RAM or video memory in VirtualBox settings.

  • Switch Graphics Controller to “VMSVGA”.

No internet in VM#

  • In VirtualBox: Settings → Network → Adapter 1 → NAT.

Screen resolution is low#

  • Inside Ubuntu terminal, install Guest Additions:

    sudo apt install virtualbox-guest-dkms virtualbox-guest-x11
    

    Then reboot.


Next Steps#

Congratulations! You now have a Unix environment. Continue learning the command line: 03 Introduction to the Command Line