Verified Commit 1c8516f1 authored by Chris Stevens's avatar Chris Stevens
Browse files

movs docs to its own project

parent e44344a9
FROM nginx:stable-alpine
RUN apk --no-cache upgrade
WORKDIR /usr/share/nginx/html
COPY public .
FROM python:alpine
RUN apk --no-cache upgrade && \
pip install sphinx sphinx_rtd_theme recommonmark
.wy-nav-content {
max-width: 90% !important;
}
/*!
* @name Readthedocs
* @namespace http://userstyles.org
* @description Styles the documentation pages hosted on Readthedocs.io
* @author Anthony Post
* @homepage https://userstyles.org/styles/142968
* @version 0.20170529055029
*
* Modified by Aloïs Dreyfus: 20200527-1037
*/
a:visited {
color: #bf84d8;
}
pre {
background-color: #2d2d2d; !important;
}
.wy-nav-content {
background: #3c3c3c;
color: aliceblue;
}
.method dt, .class dt, .data dt, .attribute dt, .function dt,
.descclassname, .descname {
background-color: #525252 !important;
color: white !important;
}
.toc-backref {
color: grey !important;
}
code.literal {
background-color: #2d2d2d !important;
border: 1px solid #6d6d6d !important;
}
.wy-nav-content-wrap {
background-color: rgba(0, 0, 0, 0.6) !important;
}
.sidebar {
background-color: #191919 !important;
}
.sidebar-title {
background-color: #2b2b2b !important;
}
.xref, .py-meth {
color: #7ec3e6 !important;
}
.admonition, .note {
background-color: #2d2d2d !important;
}
.wy-side-nav-search {
background-color: inherit;
border-bottom: 1px solid #fcfcfc;
}
.wy-table thead, .rst-content table.docutils thead, .rst-content table.field-list thead {
background-color: #b9b9b9;
}
.wy-table thead th, .rst-content table.docutils thead th, .rst-content table.field-list thead th {
border: solid 2px #e1e4e5;
}
.wy-table thead p, .rst-content table.docutils thead p, .rst-content table.field-list thead p {
margin: 0;
}
.wy-table-odd td, .wy-table-striped tr:nth-child(2n-1) td, .rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td {
background-color: #343131;
}
.highlight .m { color: inherit } /* Literal.Number */
.highlight .nv { color: #3a7ca8 } /* Name.Variable */
body {
text-align: justify;
}
.rst-content .section .admonition ul {
margin-bottom: 0;
}
li.toctree-l1 {
margin-top: 5px;
margin-bottom: 5px;
}
.wy-menu-vertical li code {
color: #E74C3C;
}
.wy-menu-vertical .xref {
color: #2980B9 !important;
}
=========================
Arch Linux install on ZFS
=========================
.. important::
Please refer to the `Arch Wiki <https://wiki.archlinux.org>`_ for the official guide on how to install Arch Linux. These are my notes adapted from the `Arch ZFS wiki <https://wiki.archlinux.org/index.php/Install_Arch_Linux_on_ZFS>`_
Download the latest `archiso <https://archlinux.org/download/>`_ and boot to it.
Install the ZFS kernel modules
------------------------------
.. code:: shell
curl -s https://eoli3n.github.io/archzfs/init | sed 's- &>/dev/null--' | bash
Setup disk partitions
---------------------
.. note::
In this guide we will be installing Arch Linux onto a root ZFS filesystem. To save some headache we won't be using ZFS on our boot partition. We'll be using GPT and UEFI as opposed to MBR. For the differences, please see `this article <https://www.howtogeek.com/193669/whats-the-difference-between-gpt-and-mbr-when-partitioning-a-drive/>`_
Using the ``parted`` utility let's create our partitions
.. code:: shell
parted /dev/sda
(parted) mklabel gpt
(parted) mkpart non-fs 0% 200
(parted) mkpart parimary 200 100%
(parted) set 1 esp on
(parted) set 1 boot on
Or we can run this all as one command using the ``--script`` option
.. code:: shell
parted --script /dev/sda mklabel gpt mkpart non-fs 0% 200 mkpart primary 200 100% set 1 esp on set 1 boot on
Format our boot partition
-------------------------
.. code:: shell
mkfs.fat -F32 /dev/sda1
Create our zpool
----------------
Find the disk ID we're going to be using for ZFS. You can find it by running ``ls /dev/disk/by-id``
.. warning::
I'm using vmware and I couldn't find anything listed in /dev/disk/by-id. I had to edit the settings of the VM to support it. In :guilabel:`Edit Settings` -> :guilabel:`VM Options` -> :guilabel:`Advanced` -> :guilabel:`Edit Configuration` add ``disk.EnableUUID TRUE``
.. code:: shell
zpool create -f -o ashift=9 \
-O acltype=posixacl \
-O canmount=off \
-O compression=lz4 \
-O devices=off \
-O dnodesize=legacy \
-O mountpoint=none \
-O normalization=formD \
-O relatime=on \
-O xattr=sa \
-R /mnt \
zroot /dev/disk/by-id/scsi-36000c29168cfcdb14fb4e851f81025cf-part2
Create our data sets
--------------------
.. code:: shell
zfs create -o mountpoint=none zroot/ROOT
zfs create -o mountpoint=/ -o canmount=noauto zroot/ROOT/default
zfs create -o mountpoint=none zroot/data
zfs create -o mountpoint=/home zroot/data/home
zfs create -o mountpoint=/root zroot/data/home/root
zfs create -o mountpoint=/var zroot/data/var
zfs create -o mountpoint=/var/log zroot/data/var/log
zfs create -o mountpoint=/tmp zroot/data/tmp
Export/import your datasets
---------------------------
To validate your configurations, export then reimport all your zpools.
.. warning::
Do not skip this, otherwise you will be required to use -f when importing your pools. This unloads the imported pool.
.. code:: shell
zpool export zroot; zpool import -d /dev/disk/by-id -R /mnt zroot -N
Remount your datasets:
.. code:: shell
zfs mount zroot/ROOT/default; zfs mount -a
Configure the root filesystem
-----------------------------
Set the bootfs property on the descendant root filesystem so the boot loader knows where to find the operating system.
.. code:: shell
mkdir -p /mnt/etc/zfs; zpool set cachefile=/etc/zfs/zpool.cache zroot; cp /etc/zfs/zpool.cache /mnt/etc/zfs/zpool.cache
Mount the the boot partition inside /mnt/boot
.. code:: shell
mkdir /mnt/boot; mount /dev/sda1 /mnt/boot
genfstab -U -p /mnt >> /mnt/etc/fstab.zfs
Bootstrap your arch system
--------------------------
.. code:: shell
pacstrap /mnt base zfs-linux-lts vim
Create/enter the chroot
.. code:: shell
arch-chroot /mnt
Add the ZFS repo to pacman
--------------------------
.. code:: shell
cat << EOF >> /etc/pacman.conf
[archzfs]
Server = http://archzfs.com/archzfs/x86_64
Server = http://mirror.sum7.eu/archlinux/archzfs/archzfs/x86_64
Server = https://mirror.biocrafting.net/archlinux/archzfs/archzfs/x86_64
EOF
Some basic arch configs
-----------------------
Set local timezone and create /etc/adjtime
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: shell
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
hwclock --systohc
set and generate locale
~~~~~~~~~~~~~~~~~~~~~~~
.. code:: shell
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
Set the host name
~~~~~~~~~~~~~~~~~
.. code:: shell
hostnamectl set-hostname <hostname>
Adjust the hosts file
~~~~~~~~~~~~~~~~~~~~~
.. code:: shell
cat << EOF >> /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain localhost6
192.168.1.250 $myhostname.$mydomain $myhostname
2001:470:8050:1::250 $myhostname.$mydomain $myhostname
EOF
Enable NTP daemon
~~~~~~~~~~~~~~~~~
.. code:: shell
timedatectl set-ntp true
Configure networking
~~~~~~~~~~~~~~~~~~~~
DHCP
""""
.. code:: shell
cat << EOF > /etc/systemd/network/eth0.network
[Match]
Name=eth0
[Network]
DHCP=yes
EOF
Static
""""""
.. code:: shell
cat << EOF > /etc/systemd/network/eth0.network
[Match]
Name=eth0
[Network]
Address=192.168.1.250/24
Gateway=192.168.1.1
DNS=192.168.1.53
Address=2001:470:8050:1::250/64
Gateway=2001:470:8050:1::1
DNS=2001:470:8050:1::53
EOF
Then enable networking at startup
.. code:: shell
systemctl enable systemd-networkd
systemctl enable systemd-resolved
Set the root password
~~~~~~~~~~~~~~~~~~~~~
.. code:: shell
passwd
Configure systemd-boot
----------------------
.. code:: shell
mkdir -p /boot/loader/entries
cat << EOF > /boot/loader/loader.conf
default arch
console-mode max
timeout 5
EOF
cat << EOF > /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux-lts
initrd /initramfs-linux-lts.img
options net.ifnames=0 zfs=zroot/ROOT/default rw
EOF
bootctl --path=/boot install
Configure systemd ZFS mounts
----------------------------
.. code:: shell
zpool set cachefile=/etc/zfs/zpool.cache zroot
systemctl enable zfs.target
systemctl enable zfs-import-cache
systemctl enable zfs-mount
systemctl enable zfs-import.target
rm /etc/hostid && zgenhostid $(hostid)
Update ``/etc/mkinitcpio.conf`` and regen the initrd
----------------------------------------------------
.. code:: shell
sed -i 's|^HOOKS.*|HOOKS=\"base udev autodetect modconf block keyboard zfs filesystems\"|g' /etc/mkinitcpio.conf
mkinitcpio -p linux-lts
Got swap?
---------
.. code:: shell
zfs create -V 2G -b $(getconf PAGESIZE) \
-o compression=lz4 \
-o logbias=throughput \
-o sync=always \
-o primarycache=metadata \
-o secondarycache=none \
-o com.sun:auto-snapshot=false \
zroot/swap
mkswap /dev/zvol/zroot/swap
swapon /dev/zvol/zroot/swap
echo "/dev/zvol/zroot/swap none swap discard 0 0" >> /etc/fstab
Lose the swap
-------------
.. code:: shell
swapoff /dev/zvol/zroot/swap
zfs destroy zroot/swap
Arch Linux install
##################
.. important::
Please refer to the `Arch Wiki <https://wiki.archlinux.org>`_ for the official guide on how to install Arch Linux.
Setup disk partitions
---------------------
.. code-block:: shell
parted /dev/sda
(parted) mklabel gpt
(parted) mkpart primary fat32 1MiB 512MiB
(parted) set 1 esp on
(parted) mkpart primary linux-swap 512MiB 2560MiB
(parted) mkpart primary ext4 2560MiB 100%
(parted) quit
Or you can wrap that all into one line:
.. code-block:: shell
parted --script /dev/sda mklabel gpt mkpart primary fat32 1MiB 512MiB set 1 esp on \
mkpary primary linux-swap 512MiB 2560MiB mkpart primary ext4 2560MiB 100%
Format partitions
-----------------
.. code-block:: shell
mkfs.fat -F32 /dev/sda1
mkswap /dev/sda2
mkfs.ext4 /dev/sda3
Mount partitions
----------------
.. code-block:: shell
mount /dev/sda3 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
swapon /dev/sda2
Install the base system and enter chroot
----------------------------------------
.. code-block:: shell
pacstrap /mnt base linux vim
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
Set local timezone and create /etc/adjtime
------------------------------------------
.. code-block:: shell
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
hwclock --systohc
Set and generate locale
-----------------------
.. code-block:: shell
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
Set the host name
-----------------
.. code-block:: shell
hostnamectl set-hostname <hostname>
Adjust the hosts file
---------------------
.. code-block:: text
cat << EOF > /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain localhost6
192.168.1.250 $myhostname.$mydomain $myhostname
2001:470:8050::250 $myhostname.$mydomain $myhostname
EOF
Enable NTP daemon
-----------------
.. code-block:: shell
timedatectl set-ntp true
Set the root password
---------------------
.. code-block:: shell
passwd
Create files for and install systemd-boot
-----------------------------------------
.. code-block:: shell
mkdir -p /boot/loader/entries
cat << EOF > /boot/loader/loader.conf
default arch
console-mode max
timeout 5
EOF
cat << EOF > /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=/dev/sda3 net.ifnames=0
EOF
bootctl --path=/boot install
Configure networking
--------------------
DHCP
~~~~
.. code-block:: shell
cat << EOF > /etc/systemd/network/eth0.network
[Match]
Name=eth0
[Network]
DHCP=yes
EOF
Static
~~~~~~
.. code-block:: shell
cat << EOF > /etc/systemd/network/eth0.network
[Match]
Name=eth0
[Network]
Address=192.168.1.250/24
Gateway=192.168.1.1
DNS=192.168.1.53
Address=2001:470:8050::250/64
Gateway=2001:470:8050::1
DNS=2001:470:8050::53
EOF
Enable networking on boot
-------------------------
.. code-block:: shell
systemctl enable systemd-networkd
systemctl enable systemd-resolved
Exit chroot and reboot
----------------------
.. code-block:: shell
exit
reboot
===============================
Arch Linux post-install options
===============================
Instal the secure shell, sudo
-----------------------------
.. code-block:: shell
{
pacman -S --noconfirm openssh sudo
systemctl enable sshd --now
}
ZSH
---
Install zsh and some plugins
""""""""""""""""""""""""""""
.. code-block:: shell
{
pacman -S --noconfirm zsh zsh-autosuggestions zsh-syntax-highlighting
}
Some basic zsh settings
"""""""""""""""""""""""
.. code-block:: shell
{
cat >> ~/.zshrc <<EOF
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=2000
setopt APPEND_HISTORY
setopt COMPLETE_ALIASES