How to install Arch Linux

In this lesson we install Arch Linux on encrypted btrfs volume step by step.

1. Show all volumes on hard drive:

ls /dev/sd*

2. Delete all volumes on drive /dev/sda

fdisk /dev/sda

Next write letter (d) -> number of volume and then write changes (w)

3. Create some partitions with command cfdisk:
– First partition: 256M, type: EFI System
– Second partition: 512M
– Third partition: full size of disk

Write changes, type yes and exit from cfdisk.

4. Now let’s create file system and encrypt on our partitions:

mkfs.vfat -n "EFI System" /dev/sda1
mkfs.ext4 -L boot /dev/sda2
mkfs.ext4 -L root /dev/sda3

We successfully created three partitions – efi, boot and root.

Now we need to encrypt our root partition:

modprobe dm-crypt
modprobe dm-mod
cryptsetup luksFormat -v -s 512 -h sha512 /dev/sda3

Type YES in capital letters and password for encrypted partition.

Arch Linux - Cryptsetup

5. Open our encrypted partition:

cryptsetup open /dev/sda3 archlinux

6. Create btrfs partition on our encrypted partition:

mkfs.btrfs -L root /dev/mapper/archlinux

7. Mount

mount -t btrfs /dev/mapper/archlinux /mnt
cd /mnt

8. Create subvolumes for btrfs partition

btrfs subvolume create root
btrfs subvolume create home
btrfs subvolume create snapshots

Go to / and unmount /mnt

cd /
umount -R /mnt

8. Mount

mount -t btrfs -o subvol=root /dev/mapper/archlinux /mnt

Create home and snapshots directories:

mkdir /mnt/home
mkdir /mnt/snapshots

Mount home and snapshots directories

mount -t btrfs -o subvol=home /dev/mapper/archlinux /mnt/home
mount -t btrfs -o subvol=snapshots /dev/mapper/archlinux /mnt/snapshots

Create boot directories:

mkdir /mnt/boot
mkdir /mnt/boot/efi

Show partitions:


Mount boot directories:

mount /dev/sda2 /mnt/boot
mount /dev/sda1 /mnt/boot/efi

9. Create swap file:

dd if=/dev/zero of=swap bs=1M count=1024
chmod 0600 swap
mkswap swap
swapon swap

10. Install Arch Linux to /mnt directory:

pacstrap -i /mnt base base-devel efibootmgr grub linux linux-firmware networkmanager vim mc 

11. Generate fstab

genfstab -U /mnt > /mnt/etc/fstab

12 Arch chroot to our new system:

arch-chroot /mnt

13. Change root password:


14. Uncomment locales in /etc/locale.gen file

vim /etc/locale.gen

Generate locale:

echo LANG=en_US > /etc/locale.conf

15. Configure grub boot loader

vim /etc/default/grub

In line GRUB_CMDLINE_LINUX=”” write this text:


Change file /etc/mkinitcpio.conf: in line HOOKS add encrypt

HOOKS=(... encrypt ...)
mkinitcpio -p linux

Configure grub bootloader:

grub-install --boot-directory=/boot --efi-directory=/boot/efi /dev/sda2
grub-mkconfig -o /boot/grub/grub.cfg
grub-mkconfig -o /boot/efi/EFI/arch/grub.cfg

Change VGA resolution in Linux

1.First create modeline with your resolution

cvt 1680 1050

This will create modeline for resolution of 1600×900 which will look something like this:

1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz
Modeline "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync

2. To add this resolution to monitor settings, type the following command:

xrandr --newmode "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync

3. Next show your monitors list and find name of your monitor (VGA-1)

xrandr --listmonitors

3. And next write this command:

xrandr --addmode VGA-1 "1680x1050_60.00"

4. In Linux Mint, xorg.conf is not present by default and has to be created. This can be created only when x server is not working ie.  in console mode otherwise system will give error. Type these highlighted commands one by one in console mode:

Alt+Ctrl+F1 (switch to console mode)

sudo service lightdm stop (For Mint 12 Lisa users)


sudo service mdm stop (For Mint 13 Maya users)
sudo X -configure (generates new xorg.conf file)

5. To switch back to graphical mode, type:

sudo start lightdm (Mint 12 Lisa users)
sudo service mdm start (Mint 13 Maya users)

If above commands fail to bring back graphical mode, just restart your computer.

Cockpit – Web GUI for Your Linux Servers

Cockpit gives you a GUI for your server, which can be accessed via a web browser. Cockpit makes it easy to start containers, administer storage, configure networks, inspect logs, and perform system tasks with a mouse.

You can think of Cockpit like a graphical “desktop interface”, but for individual servers.

To install Cockpit on Debian / Ubuntu use command:

sudo apt install cockpit

Default Cockpit web port is 9090, don’t forget to allow access to this port in your firewall.

With Cockpit you can easy get access to server terminal from your Web-browser:

How to install zsh on Debian, Ubuntu or Linux Mint

Zsh is a shell designed for interactive use, although it is also a powerful scripting language.

To install Zsh on Debian, Ubuntu or Linux Mint use command:

sudo apt install zsh

Next install “Oh My Zsh” – delightful, open source, community-driven framework for managing your Zsh configuration. Use command:

sh -c "$(curl -fsSL"

If you want to change zsh theme go to:

In order to enable a theme, set ZSH_THEME to the name of the theme in your ~/.zshrc

nano ~/.zshrc

Some themes need custom fonts, install it from git:

git clone --depth=1
cd fonts

KDE change application launcher

1. Download new application launcher from site:

2. Run command:

plasmapkg2 --install LauncherName.tar.gz

If you want to upgrade launcher to new version use command:

plasmapkg2 --upgrade LauncherName.tar.gz

3. Right click on Start Menu icon > Show alternatives > Select LauncherName

If you want to uninstall launcher use command:

plasmapkg2 --remove LauncherName.tar.gz

Setup Proxmox cluster

1. First download official ISO image from Proxmox website:

2. Write ISO image to USB flash drive using program Etcher:

3. Boot PC from USB drive and install Proxmox. If you have two hard drives you can use ZFS file system to create RAID array.

Now log in to Proxmox admin panel using Web-browser: https://server-ip-address:8006

After installation we need to upgrade our system. Proxmox based on Debian GNU Linus and it use Debian repositories but in free version of Proxmox we will have an error when we try to upgrade. We need to disable enterprise Proxmox repositories. Open file /etc/apt/sources.list.d/pve-enterprise.list and comment with symbol # first line with enterprise Proxmox repository.

nano /etc/apt/sources.list.d/pve-enterprise.list

Then we can update packages list and upgrade our system:

apt update
apt upgrade

After installation let’s configure Local storage.

In admin panel go to Datacenter -> Storage, select local-lvm storage and click Remove

After that go to your Node -> Shell and write next commands:

lvremove /dev/pve/data
lvresize -l +100%FREE /dev/pve/root

And the last command to resize our local storage to 100% is:

resize2fs /dev/mapper/pve-root

Done, now we can use 100% of local storage, installed in our server. If you click on local storage you can see entire size of hard drive.

To remove the “You do not have a valid subscription for this server” popup message while logging in, run the command bellow:

sed -Ezi.bak "s/(\(\{\s+title: gettext\('No valid sub)/void\(\{ \/\/\1/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && systemctl restart pveproxy.service

Restore MySQL database from files

If you have MySQL database files and you want to restore database on new server do next steps:

1. Stop MySQL server:

systemctl stop mysql

2. Copy all files of database to /var/lib/mysql directory;

3. Also copy files:


4. Change user and group of all files in directory /var/lib/mysql to mysql:mysql:

chown -R mysql:mysql .

5. Change permission of files in directory /var/lib/mysql to 660

find . -type f -print0 | xargs -0 chmod 660

6. Start MySQL server:

systemctl start mysql

To restore database from SQL dump use command:

mysql -u [user] -p [database_name] < [filename].sql