Arch Linux Infrastructure - Brouter Inception - Part 3 - Hypervisor OS Setup

alt text

Index

Part 01 - Network Switch VLANs

Part 02 - Hypervisor OS Install

Part 03 - Hypervisor OS Setup - You Are Here!

Part 04 - Virtual Router

Part 05 - VoIP Server

Part 06 - Automation Server

Part 07 - NAS

Part 08 - NFTables Transparent TOR Proxy / SSH / IRC

Hypervisor OS Setup

Connect To a Network

ip addr
dhcpcd eno1
 
ping google.ca
ping 8.8.8.8

WiFi Connection

pacman -S dialog wpa_supplicant
wifi-menu

Setup & Install

Turn off Nano’s word wrap default :S

nano ~/.nanorc

set nowrap

Install sudo (May already be installed)

pacman -S sudo

Make A New User

useradd -m -G wheel -s /bin/bash plebuser

Set password for user

passwd plebuser
New password: 1337pleb
Retype new password: 1337pleb
passwd: password updated successfully

Edit visudo

EDITOR=nano visudo

Enable sudo for wheel group

Uncomment

#%wheel ALL=(ALL) ALL

to

%wheel ALL=(ALL) ALL

Change To New User Account

exit
Arch Linux 4.11.6-1ARCH (tty1)
login: plebuser
cd

Turn off Nano’s word wrap default again for this use :S

nano ~/.nanorc

set nowrap

Install Virtual Machine Packages

Install libvirt, virt-manager, qemu, qemu-arch-extra, dmidecode, ovmf, dnsmasq, openssh, ebtables, bridge-utils, openbsd-netcat, tcpdump

sudo pacman -S libvirt virt-manager qemu qemu-arch-extra dmidecode ovmf dnsmasq openssh ebtables bridge-utils openbsd-netcat tcpdump

Add User To Virtual Machine Groups

sudo usermod -a -G kvm,libvirt plebuser

Enable sshd Service

sudo systemctl enable sshd
sudo systemctl start sshd

Edit sshd Config

sudo nano /etc/ssh/sshd_config

Find PermitRootLogin and change it to yes.

PermitRootLogin yes

Enable libvirtd Service

sudo systemctl enable libvirtd
sudo systemctl start libvirtd

Change qemu running group from 78 to kvm

sudo sed -i s/78/kvm/ /etc/libvirt/qemu.conf

Enable UEFI Booting of VMs

sudo nano /etc/libvirt/qemu.conf
nvram=["/usr/share/ovmf/ovmf_code_x64.bin:/usr/share/ovmf/ovmf_vars_x64.bin"]

Auto-Start Virtual Bridging For VM Default NIC

[user@hypervisor nginx]$ sudo virsh net-autostart default
Network default marked as autostarted

[user@hypervisor nginx]$ sudo virsh net-list --all
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 default              active     yes           yes

Setup A Windows Manager For Virt-Manager

i3-wm (Windows manager to use virt-manager)

sudo pacman -S xorg xorg-xinit i3-wm i3status i3lock dmenu ranger rxvt-unicode chromium firefox scrot zsh

Hit Enter on any default option selections during install process.

Configure startx To Start i3-wm

echo "exec i3" >> ~/.xinitrc
startx

Auto start on boot

Show current shell.

echo $SHELL
/bin/bash

Change shell to zsh.

chsh -s $(which zsh)

Edit zsh start up.

.zshrc

if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
  startx
fi

Add systemd service to autologin user.

sudo mkdir -p /etc/systemd/system/getty@tty1.service.d/
sudo nano override.conf

Make sure to change the username to the one wanted.

override.conf

# /etc/systemd/system/getty@tty1.service.d/override.conf
[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin YOUR_USERNAME_HERE --noclear %I $TERM

On next reboot, it will skip the tty1 login step and go straight to your window manager.

This is so the screen saving functions can engage and the terminal doesn’t cause burn-in.

i3 Wizard

i3 wizard will ask you two questions, Create the configuration YES , Select ALT for the MOD key (Otherwise it gets touchy if you have to use MSWin Boxes and you have the MOD key set to the Windows Key).

Push ALT+D for a menu of apps push page up/down to scroll through or just type a search like chromium when you install it.

ALT+ENTER for Terminal.

ALT+SHIFT+E exit i3

Next Part

Continue to Part 04 - Virtual Router

Written on June 22, 2017