Archlinux in Virtualbox

Install Arch Linux in Virtualbox

https://wiki.archlinux.org/index.php/Installation_guide

Pre-installation

Partition the disks

1
$ fdisk /dev/sda

boot

1
2
3
4
5
> n
> return (default primary)
> return (default partition 1)
> return (default first sector)
> +250M

swap

1
2
3
4
5
> n
> return (default primary)
> return (default partition 2)
> return (default first sector)
> +2G

/

1
2
3
4
5
6
> n
> return (default primary)
> return (default partition 3)
> return (default first sector)
> +2G
> return

/home

1
2
3
4
> n
> p (make primary)
> return (default first sector)
> return (default last sector)

make /dev/sda1 bootable

1
2
> a
> 1

make /dev/sda1 to swap type partition

1
2
3
> t
> 2
> 82

write table to disk and exit fdisk

1
> w

Format the partitions

format partitions

1
2
3
$ mkfs.ext4 /dev/sda1
$ mkfs.ext4 /dev/sda3
$ mkfs.ext4 /dev/sda4

make swap

$ mkswap /dev/sda2

mount swap

$ swapon /dev/sda2

Mount the partitions

1
2
3
4
5
6
$ mount /dev/sda3 /mnt
$ cd /mnt
$ mkdir boot home
$ mount /dev/sda1 boot
$ mount /dev/sda4 home
$ cd /

Installation

Select the mirrors

rankmirrors to make this faster (though it takes a while)

1
2
3
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig
rankmirrors -n 6 /etc/pacman.d/mirrorlist.orig \>/etc/pacman.d/mirrorlist
pacman -Syy

Install the base packages

1
2
# install base packages (take a coffee break if you have slow internet)
pacstrap /mnt base base-devel

Configure the system

Generate an fstab file

$ genfstab -p /mnt >> /mnt/etc/fstab

Change root into the new system

$ arch-chroot /mnt

Set the hostname

$ echo [archlinux] > /etc/hostname

Set the time zone

$ ln -sf /usr/share/zoneinfo/Australia/Sydney /etc/localtime

uncomment the needed locales in /etc/locale.gen, then generate them with

$ locale-gen

Set locale preferences in /etc/locale.conf and possibly $HOME/.config/locale.conf

$ echo LANG=en_US.UTF-8 > /etc/locale.conf

Set the root password (root account ,not your account, we will create that later)

$ passwd

Install a bootloader

1
2
$ pacman -S grub-bios
$ grub-install /dev/sda

Create a new initial RAM disk

1
2
3
$ mkinitcpio -p linux
$ grub-mkconfig -o /boot/grub/grub.cfg
$ exit

Unmount the partitions

1
2
3
4
$ umount /mnt/home
$ umount /mnt/boot
$ umout /mnt
$ reboot

Until not, we finish installing archlinux, then we are going to setup the system.

Post-installation

After reboot, you might not be able to connect to innternet, run command to get ip address

$ dhcpcd

run it automatically when system starts

$ systemctl enable dhcpcd

turn on multi lib to install 32bit applications

$ vi /etc/pacman.conf

uncomment

1
2
[multilib](#)
Include = /etc/pacman.d/mirrorlist

update packages

1
2
$ pacman -Syy
$ pacman -Su

install x environment

$ pacman -S xorg-server xorg-xinit xorg-server-utils

intall mesa for 3d

$ pacman -S mesa

install virtualbox guest packages

1
2
$ pacman -S virtualbox-guest-utils
$ modprobe -a vboxguest vboxsf vboxvideo

create

$ vi /etc/modules-load.d/virtualbox.conf

add

1
2
3
vboxguest
vboxsf
vboxvideo
$ reboot
1
2
$ pacman -S xorg-twm xorg-xclock xterm
$ startx

create user to login

1
2
3
$ useradd -m -g users -G storage,power,wheel -s /bin/bash jma
$ passwd jma
$ visudo

allow user to run sudo command

find Uncomment to allow members of group wheel to execute any command and uncomment %wheel ALL=(ALL) ALL