Skip to content

Instantly share code, notes, and snippets.

@thelbouffi
Last active June 22, 2019 21:53
Show Gist options
  • Select an option

  • Save thelbouffi/50cd0cd05ce065650e0a094291c7395f to your computer and use it in GitHub Desktop.

Select an option

Save thelbouffi/50cd0cd05ce065650e0a094291c7395f to your computer and use it in GitHub Desktop.
install arch linux
=======================================================
I- Partitionate the disk
fdisk -l
fdisk /dev/sda
* boot partition
n -> p -> enter -> enter (defines first sector for boot partition by default 2048) -> 1002048 sectors (defines last sector for boot partition)
a (toogle boot) -> t (type) -> ef (EFI)
* disk parttion
n -> p -> enter -> enter (fst sector) -> enter (last sector)
* to see parttion table
p
* to write save & quit
w
fdisk -l
======================================================
II- Format
mkfs.vfat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
======================================================
III- Mount partitions to system
ls -l /mnt==> we should fint nothing
mount /dev/sda2 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
df -h ==> should print that /dev/sda1 & /dev/sda2 are mounted
The reason why we mount in this way (one partion at /mnt and the second partition as folder in that parttion /mnt/boot)
is to allow pacstrap to write into a single folder wich in facts write in two partitions and that makes it easy to install
So pacstrap will put the base system onto the mount point wich write it into both partitions some inside /mnt/boot and some into /mnt
=======================================================
IV- Install the base packages
pacstrap is a binary of arch (/usr/bin/pacstarp) it writes the base system to a mount point
pacstrap /mnt base => live installation will start
=======================================================
V- Generate the fsatb file
genstab -U /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab => to chack its content
what this file does is once our system boots it will use this file to know:
which partions to mount, where to mount them, the options to mount them with and then the order of mounting
In our case it will be two entries:
* the root system /dev/sda2 mounetd on / its type is ext4 read/write
* the boot partition mounetd at /boot type vfat
blkid ==> this command also give us idea about the system mounted partition
========================================================
VI- chroot the system
arch-chroot /mnt => arch linux iso root will change to our installed / (but we are still on the iso)
=========================================================
VII- set time zone
now we are on our system any thing we will it will remain on our system, so we can set time
ln -sf /usr/share/zoneinfo/africa/casablanca /etc/localtime
date => to check out the time
==========================================================
VIII- set localization
we will generate the local files
nano /etc/locale.gen => uncomment locale you want and save
locale-gen => will generate locale uncommented
now we should create the locale.conf
nano /etc/locale.conf => and then add the LANG and KEYMAP for example
LANG=en_US.UTF-8
KEYMAP=de-latin1
and finally ctrl+X to save
==========================================================
IX- set hostname
hostname => to see the actual hostname it will be archiso
nano /etc/hostname => insert wanted hostname myHostname then ctrl+X
hostname => to see the new hostname
==========================================================
IX- set hosts file
it contains different host names to ip adresses
nano /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname
then save
==========================================================
IX- set passwd
insert the new password
===========================================================
X- Exit
now we can exit from chroot envirement
exit
unmount /mnt/boot
unmount /mnt
reboot
now we can access arch from Boot existing os
pacman -S grub
grub install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
reboot
df -h => to see our disk how it looks like
networking is not enabled (so ifconfig ping wont work) => we need to enable DHCP (Dynamic Host Configuration Protocol) precisely DHCP clinet which is for Arch it's dhcpcd.
note that Arch comes with systemd wich means we have systemctl command
ip addr => to see if we have a network interface
systemctl enable dhcpcd
systemctl start dhcpcd
this will enable our network interface and we ill have an IP to work with
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment