Installing 2019 Arch Linux on a FastyCloud Server

Last modified: October 7, 2020
You are here:
Estimated reading time: 9 min

Introduction

Arch Linux has a smaller, but still strong, following than more popular distributions. Its philosophy is quite different, with advantages and disadvantages.

Arch requires its users to be more do it yourself oriented. Arch does not have a GUI installation, but this guide will get a basic Arch installation running on your FastyCloud server. Arch does not configure everything for you by itself, but that lets you choose how to do it; which can be especially beneficial since there are multiple ways. Arch does not install a huge amount of packages, including a desktop environment; instead allowing you to choose what you want on your system, and leave off numerous packages that you don’t use.

The Arch repositories strongly favor leaving packages as they are made by their original upstream developers. If you run into problems with a package on other distributions, upstream maintainers may often refer you to your distribution, since it often makes changes that could be responsible. That rarely happens on Arch, as changes made are usually limited to: those necessary to work with Arch, such as its file-system hierarchy; and major upstream bug fixes and security back ports that are temporarily used until the next upstream release is made that will include them. That said, some other distributions sometimes add features and bug fixes to packages that the distribution didn’t bother sending upstream or that upstream developers didn’t accept, and these extra patches aren’t added in Arch packages, unless really necessary.

Arch operates as a “rolling release”. There are no versions or release cycles for Arch as a whole. Trusted Arch package maintainers submit new upstream releases into Arch’s repositories. Users periodically update all packages to the latest ones. Some users update daily, some weekly and some even less frequently. An Arch user gets the benefits of running the latest releases, instead of potentially months or years old versions on other distributions, but may also run into problems that upstream testing didn’t catch before a new release was made.

Arch is considered a more advanced and technically demanding distribution than many others. Someone completely new to Linux can use Arch, but he or she must be prepared and eager to do a lot of learning. The Arch community is extremely helpful, but it is expected that a user will make a good effort searching for how to fix a problem, rather than immediately just asking others for help.

Boot from Arch ISO

Although Arch is not a “Server Type” listed when deploying a new server on FastyCloud , you can easily boot an Arch ISO, and install your server yourself.

Arch releases a new ISO at the beginning of every month. If the most recent Arch ISO on FastyCloud is not from the current month, you can manually upload the newest one to FastyCloud and use that instead. When you use an Arch ISO to install to a hard drive, it gets the most recent versions of all packages from Arch’s servers. The versions of packages on the Arch ISO are not what are installed to your server. So, unless there’s a bug fix or feature not included on FastyCloud most recent Arch ISO in its ISO Library, one that affects the installation process, you probably don’t need to manually upload the newest one.

FastyCloud ISO library

After choosing “Deploy New Server”, under “Server Type”, switch to the “ISO Library” tab, and select the most recent Arch Linux ISO.

Manually upload most recent ISO

To get the most recent ISO, visit https://www.archlinux.org/download/ and click on one of the HTTP direct download links. On the next page, copy the link to the “.iso” file. Visit your FastyCloud ISO upload area at https://my.FastyCloud .com/iso/. Click “Add ISO”, paste in the link you just copied, and click “Upload”. The page will automatically refresh showing its download progress, and after a few minutes, it will show the ISO is available. Choose “Deploy New Server”, and under “Server Type”, switch to the “Upload ISO” tab, and select the ISO.

Connect to the ISO console

After deploying your new server, click on it to bring up the “Server Information” page. (If you see a note saying your server may still be finishing installing, you can ignore this, as your server is likely booted off the ISO for you to proceed.) Click on the icon in the upper right that looks like a computer monitor, that shows “View Console” on hover.

Press ENTER on “Boot Arch Linux (x86_64)“, and in a moment you will be logged in as root. (You may need to resize the window to show the entire console.)

The ISO uses DHCP to automatically configure networking, which works properly with FastyCloud  setup. Verify this worked.

# ping -c 1 archlinux.org

Synchronize the clock

Make sure the system clock is accurate.

# timedatectl set-ntp true

Update keyring

Packages on Arch’s servers can be signed by newer encryption keys than are on the ISO, so update to the newest trusted keyset.

# pacman -Sy archlinux-keyring

Partition disks

View the block devices detected.

# lsblk

The ISO CD will likely be sr0, and loop0 is being used to mount part of the ISO. This tutorial assumes you chose a standard FastyCloud server with a single hard drive, so also assumes your hard drive is vda. This is because FastyCloud standard servers give a virtual hard drive using QEMU virtio_blk for faster performance.

Partition the disk.

# fdisk /dev/vda

You need to decide now if you need a swap partition. If you’re unsure, it might be useful to look ahead to the section titled “Create Swap Space”.

NoteIf you wanted to use a GPT instead of DOS partition table, you would need to create a 1MB BIOS boot partition for GRUB.

No swap partition

Press N followed by ENTER 5 times to create a single partition of maximum size. Press W followed by ENTER to write the partition table. Your system partition is /dev/vda1.

With Swap Partition

Press N followed by ENTER 4 times. Next enter +<SIZE> (for example: +512M), then ENTER to create the swap partition. Press TENTER, then input 82, and ENTER again to mark it as a swap partition. Press N followed by ENTER 5 times to create your system partition. Press W, then ENTER to write the partition table. Your system partition is /dev/vda2.

Create a file-system

Btrfs

Btrfs is based on copy-on-write. When changed data is written, it is not simply written to overwrite the original data as in other file-systems. Changed blocks are written elsewhere and only after a successful write will the “pointers” to these new blocks be updated. This increases fault tolerance, so if something goes wrong during a write, the original data isn’t lost. It allows file-system provided snapshots. Behind the scenes, it maintains checksums on each block to automatically detect and sometimes silently correct corrupted data. Btrfs allows most file-system level modifications to be performed while it is mounted and in use, compared to most others that require they be offline. Btrfs has had some bumps while being developed, but as Arch will be running the most recent kernel, btrfs has been considered quite stable for quite some time now, with the exception of RAID levels 5 and 6 which are still being worked on.

# mkfs.btrfs --label arch <SYSTEM_PARTITION>

Ext4

Ext4 doesn’t have the latest file-system features, and doesn’t perform the best, but has been around since 2008, and is based on ext3 which has been around since 2001. Its code base is fairly stable, so some would argue it is more stable than newer file-systems, but as others have matured over the years, this argument has become less relevant.

# mkfs.ext4 -L arch <SYSTEM_PARTITION>

XFS

XFS is designed around parallel IO, focusing on scalability. It provides better performance than ext4, and, depending on the situation, provides slightly better or slightly worse performance compared to btrfs. XFS does not use copy-on-write, and only maintains checksums on its metadata rather than the data itself.

# mkfs.xfs -L arch <SYSTEM_PARTITION>

Mount file-system

Use the following command to mount the file-system:

# mount /dev/disk/by-label/arch /mnt

Create swap space

Swap space isn’t strictly necessary. You are better off running with 2GB of memory and no swap space, than 1GB of memory and 1GB of swap space. Swap space is a crutch to get by with less actual memory than your system and all of its programs require. Running out of memory on Linux should be avoided, because the kernel will automatically attempt freeing up memory by killing processes.

If you want to run without swap space, you can skip the rest of this section.

If you want to run with swap space, you can use a swap partition or a swap file. A swap partition has the benefits of being untouched by a file-system, so it never gets fragmented, and never gets tied up if your file-system is having momentary problems. A swap file has the benefit of being able to easily be resized, or deleted and added when needed.

Note btrfs is only expected to support swap files in Linux 5.0+, expected some time early to mid 2019.

Swap partition

# mkswap /dev/vda1
# swapon /dev/vda1

Swap file

# dd if=/dev/zero of=/mnt/swapfile bs=1M count=<SIZE IN MB> status=progress
# chmod 600 /mnt/swapfile
# mkswap /mnt/swapfile
# swapon /mnt/swapfile

Install base package group

Use this command:

# pacstrap /mnt base linux linux-firmware --noconfirm
  • If desired, substitute linux-ltslinux-mainline or another kernel from this list for the linux package.
  • If you are running btrfs, install the btrfs-progs package.

This installed a minimal amount of packages that Arch assumes to be installed on every system, and leaving any of them off risks breaking things at your own risk. Note the ISO includes many more packages than are in the “base” group. The base group will only take about 1.4GB.

Note you may notice WARNING: Possibly missing firmware for module: aic94xx and wd719x. These may be ignored.

Configure your new system

Automatically generate your /etc/fstab file (automatically mounts file-systems).

# genfstab -L /mnt >> /mnt/etc/fstab

You can now change root into your new installation, which basically treats your new installation at /mnt/ as if it were at /. While in the chroot environment, it will run programs installed on your hard drive rather than the ISO, as the ISO file-system is not visible within it.

# arch-chroot /mnt

Your system will internally keep track of time using UTC, but you can choose what time zone it should use when displaying the date and time. Determine which region to use.

# ls /usr/share/zoneinfo

Assuming you will use America, determine which city to use.

# ls /usr/share/zoneinfo/America

Assuming you will use New_York, choose that time zone.

# ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
# hwclock --systohc

Choose a UTF-8 locale.

# sed 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' -i /etc/locale.gen
# locale-gen
# echo 'LANG=en_US.UTF-8' > /etc/locale.conf

Configure networking

The easiest way to configure networking on a FastyCloud server is through DHCP. FastyCloud DHCP servers will still give you a public static IP address.

To see the networking devices detected.

# ip addr

The loopback device is labeled lo. On FastyCloud servers, you will likely see the networking device as ens3.

# cat <<EOF > /etc/systemd/network/ens3.network
> [Match]
> Name=ens3
>
> [Network]
> DHCP=ipv4
> EOF

Make DHCP automatically run at boot.

# systemctl enable systemd-networkd

Make DNS resolution automatically run at boot.

# systemctl enable systemd-resolved

Make /etc/resolv.conf forward requests to systemd-resolved.

# ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

Set the hostname for your server.

# echo '<YOUR_HOSTNAME>' > /etc/hostname

Using the hostname you chose, and the static IP address in place of <YOUR_STATIC_IP> shown when you ran ip addr, setup your hosts file.

$ cat <<EOF > /etc/hosts
> <YOUR_STATIC_IP>   localhost
> ::1                localhost
> <YOUR_STATIC_IP>   <YOUR_HOSTNAME>.localdomain  <YOUR_HOSTNAME>
> EOF

Set your root password

Use the following command to set a password. You will be prompted to enter your new password twice.

# passwd

Configure boot loader

Install the grub package.

# pacman -S grub

Install it to the hard drive.

# grub-install --target=i386-pc /dev/vda

NoteThe argument is the disk itself, NOT your system partition.

By default at boot, grub will wait for 5 seconds before choosing the default option. To disable this wait, use the following.

# sed 's/^GRUB_TIMEOUT=5$/GRUB_TIMEOUT=0/' -i /etc/default/grub

NoteIf you still want access to the grub boot menu, you might want to set this to 1 second instead of 0.

By default, grub gives the kernel the quiet option which systemd also follows. Use the following to show startup and shutdown messages.

# sed 's/^GRUB_CMDLINE_LINUX_DEFAULT="quiet"$/GRUB_CMDLINE_LINUX_DEFAULT=""/' -i /etc/default/grub

Create the grub configuration.

# grub-mkconfig -o /boot/grub/grub.cfg

Reboot into your hard drive

Exit the chroot environment.

# exit

Power off your server.

# systemctl poweroff

Go back into FastyCloud “Server Information” page for your server. On the “Settings” tab, click on “Custom ISO”, then “Remove ISO”. Click on the “Server Restart” icon, then “View Console”.

Create User

Login as root, with the password you chose earlier.

Install sudo.

# pacman -S sudo

Allow members in group wheel to use sudo.

# cp /etc/sudoers /etc/sudoers.new
# sed 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' -i /etc/sudoers.new
# visudo -c -f /etc/sudoers.new && mv /etc/sudoers.new /etc/sudoers

Create a user account.

# useradd --create-home --groups wheel <USERNAME>

Set the user’s password.

# passwd <USERNAME>

Log out as root.

# exit

Log in as the newly created user.

The commands below are still required to be run as root, so are still prefixed by #. The recommended way to run commands as root is to, as a regular user, prefix each of them with sudo. When you run sudo, the password it asks you for is your user password, not the root password.

Configure time synchronization

For a lightweight time synchronization client with rough accuracy use the following.

# systemctl enable --now systemd-timesyncd

If you would prefer better accuracy.

# pacman -S ntp
# systemctl enable --now ntpd

Configure SSH

Install a SSH server, so you can use SSH to connect to your Arch system instead of using FastyCloud virtual console.

# pacman -S openssh
# sed 's/#Port 22/Port 22/' -i /etc/ssh/sshd_config
# systemctl enable --now sshd

At this point, you can close the virtual console, and connect with SSH. Note, by default sshd will not allow you to login as root.

Upgrading

Because Arch is a “rolling release”, you can upgrade all packages you have installed whenever you’d like. Users may upgrade on their own schedule, daily, weekly and so on. If you upgrade often, not many packages will need to be upgraded at once, and any potential problems you may run into will be easier to pinpoint. It is important to upgrade all packages at once, as the following command will do. It’s easy to imagine why upgrading something like “glibc” alone, without the programs that use it, would cause problems.

# pacman -Syu

After upgrading, it is important to look through the output for messages given to you. It may tell you there are things you need to do. For this reason, do NOT setup automatic upgrading.

Note any already running programs before an upgrade won’t be the newer version until they’re restarted. In that case, when something really foundational that can’t just be restarted, like the linux kernel, glibc or systemd is updated, it is a good idea to reboot.

Keep startup messages

To show successful startup and shutdown messages, you need to have removed the quiet kernel parameter above from your grub configuration. (If you didn’t do so, you still can now with also re-creating the grub configuration.) Note these messages will only show through FastyCloud virtual console, not on ssh sessions. Part way through the boot process, the system will switch into a KMS (kernel mode setting graphics mode), which will lose messages before then. You can change the switch into KMS to happen earlier, to retain all messages.

# sed 's/^MODULES=()$/MODULES=(cirrus)/' -i /etc/mkinitcpio.conf
# mkinitcpio -p linux

By default, after the system boots and a tty initializes, it clears the screen. Although that’s aesthetically pleasing, it prevents you from simply looking at the messages during boot. You can turn off this behavior.

# mkdir /etc/systemd/system/[email protected]

Redirecting the output sudo cat will not use root permissions, so this is a way around that. (You do not need to prefix the cat command itself with sudo, so it is prefixed by $)

$ cat <<EOF | sudo tee /etc/systemd/system/[email protected]/noclear.conf
> [Service]
> TTYVTDisallocate=no
> EOF

Want

Was this article helpful?
Dislike 0
Views: 20