Now Playing
AVForums Super Veteran
I've had to do this a few times on different machines and on each occasion I've had to rely on my google skills to identify and refer to a number of resources that helped me on the way. This is written to help myself and others get it right first time and save what could otherwise be hours of frustration. This guide assumes a basic level of Linux know-how and covers installing Arch Linux onto a target USB flash drive (/dev/sdX) using a source USB flash drive (/dev/sdY). Furthermore, it details how to go about installing Arch on a EUFI machine without having to install a bootloader.
Firstly, download the Arch Linux ISO file and write it to a flash drive as follows (where sdY represents the flash drive):
Turn off compatibility mode and secure boot in the UEFI BIOS, connect network cable, and reboot target machine from flash drive. After the boot sequence is completed insert the target flash drive on which you wish to install Arch Linux and determine its device name:
Partition the target flash drive with 512MB partition of type ef00 and the remainder as a regular Linux partition using gdisk:
If you need to wipe out existing partitions etc. on the target flash drive use expert mode (press x) and zap the gpt tables, mbr etc. (press z). Then relaunch gdisk as above
Once in gdisk press n and follow the prompts to size the partition table and set its type +512MB ef00
When done with the first partition press n again and create a second (Linux) partition utilising the remaining space on the flash drive.
When done press w and confirm writing of the partition tables.
Format the partitions FAT32 and EXT4 respectively:
Now mount the Linux partition to /mnt and EFI System Partition to /mnt/boot
Install the base system, generate an fstab (note the use of -U to utilise UUIDs for device identification) and load temp files to ram:
Add the following to fstab:
chroot into and configure the base system
Add the same hostname to /etc/hosts and edit the file to place it in the correct location
127.0.0.1 localhost.localdomain localhost myhostname:
Set locale by uncommenting the locale you wish to use. Typically either US or ZA
Create a symbolic link /etc/localtime to your subzone file /usr/share/zoneinfo/Zone/SubZone using this command:
Setup Dynamic IP, firstly by ascertaining ethernet device name, then by copying a sample profile from /etc/netctl/examples to /etc/netctl and modifying it:
Set the root password:
Install some essentials (only install intel-ucode if you're running Intel hardware):
Enable root login (thanks scrarfussi):
Find the following line
#PermitRootLogin prohibit-password
Remove the # and change prohibit-password to yes
Now you have a decision to make...use a bootloader or bypass it. Bypassing makes for a faster boot and is great if your EUFI BIOS can boot an OS directly.
If you want to use a bootloader:
Install the UEFI bootloader.
Determine device UUIDs and create a configuration file to add an entry for Arch Linux to the gummiboot manager:
Remove UUID entries other than that pertaining to the flash drive and add the following (using your device UUID):
If you don't want to use a bootloader:
exit chroot
List EFI boot entries in BIOS and flush cache
Use efibootmgr to delete all firmware boot entries
where # is the entry number you want to delete
Now what is needed is the ability to have the EFISTUB point to the UUID of the Linux partition on the flash drive you've just installed to in order to ensure that the correct device is referenced for booting regardless of what other drives are present on the machine. In my case it was /dev/sdb2. Typing in a UUID from a terminal window seems like a stupid idea unless you're really accurate with your typing.
I got around that by capturing the UUIDs in a file, editing it to remove the crud, adding the efibootmgr line I needed and then running the resulting script.
Once the file was loaded in nano I added the efibootmgr line referencing the partition UUID for /dev/sdb2 (i.e. the root partition of my Arch install). It reads as follows:
Capture UUIDs in a file for editing and execution
This what was added to the file:
Exit the target system, flush cache and reboot from the target flash drive (remember to remove the source USB flash drive during reboot sequence):
To come
- add NFS server
- add SAMBA server
- add LMS
Firstly, download the Arch Linux ISO file and write it to a flash drive as follows (where sdY represents the flash drive):
Code:
dd bs=4M if=/path/to/archlinux.iso of=/dev/sdY && sync
Turn off compatibility mode and secure boot in the UEFI BIOS, connect network cable, and reboot target machine from flash drive. After the boot sequence is completed insert the target flash drive on which you wish to install Arch Linux and determine its device name:
Code:
lsblk
Partition the target flash drive with 512MB partition of type ef00 and the remainder as a regular Linux partition using gdisk:
Code:
gdisk /dev/sdX
If you need to wipe out existing partitions etc. on the target flash drive use expert mode (press x) and zap the gpt tables, mbr etc. (press z). Then relaunch gdisk as above
Once in gdisk press n and follow the prompts to size the partition table and set its type +512MB ef00
When done with the first partition press n again and create a second (Linux) partition utilising the remaining space on the flash drive.
When done press w and confirm writing of the partition tables.
Format the partitions FAT32 and EXT4 respectively:
Code:
mkfs.fat -F32 /dev/sdX1
mkfs.ext4 /dev/sdX2
Now mount the Linux partition to /mnt and EFI System Partition to /mnt/boot
Code:
mount /dev/sdX2 /mnt
mkdir /mnt/boot
mount /dev/sdX1 /mnt/boot
Install the base system, generate an fstab (note the use of -U to utilise UUIDs for device identification) and load temp files to ram:
Code:
pacstrap /mnt base
genfstab -U -p /mnt >> /mnt/etc/fstab
nano /mnt/etc/fstab
Add the following to fstab:
Code:
tmpfs /var/log tmpfs defaults 0 0
tmpfs /var/tmp tmpfs defaults 0 0
tmpfs /tmp tmpfs defaults 0 0
chroot into and configure the base system
Code:
arch-chroot /mnt /bin/bash
hwclock --systohc --utc
echo myhostname > /etc/hostname
Add the same hostname to /etc/hosts and edit the file to place it in the correct location
127.0.0.1 localhost.localdomain localhost myhostname:
Code:
echo myhostname >> /etc/hosts
nano /etc/hosts
Set locale by uncommenting the locale you wish to use. Typically either US or ZA
Code:
nano /etc/locale.gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
locale-gen
Create a symbolic link /etc/localtime to your subzone file /usr/share/zoneinfo/Zone/SubZone using this command:
Code:
ln -s /usr/share/zoneinfo/Africa/Johannesburg /etc/localtime
Setup Dynamic IP, firstly by ascertaining ethernet device name, then by copying a sample profile from /etc/netctl/examples to /etc/netctl and modifying it:
Code:
ip l
cd /etc/netctl
cp examples/ethernet-dhcp my_network
nano /etc/netctl/my_network
netctl enable my_network
Set the root password:
Code:
passwd
Install some essentials (only install intel-ucode if you're running Intel hardware):
Code:
pacman -S intel-ucode openssh mc
Enable root login (thanks scrarfussi):
Find the following line
#PermitRootLogin prohibit-password
Remove the # and change prohibit-password to yes
Code:
cd /etc/ssh/
cp sshd_config sshd_config.org
nano sshd_config
Now you have a decision to make...use a bootloader or bypass it. Bypassing makes for a faster boot and is great if your EUFI BIOS can boot an OS directly.
If you want to use a bootloader:
Install the UEFI bootloader.
Code:
pacman -S dosfstools
pacman -S gummiboot
gummiboot install
Determine device UUIDs and create a configuration file to add an entry for Arch Linux to the gummiboot manager:
Code:
blkid >> /boot/loader/entries/arch.conf
nano /boot/loader/entries/arch.conf
Remove UUID entries other than that pertaining to the flash drive and add the following (using your device UUID):
Code:
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=UUID=b73ea863-5d7f-4d4d-b12e-51fef92cdb2f rw
If you don't want to use a bootloader:
exit chroot
Code:
exit
Code:
efibootmgr -v
sync
Code:
efibootmgr -b # -B
Now what is needed is the ability to have the EFISTUB point to the UUID of the Linux partition on the flash drive you've just installed to in order to ensure that the correct device is referenced for booting regardless of what other drives are present on the machine. In my case it was /dev/sdb2. Typing in a UUID from a terminal window seems like a stupid idea unless you're really accurate with your typing.
I got around that by capturing the UUIDs in a file, editing it to remove the crud, adding the efibootmgr line I needed and then running the resulting script.
Once the file was loaded in nano I added the efibootmgr line referencing the partition UUID for /dev/sdb2 (i.e. the root partition of my Arch install). It reads as follows:
Capture UUIDs in a file for editing and execution
Code:
blkid > blkids.sh
nano blkids.sh
chmod +x blkids.sh
./blkids.sh
This what was added to the file:
Code:
efibootmgr -d /dev/sdb -p 1 -c -L "Arch" -l /vmlinuz-linux -u "root=UUID=addyouruuidhere rw initrd=/intel-ucode.img initrd=/initramfs-linux.img"
Exit the target system, flush cache and reboot from the target flash drive (remember to remove the source USB flash drive during reboot sequence):
Code:
sync
exit
umount /mnt/boot
umount /mnt
sync
reboot
To come
- add NFS server
- add SAMBA server
- add LMS