Last active
June 22, 2019 21:53
-
-
Save thelbouffi/50cd0cd05ce065650e0a094291c7395f to your computer and use it in GitHub Desktop.
install arch linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
======================================================= | |
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 | |
NOTE: | |
- we can also partitionate using cfdisk | |
- normally we should create 3 partitions boot partition, swap partition and root partition | |
====================================================== | |
II- Format | |
mkfs.vfat -F32 /dev/sda1 | |
mkfs.ext4 /dev/sda2 | |
NOTE: | |
if we have 3 partitions sda1 sda2 and sda3, we can format them like that: | |
mkfs.ext2 /dev/sda1 => for the boot also we can format using ext4 | |
mkfs.ext4 /dev/sda3 => for the root partition | |
mkswap /dev/sda2 | |
swapon /dev/sda2 => for the swap partition | |
====================================================== | |
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 | |
NOTE: if we have a swap partition we dont need to mount it | |
======================================================= | |
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 | |
genfstab -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 ctrl+O and ctrl+X to 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 | |
and finally ctrl+O and 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 | |
on docs we have | |
nano /etc/hosts | |
127.0.0.1 localhost | |
::1 localhost | |
127.0.1.1 myhostname.localdomain myhostname | |
then save | |
for me I did: | |
127.0.0.1 localhost myHostname | |
========================================================== | |
IX- set password | |
passwd => insert the new password | |
========================================================== | |
X- install grub | |
grub is meant for allowing us access arch from Boot existing os | |
The GRUB (Grand Unified Bootloader) is the first program which starts when the program is switched on. The bootloader transfers the control to the operating system kernel. | |
pacman -S grub | |
grub-install /dev/sda | |
grub-mkconfig -o /boot/grub/grub.cfg | |
df -h => to see our disk how it looks like | |
=========================================================== | |
XI- Exit | |
now we can exit from chroot envirement | |
exit | |
umount /mnt/boot | |
umount /mnt | |
reboot | |
now we can access arch from Boot existing os | |
============================================================ | |
XII - Logging | |
we boot from Boot existing os | |
we insert for login : root | |
for password: the password that we created | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
back to Boot Arch Linux (x86_64) | |
mount /dev/sda2 /mnt | |
mount /dev/sda1 /mnt/boot | |
arch-chroot /mnt | |
make the fix you want | |
exit | |
umount /mnt/boot | |
umount /mnt | |
reboot | |
then Boot from existing os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 => to make this service start each time we reboot | |
systemctl start dhcpcd | |
this will enable our network interface and we ill have an IP to work with | |
to test if it works | |
ping google.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
to get somthing graphical on our machine we need: desktop or display managers "dms" & desktop environement "des" | |
globaly we need: | |
- X server | |
- GPU driver | |
- Window Manager (Gnome, KDE, i3wm) | |
- Apps (terminal urxvt for example) | |
for our example we will install: | |
- 1st we need xorg-server: X server | |
Xorg is the X Window server which allows users to have a graphical environment at their fingertips. X provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting with a mouse and keyboard. The X.Org Server implements the server side of the X Window System core protocol | |
- 2nd lxdm: display manager | |
LXDM is a lightweight display manager for the LXDE desktop environment. | |
- 3rd mate is one of many desktop env like gnome, kde, kde/plasma, lxde, Xfce, nome | |
- 4th mate-extra | |
pacman -S xorg-server lxdm mate mate-extra | |
useradd -m -d /home/taha taha => we need a user with pwd beacause on arch we are root | |
passwd taha | |
systemctl enable lxdm | |
systemctl start lxdm => launch the display manager | |
==================================================== | |
NOTE: to go back to arch terminal ctrl + F2 | |
==================================================== | |
to let a user do root things | |
ctrl+F2 | |
login | |
nano /etc/sudoers | |
taha ALL=(ALL) ALL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
another example of installing dektop env. | |
=================================== | |
part 1: create a user acount | |
useradd -m -g users -s /bin/bash taha => creates a user called taha -s to use bash as defalut shell -m create /home/taha -g to add taha to group of users | |
passwd taha | |
visudo => to add taha to sudoers, when visudo opened scroll to root ALL=(ALL) ALL and insert taha ALL=(ALL) ALL | |
===================================== | |
part 2: install prerequisites (display server, graphics driver, display manager) | |
* display server is the link between software and hardware, it allows the computer to display images taht we want by configuring the graphic card to dispaly them on the monitor => the most popular display server is xorg | |
*find the appropriate gpu driver and install it, xf86-video-vesa is a standard of all gpu cards | |
*display manager is the login page, for each desktop env ther is a recomanded display manager like below in the list: | |
KDE Plasma 5 - sddm | |
KDE4 - kdm* | |
GNOME - gdm | |
LXDE - lxdm | |
Universal Display manager - lgthdm, mdm-dispaly-manager, slim, xorg-xdm | |
pacman -S xorg-server xorg-xinit => the default package of xorg is xorg-server and the other are utilities that we may need later | |
pacman -S driver-of-my-gpu | |
pacman -S lxdm | |
====== | |
NOTE: | |
====== | |
To choose the right driver, first detect the graphics card. lspci can be used for this task: | |
lspci -v => all devices | |
or | |
root #lspci | grep -i VGA | |
This should show something like this: | |
root #lspci | grep -i VGA | |
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09) | |
the 3rd gen is an intel i915 | |
Generation Chipset OpenGL OpenGL-ES OpenCL VAAPI Vulkan VIDEO_CARDS | |
Gen 3 915G/GM, 945G/GM, G/Q33, Q35, Atom D4xx/D5xx/N4xx/N5xx 1.4 No No No No intel i915 | |
so we will install for intel the driver xf86-video-intel | |
Note that generally for: | |
AMD -> xf86-video-amdgpu | |
NVIDIA -> xf86-video-nouveau | |
INTEL -> xf86-video-intel | |
xf86-video-vesa is a standard driver | |
pacman -S xf86-video-intel | |
========================================= | |
part 3: install the desktop environement | |
we are going to instal the group that contains the packages that we need for tha desktop environment | |
KDE Plasma 5 -> plasma | |
Cinnamon -> cinnamon | |
GNOME -> gnome | |
LXDE -> lxde or lxde-gtk3* | |
MATE -> lxde or mate-gtk3* | |
Xfce -> xfce4 | |
pacman -S lxde | |
By default it only install the minimum of desktop env, and not many other apps that go with it, to do that we can install other packages that have a bundle of group of packages like | |
KDE Plasma 5 -> kade-applications | |
Cinnamon -> N/A (not applicable or available) | |
GNOME -> gnome-extra | |
LXDE -> (not applicable or available) | |
MATE -> mate-extra | |
Xfce -> xfce4-goodies | |
================================================= | |
part 4: launch the display manager while booting | |
systemctl enable lxdm | |
systemctl start lxdm | |
reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
when installing on virtualox we have to install Guest Additions, to be able to improve image resolution and better control of the mouse. : | |
- first way: from terminal | |
pacman -S virtualbox-guest-utils => for VirtualBox Guest utilities with X support, then choose for the default linux kernel choose virtualbox-guest-modules-arch and for non-default kernels choose virtualbox-guest-dkms | |
pacman -S virtualbox-guest-utils-nox => for VirtualBox Guest utilities without X support | |
systemctl enable vboxservice | |
reboot | |
- second way: | |
mount the VBoxGuestAdditions.iso on cdrom of virtualbox app | |
mount /dev/cdrom /mnt => this will mount the cdrom | |
cd /mnt | |
./VBoxLinuxAdditions.run | |
======== | |
NOTE: | |
======== | |
we may need to have as graphical card VBoxVGA to be able to have full screen | |
so go to the virtualbox app => arch vdi setting => display => choose as graphics controller VBoxVGA | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment