-
Notifications
You must be signed in to change notification settings - Fork 0
/
virt-setup.sh
77 lines (65 loc) · 2.69 KB
/
virt-setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
echo "-------------------------------------------------"
echo "Starting setup "
echo "-------------------------------------------------"
ISO=$(curl -4 ifconfig.co/country-iso)
echo "-------------------------------------------------"
echo "Setting up the best mirrors for ${ISO} "
echo "-------------------------------------------------"
sudo reflector -a 48 -c ${ISO} -f 5 -l 20 --sort rate --save /etc/pacman.d/mirrorlist
sudo pacman -Syy
echo "-------------------------------------------------"
echo "Installing virtualization packages "
echo "-------------------------------------------------"
PKGS=(
'virt-manager'
'qemu'
'qemu-arch-extra'
'qemu-block-iscsi'
'bridge-utils'
'dnsmasq'
'vde2'
'openbsd-netcat'
'iptables-nft'
'edk2-ovmf'
'virtualbox'
'virtualbox-guest-iso'
'virtualbox-ext-oracle'
'docker'
'docker-compose'
'gnome-boxes'
'dmidecode'
)
for PKG in "${PKGS[@]}"; do
echo "Installing: ${PKG}"
paru -S "$PKG" --needed
done
snap install multipass
echo "-------------------------------------------------"
echo "Adding user (${USER}) to neccessary groups "
echo "-------------------------------------------------"
sudo usermod -aG libvirt ${USER}
sudo usermod -aG docker ${USER}
sudo usermod -aG vboxusers ${USER}
echo "-------------------------------------------------"
echo "Loading Virtualbox kernel modules "
echo "-------------------------------------------------"
sudo modprobe vboxdrv vboxnetadp vboxnetflt
echo "-------------------------------------------------"
echo "Whitelisting Virtualbox with Wayland "
echo "-------------------------------------------------"
gsettings set org.gnome.mutter.wayland xwayland-grab-access-rules "['VirtualBox Machine']"
echo "-------------------------------------------------"
echo "Starting services "
echo "-------------------------------------------------"
sudo systemctl enable --now libvirtd
sudo systemctl enable --now docker
echo "-------------------------------------------------"
echo "Installing Portainer & Watchtower "
echo "-------------------------------------------------"
sudo docker volume create portainer_data
sudo docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
sudo docker run -d --name watchtower --restart=always -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower
echo "-------------------------------------------------"
echo "Complete "
echo "-------------------------------------------------"