---
# System prepended metadata

title: My Arch Linux Installation
tags: [arch linux]

---

# My Arch Linux Installation
###### tags: `arch linux`

## Installation
Firstly, Downloading [image](https://archlinux.org/download/)

Then inserting the iso image, or booting from usb
![](https://i.imgur.com/zUpcMIV.png)

### Check the connection that is good
`ip addr`
`ping archlinux.org`

### Update the system clock
Use timedatectl(1) to ensure the system clock is accurate: 
`timedatectl set-ntp true`

### Partition the disk
Use cfdisk to partition the disk
`cfdisk`
![](https://i.imgur.com/PyPNESy.png)
/dev/sda1 EFI system
/dev/sda2 swap
/dev/sda3 root

Format the partitions above
```
mkfs.fat -F32 /dev/sda1
mkswap    /dev/sda2
swapon    /dev/sda2
mkfs.ext4 /dev/sda3
```

### Mount the file systems
```
mount /dev/sda3 /mnt
mkdir -p /mnt/boot
mount /dev/sda1 /mnt/boot
```

### Install Arch Linux rootfs & firmware
Install rootfs andd firmware to mounted /root
`pacstrap /mnt base linux linux-firmware`

### Configure system

Generate an fstab file
`genfstab -U /mnt > /mnt/etc/fstab`

Change root into the new system
`arch-chroot /mnt`

Set the time zone
`ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime`

Run hwclock(8) to generate /etc/adjtime
`hwclock --systohc`

Set password for root user
`passwd`

Install miscellaneous tools
```
pacman -Syuu vim dhclient wget git
```

Edit /etc/locale.gen and uncomment en_US.UTF-8 zh_TW.UTF-8
`locale-gen`

Edit /etc/locale.conf  
```
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL= 
```

### Install UEFI filesystem
```
pacman -Syuu grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
```
Now, everything is ready. Unplug the boot cd and reboot the system.

## Post-installation
Request DHCP after the first boots into system
`dhclient`

### Install sudo
Add user to system
`useradd -m -d /home/red red`

Set password to that user
`passwd red`

Install sudo and desert the root user!
```
pacman -Syuu sudo
```
Add new sudoer by visudo
```
ln -sf /usr/bin/vim /usr/bin/vi
visudo
++red ALL=(ALL) ALL
```
![](https://i.imgur.com/lEQ60lj.png)

Modify /etc/passwd to remove root login
![](https://i.imgur.com/ZdYYqNB.png)

### Install KDE
Install sddm display manager
```
sudo pacman -Syuu sddm
```
Install KDE desktop environment (All selections are default)
```
sudo pacman -Syuu plasma kde-applications sddm-kcm
```
Enable sddm
`sudo systemctl enable sddm`

Enable NetworkManager
`sudo systemctl enable vboxservice.service`
`sudo systemctl start vboxservice.service`

Start GUI desktop!
`sudo systemctl start sddm`

Install fcitx Input Method
`sudo pacman -Syuu fcitx fcitx-chewing noto-fonts-cjk kcm-fcitx`

Enable KDE Discover
`sudo pacman -Syuu packagekit-qt5`

### Install the better shell
Install zsh and [oh-my-zsh](https://ohmyz.sh/#install)
```
sudo pacman -Syuu zsh 
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
```

### Install Virtual Box
Install kernel headers and toolchains
`sudo pacman -Syuu linux-headers base-devel`
`sudo pacman -S virtualbox-guest-utils`
`sudo systemctl enable vboxservice.service`

Then, reboot the system.

## Trobleshooting
`grub-install` reported EFI variables are not supported on this system:
This means the current system is not booted from UEFI.
VirtualBox:
![](https://i.imgur.com/q6RRqmI.png)

## References
[1] [Arch Linux, Installation Guide](https://wiki.archlinux.org/title/installation_guide)