Friday, July 22, 2016

archlinux - fonts (chinese)

Fonts and font collections in the enabled repositories can be installed using pacman. Available fonts may be found by using:

# pacman -Ss font

The font or font collection wqy-zenhei solved the problem of displaying chinese characters on Chromium and Firefox browsers:

# pacman -S wqy-zenhei

List of ordinary fonts:

adobe-source-code-pro-fonts (Adobe)
adobe-source-sans-pro-fonts (Adobe)
adobe-source-serif-pro-fonts (Adobe)


Wednesday, July 20, 2016

archlinux - graphical user interface

The below configuration has a great performance; it's been running on an old laptop Intel Centrino 1.7Ghz with 1Gb RAM and 100Gb HDD

Display server: Xorg

# pacman -S xorg-server xorg-server-utils xorg-apps

Display drivers: intel

# pacman -S xf86-video-intel

Desktop environments: Xfce

# pacman -S xfce4 xfce4-goodies xfce4-whiskermenu-plugin

xinitrc: The ~/.xinitrc file is a shell script read by xinit and by its front-end startx. It is mainly used to execute desktop environments, window managers and other programs when starting the X server (e.g., starting daemons and setting environment variables). The xinit program starts the X Window System server and works as first client program on systems that are not using a display manager.

- first create a copy of the default xinitrc in home directory:

# cp /etc/X11/xinit/xinitrc ~/.xinitrc

- Append desired commands and remove/comment the conflicting lines.


if [ -d /etc/X11/xinit/xinitrc.d ] ; then
    for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
        [ -x "$f" ] && . "$f"
    unset f

# twm &
# xclock -geometry 50x50-1+1 &
# xterm -geometry 80x50+494+51 &
# xterm -geometry 80x20+494-0 &
# exec xterm -geometry 80x66+0+0 -name login

## some applications that should be run in the background
xscreensaver &
xsetroot -cursor_name left_ptr &

exec startxfce4

- when executing # startx the graphical user interface will be displayed, in this case Xfce

Desktop environments: GNOME

#  pacman -S gnome gnome-extra

- same as Xfce, first create a copy of the default xinitrc in home directory and append desired commands and remove/comment the conflicting lines.

exec gnome-session

Display manager: GDM

# pacman -S gdm
# systemctl enable gdm.service

Enable Network to be managed using GUI:

# pacman -S networkmanager network-manager-applet dhclient
# systemctl enable NetworkManager.service


Sunday, July 10, 2016

archlinux - openssh server

Piece of cake!

# pacman -S openssh

- The SSH daemon configuration file can be found and edited in /etc/ssh/sshd_config.

Enable the sshd service (start on every boot):
# systemctl enable sshd.service


archlinux - VMWare tools

Straightforward guide from arch wiki.

- Install the dependencies using pacman: base-devel (for building), net-tools (for ifconfig, used by the installer) and linux-headers (for kernel headers).
# pacman -S net-tools

- Create bogus init directories for the installer:
# for x in {0..6}; do mkdir -p /etc/init.d/rc${x}.d; done

- The installer can then be mounted:
# mount /dev/cdrom /mnt

- Extracted (e.g. to /tmp):
# tar xf /mnt/VMwareTools*.tar.gz -C /tmp

- And started:
# perl /tmp/vmware-tools-distrib/

- Reboot the Virtual Machine:
# systemctl reboot

- Log in and start the VMware Tools:
# /etc/init.d/rc6.d/K99vmware-tools start

Additionally, autostart of VMWare tools on every boot.

- Create the following text file:
# nano /etc/systemd/system/vmwaretools.service

Add the following text:
Description=VMWare Tools daemon

ExecStart=/etc/init.d/vmware-tools start
ExecStop=/etc/init.d/vmware-tools stop


- To have it start at boot write the following in the terminal:
# systemctl enable vmwaretools.service


Friday, July 8, 2016

archlinux - installation

Just another learner's howto install the archlinux on top of VMWare VM.

1. Download from the latest version as of july/2016 (from HK mirror) or choose from the available hosts from

Then boot from ISO to begin proper installation. It will automatically login with root user.

- check whether the internet connection is working:

# ping -c 3

The DHCP daemon is supposed to start automatically when running the live system from ISO. If it does not work, check network configuration page (reference below).

2. Preparing storage (partitioning and formatting)
- Identify the devices where the new system will be installed:

# lsblk

Usually, and I believe for most of cases, the device name is SDA.

- Partitioning: the plan is to make simple partition using GPT format:
/dev/sda1 - BIOS boot partition
/dev/sda1 - boot (512mb) with bootable flag
/dev/sda2 - swap (2gb)
/dev/sda3 - root (remainder)

To achieve this, I am going to use # parted as per below:

# parted /dev/sda

parted prompt:
# mklabel gpt
# mkpart ESP fat32 1MiB 513MiB
# set 1 boot on
# mkpart primary linux-swap 513MiB 2.5GiB
# mkpart primary ext3 2.5GiB 100%
# quit

- Formatting: execute # lsblk to see whether the partitions were created correctly.
# mkfs.fat -F32 /dev/sda1 #first partition - boot
# mkswap /dev/sda2        #second partition - swap
# swapon /dev/sda2        #activate swap
# mkfs.ext4 /dev/sda3     #third partition - root

3. Mounting the partitions:
# mount /dev/sda3 /mnt       #Mount the root partition
# mkdir -p /mnt/boot         
# mount /dev/sda1 /mnt/boot  #Mount the boot partition

4. Installing the base package:
# pacstrap -i /mnt base base-devel grub sudo vim net-tools linux-headers abs 

5. Configuring the system:
- Generate FSTAB
# genfstab -U /mnt >> /mnt/etc/fstab

- Chroot to new mount system root
# arch-chroot /mnt /bin/bash

- Setup Locale and Time:
edit /etc/locale.gen and uncomment the needed localisations e.g. en_US.UTF-8 UTF-8. Save the file, and generate the new locales:
# nano /etc/locale.gen
# locale-gen

create file /etc/locale.conf with the uncommented lines e.g. en_US.UTF-8
# echo LANG=en_US.UTF-8 >> /etc/locale.conf

select a time zone and create the symbolic link /etc/localtime, where Zone/Subzone is the TZ value from tzselect:
# tzselect
# ln -s /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime

6. Installing a boot loader: there are few choices for boot loaders; the one that is going to be installed is GRUB:
# grub-install /dev/sda
- since this system is being installed in a virtual machine, the above command will result in a error; as a result, the option --force must be added as below:
# grub-install --force /dev/sda
- at last:
# grub-mkconfig -o /boot/grub/grub.cfg

7. Re-generate the initramfs image:
# mkinitcpio -p linux

8. Adjust network configuration for the next boot:
# cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/ethernet-dhcp
- edit the new profile /etc/netctl/ethernet-dhcp - line interface with the correct network adapter (may be obtained by command ip link);
- start the netctl:
# netctl start ethernet-dhcp
- make the netctl auto start at boot:
# netctl enable ethernet-dhcp

9. Set the root password:
# passwd

10. Set the hostname:
# echo any_hostname >> /etc/hostname

update 2016-09-11 - The hostname can be set after initial reboot by using the following command:
# hostnamectl set-hostname <any_hostname>

11. Add new users:
# useradd -m -g users -G wheel -s /bin/bash user_name
# passwd user_name

12. Allow new users to sudo:
# visudo
and uncomment the lines below:
## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL

13. Exit from the chroot environment, umount the partitions and reboot the system:

# exit
# umount -R /mnt
# reboot

14. Syncronize and update the system:
# pacman -Syu