Skip to content

Instantly share code, notes, and snippets.

@iani
Created July 6, 2021 07:33
Show Gist options
  • Save iani/320613cfdc5ea7caf351202c01470b80 to your computer and use it in GitHub Desktop.
Save iani/320613cfdc5ea7caf351202c01470b80 to your computer and use it in GitHub Desktop.

Link for downloading image

http://mirrors.evowise.com/archlinux/iso/2021.07.01/

Select archlinux-2021.07.01-x86_64.iso This image is 778 M

Installing arch linux on macmini - 1 Jun 2021 03:29 github instructions

Partitioning hd for linux (useful?????)

https://www.youtube.com/watch?v=jYbGyHvx7EQ

Install Arch Linux with UEFI (Mac) SUCCESSFUL 2 Jun 2021 16:13 !!!

https://www.itzgeek.com/how-tos/linux/arch-linux/install-arch-linux-2021.html#UEFI

Install Arch Linux on Mac mini - only works for creating USB live and booting

https://gist.github.com/andrsd/cbc85a27f33c77951dff39b2748f23c4

We will be creating dual boot for OS X and Linux with no special boot loader. For other setup, refer to [1]. We will keep all data on an external hard drive, so we do not need huge amount of space for the linux system. We will install from an USB thumb drive (will need at least 1GB in size), newer Minis do not have CD roms.

Prepare the disk in Mac OS X (El Capitan)

  • Open Disk Utility and select the disk (not partition), click Partition (top tool bar)
  • There are at least 3 partitions: EFI, OS X, Recovery. Only OS X will be shown.
  • Repartition your disk as follows:
    1. OS X (size: ~ tens of GB, type HFS+, for OS X)
    2. Arch tmp (size: ~ 10 GB, FAT, will be removed later)

Create LiveUSB that we will boot from

  • Download the .iso from download page
  • Open Terminal
  • $ diskutil list and find out its name (let’s say it is /dev/disk2)
  • $ diskutil unmountDisk /dev/disk2 to unmount the drive
  • # dd if=/path/to/arch-linux-image.iso of=/dev/rdisk2 bs=1m (we replaced disk with rdisk which is the “raw” disk in OS X and a lot faster, it is not a typo)
  • $ diskutil eject /dev/disk2

Boot from LiveUSB

  • Hold Alt while booting
  • Select the USB disk
  • Welcome to Arch Linux installer ;-)

Installation

  • Connect to network
    • $ wifi-menu to setup wireless networking (assuming DHCP is available)
  • Setup time
    • $ timedatectl set-ntp true
    • Check its status $ timedatectl status
  • Partition the drive again ;-)
    • # cgdisk
    • Remove the Arch tmp partition we created earlier.
    • Remember to create 128 MB gap after OS X partitions, by typing +128M for the start of the partition.
    • Add new Arch boot partition (~ 100 MB)
    • Add new Arch root partition (fill the space)
    • Swap file can be created later if needed
  • Create file systems
    • # mkfs.ext2 /dev/<arch boot>
    • # mkfs.ext4 /dev/<arch root>
  • Mount the partitions
    • # mount /dev/<arch root> /mnt
    • # mkdir /mnt/boot
    • # mount /dev/<arch boot> /mnt/boot
  • Edit mirror list
    • # vim /etc/pacman.d/mirrorlist it will be used pac the next step, so take good care of it here
  • Install the base packages
    • # pacstrap /mnt base
  • Configure the system
    • # genfstab -U -p /mnt >> /mnt/etc/fstab
    • # arch-chroot /mnt /bin/bash
    • # echo <computer name> > /etc/hostname
    • # ln -s /usr/share/zoneinfo/<zone>/<subzone> /etc/localtime
    • # nano /etc/locale.gen uncomment locales you want
    • # locale-gen
    • # echo LANG=<your_locale> > /etc/locale.conf
    • TODO: setup wireless networking
    • # mkinitcpio -p linux
    • # passwd
    • # pacman -S gptfdisk

Boot loader

  • # mkdir /boot/efi
  • # mount /dev/<EFI partition>
  • # pacman -S grub efibootmgr
  • # grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch
  • # grub-mkconfig -o /boot/grub/grub.cfg

Reboot

  • # exit or Ctrl + D
  • # umount -R /mnt
  • # reboot

Bluetooth

  • Install bluez bluez-libs bluez-utils
  • udev rule in /etc/udev/rules.d/10-local.rules:
    # Set bluetooth power up
    ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig hci0 up"
        

WiFi

Let’s assume wlan is out interface for this setup.
  • Install b43-firmware from AUR
  • pacman -S wpa_supplicant
  • # vim /etc/wpa_supplicant/wpa_supplicant-wlan.conf
    ctrl_interface=/run/wpa_supplicant
    update_config=1
        
  • # wpa_supplicant -B -i wlan -c /etc/wpa_supplicant/wpa_supplicant-wlan.conf
  • # wpa_cli
    > scan
    > scan_results
    > add_network
    > set_network 0 ssid "MYSSID"
    > set_network 0 psk "passphrase"
    > enable_network 0
    > save_config
        
  • Or instead of wpa_cli, do wpa_passphrase MYSSID passphrase > /etc/wpa_supplicant/wpa_supplicant-wlan.conf
  • # dhcpcd wlan

Use systemd to start the service:

  • # ln -s /usr/share/dhcpcd/hooks/10-wpa_supplicant /usr/lib/dhcpcd/dhcpcd-hooks/
  • # systemctl enable dhcpcd@wlan

References

Network access

enable internet access via ethernet on freshly installed arch

Find your ethernet network interface

List network interfaces with their status: ip link

Don’t know exactly what this does: networkctl list

install and enable networkd and resolved

To connect to the internet you need to start 2 systemctl services. These are: networkd and resolved.

networkd is a service that connects the network hardware devices on your computer (wifi, ethernet) to the internet. resolved is a service that resolves names to find their ip addresses. Example: When you type ping google.com it resolves the name google.com to the address 8.8.8.8 or the latest address corresponding to google.com.

For each of these services, you also need to create a configuration file which the service uses to configure how it runs.

Next we show in detail how to create the 2 files and start the 2 services.

Enabling networkd
Create config file in: /etc/systemd/network/20-wired.network

Create a file at exactly this path:

/etc/systemd/network/20-wired.network

Fill it with exactly these contents

[Match]
Name=enp4s0f0

[Network]
DHCP=ipv4
DNS=195.130.124.68
DNS=195.130.124.78
DNS=8.8.8.8

This gives the DNS servers used to resolve names.

Enable netrworkd
systemctl enable systemd-networkd
enabling resolved
make /etc/resolv.conf available

resolved uses /etc/resolv.conf to configure the servers which it will use to resolve addresses from names.

On a freshly installed arch linux, you must first link the stub file created by the install to the location where resolvd expects to use it:

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

You may check that the link worked:

ls -l /etc7resolv.con
Note: Manjaro vs arch versions of resolv.conf

Manjaro arch linux creates the resolv.conf file using NetworkManager. So you will find it directly in its desired location, with contents like this:

# Generated by NetworkManager
search forthnet.lan
nameserver 192.168.1.1
nameserver 2a02:858::8888
nameserver 2a02:858::8844
  

Fresh install of plain arch linux creates a stub-resolv.conf in /run/systemd/resolve/stub-resolv.conf and writes in the comments

The contents are:

There is more info about resolv.conf in Wikipedia: https://en.wikipedia.org/wiki/Resolv.conf

Excerpt:

resolv.conf is the name of a computer file used in various operating systems to configure the system’s Domain Name System (DNS) resolver. The file is a plain-text file usually created by the network administrator or by applications that manage the configuration tasks of the system. The resolvconf program is one such program on FreeBSD or other Unix machines which manages the resolv.conf file.

Enable resolved

After the file has been created, you may enable the resolved sevice like this:

systemctl enable systemd-resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment