Skip to content

Instantly share code, notes, and snippets.

@peteyoung
Last active February 13, 2017 10:32
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • 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 dhcpcd@enp0s3.service
    
    #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

speaker-test -c 2

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
    • Based on: https://wiki.archlinux.org/index.php/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

Update everything

  pacman -Syu

Install xfce

Based on: https://wiki.archlinux.org/index.php/Xfce
  • Install xfce
    sudo pacman -S xfce4
    • hit enter to default to installing all packages

    • select mesa-libgl

    • test it

      startxfce4

Setup to build/install AUR packages

sudo pacman -Su fakeroot
sudo pacman -Su binutils	

Install vim

sudo pacman -Su gvim

Add the following to .bashrc

export TERM=xterm-256color

Install Fonts

  • Xorg fonts

    sudo pacman -Su xorg-fonts-type1
  • Google fonts

    curl "https://aur.archlinux.org/packages/tt/ttf-google-fonts-git/ttf-google-fonts-git.tar.gz" > ttf-google-fonts-git.tar.gz
    tar -xzvf ttf-google-fonts-git.tar.gz
    cd ttf-google-fonts-git
    makepkg -s
    sudo pacman -U ttf-google-fonts-git-20131111-1-any.pkg.tar.xz 

Installed

sudo pacman -Syu
sudo pacman -Su emacs
sudo pacman -Su git
sudo pacman -Su firefox
sudo pacman -Su openssh
sudo pacman -Su net-tools
sudo pacman -Su gvim
ssh-keygen -t rsa -C "pete@simpli.fi"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment