2019-10-01 13:25:36 +00:00
Arch Linux
2019-09-30 15:10:10 +00:00
======================
> John Hammond | September 29th, 2019
2019-10-01 13:26:38 +00:00
These are my notes and scripts while installing and setting up my Arch Linux environment.
2019-09-30 15:10:10 +00:00
2019-10-01 13:25:36 +00:00
I did this on my DELL XPS 15 laptop on September 29th, 2019. Following that,
I began to set up a virtual machine for use at work. The virtual machine required
a little bit of a different setup, so I decided to write these things down
and try and automate the procedure.
2019-09-30 15:10:10 +00:00
2019-10-01 13:25:36 +00:00
--------------------------
2019-09-30 15:10:10 +00:00
2019-10-01 13:25:36 +00:00
The `bootstrap.sh` script
=================
2019-09-30 15:10:10 +00:00
2019-10-01 13:25:36 +00:00
This script is still in development, but it can be used to quickly take a
freshly installed Arch Linux system to a fleshed-out and working state (per my own
idea of "usable").
2019-09-30 15:10:10 +00:00
2019-10-01 13:25:36 +00:00
> **NOTE:** The script is INCOMPLETE, and I will be continuously adding to it.
2019-09-30 15:10:10 +00:00
2019-10-01 13:25:36 +00:00
As of right now, the script will
2019-10-01 02:35:25 +00:00
2019-10-01 13:25:36 +00:00
* Set the locale, "arch" hostname, and EDT5EST timezone
* Create a new user (or use an existing one) you supply
* Configure `pacman` to use close mirrors
* Install:
- sudo
- pulseaudio (and pavucontrol)
- git
- vim
- tmux
- X (and xrandr)
- base-devel
- i3 (and gnu-free-fonts)
- terminator
- dmenu
- firefox
- yay
* Configure Terminator to use my prefered theme
* Configure tmux to run on start of a shell
* Configure X to start i3 and for the first TTY to start the desktop
* Configure Vim to use the Sublime Text Monokai colorscheme
* Configure git with my preferred name and e-mail (change this if you use this)
* Made the /opt directory writeable by the user (I like to store tools there)
2019-09-30 15:10:10 +00:00
2019-10-01 13:25:36 +00:00
You can run the script right after a fresh install and you set up GRUB. Replace
`john` with whatever username you want to be the one managing your system, that
you use from here on out.
```
./bootstrap.sh < john >
```
Installing
------------
**Downloading the ISO**
I downloaded the `archlinux-2019.09.01-x86_64.iso` from here: [https://www.archlinux.org/download/ ](https://www.archlinux.org/download/ ).
I searched for a United States mirror and chose one: specifically, I used: [http://mirrors.acm.wpi.edu/archlinux/iso/2019.09.01/ ](http://mirrors.acm.wpi.edu/archlinux/iso/2019.09.01/ )
2019-09-30 15:10:10 +00:00
2019-10-01 02:35:25 +00:00
2019-10-01 13:25:36 +00:00
**Burning the ISO to a Disc**
I still had Ubuntu at the time, so I burned the Arch Linux ISO to a disc with [Brasero].
**Booting the Arch Linux Live Disc**
2019-09-30 15:10:10 +00:00
On my DELL XPS 15, I needed to spam the `F12` key when booting to get to the menu and choose "Boot from CD". **I made sure to boot in UEFI** .
Once I got into the Arch Linux prompt, I followed the instructions from their [Installation Guide ](https://wiki.archlinux.org/index.php/installation_guide ).
I didn't need to change the keyboard layout, so I went on just to verify the UEFI boot mode:
```
ls /sys/firmware/efi/efivars
```
This had results, so I knew I successfully booted with UEFI. Good enough!
2019-10-01 13:25:36 +00:00
When I did this on the virtual machine, I did not have results -- it had not booted
in UEFI. This did not end up mattering much.
2019-10-01 02:35:25 +00:00
2019-10-01 13:25:36 +00:00
**Connecting to the Internet**
2019-09-30 15:10:10 +00:00
On my DELL XPS 15, I wanted to connect to the Internet right away. To get started, I needed to know the name of the
interface I was working with.
```
ip link
```
In my case, my interface name was `wlp59s0` .
Now I needed to actually connect to my Wi-Fi. I used `netctl` to keep it easy.
```
cp /etc/netctl/examples/wireless-wpa /etc/netctl/home
vim /etc/netctl/home
```
With that configuration file, I could fill in the interface name, SSID, and Wi-Fi password.
```
net start home
```
At that point, I could connect to the Internet!
2019-10-01 13:25:36 +00:00
On the virtual machine, I did not need to set any of this up. Because the VM was
either bridged or NAT-d, it should have Internet. I did run these commands to
snag an IP address (and I often need to do this on boot for the VM):
```
dhcpcd
dhcpcd -4
```
**Updating the Time Service**
2019-09-30 18:20:00 +00:00
```
timedatectl set-ntp true
```
2019-10-01 13:25:36 +00:00
**Partitioning the Disks**
2019-09-30 18:20:00 +00:00
I used this command to determine which devices are set up already.
```
fdisk -l
```
In my case of my DELL XPS 15, I had `/dev/nvmen1p1` , `/dev/nvmen1p2` and `/dev/nvmen1p3` all set up (because I did have Ubuntu installed on this previously).
My `/dev/nvmen1p1` was the EFI partition for GRUB, `/dev/nvmen1p2` was my EXT4 filesystem, and `/dev/nvmen1p3` was my swapspace.
2019-09-30 18:53:26 +00:00
_If you needed to partition the drive manually, like you were setting up in a virtual machine, I would recommend using `cfdisk` ._
In my case, I needed to format these partitions with their appropriate purposes.
```
mkfs.ext4 /dev/nvmen1p2
mkswap /dev/nvmen1p3
swapon /dev/nvmen1p3
```
I handled the `/dev/nvmen1p1` EFI partition later, when I would install GRUB.
2019-10-01 13:25:36 +00:00
In the case of the virtual machine, I would need to create these partitions "manually"
with
2019-09-30 18:53:26 +00:00
```
2019-10-01 13:25:36 +00:00
cfdisk
2019-09-30 18:53:26 +00:00
```
2019-10-01 13:25:36 +00:00
I created a 1 GB partition for swap space and another 1 GB for the boot loader (probably don't need that much...) and the rest I reserved for the filesystem.
2019-09-30 18:53:26 +00:00
2019-10-01 13:25:36 +00:00
I would then run the appropriate commands with `/dev/sda1` , `/dev/sda2` , etc.
2019-09-30 18:53:26 +00:00
2019-10-01 13:25:36 +00:00
**Mounting the Filesystem**
2019-09-30 18:53:26 +00:00
```
2019-10-01 13:25:36 +00:00
mount /dev/nvmen1p2 /mnt
2019-09-30 18:53:26 +00:00
```
2019-10-01 13:25:36 +00:00
**Installing Arch**
2019-09-30 18:53:26 +00:00
```
2019-10-01 13:25:36 +00:00
pacstrap /mnt base
2019-09-30 18:53:26 +00:00
```
2019-10-01 13:25:36 +00:00
**Configure the system**
2019-09-30 18:53:26 +00:00
2019-09-30 19:10:42 +00:00
```
2019-10-01 13:25:36 +00:00
genfstab -U /mnt >> /mnt/etc/fstab
2019-09-30 19:10:42 +00:00
```
2019-10-01 13:25:36 +00:00
**Chroot into the new filesystem**
2019-09-30 19:10:42 +00:00
```
2019-10-01 13:25:36 +00:00
arch-chroot /mnt
2019-09-30 19:10:42 +00:00
```
2019-09-30 18:20:00 +00:00
2019-10-01 13:25:36 +00:00
**Setting the root password**
2019-09-30 18:20:00 +00:00
2019-09-30 19:10:42 +00:00
```
passwd
```
2019-10-01 13:25:36 +00:00
**Install GRUB**
2019-09-30 19:10:42 +00:00
```
pacman -Sy grub os-prober
2019-10-01 12:41:02 +00:00
```
2019-10-01 13:25:36 +00:00
_When I was installing via virtual machine, I just needed to:_
2019-09-30 19:10:42 +00:00
2019-10-01 12:41:02 +00:00
```
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
2019-09-30 19:10:42 +00:00
```
2019-09-30 15:10:10 +00:00
2019-10-01 13:25:36 +00:00
_When I was installing on my hard drive I did:_
2019-10-01 12:41:02 +00:00
```
grub-install /dev/nvmen1p3
grub-mkconfig -o /boot/grub/grub.cfg
```
2019-10-01 02:35:25 +00:00
**DO NOT forget to copy over a network profile for `netctl` and install `netctl` and `network-manager`
so you still have internet access when you reboot into the real system**
2019-09-30 15:10:10 +00:00
2019-10-01 13:25:36 +00:00
At this point, the `bootstrap.sh` script could be used.
2019-10-01 02:35:25 +00:00