🖥️ 🐧 Installing Arch Linux in my new NUC7i3BNH

Time to setup my new NUC7i3BNH.
I will install Arch Linux with no window manager and it will act as my home server with Seafile, Plex, Sickchill, sabnzbd, etc..
Preparation
Upgrade BIOS Firmware
- Download the latest BIOS
- Copy the .bios file to a USB drive
- Boot and enter the upgrade page with F7
Burn ISO to USB pen drive
- Download the Arch Linux ISO
- Burn the iso in the usb pen drive.
1lsblk
2cd Downloads
3sudo dd bs=4M if=archlinux-2020.05.01-x86_64.iso of=/dev/sdc status=progress oflag=sync
Installation
Boot from the usb pen drive (setup the boot sequence entering the BIOS with F2).
First steps and testing Internet connection
Make sure to use the correct keyboard layout (e.g.: for a portuguese layout; use the ? key for the - character).
1loadkeys pt-latin9
Test the Internet connection.
1ip link
2dhcpcd
3ping archlinux.org
Activate the ntp service.
1timedatectl set-ntp true
Make sure the en_US.UTF-8 is uncommented.
1nano /etc/locale.gen
2locale-gen
Create partitions
List the drives and use cgdisk to create the partitions.
1lsblk
2cgdisk /dev/nvme0n1
Partitions to create.
| # | Size | Hexcode | Label |
|---|---|---|---|
| 1 | 1G | ef00 | boot_efi |
| 2 | 1G | ef02 | boot |
| 3 | 222G | 8304 | root |
| 4 | 8.9G | 8200 | swap |
Format the partitions.
1mkfs.vfat /dev/nvme0n1p1
2mkfs.ext4 /dev/nvme0n1p2
3mkfs.ext4 /dev/nvme0n1p3
4mkswap /dev/nvme0n1p4
5swapon /dev/nvme0n1p4
Mounting the partitions
1mount /dev/nvme0n1p3 /mnt
2mkdir -p /mnt/boot
3mount /dev/nvme0n1p2 /mnt/boot
4mkdir -p /mnt/boot/efi
5mount /dev/nvme0n1p1 /mnt/boot/efi
Install the base system
Choose a mirror near you.
1nano /etc/pacman.d/mirrorlist
Copy your preferred mirror to the first line.
Tips:
- Alt+6 to copy a Server line.
- PageUp key to scroll up.
- Ctrl+U to paste it at the top of the list.
- Ctrl+X to exit, and when prompted to save changes, press Y and Enter.
Refresh the packages list and install the base system.
1pacman -Syy
2pacstrap /mnt base base-devel linux linux-firmware
Generate the fstab file.
1genfstab -U /mnt >> /mnt/etc/fstab
Configurations and boot manager
Change context to the base install mounted partitions.
1arch-chroot /mnt
Install nano to edit files.
1pacman -S nano
Define your local timezone.
1ln -s /usr/share/zoneinfo/Europe/Lisbon /etc/localtime
Hardware clock.
1hwclock --systohc --utc
Uncomment en_US.UTF-8 UTF-8 and generate the locale.
1nano /etc/locale.gen
2locale-gen
LANG and KEYMAP configurantion.
1echo "LANG=en_US.UTF-8" >> /etc/locale.conf
2echo "KEYMAP=pt-latin9" >> /etc/vconsole.conf
Hosts and hostname configuration.
1echo "myhostname" >> /etc/hostname
2echo "127.0.0.1 localhost" >> /etc/hosts
3echo "::1 localhost" >> /etc/hosts
4echo "127.0.1.1 myhostname.localdomain myhostname" >> /etc/hosts
Install and enable network services.
1pacman -S networkmanager
2systemctl enable NetworkManager.service
Useful to have sooner than later.
1pacman -S git wget unzip openssh
2systemctl enable sshd
Create an initial ramdisk environment.
1mkinitcpio -P
Change your root password.
1passwd
Install grub.
1pacman -S grub efibootmgr
2grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
3grub-mkconfig -o /boot/grub/grub.cfg
Install intel-ucode.
1pacman -S intel-ucode
Unmount and reboot.
1exit
2umount /mnt/boot/efi
3umount /mnt/boot
4umount /mnt
5reboot
Log in as root and create your user.
1useradd -m -g users -s /bin/bash myuser
2chfn myuser
3passwd myuser
Create a new group to match your user.
1groupadd mygroup
2gpasswd -a myuser mygroup
Add your user as a sudoer.
1pacman -S sudo vi
2visudo /etc/sudoers
Add:
myuser ALL=(ALL) ALL
After installation
Fix the IP in the router DHCPCD table
I like to always have the same IP address and tipically I do that at the router level.
Authorized key to access from my desktop
On the server:
1mkdir -p .ssh
On the desktop:
1cat $HOME/.ssh/id_rsa.pub | ssh myuser@myhostname "cat >> .ssh/authorized_keys"
Install yay (Yet another Yogurt)
1mkdir -p downloads
2cd downloads
3wget https://aur.archlinux.org/cgit/aur.git/snapshot/yay.tar.gz
4tar xvf yay.tar.gz
5cd yay
6makepkg -sri
fstab and my NAS
In my server I have NFS mounted directories to my NAS.
1yay -S nfs-utils
2
3sudo systemctl enable rpcbind.service
4sudo systemctl start rpcbind.service
5sudo systemctl status rpcbind.service
6
7sudo systemctl enable nfs-client.target
8sudo systemctl start nfs-client.target
9sudo systemctl status nfs-client.target
10
11sudo systemctl enable NetworkManager-wait-online.service
12sudo systemctl start NetworkManager-wait-online.service
13sudo systemctl status NetworkManager-wait-online.service
14
15sudo mkdir -p /home/nas
16sudo mkdir -p /home/nas/media
17sudo mkdir -p /home/nas/downloads
I reviewed the mount options, mounted /tmp in memory and added the NFS mountpoints.
1UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX / ext4 noatime,discard,data=ordered,errors=remount-ro 0 1
2UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX /boot ext4 noatime,discard,data=ordered,errors=remount-ro 0 2
3UUID=XXXX-XXXX /boot/efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 2
4tmpfs /tmp tmpfs nodev,nosuid,noatime,mode=1777 0 0
5/swapfile none swap defaults 0 0
6mynasserver:/nfs/media /home/nas/media nfs users,noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,soft,intr,noatime 0 0
rsync
yay -S rsync
Apache
https://wiki.archlinux.org/index.php/Apache_HTTP_Server
I will tranfer all my configuration from the old server.
On the new server:
1yay -S apache php-apache
On the old server:
1sudo systemctl stop httpd
2sudo systemctl disable httpd
3sudo systemctl status httpd
4sudo tar --xattrs -czpvf /home/nas/downloads/httpd.tar.gz /etc/httpd
On the new server:
1sudo systemctl stop httpd
2
3cd /
4sudo tar -xvf /home/nas/downloads/httpd.tar.gz
5
6sudo systemctl start httpd
7sudo systemctl status httpd
8sudo systemctl enable httpd
Sabnzbd
https://wiki.archlinux.org/index.php/SABnzbd
I will tranfer all my configuration from the old server.
On the new server:
1yay -S sabnzbd python2-pyopenssl p7zip unzip
On the old server:
1sudo systemctl stop sabnzbd
2sudo systemctl disable sabnzbd
3sudo systemctl status sabnzbd
4sudo tar --xattrs -czpvf /home/nas/downloads/sabnzbd.tar.gz /opt/sabnzbd
On the new server:
1sudo systemctl stop sabnzbd
2
3cd /
4sudo tar -xvf /home/nas/downloads/sabnzbd.tar.gz
5
6# find and replace the old server hostname for the new one
7sudo vi /opt/sabnzbd/sabnzbd.ini
8
9sudo systemctl start sabnzbd
10sudo systemctl status sabnzbd
11sudo systemctl enable sabnzbd
Check if everything is working: https://myhostname:9090/sabnzbd/
Sickchill
I will tranfer all my configuration from the old server.
On the new server:
1yay -S sickchill-git
On the old server:
1sudo systemctl stop sickchill
2sudo systemctl disable sickchill
3sudo systemctl status sickchill
4sudo tar --xattrs -czpvf /opt/sickchill.tar.gz /opt/sickchill
5sudo scp /opt/sickchill.tar.gz root@myhostname:/home/myuser
6sudo rm /opt/sickchill.tar.gz
On the new server:
1sudo systemctl stop sickchill
2
3cd /
4sudo cp /home/myuser/sickchill.tar.gz .
5sudo tar -xvf sickchill.tar.gz
6sudo rm /home/myuser/sickchill.tar.gz
7sudo rm sickchill.tar.gz
8
9# find and replace the old server hostname for the new one
10sudo vi /opt/sickchill/data/config.ini
11
12sudo systemctl start sickchill
13sudo systemctl status sickchill
14sudo systemctl enable sickchill
Check if everything is working: http://myhostname:8081/home/
Plex
I will tranfer all my configuration from the old server.
On the new server:
1yay -S plex-media-server-plexpass
On the old server:
1sudo systemctl stop plexmediaserver
2sudo systemctl disable plexmediaserver
3sudo systemctl status plexmediaserver
4sudo tar --xattrs -czpvf /home/nas/downloads/plexmediaserver.tar.gz /usr/lib/plexmediaserver
5sudo tar --xattrs -czpvf /home/nas/downloads/plex.tar.gz /var/lib/plex
On the new server:
1sudo systemctl stop plexmediaserver
2
3cd /
4sudo tar -xvf /home/nas/downloads/plexmediaserver.tar.gz
5sudo tar -xvf /home/nas/downloads/plex.tar.gz
6
7sudo systemctl start plexmediaserver
8sudo systemctl status plexmediaserver
9sudo systemctl enable plexmediaserver
Reviewed the port forwarding in my router:
| Plex | 32400 | 32400 | x.x.x.x | BOTH |
| Plex DLNA Server | 1900 | 1900 | x.x.x.x | UDP |
| Plex DLNA Server (TCP) | 32469 | 32469 | x.x.x.x | TCP |
| Plex GDM _ 1 | 32410 | 32410 | x.x.x.x | UDP |
| Plex GDM _ 2 | 32412 | 32412 | x.x.x.x | UDP |
| Plex GDM _ 3 | 32413 | 32413 | x.x.x.x | UDP |
| Plex GDM _ 4 | 32414 | 32414 | x.x.x.x | UDP |
Check if everything is working: https://app.plex.tv/
Seafile
https://www.seafile.com/en/download/
On the new server:
1yay -S certbot-apache
On the old server:
1sudo systemctl stop seahub
2sudo systemctl stop seafile
3sudo systemctl stop mysqld
4sudo systemctl disable seahub
5sudo systemctl disable seafile
6sudo systemctl disable mysqld
7
8sudo tar --xattrs -czpvf /home/nas/downloads/letsencrypt.tar.gz /etc/letsencrypt
9sudo tar --xattrs -czpvf /home/nas/downloads/mysql.tar.gz /var/lib/mysql
10sudo tar --xattrs -czpvf /home/nas/downloads/ccnet.tar.gz /srv/seafile/ccnet
11sudo tar --xattrs -czpvf /home/nas/downloads/conf.tar.gz /srv/seafile/conf
12#sudo tar --xattrs -czpvf /home/nas/downloads/pro-data.tar.gz /srv/seafile/pro-data
13sudo tar --xattrs -czpvf /srv/seafile/seahub-data.tar.gz /srv/seafile/seahub-data
14
15sudo scp -p /etc/systemd/system/seafile.service myuser@myhostname:/home/myuser/seafile.service
16sudo scp -p /etc/systemd/system/seahub.service myuser@myhostname:/home/myuser/seahub.service
On the new server:
1cd /
2sudo tar -xvf /home/nas/downloads/letsencrypt.tar.gz
3sudo certbot certificates
4
5sudo useradd -m -r -d /srv/seafile -s /usr/bin/nologin seafile
6sudo groupadd nogroup
7
8sudo mkdir -p /home/nas/seafile-data
9sudo chmod 750 /home/nas/seafile-data
10
11sudo vi /etc/fstab
12# add an entry for nas:/nfs/seafile-data
13sudo shutdown -r now
14
15sudo ls -lah /home/nas/seafile-data
16
17yay -S python-imaging mysql-python libsearpc libsepol libselinux mariadb jdk8-openjdk python-pdftotext
18
19sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
20
21sudo systemctl stop mysqld
22
23cd /
24sudo tar -xvf /home/nas/downloads/mysql.tar.gz
25
26sudo systemctl start mysqld
27sudo systemctl status mysqld
28sudo systemctl enable mysqld
29
30mysql -u root -p
31
32sudo -u seafile -s /bin/sh
33cd /srv/seafile
34mkdir -p seafile-data
35wget "https://download.seafile.com/d/XXXXXXX/files/?p=/pro/seafile-pro-server_7.0.17_x86-64.tar.gz&dl=1" -O seafile-pro-server_7.0.17_x86-64.tar.gz
36tar -xzf seafile-pro-server_*
37mkdir installed
38mv seafile-pro-server_*tar.gz installed
39exit
40
41cd /
42sudo tar -xvf /home/nas/downloads/ccnet.tar.gz
43sudo tar -xvf /home/nas/downloads/conf.tar.gz
44#sudo tar -xvf /home/nas/downloads/pro-data.tar.gz
45sudo tar -xvf /home/nas/downloads/seahub-data.tar.gz
46sudo cp /home/myuser/seafile.service /etc/systemd/system/seafile.service
47sudo cp /home/myuser/seahub.service /etc/systemd/system/seahub.service
48sudo rm /home/myuser/seafile.service
49sudo rm /home/myuser/seahub.service
50sudo systemctl daemon-reload
51
52sudo -u seafile -s /bin/sh
53ln -s /home/nas/seafile-data /srv/seafile/seafile-data
54ls ...
55cd /srv/seafile
56cd seafile-pro-server-7.0.17
57upgrade/minor-upgrade.sh
58ls ..
59exit
60
61sudo find /srv/seafile ! -user seafile -exec chown seafile:seafile {} \;
62sudo find /home/nas/seafile-data ! -user seafile -exec chown seafile:seafile {} \;
63
64sudo -u seafile -s /bin/sh
65cd /srv/seafile
66rm -rf pro-data/search
67exit
68
69sudo systemctl start seafile
70sudo systemctl status seafile
71sudo systemctl enable seafile
72sudo systemctl start seahub
73sudo systemctl status seahub
74sudo systemctl enable seahub
75
76sudo -u seafile -s /bin/sh
77cd /srv/seafile/seafile-server-latest
78./pro/pro.py search --update
Reviewed the port forwarding in my router:
| seafile | 8082 | 8082 | x.x.x.x | BOTH |
| seahub | 8000 | 8000 | x.x.x.x | BOTH |
| seafile (Web) | 80 | 80 | x.x.x.x | BOTH |
| seafile (Web SSL) | 443 | 443 | x.x.x.x | BOTH |
| seafile (webdav) | 8080 | 8080 | x.x.x.x | BOTH |
| seafdav | 8083 | 8083 | x.x.x.x | BOTH |
Check if everything is working: https://myseafileurl/
#Linux #Arch Linux #NUC #Seafile #Tags/Sabnzbd #Tags/Sickchill #Tags/Plex