Skip to content

Instantly share code, notes, and snippets.

@Marin-Kitagawa
Last active April 22, 2021 15:09
Show Gist options
  • Save Marin-Kitagawa/3fd2d60d336ee73d8600db52f84afade to your computer and use it in GitHub Desktop.
Save Marin-Kitagawa/3fd2d60d336ee73d8600db52f84afade to your computer and use it in GitHub Desktop.
Installing Arch Linux in Windows 10 host within VirtualBox

Arch Linux Installation

Add the ISO file, uncheck Floppy and check EFIunder Systems in VirtualBox. VirtualBox (version used : 6.1.20)

Note : Add sudo wherever necessary (after installing this (given in the below steps))

Check the dependencies listed for all the pacman -Syu <pkg_name> command run

  • Increase the font size first

    ls /usr/share/kbd/consolefonts/
    setfont ter-232b.psf.gz
    # or  for 24 size font if it looks big
    setfont ter-224b.psf.gz
  • Check the internet connection

    ping <url>
  • Console keymap

    ls /usr/share/kbd/keymaps/i386/qwerty/
    loadkeys <choose_a_key>
  • Check if the system is booted into UEFI mode

    ls /sys/firmware/efi/efivars/ # Must be non-empty
  • Set time and date and check status

    timedatectl set-ntp true
    timedatectl status
  • Set up disks

    cfdisk
    1. Then choose GPT
    2. Then create a partition of 1G for EFI
    3. The go down to the remaining partition and just leave it as it is
    4. Then go back to the previous partition and then change the type to EFI file system
    5. Check the allocations and remember the Device and the file system
    6. Click on Write and come out
  • Format the disks

    mkfs.ext4 /dev/sda2
    mkfs.fat -F32 /dev/sda1
  • Mount the disks

    mount /dev/sda2 /mnt
    mkdir /mnt/efi
    mount /dev/sda1 /mnt/efi
  • Get base package and kernel

    pacstrap /mnt base linux linux-firmware
  • Generate UUID for disk

    genfstab -U /mnt >> /mnt/etc/fstab
  • Change the root directory

    arch-chroot /mnt
    ls
  • Set up time zone

    ln -sf /usr/share/zoneinfo/<choose> /etc/localtime
  • Sync the hardware clock

    hwclock --systohc
    pacman -Syu vim
    vim /etc/locale.gen
    # Choose the Time Zone (uncomment)
  • Set the layout of keyboard if necessary

    vim /etc/vconsole.conf
    # Then type
    KEYMAP=layout # If the keyboard layout is different
  • Set up the hostname and hosts

    vim /etc/hostname
    # Type the name
    # Save and exit
    vim /etc/hosts
    # Add the following lines
    127.0.0.1    localhost
    ::1          localhost
    127.0.1.1    <hostname>.localdomain    <username>
  • Set up root password

    passwd
    # Type the password
  • Add user to groups

    useradd -G wheel,aduio,video -m <username>
  • Install netctl package for connecting to a network

    pacman -Syu netctl
    # Optional Dependencies will be listed
    # Download the necessary (safe to download all)
    pacman -Syu dhcpcd dialog wpa_supplicant ifplugd ppp openvswitch wireguard-tools
  • Install sudo package

    pacman -Syu sudo
    EDITOR=vim visudo
    # Uncomment %wheel% permission to allow user to run as sudo
  • Install GRUB and EFI Boot Manager package

    pacman -Syu grub efibootmgr
  • Set up bootloader

    grub-install --target=x86_64-efi --efi-directory=/efi/ --bootloader-id=<any_name>
    # Generate a grub config file
    grub-mkconfig -o /boot/grub/grub.cfg
  • Boot into Arch Linux

    exit
    shutdown now
    1. Remove the .iso file from VirtualBox
  • Set up network configuration

    # Logged in as root (I forgot my password)
    # So type sudo in front if any permission is denied
    cd /etc/netctl/
    cp /examples/* .
    vim ethernet-dhcp
    # Uncomment DHCPClient=dhcpcd
    ip a
    # Remember the name of the adapter eg. enp0s3
    vim ethernet-dhcp
    # Change Interface=eth0 to Interface=<adapter_name> which is enp0s3
    # Enable a service
    sudo systemctl enable dhcpcd
    sudo systemctl start dhcpcd
    # Check with ping
  • Setting up a desktop environment (see the last step if you want Xfce4 and resume from after this step)

    pacman -Syu xorg xorg-server
    pacman -Syu gnome gnome-extra gnome-shell
    pacman -Syu install gdm  # To get the latest version
    systemctl enable gdm
    # Reboot
    shutdown now
    # Start the virtual machine
  • Adding language and format

    1. Go to settings and select the language and format
    2. Restart the session
  • Guest additions and Xfce4 (because I didn't like Gnome 40 though I installed it first and checked it)

    pacman -Syu linux-headers virtualbox-guest-dkms virtualbox-guest-utils
    sudo systemctl enable vboxservice.service
    pacman -Syu ttf-fira-code xfce4 xfce4-goodies
    startxfce4 
  • Credits
    SavvyNik - How to Install Arch Linux on VirtualBox on Windows 10
    Michael Ghens - Setting up Arch linux in VirtualBox
    Gnome - ArchWiki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment