I have installed Arch Linux on my DeskMini A300.
The Arch Wiki [Installation Guide](https://wiki.archlinux.jp/index.php/Installation Guide) has a very detailed explanation, so basically you can just follow the procedure. However, some of them had to be set by themselves according to the environment and usage, so keep a record just in case.
Download the Arch Linux installation image (.iso) before proceeding with the steps below. https://www.archlinux.jp/download/
If you get the installation image from the mirror, it is recommended to verify the signature of the file as a countermeasure against tampering. The following uses OpenSSL to calculate the SHA-1 hash. Make sure that this hash value matches the hash published in Honke.
% openssl sha1 /path/to/arch.iso
SHA1(/path/to/arch.iso)= c71fdff7f793888d7f53aa5e0685602e3167825c
The following steps depend on the OS used to create the installation media.
MAC OS X
First, check the name of the USB device.
% diskutil list
USB devices mount automatically on Mac OS X. In this state, the installation image cannot be written, so unmount it manually.
% diskutil unmountDisk /dev/diskN
Write the installation image. Faster transfers can be achieved by using / dev / rdiskN
instead of / dev / diskN
. The prefix r
means raw mode.
% sudo dd if=/path/to/arch.iso of=/dev/rdiskN bs=1M
Insert the USB device with the Arch Linux installation media into the computer to be installed and boot the system using this USB device as the boot disk. In the case of DeskMini A300, it started without any settings.
First, set the font and keyboard layout. The settings here are not persistent and are not required, but make sure you have a comfortable working environment as you will continue to operate from the console.
In my case, I output HDMI to a 4K TV, so the characters were too small to read anything, so I changed to a larger font. With the following settings, it has improved to the extent that characters can be read if you manage to bring your face closer. Larger fonts are not provided by default, so I gave up in a live environment.
# setfont sun12x22
I also changed the keymap because I wanted to use a Japanese keyboard. This setting is not required if you use an alphabetic keyboard.
# loadkeys jp106
Check the list of discs recognized from the live environment.
# fdisk -l
After confirming the name of the disk, specify the target disk and create a partition. There are certain rules for the / boot
partition for UEFI boot, so follow the instructions below to create it.
# parted /dev/nvme0n1
(parted) mklabel gpt
(parted) mkpart ESP fat32 1MiB 513MiB
(parted) set 1 boot on
(parted) set 1 esp on
The file system and size of the other partitions are free. I chose ext4 as the filesystem here and created only the /
partition.
(parted) mkpart primary ext4 513MiB 100%
(parted) quit
Check the name of the partition with fdisk -l
and format it with the appropriate utility for your file system.
# fdisk -l
Disk /dev/nvme0n1: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1050623 1048576 512M EFI System
/dev/nvme0n1p2 1050624 976773119 975722496 465.3G Linux filesystem
# mkfs.fat -F32 /dev/nvme0n1p1
# mkfs.ext4 /dev/nvme0n1p2
Mount the partition under / mnt
to install Arch Linux.
# mount /dev/nvme0n1p2 /mnt
# mkdir /mnt/boot
# mount /dev/nvme0n1p1 /mnt/boot
Since the date and time are required to verify the signing key, use NTP to synchronize the time.
# timedatectl set-ntp true
Then specify the mirror server to get the package from. Edit /etc/pacman.d/mirrorlist
using something like vim
. It is better to move the servers of Japan, China and South Korea, which are close in distance, to the upper ranks. Mirror Status is also helpful. An example is shown below.
/etc/pacman.d/mirrorlist
Server = https://ftp.jaist.ac.jp/pub/Linux/ArchLinux/$repo/os/$arch
Server = https://jpn.mirror.pkgbuild.com/$repo/os/$arch
Server = https://mirrors.cat.net/archlinux/$repo/os/$arch
When you're ready, use the pacstrap
script to install the base package, Linux kernel, and firmware.
# pacstrap /mnt base linux linux-firmware
Create / etc / fstab
using the genfstab
command so that the partition you just created will be mounted automatically.
# genfstab -U /mnt >> /mnt/etc/fstab
Previously, the live environment for USB installation media was /
. If you execute the following command, / mnt
and below where Arch Linux is installed with pacstrap
will be treated as /
.
# arch-chroot /mnt
Use pacman -Syu
to install the required packages. An example package is shown below.
Package | Repository | Description |
---|---|---|
amd-ucode | core | Microcode for AMD processors(Firmware update) |
git | extra | Fast distributed version control system |
intel-ucode | extra | Microcode for Intel processors(Firmware update) |
make | core | GNU make |
openssh | core | SSH server and client |
pacman-contrib | community | pacman related utilities |
sudo | core | A command in which a user executes a command with the privileges of another user |
tmux | community | Terminal multiplexer |
vim | extra | Text editor |
zsh | extra | High-performance command shell |
The DeskMini A300 should have AMD's Ryzen and Athlon, so install ʻamd-ucode. ʻIntel-ucode
is not required. The opposite is true if you have an Intel CPU.
The system time zone is specified by a symbolic link.
# ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
Match the hardware clock to the NTP-synchronized system clock. The hardware clock is the time recorded on the motherboard that keeps the clock running while the system is shut down. The next time you boot the system, the system clock will be set automatically by reading the hardware clock.
Here, the hardware clock records the same UTC time as the system clock. The automatically generated / etc / adjtime
states that the hardware clock is in UTC time.
# hwclock --systohc --utc
Edit /etc/locale.gen
and uncomment the locale you want to use. For example, uncomment ʻen_US.UTF-8 UTF-8and
ja_JP.UTF-8 UTF-8. Then run the
local-gen` script to actually enable that locale.
# local-gen
Set the system locale.
/etc/locale.conf
LANG=en_US.UTF-8
Set the font and keyboard layout as needed.
/etc/vconsole.conf
FONT=sun12x22
KEYMAP=jp106
Write the name of this computer in / etc / hostname
.
# echo your-hostname > /etc/hostname
Write the same name to / etc / hosts
.
/etc/hosts
127.0.0.1 localhost
127.0.1.1 your-hostname
::1 localhost
Set the password for the root user.
# passwd
Install systemd-boot on the EFI system partition.
# bootctl --path=/boot install
Check the UUID of the /
partition.
# ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 15 Feb 14 22:01 5a534876-bb2f-4fd3-880e-9244235d42c3 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 15 Feb 14 22:01 1234-5678 -> ../../nvme0n1p1
Add the loader settings to boot Arch Linux under / boot / loader / entries
. If you are using an Intel processor, replace /amd-ucode.img
with /intel-ucode.img
. Also, for the UUID, specify the UUID of the /
partition confirmed earlier.
/boot/loader/entries/arch.conf
#When using the latest Linux kernel
title Arch Linux
linux /vmlinuz-linux
initrd /amd-ucode.img
initrd /initramfs-linux.img
options root=UUID=5a534876-bb2f-4fd3-880e-9244235d42c3 rw
/boot/loader/entries/arch.conf
#Stable version(Longterm Support)When using the Linux kernel
title Arch Linux
linux /vmlinuz-linux-lts
initrd /amd-ucode.img
initrd /initramfs-linux-lts.img
options root=UUID=5a534876-bb2f-4fd3-880e-9244235d42c3 rw
Edit the boot loader configuration file /boot/loader/loader.conf
.
/boot/loader/loader.conf
default arch
timeout 5
editor no
Exit the chroot environment and restart your computer. You should be able to boot your system from your bootloader even if you remove the USB device.
# exit
# umount -R /mnt
# reboot
Check the name of the network interface with the following command.
# /ls -l /sys/class/net
total 0
lrwxrwxrwx 1 root root 0 Feb 14 22:01 enp2s0 -> ../../devices/pci0000:00/0000:00:01.7/0000:02:00.0/net/enp2s0
lrwxrwxrwx 1 root root 0 Feb 14 22:01 lo -> ../../devices/virtual/net/lo
Network settings are managed using systemd-networkd. The following is the configuration file when using DHCP.
/etc/systemd/network/wired-dhcp.network
[Match]
Name=enp2s0
[Network]
DHCP=ipv4
If you use a static IP address:
/etc/systemd/network/wired-static.network
[Match]
Name=enp2s0
[Network]
Address=192.168.0.16/24
Gateway=192.168.0.1
DNS=8.8.8.8
Make sure systemd-networkd runs automatically when the system boots. Also, restart the service once for the settings to take effect.
# systemctl enable systemd-networkd
# systemctl restart systemd-networkd
DNS
Create the following symbolic link for all name resolution via systemd.
# ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
Enable the systemd-resolved service, which provides name resolution capabilities.
# systemctl enable systemd-resolved
# systemctl restart systemd-resolved
SSH
Let's enable SSH login. The config file exists in / etc / ssh / sshd_config
, but you can postpone changing the config because non-root users can log in without changing the config.
# systemctl enable sshd
# systemctl restart sshd
It is very dangerous to perform all operations with root privileges. We recommend that you create an administrative user and run sudo
only when you need root privileges.
Use the ʻuseradd` command to add a user. Traditionally, the name of the user group that can get root privileges is wheel.
# useradd -m -G wheel -s /bin/zsh pttkny
Uncommenting the following line in / etc / sudoers
will allow users in the wheel group to use sudo
.
/etc/sudoers
%wheel ALL=(ALL) ALL
Recommended Posts