Difference between revisions of "User:A2WXH3i"

From ArchWiki
Jump to navigation Jump to search
(User privileges)
(User privileges)
Line 355: Line 355:
 
This step will show you how to add your newly created user to the {{ic|/etc/sudoers}} file.
 
This step will show you how to add your newly created user to the {{ic|/etc/sudoers}} file.
  
{{ic|warning:}}
+
{{warning| a}}
  
 
== Enabling multilib repositories ==
 
== Enabling multilib repositories ==

Revision as of 13:03, 19 June 2019

Warning: This is a collection of unofficial Arch Linux installation guides written by myself.

This guide assumes basic knowledge of how to use GNU/Linux, the folder structure of a GNU/Linux system and how to use VIM or nano to edit text files.

Text in italics means you should replace the text with something appropriate to your install.

Unofficial Arch Linux Installation Guide

Prerequisites (Pre-boot)

Note: Regardless of the installation you will be attempting these steps need to be followed.

Download Arch Linux.

Verify ISO

Note: These next steps require either a system with GnuPG installed or an Arch Linux derivative e.g. Manjaro Linux.

Download the PGP signature and verify the ISO.

$ gpg --keyserver pgp.mit.edu --keyserver-options auto-key-retrieve --verify archlinux-version-x86_64.iso.sig

The following command can be used if using an Arch Linux derivative:

$ pacman-key -v archlinux-version-x86_64.iso.sig

Copy media to a USB

You can use the tool dd to copy the ISO to the USB via the command line, alternatively you could use Etcher if you like a GUI.

Below is an example of how you can use dd to copy the ISO to a USB.

# sudo dd if=archlinux-version-x86_64.iso of=/dev/sdX status=progress

Once the ISO is copied to the USB boot to it.

Prerequisites (Live USB)

Note: Use Shift+PageUp and Shift+PageDown to scroll in the TTY.

Keyboard Layout

If you need a keyboard layout that isn't US English use the command below to list possible keymaps.

# ls /usr/share/kbd/keymaps/**/*.map.gz

Set the keymap.

# loadkeys uk

Verifying boot mode

# ls /sys/firmware/efi/efivars
Warning: If nothing is listed here, you are NOT in EFI mode.

Connecting to the internet

If using Wi-Fi use the command below.

# wifi-menu

If you are on a wired connection you should connect to the network automatically, if you don't use the command below.

# dhcpcd

Verifying internet connection.

# ping archlinux.org

Changing Mirrors

On another device visit the link below and generate mirror links for your country.

https://www.archlinux.org/mirrorlist/

Once you have generated mirrors edit the file shown below.

/etc/pacman.d/mirrorlist

Sync the newly added mirrors.

# pacman -Syyy

Syncing the clock

Use the command below which will use systemd's Network Time Protocol service to sync the clock with a server.

# timedatectl set-ntp true

Verify the clock synced.

# timedatectl status

Standard UEFI Install

Partition the disk

Warning: The first thing to do is to list the disks in your system, you could have an NVME drive in your PC which could effect this guide. This guide will be using /dev/sdX. If you are using NVME it should be /dev/nvme0n1. Please make sure you are targeting the correct drive as loss of data will occur.

Use the command below to list the disks in your system.

# fdisk -l

Target the disk you will be using for installation.

# fdisk /dev/sdX

EFI Partition

Use g to create a GUID partition table as opposed to a Master boot record.

g

Use n to create a new partition.

n

Skip the partition number.

ENTER

Skip the first sector resizing.

ENTER

Next make the size of the partition 512MB big, this will be used for UEFI.

+512M

Use t to change the type of the partition.

t

This will select the partition number, you could just press enter.

1

This will set the partition to EFI.

1

Root Partition

Now create the root partition where Arch Linux will be installed.

n

Keep this partition as number 2.

ENTER

Skip the first sector resizing.

ENTER

Skip second sector resizing so the rest of the disk is used.

ENTER

Finally write all these changes to the disk.

w
Note: You should check the partition layout with p before writing the changes.

Example Layout

Your drive should look like something below.

Mount point Partition Type Size
/mnt/boot /dev/sdX1 EFI (FAT32) 512M
/mnt /dev/sdX2 Linux FS (ext4) 120G

Format partitions

Format the EFI partition.

# mkfs.fat -F32 /dev/sdX1

Format root partition.

# mkfs.ext4 /dev/sdX2

Mount partitions

Next mount the partitions so you can install Arch Linux.

# mount /dev/sdX2 /mnt

Make a directory before mounting the boot partition otherwise it will fail.

# mkdir /mtn/boot

Now mount the boot partition.

# mount /dev/sdX1 /mnt/boot

Install the base system

Next install the base system along with base-devel and the linux-headers package.

Note: You can add more packages here if you would like.
# pacstrap -i /mnt base base-devel linux-headers

Generate fstab file

Generate a fstab file so Arch Linux knows how to boot properly.

# genfstab -U -p /mnt >> /mnt/etc/fstab

Chroot into the system

This will transfer you from the live USB to your new Arch Linux install.

# arch-chroot /mnt

Install packages

Note: Microcode packages should be installed for your CPU.

The Intel package is intel-ucode

The AMD package is amd-ucode
# pacman -S grub efibootmgr dosfstools os-prober mtools vim bash-completion

Configuring GRUB

Mount EFI partition

Create the folder below as the partition won't mount.

# mkdir /boot/EFI

Now mount the partition.

# mount /dev/sdX1 /boot/EFI

Install GRUB

Warning: The --efi-directory flag is crucial as GRUB will fail to install.
Note: The --bootloader-id flag can also be changed to your liking.
# grub-install --target=x86_64-efi --efi-directory=/boot/EFI --bootloader-id=Arch_Linux --recheck

English locale file

Copy english locale file for grub.

# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

Generating GRUB config file

You need to generate a config file for GRUB so the system boots.

Note: The microcode packages installed earlier will be included in this config.
# grub-mkconfig -o /boot/grub/grub.cfg

Standard UEFI Finished

Tip: It is recommend you follow the post-installation guide for a more complete system.

Post-Installation

Creating a swap file

Tip: It is better to create a swap file rather than a swap partition because they are easier to manage.

This will create a file which is 4GB in size that is located in the root of your install:

# fallocate -l 4G /swapfile

Next set it so only root can manipulate the file:

# chmod 600 /swapfile

This makes the file a swap file:

# mkswap /swapfile

Finally configure fstab so the swap file is loaded on system boot:

/etc/fstab
/swapfile none swap defaults 0 0

Set the locale

Edit /etc/locale.gen and uncomment en_US.UTF-8 UTF-8 and any other needed locales e.g. en_GB.UTF-8 UTF-8

Generate the locales with:

# locale-gen

Next edit /etc/locale.conf with the locale you will use on your system:

/etc/locale.conf
LANG=en_GB.UTF-8

Next do the same for /etc/vconsole.conf so you get the preferred keyboard layout in the TTY.

/etc/vconsole.conf
KEYMAP=uk

Set the time zone

Use the command below which will use systemd's Network Time Protocol service to sync the clock with a server:

# timedatectl set-ntp true

Verify the clock synced.

# timedatectl status

Make a link with your timezone so the clock can adjust accordingly.

# ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime

Lastly set the hardware clock from the system clock.

# hwclock --systohc

Set the hostname

Create /etc/hostname and add a desired hostname:

/etc/hostname
hostname

User management

Set the root password:

# passwd root

This will create a user and it will also create a directory for them in /home:

# useradd -m user

Set the password for the new user:

# passwd user

User privileges

This step will show you how to add your newly created user to the /etc/sudoers file.

Warning: a

Enabling multilib repositories

You will need to edit /etc/pacman.conf and uncomment the multilib section.

/etc/pacman.conf
[multilib]
Include = /etc/pacman.d/mirrorlist