Server install

This describes how I install my server from scratch. I'm using Gentoo.

Hardware

Disks

SSD

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         2099199   1024.0 MiB  EF00  EFI System
   2         2099200        18876415   8.0 GiB     8200  Linux swap
   3        18876416      1000215182   467.9 GiB   FD00  Linux RAID

HDD

Software Raid

mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/nvme0n1p3 /dev/nvme1n1p3 --name=ROOT

mdadm --assemble --scan

Filesystems

mkfs.vfat -n BOOT /dev/nvme0n1p1
mkfs.vfat -n BOOT /dev/nvme1n1p1
mkfs.ext4 -L ROOT /dev/md1

Install

mkdir /mnt/gentoo
cd /mnt
mount /dev/md/ROOT gentoo
mkdir gentoo/boot
mount /dev/nvme0n1p1 gentoo/boot

wget https://mirror.leaseweb.com/gentoo/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-20190515T214503Z.tar.xz
tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner

mount --types proc /proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) ${PS1}"

emerge-webrsync
emerge --update --newuse --deep --with-bdeps=y --tree --backtrack=50 --verbose-conflicts @world

cd /etc
echo "Europe/Amsterdam" > timezone
emerge --config sys-libs/timezone-data
vi locale.gen   (enable en_US.UTF-8 UTF-8)
locale-gen
eselect locale list   (select en_US.utf8)
. /etc/profile

emerge sys-kernel/gentoo-source
cd /usr/src/linux
make menuconfig
make -j16
make install
make modules_install

echo "sys-apps/util-linux static-libs" > /etc/portage/package.use/util-linux
emerge genkernel
=> enable MDADM in /etc/genkernel.conf
genkernel initramfs

emerge refind
refind-install

emerge efibootmgr
efibootmgr -c -d /dev/nvme0n1 -p 1 -L "Boot 0" -l 'EFIBOOTbootx64.efi'
efibootmgr -c -d /dev/nvme1n1 -p 1 -L "Boot 1" -l 'EFIBOOTbootx64.efi'

mkswap -L SWAP0 /dev/nvme0n1p2
mkswap -L SWAP1 /dev/nvme1n1p2
swapon -a

emerge syslog-ng cronie
rc-update add syslog-ng
rc-update add cronie

Tools

lsblk -fs
blkid

TigerVnc

emerge xfce4-meta xfce4-terminal tigervnc
echo "/usr/bin/startxfce4 &" > ~/.vnc/xstartup
edit /etc/conf.d/tigervnc:
    DISPLAYS="milo:1"
    VNC_OPTS="-geometry 1550x1000 -depth 16"
run 'vncpasswd' as the user
rc-update add tigervnc

Java

mkdir /etc/portage/profile
echo "dev-java/openjdk-bin -gentoo-vm" >> /etc/portage/profile/package.use.mask

enable the "gentoo-vm" use flag for the emerge of the package
emerge openjdk-bin

Hardware

Disks

SSD

Number Start (sector) End (sector) Size Code Name
1 2048 2097152 1023.0 MiB 8300 Linux filesystem
2 2099200 18876415 8.0 GiB 8200 Linux swap
3 18876416 1000215182 467.9 GiB FD00 Linux RAID

HDD

Software Raid

mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/nvme0n1p3 /dev/nvme1n1p3 --name=ROOT

mdadm --assemble --scan

Filesystems

mkfs.vfat -n BOOT /dev/nvme0n1p1
mkfs.vfat -n BOOT /dev/nvme1n1p1
mkfs.ext4 -L ROOT /dev/md1

Install

mkdir /mnt/gentoo
cd /mnt
mount /dev/md/ROOT gentoo
mkdir gentoo/boot
mount /dev/nvme0n1p1 gentoo/boot

wget https://mirror.leaseweb.com/gentoo/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-20190515T214503Z.tar.xz
tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner

mount --types proc /proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) ${PS1}"

emerge-webrsync
emerge --update --newuse --deep --with-bdeps=y --tree --backtrack=50 --verbose-conflicts @world

cd /etc
echo "Europe/Amsterdam" > timezone
emerge --config sys-libs/timezone-data
vi locale.gen   (enable en_US.UTF-8 UTF-8)
locale-gen
eselect locale list   (select en_US.utf8)
. /etc/profile

emerge sys-kernel/gentoo-source
cd /usr/src/linux
make menuconfig
make -j16
make install
make modules_install

echo "sys-apps/util-linux static-libs" > /etc/portage/package.use/util-linux
emerge genkernel
=> enable MDADM in /etc/genkernel.conf
genkernel initramfs

emerge refind
refind-install

emerge efibootmgr
efibootmgr -v

Tools

lsblk -fs
blkid
efibootmgr -v
sgdisk -i 1 /dev/nvme0n1 | grep "Partition unique GUID"