This commit is contained in:
rickellis
2018-01-21 21:27:44 -07:00
parent fbb820d119
commit 349af4f46d
+78 -99
View File
@@ -6,20 +6,17 @@ All references to disk nodes in this document are shown as:
/dev/sd*
You will need to change these to reflect your particular drive. To view your drive info use:
You will need to change these to reflect your particular drive. To get this info use:
# fdisk -l
## Prepare Installation Media
---
## 1. Prepare Installation Media
[Download](https://www.archlinux.org/download/) the Arch Linux ISO and create a bootable USB drive. The simplest way to do this on Linux is using the dd command:
[Download](https://www.archlinux.org/download/) the Arch Linux ISO and create a bootable USB drive. The simplest way to create bootable media on Linux is using the dd command:
sudo dd bs=4M if=/path_to_arch_.iso of=/dev/sdX && sync
If you prefer a graphical interface you can use [Etcher](https://etcher.io/) (on Linux, Mac, and Windows), Netbootin (on Mac or Windows), or Rufus on Windows.
On Mac use Etcher or UNetBootin. On Windows use Rufus.
---
@@ -27,11 +24,11 @@ If you prefer a graphical interface you can use [Etcher](https://etcher.io/) (on
Hold F12 (or whatever key is used on your system) during startup to access bios. Then...
* __Turn UEFI On.__ Most modern systems use UEFI, so it's generally on by default.
* __Make sure UEFI is ON__. Most modern systems use UEFI, so it's generally on by default.
* __Disable Secure Boot.__ If secure boot is enabled it must be turned off since Linux boot loaders don't typically have digital signatures. Note that if you intend on running a dual-boot system with Windows and Linux you won't be able to use BitLocker disk encryption on the partition containing Windows, as it requires secure boot.
* __Disable Secure Boot__. If secure boot is enabled it must be turned off since Linux boot loaders don't typically have digital signatures. Note that if you intend on running a dual-boot system with Windows and Linux you won't be able to use disk encryption on the partition containing Windows, as it requires secure boot.
* __Disable Fast Startup Mode.__ If you are dual booting with Windows turn off Fast Startup. This feature puts Windows into hibernation when you power off. Because some systems are still active during hibernation, booting into Linux can cause various nasty problems.
* __Disable Fast Startup Mode__. If you are dual booting with Windows turn off Fast Startup. This feature puts Windows into hibernation when you power off. Because some systems are still active during hibernation, booting into Linux can cause various nasty problems.
---
@@ -45,58 +42,41 @@ Hold F12 (or whatever key is used on your system) during startup to access start
The most reliable way is to use a wired connection, as Arch is setup by default to connect to DHCP. However, you can usually get WiFi working by running:
wifi-menu
# wifi-menu
To test your connection:
ping -c 3 www.google.com
# ping -c 3 www.google.com
---
## Hard Drive Preparation
To view your disc information:
fdisk -l
### Delete Existing Disk Partitions
This step is only necessary if you are using a drive with existing partitions. If you are installing onto a drive with unallocated space, skip this step.
To remove partitions you can use parted:
parted -s /dev/sd* rm 1
parted -s /dev/sd* rm 2
parted -s /dev/sd* rm 3
etc.
### Zero Hard Drive with Random Data
## Zero Hard Drive with Random Data
Optional step if you are using a hard drive with existing data. Here's how to do it using dd:
dd if=/dev/urandom of=/dev/sd* status=progress
# dd if=/dev/urandom of=/dev/sd* status=progress
Or if you're paranoid you can use a multi-pass tool like shred.
shred -vfz -n 5 /dev/sd*
# shred -vfz -n 5 /dev/sd*
---
## Partition Hard Drive
__NOTE:__ Since we're using LVM we only need two drive partitions: boot, and root. The LVM will live on root.
__NOTE:__ Since we're using LVM we only need two drive partitions: boot and root. The LVM will be created on root later.
First, launch __parted__ on your desired drive node;
parted /dev/sd*
# parted /dev/sd*
Then run the following commands with your particular values:
(parted) mklabel gpt
(parted) mkpart primary 1MiB 512MiB name 1 boot
(parted) set 1 boot on
(parted) mkpart primary 512MiB 100% name 2 root
(parted) quit
# (parted) mklabel gpt
# (parted) mkpart primary 1MiB 512MiB name 1 boot
# (parted) set 1 boot on
# (parted) mkpart primary 512MiB 100% name 2 root
# (parted) quit
---
@@ -104,17 +84,17 @@ Then run the following commands with your particular values:
Before we setup our LVM we need to encrypt the root partition we just created.
cryptsetup luksFormat -v -s 512 -h sha512 /dev/sd*
# cryptsetup luksFormat -v -s 512 -h sha512 /dev/sd*
Now let's decrypt it so we can use it.
__Note__: I'm labeling this partition as "lvm". We will use this label later when we create the LVM.
cryptsetup open --type luks /dev/sd* lvm
# cryptsetup open --type luks /dev/sd* lvm
To verify our "lvm" label we can use:
ls /dev/mapper/lvm
# ls /dev/mapper/lvm
---
@@ -122,13 +102,13 @@ To verify our "lvm" label we can use:
### Create Physical Volume
pvcreate /dev/mapper/lvm
# pvcreate /dev/mapper/lvm
### Create Volume Group
__Note:__ I'm labelling my volume group as "vg".
vgcreate vg /dev/mapper/lvm
# vgcreate vg /dev/mapper/lvm
### Create Logical Volumes
@@ -136,36 +116,36 @@ At minimum we need two volumes. One for swap, the other for root. We can additio
__Note:__ The sizes below can be specified in megabytes (100M) or gigs (10G).
__Also__ the "L" arguments below are case sensitive. The capital L is used when you want to specify a fixed size volume, the lowercalse l lets you specify percentages.
__Also__ the "L" arguments below are case sensitive. The capital L is used when you want to specify a fixed size volume, the lowercase l lets you specify percentages.
lvcreate -L 4G vg -n swap
lvcreate -L 20G vg -n root
lvcreate -l 100%FREE vg -n home
# lvcreate -L 4G vg -n swap
# lvcreate -L 20G vg -n root
# lvcreate -l 100%FREE vg -n home
### Create Filesystems
__Note:__ The boot partition is on the non-LVM partition.
mkfs.vfat -F32 /dev/sd*
mkfs.ext4 /dev/mapper/vg-root
mkfs.ext4 /dev/mapper/vg-home
mkswap /dev/mapper/vg-swap
# mkfs.vfat -F32 /dev/sd*
# mkfs.ext4 /dev/mapper/vg-root
# mkfs.ext4 /dev/mapper/vg-home
# mkswap /dev/mapper/vg-swap
### Mount the volumes
We need to create a couple directories while we're at it.
mount /dev/mapper/vg-root /mnt
# mount /dev/mapper/vg-root /mnt
mkdir /mnt/home
mount /dev/mapper/vg-home /mnt/home
# mkdir /mnt/home
# mount /dev/mapper/vg-home /mnt/home
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
# mkdir /mnt/boot
# mount /dev/sda1 /mnt/boot
### Enable Swap
swapon -s /dev/mapper/vg-swap
# swapon -s /dev/mapper/vg-swap
---
@@ -177,25 +157,24 @@ By default Arch has a selection of servers from various countries listed in the
Note that reflector has two dependencies (rsync and curl) which should be installed by default in Arch, but to be safe we specify them:
sudo pacman -S reflector rsync curl
# sudo pacman -S reflector rsync curl
### Backup your local mirrorlist
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
# sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
### Create New Mirrorlist
Note: If you are in a different country change "United States" to your country.
sudo reflector --verbose --country 'United States' -l 5 --sort rate --save /etc/pacman.d/mirrorlist
# sudo reflector --verbose --country 'United States' -l 5 --sort rate --save /etc/pacman.d/mirrorlist
---
## Install Arch Linux
Finally!
pacstrap -i /mnt base base-devel
# pacstrap -i /mnt base base-devel
---
@@ -203,11 +182,11 @@ Finally!
We now need to update the filesystem table on the new installation. Fstab contains the association between filesystems and mountpoints.
genfstab -U -p /mnt >> /mnt/etc/fstab
# genfstab -U -p /mnt >> /mnt/etc/fstab
You can verify fstab with:
cat /mnt/etc/fstab
# cat /mnt/etc/fstab
__TO INVESTIGATE!!!__ When we generated the fstab did it add our swap to it?
@@ -219,7 +198,7 @@ __TO INVESTIGATE!!!__ When we generated the fstab did it add our swap to it?
Since we're still booted via USB, in order to configure our new system we need to change root. If we don't do that, every change we make will be applied to the USB installation.
arch-chroot /mnt
# arch-chroot /mnt
---
@@ -227,13 +206,13 @@ Since we're still booted via USB, in order to configure our new system we need t
While there are various bootloaders that may be used, since the Linux kernel has a built-in EFI image, all we need is a way to execute it. For that we will install systemd-boot, a minimalist boot manager:
bootctl --path=/boot install
# bootctl --path=/boot install
### Update the loader.conf file
Using nano we can edit the config file:
nano /boot/loader/loader.conf
# nano /boot/loader/loader.conf
Make sure that __only__ the following lines are in the file:
@@ -247,23 +226,23 @@ __Notes:__ The timeout setting is the number of seconds the menu is displayed. T
In the next step we will update the boot loader config file. But first, we need to determine the UUID of our root partition. In order to get the UUID you first need to know what device node root is on. Look it up using:
fdisk -l
# fdisk -l
The device node will be something like
/dev/sda2
# /dev/sda2
You can now get the UUID that corresponds to the root node you just looked up using:
blkid /dev/sda2
# blkid /dev/sda2
You can either write down the UUID (which could be painful given the length), or what I prefer to do is pipe the output of the above command to the config file that we will need that information in:
blkid /dev/sda2 > /boot/loader/entries/arch.conf
# blkid /dev/sda2 > /boot/loader/entries/arch.conf
Then open the config file in nano:
nano /boot/loader/entries/arch.conf
# nano /boot/loader/entries/arch.conf
Arrow over to the UUID and shift/arrow to highlight it. Use Ctl+K to cut the line. It will remain in the clipboard for use next.
@@ -276,7 +255,7 @@ Now delete everything in that file and add the following info. Make sure to repl
### Update Bootloader
bootctl update
# bootctl update
---
@@ -286,7 +265,7 @@ Since we're using disk encryption we need to make sure that it gets initialized
Edit the following config file:
nano /etc/mkintcpio.conf
# nano /etc/mkintcpio.conf
Scroll down to the hooks section. It should look similar to this:
@@ -298,11 +277,11 @@ Change it to this:
Now update the initramfs image with our hooks change:
mkinitcpio -p linux
# mkinitcpio -p linux
If you're curious what modules are available as intcpio hooks:
ls /usr/lib/initcpio/install
# ls /usr/lib/initcpio/install
## Add NVMe to mkinitcpio
@@ -310,7 +289,7 @@ This step is only necessary if your computer is running PCIe storage rather than
Edit the following config file:
nano /etc/mkintcpio.conf
# nano /etc/mkintcpio.conf
Add __nvme__ to the MODULES variable:
@@ -318,7 +297,7 @@ Add __nvme__ to the MODULES variable:
Now update the initramfs image with our module change:
mkinitcpio -p linux
# mkinitcpio -p linux
---
@@ -326,19 +305,19 @@ Now update the initramfs image with our module change:
Open the locale.gen file and uncomment your preferred language (I'm using en_US.UTF-8):
nano /etc/local.gen
# nano /etc/local.gen
Now save the file and generate the locale:
locale-gen
# locale-gen
Add your language choice to the locale.conf file:
echo LANG=en_US.UTF-8 > /etc/locale.conf
# echo LANG=en_US.UTF-8 > /etc/locale.conf
Export the language as an environmental shell variable:
export LANG=en_US.UTF-8
# export LANG=en_US.UTF-8
---
@@ -346,15 +325,15 @@ Export the language as an environmental shell variable:
Invoke this command to be prompted to find your timezone:
tzselect
# tzselect
Now, use the provided TZ to create a symbolic link to /etc/localtime:
ln -s /usr/share/zoneinfo/America/Denver /etc/localtime
# ln -s /usr/share/zoneinfo/America/Denver /etc/localtime
Update the hardware clock:
hwclock --systohc --utc
# hwclock --systohc --utc
---
@@ -362,23 +341,23 @@ Update the hardware clock:
This is the name of your computer. Note: Change "arch" to whatever you want your host to be.
echo arch > /etc/hostname
# echo arch > /etc/hostname
---
## Set Root Password
passwd
# passwd
---
## Create User Account
useradd -m -G wheel,users -s /bin/bash <username>
# useradd -m -G wheel,users -s /bin/bash <username>
And set the user password:
passwd <username>
# passwd <username>
---
@@ -386,15 +365,15 @@ And set the user password:
Install sudo:
pacman -S sudo
# pacman -S sudo
Then run the following command, which will open the sudoers file:
EDITOR=nano visudo
# EDITOR=nano visudo
Find this line and uncomment:
%wheel ALL=(ALL) ALL
# %wheel ALL=(ALL) ALL
---
@@ -404,7 +383,7 @@ Multilib repos allows the user to run and build 32-bit applications on 64-bit in
First we need to edit the pacman.conf file:
nano /etc/pacman.conf
# nano /etc/pacman.conf
Uncomment the following lines:
@@ -421,11 +400,11 @@ Save the file and exit.
### Refresh the package databases
pacman -Syy
# pacman -Syy
### Install Yaourt
sudo pacman -S yaourt
# sudo pacman -S yaourt
---
@@ -433,7 +412,7 @@ Save the file and exit.
The installation is basically done so we now update all installed packages:
pacman -Syu
# pacman -Syu
---
@@ -441,6 +420,6 @@ The installation is basically done so we now update all installed packages:
You should now have a working Arch Linux installation. It doesn't have a desktop environment or any applications yet, but the base installation is done. You can now reboot and remove the USB drive:
unmount -R /mnt
# unmount -R /mnt
reboot
# reboot