Skip to content

Instantly share code, notes, and snippets.

@peteyoung
Last active February 13, 2017 10:32
Show Gist options
  • Save peteyoung/7780167 to your computer and use it in GitHub Desktop.
Save peteyoung/7780167 to your computer and use it in GitHub Desktop.
Arch Linux VM Setup

Arch Linux VM Setup

Beginner's Guide

Following the steps found on the Arch wiki: https://wiki.archlinux.org/index.php/Beginners%27_Guide

  • set font

    setfont Lat2-Terminus16
  • set up locale

    vi /etc/locale.gen
    • un comment line with "en_US.UTF-8 UTF-8"
  • test network

    ping -c 3 www.google.com
  • check interface

    ip link
    • copy down name of interface (enp0s3)
  • partition drive

    cgdisk /dev/sda
  • format partition

    mkfs.ext4 /dev/sda1
  • mount partiton

    mount /dev/sda1 /mnt
  • install the base

    pacstrap -i /mnt base
  • Generate an fstab

    genfstab -U -p /mnt >> /mnt/etc/fstab 
    vi /mnt/etc/fstab
  • Chroot and configure the base system

    arch-chroot /mnt /bin/bash
    vi /etc/locale.gen
    • un comment line with "en_US.UTF-8 UTF-8"
    echo LANG=en_US.UTF-8 > /etc/locale.conf
    export LANG=en_US.UTF-8
    vi /etc/vconsole.conf
    • Add FONT=Lat2-Terminus16
    ln -s /usr/share/zoneinfo/CST6CDT /etc/localtime
    hwclock --systohc --utc
  • Hostname

    echo arch-vm > /etc/hostname
  • Configure the network (Wired using netctl)

    #systemctl enable dhcpcd.service
    systemctl enable [email protected]
    
    #cd /etc/netctl
    #cp examples/etherenet-static my-network
    #vi my-network  # didn't need anything
    #netctl enable my-network
  • Create an initial ramdisk environment

    mkinitcpio -p linux
  • Set the root password

    passwd
    • (1 to 2)
  • Install and configure a bootloader

    pacman -S gptfdisk syslinux
    syslinux-install_update -i -a -m
    • Above causes "FAILED to set attribute Legacy BIOS Bootable on /dev/sdaX" unless gdisk is installed.
  • edit syslinux.cfg and change /dev/sda3 to /dev/sda1

    vi /boot/syslinux/syslinux.cfg
      ...
        LABEL arch
          ...
            APPEND root=/dev/sda1 ro
            ...
      
  • Unmount the partitions and reboot (remove media from virtual dvd)

    exit
    umount /mnt
    reboot
  • Install the Guest Additions (VirtualBox)

    • Download at: https://wiki.archlinux.org/index.php/VirtualBox#Arch_Linux_guests

      pacman -S virtualbox-guest-utils
      modprobe -a vboxguest vboxsf vboxvideo
      vi /etc/modules-load.d/virtualbox.conf
      • Add the following to the above file
        vboxguest
        vboxsf
        vboxvideo
        
    • keep date and time in sync

      systemctl enable vboxservice.service
      systemctl start vboxservice.service
  • Sound setup

  • Install X Windows

    pacman -S xorg-server xorg-server-utils xorg-xinit
    pacman -S xorg-twm xorg-xclock xterm
  • Add User

    useradd -m -g users -s /bin/bash pete
      passwd pete
    • petu...

    • setup sudo

      pacman -S sudo
      visudo
      • add the following in visudo
          pete ALL=(ALL) ALL
          ```
        
      * login as new user on another virtual terminal
        
    • setup X for user

       cp /etc/X11/xinit/xinitrc ~/.xinitrc
       vi ~/.xinitrc
    • Add the following line to the top of ~/.xinitrc above any exec options. This adds VirtualBox functionality to X so the vm window can be resized, etc.

      /usr/bin/VBoxClient-all
    • change last few lines

      twm &
      exec xterm -geometry 30x30+0+0 -name login
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment