Finally switch back to Arch linux again after trying so many linux systems. The main reason is Arch linux is rolling release, I never need to reinstall the system again!
A brief note of all steps in installing the Arch linux system would be helpful for future use.
-
Make a bootable USB stick of the Arch linux (See here). Without doubt using
ddis the easiest method, however you should be very careful when using this command:dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx && syncmost of the time
/dev/sdxshould be/dev/sdb, the usb disk. -
Use
cfdiskcommand to partition the hard disk and flag the partition where the/bootto be installed asbootableand hitWrite. For my case I will install/,/bootand/hometo the same partition(sda4), so only one partition is needed. -
Create file sytems. Usually use ext4 format.
mkfs.ext4 /dev/sda4 -
mount /dev/sda4 /mnt. -
Connect to wifi. First use
ip linkcommand to find the code for the wireless network interface(start withw) and then usewifi-menucommand to connect to wifi.ip link1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp8s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 08:9e:01:1d:6e:9c brd ff:ff:ff:ff:ff:ff
3: wlp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
link/ether dc:85:de:88:24:09 brd ff:ff:ff:ff:ff:ffwifi-menu wlp7s0 -
Select nearest mirror (can ignore this step):
nano /etc/pacman.d/mirrorlist -
Install Arch system files
pacstrap /mnt base base-devel -
Run the following command
genfstab -U -p /mnt >> /mnt/etc/fstab -
Switch root from usb to hard disk. After running the command, the prompt changes to something like
sh-4.3#.arch-chroot /mnt -
Set hostname and add the same host name to
/etc/hosts, here using ‘dh’ as hostnameecho dh > /etc/hostname nano /etc/hosts#
127.0.0.1 localhost.localdomain localhost dh ::1 localhost.localdomain localhost dh -
Set timezone.
zoneandsubzoneare set according to your location(use tab to see all options).ln -sf /usr/share/zoneinfo/zone/subzone /etc/localtime -
Uncomment the needed locales in
/etc/locale.genand runlocale-gen. For exampleen_US.UTF-8. -
Set locale preference in
/etc/locale.conf.echo LANG=en_US.UTF-8 > /etc/locale.conf -
Install wifi driver, otherwise can’t connect to the internet after restarting! (Later on, after restarting use the same strategy in step 3 to connect to the internet. DO NOT REBOOT NOW if you want dual boot)
pacman -S iw wpa_supplicant dialog -
Dual boot setting (dual boot with Windows)
pacman -S grub grub-install /dev/sda pacman -S os-prober os-prober grub-mkconfig -o /boot/grub/grub.cfg exit umount /mnt -
REBOOT
After reboot, login as root:
-
Connect to wifi using the same method as introduced in step 4. The following command makes computer automatically connect to this wifi later(change
wlp7s0accordingly):wifi-menu wlp7s0 pacman -S wpa_actiond systemctl enable dhcpd@wlp7s0.service -
Add user to the
wheelgroup (only changeweichengaccordingly):useradd -m -G wheel -S /bin/bash weicheng passwd weichengand then uncomment the line
%wheel ALL=(ALL) ALLin the
/etc/sudoersfile so that the user can usesudocommand.
UI installation I (nouveau, kde, xintrc)
-
Graphics card installation. I used
nouveaugraphics driver,kdedesktop and no display manager (usexinitrcinstead) the first time I installed Archlinux:# Install graphics driver & dependency mesa-libgl pacman -S mesa-libgl xf86-video-nouveau pacman -S xorg-server pacman -S xorg-xinit xorg-twm xorg-xclock xterm -
KDE installation.
pacman -S kde # Language support for Chinese pacman -S kde-l10n-zh_cnI used
xinitrcmethod to start kde: uncomment the lineexec startkdein the.xinitrcfile and then runstartxorxinitto start KDE. (See here).To start X at login: Add the following line to the bottom of the
~/.bash_profile(See here)[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
UI installation II (bumblebee(nvidia/ intel), xfce4, LXDM)
I used bumblebee(to make NVIDIA Optimus enabled laptops work), xfce4 desktop and LXDM display manager the second time I installed Archlinux. I have to say I’m really satisfied with this setup - powerful, flexible and stable (thus far).
Bumblebee installation
Bumblebee is an effort to make NVIDIA Optimus enabled laptops work in GNU/Linux systems.
So make sure your computer is NVIDIA Optimus enabled. See Q1 at the end of this post.
Before installing Bumblebee, check your BIOS and activate Optimus.(See here)
Note: Don’t try to install bumblebee, mesa, nvidia and so on seprately, because it did not work when I did so!
When executing the second line command, there is some message saying that bumblebee and nvidia-libgl are in conflict. Remove nvidia-libgl? [y/N], select y. (Use pacman -Si bublebee command you’ll see that bumblebee actually provides nvidia-libgl.)
pacman -S nvidia-libgl xorg-server xorg-server-utils xorg-xinit xorg-twm xorg-xclock xterm
pacman -S bumblebee mesa xf86-video-intel nvidia
Then add user to the bumblebee group(change weich accordingly), enable bumblebeed.service and reboot:
gpasswd -a weich bumblebee
systemctl enable bumblebeed.service
reboot
Test bumblebee works or not (See here)
After running startx, there will be some x windows(terminal) and clock pop out, then run optirun glxspheres64. (optirun uses NVIDIA card to run application.)
startx
optirun glxspheres64
If bumblebee works, you’ll see this image: link
Note: You need to install mesa-demos first if you wnat to run glxinfo or glxgears commands.
Xfce4 & LXDM installation
pacman -S xfce4 xfce4-goodies lxdm
Set xfce4 as the default window manager of the system by editing /etc/lxdm/lxdm.conf and change the session line to session=/usr/bin/startxfce4. (Maybe it is already set correctly, no action needed.)
To login to one account automatically on setup, find the line in /etc/lxdm/lxdm.conf that looks like #autologin=dgod and change dgod to the desired user name.
Enable lxdm by running
systemctl enable lxdm
All Done! Cheers!
Q1. How to find out what graphics card I’m using?
Answer: Use the following command to check what graphics card you have in the computer. To my understanding, if you have both intel and NVIDIA graphics card, your computer is using the NVIDIA Optimus (I’m not sure whether it is right, but I think most of the time it should be right.)
bash
# lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 650M] (rev a1)