Guide to install Arch Linux


I just began making a new Arch Linux installation, and wrote down the procedure so far.

It’s not yet completed, and need some final adjustments. Because I’m Swedish, there are a few comments regarding how to get Swedish keyboard.

[sourcecode language=”bash”]
# Installation of Arch linux basic system
# with LVM in a Virtual Environment
#
# 2014-02-11 22:32:46
# myrveln@gmail.com
#
# Load Swedish keyboard
loadkeys sv-latin1

# Partitioning the harddrive
fdisk /dev/sda
n -> Create main partition

Create EFI partition as first partition.
+512M
default
default
default
+XGB -> Set the main partition size
t -> Set partition type
8e -> Linux LVM
a -> Set partition bootable

n -> Create swap partition
p -> Primary partition
default
default
default
t -> Set partition type
82 -> Linux swap
w -> Write the partition table

# See the partition setup with
lsblk -b /dev/sda

# Format the EFI boot disk with fat32
mkfs.fat -F32 /dev/sda1

# Create the LVM
pvcreate /dev/sda2
vgcreate main /dev/sda2
lvcreate -L 6GB -n root main
lvcreate -l 100%FREE -n home main

# Format partitions
mkfs.ext4 -L home /dev/main/home
mkfs.ext4 -L root /dev/main/root

mkswap /dev/sda3
swapon /dev/sda3

# Mount the volumes
mount /dev/main/root /mnt
mkdir /mnt/home
mount /dev/main/home /mnt/home

# Edit the mirrorlist so that Swedish server is in top
nano /etc/pacman.d/mirrorlist

# Install Arch base system into /mnt
pacstrap /mnt base base-devel linux linux-fimrware

# Generate fstab and check
genfstab -p -U /mnt > /mnt/etc/fstab
cat /mnt/etc/fstab

# Chroot into /mnt
arch-chroot /mnt /bin/bash

# Install packages
pacman -S emacs-nox sudo openssh open-vm-tools <del>grub</del>

timedatectl set-timezone Europe/Paris

# Create symlink for timesynchronizing
ln -s /usr/share/zoneinfo/Europe/Stockholm /etc/localtime

# Skapa /etc/vconsole.conf med detta innehåll
KEYMAP=sv-latin1
FONT=ter-116n
FONT_MAP=8859-1

# Install grub
grub-install /dev/sda

# Create grub configuration
grub-mkconfig -o /boot/grub/grub.cfg&amp;amp;amp;amp;amp;lt;/pre&amp;amp;amp;amp;amp;gt;
&amp;amp;amp;amp;amp;lt;pre&amp;amp;amp;amp;amp;gt;# Open /etc/locale.gen
# and uncomment #en_GB.UTF-8 UTF-8
nano /etc/locale.gen
locale-gen

# Choose the hostname and echo it into /etc/hostname
echo arch &amp;amp;amp;amp;amp;amp;gt; /etc/hostname

# Set a root password
passwd

# Add a new user
useradd -m -g users -G wheel,storage,power -s /bin/bash $username
passwd $username

# Make users in wheel group become sudo
# Uncomment line %wheel ALL=(ALL) ALL
nano /etc/sudoers

# Edit and enable ssh deamon at system start
emacs /etc/ssh/sshd_config
&amp;amp;amp;amp;amp;amp;gt; AllowGroups wheel
systemctl enable sshd.service

# Edit the file and insert lvm2 between block and filesystem like so:
emacs /etc/mkinitcpio.conf
# -&amp;amp;amp;amp;amp;amp;gt; HOOKS="base udev … block lvm2 filesystems"

mkinitcpio -p linux

# Finish the GRUB-installation. /dev/sda, no partition or volume
grub-install /dev/sda

grub-mkconfig -o /boot/grub/grub.cfg

# Exit chroot and demount filesystem
exit
umount -R /mnt

# Remove installation media and reboot
reboot

#
# Login to your new system
#

——————————————–

#
# Networking
#

# Check your network driver
lspci -v

# Check that your driver has loaded correctly
dmesg | grep ${network_driver_name}

# Check what network devices that’s on
ls /sys/class/net

# Get your mac address
cat /sys/class/net/${device_name}/address

# Copy either dhcp or static example profile from /etc/netctl/examples/
# into /etc/netctl/${PROFILENAME} and adjust to your values
emacs /etc/netctl/${PROFILENAME}

# Testrun the netctl profile
netctl start ${PROFILENAME}

# Test your network connection
ping ping.sunet.se

# Enable the profile if all is good
netctl enable ${PROFILENAME}

#
# Install deluge as headless torrent server with web-ui
#

# Install the deluge package and dependencies with pacman
pacman -S deluge python2-mako

# Enable deluge daemon at system start
systemctl enable deluged
systemctl start deluged

# Enable deluge-web at system start
systemctl enable deluge-web
systemctl start deluge-web

# Open up connections for port 58846
iptables -A INPUT -p tcp –dport 58846 -j ACCEPT
[/sourcecode]