lunes, 24 de diciembre de 2012

Installing ARCH GNU/Linux - Part 1/2


Hi to everyone, in this first part I will explain how to install ARCH GNU/Linux for 64 bits from the install CD provided by the ARCH site.

ARCH GNU/Linux is not "for newbies" distribution, like Ubuntu or Mint. This distribution has the DIY (Do It Yourself) way https://wiki.archlinux.org/index.php/The_Arch_Way and everything we can do, we need to make it by hand. Follow this guidelines, there is no automatic installer. The installation is made from scratch, by hand. So, in this post I will expose how I made the install in order to help others to get in the ARCH experience.

Why ARCH? Well, after trying a lot of GNU/Linux distributions (Ubuntu, Fedora, CentOS, Slackware, OpenSUSE, Chakra) https://wiki.archlinux.org/index.php/Arch_Compared_to_Other_Distributions I think that ARCH has the better cost/benefit balance. One of the key things for me is the speed. If the distribution is not fast, I will never like it. Another thing that let me choose ARCH, is KDE, my desktop manager by excellence. With Ubuntu KDE works bad or very slow, so I have tried also Chakra, but this can't fill my extreme expectations. So, I have tried with ARCH with KDE and I'm very happy right now.
More info: https://wiki.archlinux.org/index.php/Arch_Linux



Note for medium/advanced users: All the things in this post are summarized from the ARCH Wiki. There is no things in this posts that you can't find in the official ARCH WIki. This is not intended in any case to replace the wiki page, it's just a help guide for a new user.
This document is entirely based on:
https://wiki.archlinux.org/index.php/Beginners'_Guide
https://wiki.archlinux.org/index.php/Installation_Guide
https://wiki.archlinux.org/index.php/General_Recommendations


BEFORE START: ARCH has fdisk as a disk partitioner. If you don't know how to use thuis program and you are not familiarized, before starting this guide you must need to redistribute the partitions on your disks using your favorite program in order to avoid any kind of information loss. If you already has a GNU/Linux system follow the next steps. If you not, the advice is, one partition for /, one for /home and another one for swap.

1) Start: Download the ARCH ISO from http://www.archlinux.org/download/ and burn it in a CD. You can also make a booteable pendrive. Start the computer from the CD and we have a terminal as root.

2) Write the command
loadkeys es
to load the spanish keyboard. In my case is "es", to display all the most common keyboard distributions do
ls /usr/share/kbd/keymaps/i386/qwerty
3) We need to create the partitions with fdisk. first execute
fdisk -l
in order to see how many disks we have. in my case is /dev/sda so the command will be
fdisk /dev/sda
IF THE DISK IS EMPTY AND WE DO NOT WANT OTHER PARTITIONS: create a new partition table with the command "o".
IF WE WANT TO MAINTAIN EXISTENT PARTITIONS: Press "p" to list the partitions and select what we want to delete. Then fdisk will ask for the number of that partition. We need to enter 2 for sda2, 3 for sda3, etc.
To create a new partition (I have an empty disk): Press "n", then "p", then 1 (default), then 2048 (default), then "+20G", here we did the "/" partition. Start again with the next partition: Press "n", then "p", then "2", then enter (leave the default unchanged), and then "+444G" (my disk has 500G) and with this did the "/home" partition. The last one, press "n", then "p", then "3", then enter (leave the default unchanged) and then enter (leave the default unchanged) in order to fill the entire disk. This will be the swap partition (n my case has 2G).
Then press "t", then "3", then "82" (this is for mark as swap the swap partition).
Then press "w" to save changes.

4) Format the partitions
mkfs -t ext4 /dev/sda1
mkfs -t ext4 /dev/sda2
mkswap /dev/sda3
5) Activate the swap partition
swapon /dev/sda3
6) Mount the future / under /mnt
mount /dev/sda1 /mnt
7) Mount /home
mkdir -p /mnt/boot
(I create the folder /boot by the way but I don't use it in a different partition)
mkdir -p /mnt/home
mount /dev/sda2 /mnt/home
8) Internet setup: In my case I got connection trough a wire, but using the "wifi-menu" application it will very easy to connect to our wi-fi router. We need to do
wifi-menu wlan0
and then we need to try the connection with
ping -c 4 www.google.com
With this steps, we should be able to ping google succesfully.

9) Install all the necessary packages to start ARCH
pacstrap /mnt base base-devel dialog wpa_supplicant wireless_tools wpa_actiond 
Dialog; wpa_supplicant and wpa_actiond are used to connect to our wifi router using the wifi-menu tools once we restart for first time the system.

10) Install the bootloader (GRUB)
pacstrap /mnt grub2-bios os-prober
Note: If your motherboard uses EFI/UEFI/GPT, you need to follow other procedures.

11) Generate the fstab file
genfstab -p /mnt >> /mnt/etc/fstab
12) Do chroot to my future /
arch-chroot /mnt
13) Make the boot image
mkinitcpio -p linux
14) Configure and setup Grub
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
15) Setup the root password
passwd
16) Quit from chroot
exit
17 ) Umount our future / and /home
umount /mnt/home
umount /mnt
18) reboot!
reboot
19) Once we restart, login with root as user and the password entered in the point 15. Once inside, setup the computer name:
hostnamectl set-hostname computer_name
where "computer_name" is the machine name. Select one that you like.

20) Set the keyboard layout and font for the default terminal
nano /etc/vconsole.conf
and add (the file will be empty)
KEYMAP=la-latin1
FONT=lat9v-16
FONT_MAP=8859-1_to_uni
and then
chmod 644  /etc/vconsole.conf
chown root:root  /etc/vconsole.conf
Set the defaults:
localectl set-keymap la-latin1
localectl set-x11-keymap la-latin1
Now we need to do
nano /etc/mkinitcpio.conf
and add "consolefont" and "keymap" under the "HOOKS" section of that file.
We setup the init image in order to get this configuration from the boot.
The HOOKS section will show like this:
HOOKS="base udev autodetect pata scsi sata filesystems consolefont keymap"
Make the boot image again:
mkinitcpio -p linux
21) Set up locale settings
nano /etc/locale.gen
Uncomment ES-AR (utf and iso8859-1) and then run
localectl set-locale LANG="es_AR.UTF-8"
This also has the advantage to setup the locale into X11.

22) Set up the regional settings
timedatectl set-timezone America/Argentina/Buenos_Aires
23) Setup the time using NTP (remember stay connected to internet first with wifi-menu wlan0)
pacman -Sy ntp libedit
nano /etc/ntp.conf
and insert the Argentina servers (in my case)
server 0.ar.pool.ntp.org iburst
server 3.south-america.pool.ntp.org iburst
server 2.south-america.pool.ntp.org iburst
Save and close. Then we enable the service to start automatically
systemctl enable ntpd
Now we need to check if it works.
systemctl start ntpd 
ntpq -np
We need to see one of that three servers with a asterisk. This means that the time is synchronized with the network time. If you use Windows on the same machine you need to do an additional setup. More info here https://wiki.archlinux.org/index.php/Time_(Español)

24) Adding repositories: I only want to add multilib, so
nano /etc/pacman.conf 
and then uncomment the line. Save and close and then we need to update the packages database:
pacman -Syu
25) Create a user, in my case, called "faktorqm"
adduser faktorqm
This commands will ask you some data, I leave them by default. Since the systemd implementation, the group list is not necessary anymore.

26) Install reflector. Reflector is a program to keep upgraded the servers lists. Reflector will upgrade the list with the servers that are has the best speed according to the ranking in the ARCH wiki page.
pacman -S reflector
and when we need to refresh the server list we need to do:
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
(this makes a backup of our existing file in case of problems)
reflector --sort rate -l 10 -f 5 --save /etc/pacman.d/mirrorlist
Many people will want to use it as an alias to make the life easier:
nano ~/.bashrc
and then we write something like this
alias update_repo_list="reflector --sort rate -l 10 -f 5 --save /etc/pacman.d/mirrorlist && pacman -Syu"
Note: You can use any name instead of "update_repo_list"

27) Install yaourt. The ARCH community maintains and keep updated a lot of packages that they are "not officially supported" but in the real life they works and works very good. This packages are in a place called AUR (Arch User Repository) and the yaourt program takes it, compile and install it. More info on https://aur.archlinux.org/

We need to add the server on the pacman repository configuration file:
nano /etc/pacman.conf
and then add this:
[archlinuxfr]  
Server = http://repo.archlinux.fr/x86_64
save and close and then
pacman -Sy yaourt
and that it's all. The yaourt sintax is equal or almost equal that the pacman sintax.

28) Install the X graphic server and the video card drivers. I have an intel card, so I will to install the intel drivers doing:
pacman -Sy xf86-video-intel intel-dri lib32-intel-dri
and then install the X server
pacman -Sy xorg-server xorg-xinit xorg-utils xorg-server-utils xorg-apps xorg-twm xorg-xclock xterm
I have a notebook, so I need to install the synaptics driver too.
pacman -Sy xf86-input-synaptics 
Note 0: For the users that has NVIDIA video cards, can find more information in https://wiki.archlinux.org/index.php/Nvidia Keep in mind that some motherboards with EFI (and I guess UEFI too) the drivers doesn't works.
Note 1: The ATI privative driver doesn't work if your ACPI is not properly configured.
Note 2: For users with the latest models of ATI cards please ignore this and install directly pacman -Sy catalyst-total
Note 3: The ATI privative driver generates a kernel message (you can see that with dmesg command) and disables the lock debugging. This is not too bad, but keep in mind!
Note 4: In the case of privative ATI driver installation, you will need to edit nano /boot/grub/menu.lst and add nomodeset to the kernel line, because when I didn't do this, the screen remains all black and there is no way to work without this change.
Note 5: In the case of privative ATI driver installation, it's not necessary to add nomodeset to the kernel line.
Note 6: The lib32-intel-dri library is for the 3D acceleration under 32 bits applications.

29) Installing the window manager. My preference: KDE.
pacman -Sy kdebase-workspace kdebase phonon-vlc dbus mesa-demos kdeplasma-applets-networkmanagement networkmanager kpartsplugin kdebase-kdialog kdegraphics-okular kdemultimedia-kmix
Instead of installing the base desktop, you want to install the full dekstop environment, just change kdebase by kde and this will install around 700Mb of programs, but you will get all the programs. The phonon-vlc package is the VLC program, in my opinion, the best player on earth. You can ignore if you like another one. The mesa-demos package is only for the glxinfo and glxgears utility. With this package, we will be able to check our 3D acceleration properly.
We need to setup the graphic environment as default
systemctl enable kdm 
30) We need to install some very useful packages:
pacman -Sy flashplugin jre7-openjdk gstreamer0.10-plugins pkgfile samba opera bash-completion sudo dosfstools ntfs-3g cups cups-pdf
The jre7 package is the Java runtime environment.
The gstreamer package is some audio and video codecs.
The samba package is for file sharing in a network with Windows clients.
If you install it, remember to add to the system boot:
systemctl enable smbd
The pkgfile package is a package that allow to you search what package contains an specific executable binary, this is very useful when we don't know how package is missing.
To update the database: pkgfile --update
To search something: pkgfile -s file_name.
The opera package is a explorer, like Mozilla firefox or google chrome. Install what you want.
The bash-completion package is for autocomplete bash commands by pressing the TAB key.
In order to use the sudo command I need to add my user to the wheel group
gpasswd -a faktorqm wheel
visudo
and uncomment the line with %wheel ALL=(ALL) ALL and save using ":wq" (sin comillas). We need to restart to get it working, but we can wait to the last step.
The dosfstools package is to format pendrives under FAT32 filesystem.
If you want to automount the partitions (if you don't do this only root can mount NTFS partitions)
mkdir -p /media/windows
nano /etc/fstab
and then we need to add this line to the fstab file:

/dev/sda1 /media/windows ntfs-3g gid=users,fmask=113,dmask=002 0 0

The gid=users,fmask=113,dmask=002 parameters are for the users that are added to the users groups, gain the write access in to the NTFS partition.
The cups package is for printing and the cups-pdf package is for a PDF printer.

31) Now I will setup the netowrk in order to setup it from KDE after restart:
systemctl disable netfcg
systemctl enable NetworkManager
32) Restart! using reboot and if everything goes fine, you will start again with your KDE desktop environment and with your created user!!. Bye bye!

No hay comentarios:

Publicar un comentario