🔥 Added Arch Installation Guide

This commit is contained in:
Jun Wei Woon 2020-07-08 15:36:02 +08:00
parent d39e04dd72
commit 79fc154f5e
8 changed files with 530 additions and 0 deletions

View File

@ -0,0 +1,374 @@
---
author: "Devoalda"
authorEmoji: 🐺
title: "Linux - Arch Installation"
date: 2020-07-08T10:56:57+08:00
description: Arch Linux Installation
draft: false
hideToc: false
enableToc: true
enableTocContent: true
tocPosition: inner
tocLevels: ["h1", "h2", "h3"]
tags:
- arch
- linux
series:
- linux
categories:
- arch
- linux
image: images/postImages/archlinux.svg
---
{{< img src="/images/postImages/archlinux.svg" alt="archlinux" position="center" >}}
# Introduction
This is an installation guide for Arch Linux. This is _NOT_ a generic guide on installing Arch Linux, it is customized towards my preferences.
The Arch Linux installation guide can be found on the Arch Linux website [here](https://wiki.archlinux.org/index.php/Installation_guide)
# Dependencies
Arch can be installed in a Virtual Machine or bare metal, installations on bare metal devices may include extra steps. Here are the dependencies
* [Arch Linux ISO](https://www.archlinux.org/download/)
* USB Thumbdrive (8GB) - Bare Metal Installations
* Separate Workstation to create USB Bootable Devices
## Software to create USB Bootable Devices
### Linux
##### [dd](https://en.wikipedia.org/wiki/Dd_%28Unix%29)
```shell
dd if=/path/to/image/file.iso of=/dev/sdX status=progress
```
{{< alert theme="info" dir="ltr" >}}
Where X is the USB Device E.G. /dev/sda, ***not*** the partition of the device
Read more about dd: ```$ man dd```
{{< /alert >}}
### Windows
##### [balenaEtcher](https://www.balena.io/etcher/)
##### [Rufus](https://rufus.ie/)
##### [win32DiskImager](https://sourceforge.net/projects/win32diskimager/)
## Virtual Machine managers
Any Virtual Machine managers can be used. Here are some popular ones:
### [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
### [VMWare Workstation/Player](https://www.vmware.com/products/workstation-player.html)
# Installation
## Hardware Configurations
Here are the hardware configurations I will be using for the virtual machine
* 2GB Ram (2048MB)
* 2 Processors
{{< alert theme="info" dir="ltr" >}}
These settings can be changed in the future
{{< /alert >}}
## Arch Installation
### Boot Selection
Power on the Virtual/Physical machine. Select the first option
{{< img src="/images/postImages/arch_installation/bootmenu.png" title="Arch Boot" caption="Boot Menu" alt="Arch Boot Menu" position="center" >}}
### Internet Conectivity
Ethernet connection is recommended. If on WI-FI use [iwctl](https://wiki.archlinux.org/index.php/Iwd#iwctl)
{{< img src="/images/postImages/arch_installation/ping.png" title="Arch Boot" caption="Internet Connectivity" alt="Arch Internet Connectivity" position="center" >}}
### NTP
Sync the system time to NTP with [timedatectl]()
``` shell
timedatectl set-ntp true
```
### Partitioning Drives
Use ```lsblk``` to find out your device name
Use this command to create a new partition table on your device
``` shell
cfdisk /dev/sda
```
Select `dos` label type
{{< img src="/images/postImages/arch_installation/partitiontype.png" title="Partition" caption="Partition type label" alt="Arch Partition" position="center" >}}
Using the `arrow keys` and `Enter`, navigate and create these partitions
#### Single Drive
| Partition | Space | Remarks |
|-----------|----------|---------|
| /dev/sda1 | 512MB | boot |
| /dev/sda2 | >=10GB | root(/) |
| /dev/sda3 | Leftover | home |
#### >1 Drive
| Partition | Space | Remarks |
|-----------|----------|---------|
| /dev/sda1 | 512MB | boot |
| /dev/sda2 | Leftover | root(/) |
| /dev/sdb1 | All | home |
{{< img src="/images/postImages/arch_installation/partitiontable.png" title="Partition" caption="Partition table" alt="Arch Partition" position="center" >}}
`Write` the changes and `Quit`
### Formatting Partitions
Do a `lsblk` again, /dev/sda should have 3 partitions
#### /dev/sda1
This is the boot partition, formatted to fat32
``` shell
mkfs.fat -F32 /dev/sda1
```
#### /dev/sda2 and others
Other partitions are formatted to ext4
``` shell
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3
```
### Mount partitions
Mount the ***root*** partition
``` shell
mount /dev/sda2 /mnt
```
Create a folder and mount the ***home*** partition
``` shell
mkdir /mnt/home
mount /dev/sda3 /mnt/home
```
Check the mount points with ```lsblk```
{{< img src="/images/postImages/arch_installation/partitionmount.png" title="Partition" caption="Partition Mount" alt="Arch Partition Mount" position="center" >}}
### Pacstrap
Start the installation of arch with the Pacstrap script
``` shell
pacstrap /mnt base linux linux-firmware sudo vim git base-devel
```
Select `all` and `yes` and wait for the installation to complete.
### Fstab
Generate the fstab file
``` shell
genfstab -U /mnt >> /mnt/etc/fstab
```
### Chroot
Chroot into the system with ```BASH``` shell
```shell
arch-chroot /mnt /bin/bash
```
#### Locale
``` shell
vim /etc/locale.gen
```
Find the languages you are going to use
I am going to install
* en_us both UTF and ISO
* zh_SG.UTF-8
* ko_KR.UTF-8
{{< alert theme="info" dir="ltr" >}}
Can be changed later
{{< /alert >}}
Save and exit the editor and generate locale
``` shell
locale-gen
```
Create ```locale.conf``` with the corrosponding languages
```shell
echo "LANG=en_US.UTF-8" > /etc/locale.conf
```
#### Timezone
``` shell
ln -sf /usr/share/zoneinfo/Asia/Singapore /etc/localtime
```
#### Set local time
``` shell
hwclock --systohc --utc
````
Check the date with
``` shell
date
````
#### Hostname
Set the Hostname of your system
```shell
echo arch > /etc/hostname
```
Edit your `/etc/hosts` file with ``` vim /etc/hosts```
Enter the following line
``` shell
127.0.1.1 localhost.localdomain arch
```
Save and exit the editor
#### Network
Install and enable NetworkManager
``` shell
pacman -S networkmanager
systemctl enable NetworkManager
```
#### Bootloader
Install grub and efibootmanager
``` shell
pacman -S grub efibootmgr
```
Install the Bootmanager into the system
``` shell
mkdir /boot/efi
mount /dev/sda1 /boot/efi
lsblk # to check if everything is mounted correctly
grub-install /dev/sda # Worked for me
# grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi --removable
grub-mkconfig -o /boot/grub/grub.cfg
```
#### Root Password
Change the root password with ```passwd```
#### Reboot
Exit and reboot your system
```shell
exit
umount -R /mnt
reboot
```
You should see GRUB screen on boot, with Arch installed
Login with `root` and the password previously set
# Post-Installation
Arch is now installed, these are post installation processes like creating swap, user and installing a GUI
## Swap
Create a swapfile with the same size as your RAM
``` shell
dd if=/dev/zero of=/swapfile bs=1M count=2048 status=progress
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap defaults 0 0' >> /etc/fstab
```
{{< alert theme="info" dir="ltr" >}}
Change `2048` to the size of your RAM in **MB**
{{< /alert >}}
Check that your swapfile is working with ```free -h```
## User
Create a user and group
``` shell
groupadd sudo
groupadd username
useradd -m -g username -G sudo -s /bin/bash username
```
{{< alert theme="info" dir="ltr" >}}
Change `username` to your desired username
{{< /alert >}}
Edit sudoers file
```shell
EDITOR=vim visudo
```
Uncomment the line and add a line
``` shell
Defaults insult
# %sudo ALL=(ALL) ALL
```
{{< alert theme="info" dir="ltr" >}}
This will allow users in `sudo` group to run commands without sudo prefix
{{< /alert >}}
Change the password of the user with `passwd username`
Reboot/Logout and login as user
## DotFiles
Clone and 'install' Dotfiles from [ GitLab ]( https://gitlab.com/devoalda/dotdrop-dotfiles )
``` bash
git clone --recurse-submodules https://gitlab.com/devoalda/dotdrop-dotfiles.git
pip3 install --user -r ./dotdrop-dotfiles/dotdrop/requirements.txt
./dotdrop-dotfiles/dotdrop.sh install -p carnage
```
Install yay
``` bash
cd /opt
sudo git clone https://aur.archlinux.org/yay-git.git
cd yay-git
makepkg -si
```
Install and change shell utilities
``` bash
yay -S zsh starship st-luke-git
chsh -s /usr/bin/zsh username
```
### Display
Xorg must be installed to be able to display a WM/DE
``` bash
yay -S pulseaudio pulseaudio-alsa xorg xorg-xinit xorg-server
```
Install i3 (Optional) - More Stable
``` bash
yay -S i3-gaps i3blocks i3exit
```
Install Xmonad & Xmobar (Optional)
``` bash
yay -S xmonad xmonad-contrib xmobar-git
xmonad --recompile
```
Read more about my xmonad configurations [ here ](https://gitlab.com/devoalda/dotdrop-dotfiles/-/blob/master/readme.md)
{{< alert theme="info" dir="ltr" >}}
Install any WM/DE of your choice.
{{< /alert >}}
# Summary
Arch is installed successfully!
{{< img src="/images/postImages/arch_installation/installed.png" title="Arch" caption="Installed" alt="Installed Arch Linux" position="center" >}}
Here are some programs I would install
| Program | Function |
|------------------------------------------------|--------------------------|
| Firefox | Web Browser |
| Dmenu & Utilities | Application Launcher |
| Neovim | Editor |
| [ VSCodium ]( https://vscodium.com/ ) | Editor |
| [ Pywal ](https://github.com/dylanaraps/pywal) | Themeing |
| Flameshot | Screenshot Utility |
| Fcitx | Multi-language Keyboard |
| Trayer | Tray Application Support |
| [ Dunst ](https://dunst-project.org/) | Notification Manager |
| Mpd & Ncmpcpp | Music Player |
| Mpv | Video Player |
| Zathura | PDF Reader |
Have fun with your arch installation!
___i use arch btw___
{{< expand "Credits/References" >}}
[Mental Outlaw Videdo](https://www.youtube.com/watch?v=rUEnS1zj1DM)
[averagelinuxuser Arch Installation Guide](https://averagelinuxuser.com/a-step-by-step-arch-linux-installation-guide/)
{{< /expand >}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.0"
width="600"
height="199.41692"
id="svg2424">
<defs
id="defs2426">
<linearGradient
x1="112.49854"
y1="6.1372099"
x2="112.49853"
y2="129.3468"
id="path1082_2_"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(287,-83)">
<stop
id="stop193"
style="stop-color:#ffffff;stop-opacity:0"
offset="0" />
<stop
id="stop195"
style="stop-color:#ffffff;stop-opacity:0.27450982"
offset="1" />
<midPointStop
offset="0"
style="stop-color:#FFFFFF"
id="midPointStop197" />
<midPointStop
offset="0.5"
style="stop-color:#FFFFFF"
id="midPointStop199" />
<midPointStop
offset="1"
style="stop-color:#000000"
id="midPointStop201" />
</linearGradient>
<linearGradient
x1="541.33502"
y1="104.50665"
x2="606.91248"
y2="303.14029"
id="linearGradient2544"
xlink:href="#path1082_2_"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-0.3937741,0,0,0.393752,357.51969,122.00151)" />
<linearGradient
id="linearGradient3388">
<stop
id="stop3390"
style="stop-color:#000000;stop-opacity:0"
offset="0" />
<stop
id="stop3392"
style="stop-color:#000000;stop-opacity:0.37113401"
offset="1" />
</linearGradient>
<linearGradient
x1="490.72305"
y1="237.72447"
x2="490.72305"
y2="183.9644"
id="linearGradient4416"
xlink:href="#linearGradient3388"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.749107,0,0,0.749107,-35.459862,91.44108)" />
</defs>
<g
transform="translate(-34.777313,-129.80241)"
id="layer1">
<g
transform="matrix(0.8746356,0,0,0.8746356,14.730518,23.408954)"
id="g2424">
<g
transform="matrix(0.6378586,0,0,0.6378586,36.486487,2.17139)"
id="g2809"
style="fill:#ffffff;fill-opacity:1">
<path
d="m 339.96875,309.09375 c -14.47141,-0.0239 -26.4812,2.94367 -31.125,4.5625 l -4.78125,25.8125 c -0.0116,0.0951 23.79543,-6.34855 34.28125,-5.96875 17.36158,0.62381 18.95948,6.63541 18.65625,14.75 0.29595,0.47462 -4.47933,-7.33192 -19.5,-7.59375 -18.94961,-0.32687 -45.69284,6.70947 -45.65625,35.3125 -0.51086,32.17412 24.03361,41.63882 40.75,41.8125 15.02821,-0.27364 22.0777,-5.69136 25.9375,-8.59375 5.07124,-5.30236 10.87308,-10.63447 16.40625,-17.03125 -5.23567,9.51278 -9.77472,16.0898 -14.5,21.125 l 0,4.25 22.84375,-3.84375 0.15625,-62.09375 c -0.23141,-8.78839 5.04123,-42.41827 -43.46875,-42.5 z m -3.28125,54.0625 c 9.46889,0.12995 20.32788,4.79708 20.34375,16.03125 0.049,10.21821 -12.80005,15.71183 -21.15625,15.625 -8.35976,-0.0868 -19.45093,-6.56982 -19.5,-16.53125 0.16016,-8.90444 10.45953,-15.35418 20.3125,-15.125 z"
id="path2284"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" />
<path
d="m 398.50106,314.83145 -0.15505,102.82693 26.61213,-5.12724 0.0449,-58.30157 c 0.006,-8.68089 12.40554,-18.82451 27.9627,-18.66287 3.30202,-5.97408 9.5087,-21.24219 11.02088,-24.71514 -34.75649,-0.0833 -35.19897,9.98993 -41.24398,14.94517 -0.0631,-9.45285 -0.0213,-15.12741 -0.0213,-15.12741 l -24.2202,4.16213 z"
id="path2286"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" />
<path
d="m 548.2688,328.33058 c -0.25696,-0.12068 -13.87938,-15.93419 -41.26638,-16.0589 -25.65249,-0.42638 -54.42578,9.51895 -54.88631,52.5328 0.22457,37.81852 27.6402,52.59809 55.0314,52.88627 29.31292,0.30451 40.97654,-18.32947 41.67615,-18.79124 -3.49762,-3.0321 -16.59792,-16.0131 -16.59792,-16.0131 0,0 -8.18236,11.65102 -24.05802,11.79913 -15.87942,0.1512 -29.68245,-12.27325 -29.87805,-29.60905 -0.20349,-17.33595 12.68881,-26.72821 29.99725,-27.48687 14.98466,-0.003 23.6297,9.67334 23.6297,9.67334 l 16.35218,-18.93238 z"
id="path2288"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" />
<path
d="m 581.8125,278.84375 -25.125,5.90625 0.1875,133.9375 24.75,-4.46875 0.28125,-63.03125 c 0.0529,-6.60927 9.56127,-16.75916 25.4375,-16.4375 15.17973,0.15775 18.57236,10.11767 18.53125,11.375 l 0.4375,72.96875 24.40625,-4.3125 0.0937,-77.375 c 0.1607,-7.44539 -16.30833,-23.16954 -42.78125,-23.28125 -12.58087,0.0202 -19.54815,2.86825 -23.09375,4.96875 -6.06656,4.68565 -12.9998,9.17543 -19.8125,14.90625 6.29809,-8.09099 11.58551,-13.68516 16.75,-17.84375 l -0.0625,-37.3125 z"
id="path2290"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" />
</g>
<g
transform="matrix(0.9443373,0,0.01336345,0.9443373,78.345657,-412.48879)"
id="g5326"
style="fill:#1793d1;fill-opacity:1;stroke:none">
<path
d="m 400.67581,629.79609 7.68167,-1.91575 -0.92851,91.20792 -7.79574,1.32426 1.04258,-90.61643 z"
id="path2292"
style="fill:#1793d1;fill-opacity:1;fill-rule:evenodd;stroke:none" />
<path
d="m 421.10266,657.01757 6.75064,-2.9867 -0.86808,65.39931 -6.49779,1.33915 0.61523,-63.75176 z m -1.26059,-23.58316 5.47167,-4.41533 4.42261,4.99952 -5.47558,4.53221 -4.4187,-5.1164 z"
id="path2294"
style="fill:#1793d1;fill-opacity:1;fill-rule:evenodd;stroke:none" />
<path
d="m 440.44273,655.82614 7.67755,-1.56201 -0.1573,13.6722 c -0.007,0.58717 4.4194,-15.27364 24.68502,-14.92094 19.67986,0.10952 22.68401,15.34634 22.5291,18.76237 l -0.43759,48.0783 -6.73044,1.45631 0.63316,-47.489 c 0.0974,-1.38684 -2.88144,-13.11441 -16.78906,-13.15754 -13.90509,-0.0404 -23.68364,10.10048 -23.75821,16.57937 l -0.48127,41.83477 -7.80388,2.0313 0.63292,-65.28513 z"
id="path2296"
style="fill:#1793d1;fill-opacity:1;fill-rule:evenodd;stroke:none" />
<path
d="m 561.53301,720.20203 -7.6776,1.56186 0.15737,-13.67198 c 0.007,-0.58742 -4.42201,15.27361 -24.68504,14.92086 -19.67983,-0.10944 -22.68399,-15.34626 -22.52908,-18.76229 l 0.43757,-48.07861 8.15674,-1.64226 -0.54644,47.48988 c -0.0149,1.29682 1.36845,13.29979 15.27604,13.3426 13.90511,0.0405 23.76622,-8.37359 24.01453,-21.04416 l 0.43105,-37.46902 7.5978,-1.93195 -0.63294,65.28507 z"
id="path2298"
style="fill:#1793d1;fill-opacity:1;fill-rule:evenodd;stroke:none" />
<path
d="m 577.45461,655.28678 -5.42715,4.20017 20.19894,26.93328 -22.39092,31.11622 5.63499,4.226 21.04365,-28.8967 20.8779,29.58159 5.32727,-4.20103 -22.37578,-31.62866 18.56963,-25.5775 -5.53193,-4.73429 -16.92109,23.66778 -19.00551,-24.68686 z"
id="path2300"
style="fill:#1793d1;fill-opacity:1;fill-rule:evenodd;stroke:none" />
</g>
<path
d="m 105.8125,16.625 c -7.39687,18.135158 -11.858304,29.997682 -20.09375,47.59375 5.04936,5.35232 11.247211,11.585364 21.3125,18.625 C 96.210077,78.390904 88.828713,73.920352 83.3125,69.28125 72.7727,91.274163 56.259864,122.60209 22.75,182.8125 49.087628,167.60733 69.504089,158.23318 88.53125,154.65625 87.714216,151.1422 87.2497,147.34107 87.28125,143.375 l 0.03125,-0.84375 c 0.417917,-16.87382 9.195665,-29.84979 19.59375,-28.96875 10.39809,0.88104 18.48041,15.28242 18.0625,32.15625 -0.0786,3.17512 -0.43674,6.22955 -1.0625,9.0625 18.82058,3.68164 39.01873,13.03179 65,28.03125 -5.123,-9.4318 -9.69572,-17.93388 -14.0625,-26.03125 -6.87839,-5.33121 -14.05289,-12.2698 -28.6875,-19.78125 10.05899,2.61375 17.2611,5.62932 22.875,9 C 124.63297,63.338161 121.03766,52.354109 105.8125,16.625 z"
transform="matrix(1.1433333,0,0,1.1433333,22.920168,121.64318)"
id="path2518"
style="fill:#1793d1;fill-opacity:1;fill-rule:evenodd;stroke:none" />
<g
id="text2634"
style="font-size:8.44138241px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono">
<path
d="m 685.46692,263.83624 0,-5.32944 -1.99082,0 0,-0.71307 4.7895,0 0,0.71307 -1.99906,0 0,5.32944 -0.79962,0"
id="path3660"
style="fill:#ffffff;fill-opacity:1" />
<path
d="m 689.0982,263.83624 0,-6.04251 1.20355,0 1.43026,4.2784 c 0.13189,0.39843 0.22806,0.69658 0.28852,0.89442 0.0687,-0.21983 0.17586,-0.5427 0.3215,-0.96862 l 1.44674,-4.2042 1.07578,0 0,6.04251 -0.77077,0 0,-5.05741 -1.75587,5.05741 -0.72131,0 -1.74763,-5.14396 0,5.14396 -0.77077,0"
id="path3662"
style="fill:#ffffff;fill-opacity:1" />
</g>
<g
id="text2638"
style="font-size:8.25130367px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono">
<path
d="m 239.84053,313.69965 0,-5.20945 -1.94598,0 0,-0.697 4.68164,0 0,0.697 -1.95404,0 0,5.20945 -0.78162,0"
id="path2883"
style="fill:#ffffff;fill-opacity:1" />
<path
d="m 243.39004,313.69965 0,-5.90645 1.17646,0 1.39805,4.18205 c 0.12892,0.38947 0.22293,0.6809 0.28202,0.87429 0.0671,-0.21488 0.1719,-0.53048 0.31426,-0.94681 l 1.41417,-4.10953 1.05155,0 0,5.90645 -0.75341,0 0,-4.94353 -1.71634,4.94353 -0.70506,0 -1.70828,-5.02814 0,5.02814 -0.75342,0"
id="path2885"
style="fill:#ffffff;fill-opacity:1" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.5 KiB