Compare commits
39 Commits
Author | SHA1 | Date |
---|---|---|
Milan Meduna | a338e5e026 | |
Milan Meduna | 49c2dd36ad | |
Milan Meduna | 19cef9c844 | |
Milan Meduna | 1fecc47f07 | |
Milan Meduna | 95467063fa | |
Milan Meduna | 6bc63929c4 | |
Milan Meduna | e2254f2fb7 | |
Milan Meduna | 79267154c3 | |
Milan Meduna | 3942645387 | |
Milan Meduna | 839ea82528 | |
Milan Meduna | 62b274d2e8 | |
Milan Meduna | cd47ef45e7 | |
root | 2716d5c54e | |
root | 4c29455bfb | |
root | 3fbeb460c0 | |
root | 237fe1eeff | |
root | acc49ac7fc | |
root | b30ab554be | |
root | 8c6c427fb9 | |
milanm | 1607afb78b | |
Milan Meduna | 7b6ccc4806 | |
Milan Meduna | 18f0220d61 | |
Milan Meduna | 947211c1c3 | |
Milan Meduna | bd0862a9d7 | |
Milan Meduna | ea0c545a4c | |
root | 85a9f8fe13 | |
root | d6cc0fb7f2 | |
root | ea54b3e021 | |
Milan Meduna | 483975199a | |
root | 68572fcea4 | |
root | d32f287de5 | |
root | 4e96d430d9 | |
Milan Meduna | a256a06f42 | |
Milan Meduna | 8b0fbc61e2 | |
Milan Meduna | 5c2fd28b83 | |
Milan Meduna | 018ebf7563 | |
Milan Meduna | 1687ec1c30 | |
Milan Meduna | 8cb2cfcbe0 | |
Milan Meduna | cfb9c2b5ed |
19
README.md
19
README.md
|
@ -1,5 +1,3 @@
|
||||||
__LXD INIT not work for now, i dont have time to fix it. So, after installation via script, you need to run lxd init manually and set up it like script.__
|
|
||||||
|
|
||||||
__Features:__
|
__Features:__
|
||||||
|
|
||||||
copy_containers ->
|
copy_containers ->
|
||||||
|
@ -9,17 +7,20 @@ zfs-backup-mm-example-config ->
|
||||||
example config for zfs-backup-mm script, that backup all running containers, except those with "testing" or "deluge "in container name.
|
example config for zfs-backup-mm script, that backup all running containers, except those with "testing" or "deluge "in container name.
|
||||||
|
|
||||||
setup-usl-mm_install_requirements ->
|
setup-usl-mm_install_requirements ->
|
||||||
install dialog utility
|
configure main and universe repo in sources.list, install dialog utility
|
||||||
|
|
||||||
setup-usl-mm
|
usl-mm-bionic-upgrade ->
|
||||||
|
replace current release codename with codename in first argument, upgrade LXD to 4.16 SNAP version, upgrade system, replace some lines in /root/onstart, reboot
|
||||||
|
|
||||||
|
setup-usl-mm ->
|
||||||
1. Pre-reboot script ->
|
1. Pre-reboot script ->
|
||||||
install zfs-utils,
|
install zfs-utils,
|
||||||
change timezone to Prague,
|
change timezone to Prague,
|
||||||
crypt swap partition with ecryptfs-utils,
|
crypt swap partition with ecryptfs-utils,
|
||||||
crypt some partition with dmcrypt to use with /var/snap/lxd/common/lxd/* and LXD ZFS storage,
|
crypt some partition with dmcrypt to use with /var/lib/lxd and LXD ZFS storage,
|
||||||
add some config to sysctl.conf,
|
add some config to sysctl.conf,
|
||||||
disable snapd.lxd service,
|
disable lxd service,
|
||||||
delete everything in /var/snap/lxd/common/lxd/*,
|
delete everything in /var/lib/lxd/*,
|
||||||
delete netplan, install ifupdown,
|
delete netplan, install ifupdown,
|
||||||
configure bridged networking (you can put LXD container to your network simple by add br0 to container),
|
configure bridged networking (you can put LXD container to your network simple by add br0 to container),
|
||||||
create zpool with ashift=12,
|
create zpool with ashift=12,
|
||||||
|
@ -30,7 +31,7 @@ create /root/onstart script to decrypt crypted parition with password and start
|
||||||
reboot
|
reboot
|
||||||
|
|
||||||
2. Post-reboot script ->
|
2. Post-reboot script ->
|
||||||
for sure, stop snapd.lxd service and delete everything in /var/snap/lxd/common/lxd/*,
|
for sure, stop lxd service and delete everything in /var/lib/lxd/*,
|
||||||
exec /root/onstart to decrypt partition and import zpool,
|
exec /root/onstart to decrypt partition and import zpool,
|
||||||
configure LXD to use encrypted partition as storage,
|
configure LXD to use encrypted partition as storage,
|
||||||
add some config to /root/.screenrc (for gnuscreen utility),
|
add some config to /root/.screenrc (for gnuscreen utility),
|
||||||
|
@ -41,7 +42,7 @@ install ksplice tool for kernel live patching
|
||||||
|
|
||||||
__Requirements:__
|
__Requirements:__
|
||||||
|
|
||||||
Fresh installation of Ubuntu 20.04, swap partition and some paritition to crypted data
|
Fresh installation of Ubuntu 18.04.1, swap partition and some paritition to crypted data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
42
setup-usl-mm
42
setup-usl-mm
|
@ -12,9 +12,6 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Install net-tools"
|
|
||||||
apt install net-tools -y
|
|
||||||
|
|
||||||
echo "Exec ifconfig"
|
echo "Exec ifconfig"
|
||||||
ifconfig
|
ifconfig
|
||||||
read -p "Enter interface for configure bridge:" NET_IF
|
read -p "Enter interface for configure bridge:" NET_IF
|
||||||
|
@ -49,18 +46,16 @@ zfs create crypt/lxd
|
||||||
zfs create crypt/lxd/dir
|
zfs create crypt/lxd/dir
|
||||||
zfs create crypt/lxd/storage
|
zfs create crypt/lxd/storage
|
||||||
|
|
||||||
echo "Switch to 5.19 LXD version"
|
echo "Stopping and disabling lxd"
|
||||||
snap switch --channel 5.19/stable lxd
|
systemctl disable lxd
|
||||||
snap refresh
|
systemctl disable lxd.socket
|
||||||
|
systemctl stop lxd
|
||||||
|
|
||||||
echo "Disabling lxd snap"
|
echo "Deleting everything in /var/lib/lxd/*"
|
||||||
snap disable lxd
|
rm /var/lib/lxd/* -r
|
||||||
|
|
||||||
echo "Deleting everything in /var/snap/lxd/common/lxd/*"
|
echo "Creating mountpoint /var/lib/lxd to crypt/lxd/dir"
|
||||||
rm /var/snap/lxd/common/lxd/* -r
|
zfs set mountpoint=/var/lib/lxd crypt/lxd/dir
|
||||||
|
|
||||||
echo "Creating mountpoint /var/snap/lxd/common/lxd to crypt/lxd/dir"
|
|
||||||
zfs set mountpoint=/var/snap/lxd/common/lxd crypt/lxd/dir
|
|
||||||
|
|
||||||
echo "Configuring sysctl"
|
echo "Configuring sysctl"
|
||||||
echo "vm.swappiness = 1" > /etc/sysctl.d/50-usl-mm.conf
|
echo "vm.swappiness = 1" > /etc/sysctl.d/50-usl-mm.conf
|
||||||
|
@ -105,7 +100,7 @@ echo "DNS=8.8.8.8" >> /etc/systemd/resolved.conf
|
||||||
echo "FallbackDNS=1.1.1.1" >> /etc/systemd/resolved.conf
|
echo "FallbackDNS=1.1.1.1" >> /etc/systemd/resolved.conf
|
||||||
|
|
||||||
echo "Purging netplan,disabling dhcpcd and install ifupdown"
|
echo "Purging netplan,disabling dhcpcd and install ifupdown"
|
||||||
apt purge nplan netplan.io -y
|
apt purge nplan -y
|
||||||
rm /etc/netplan/* -f
|
rm /etc/netplan/* -f
|
||||||
apt install bridge-utils ifupdown -y
|
apt install bridge-utils ifupdown -y
|
||||||
|
|
||||||
|
@ -124,14 +119,11 @@ echo "else" >> /root/onstart
|
||||||
echo "echo \"Passwords not match!\"" >> /root/onstart
|
echo "echo \"Passwords not match!\"" >> /root/onstart
|
||||||
echo "exit 1" >> /root/onstart
|
echo "exit 1" >> /root/onstart
|
||||||
echo "fi" >> /root/onstart
|
echo "fi" >> /root/onstart
|
||||||
echo "echo \"Stopping LXD snap daemon and deleting /var/snap/lxd/common/lxd/*\"" >> /root/onstart
|
|
||||||
echo "snap disable lxd" >> /root/onstart
|
|
||||||
echo "rm /var/snap/lxd/common/lxd/* -rf" >> /root/onstart
|
|
||||||
echo "echo \"Opening encrypted partition\"" >> /root/onstart
|
echo "echo \"Opening encrypted partition\"" >> /root/onstart
|
||||||
echo "echo \$pass_var | cryptsetup open $PARTITION crypt -c -" >> /root/onstart
|
echo "echo \$pass_var | cryptsetup open $PARTITION crypt -c -" >> /root/onstart
|
||||||
echo "partprobe" >> /root/onstart
|
echo "partprobe" >> /root/onstart
|
||||||
echo "zpool import -d /dev/mapper crypt -f -m" >> /root/onstart
|
echo "zpool import -d /dev/mapper crypt -f -m" >> /root/onstart
|
||||||
echo "snap enable lxd" >> /root/onstart
|
echo "systemctl start lxd" >> /root/onstart
|
||||||
|
|
||||||
chmod +x /root/onstart
|
chmod +x /root/onstart
|
||||||
read -p "Press any key for reboot"
|
read -p "Press any key for reboot"
|
||||||
|
@ -139,9 +131,9 @@ reboot
|
||||||
}
|
}
|
||||||
|
|
||||||
post_reboot_script () {
|
post_reboot_script () {
|
||||||
echo "Disabling lxd and delete /var/snap/lxd/common/lxd/*"
|
echo "Stopping lxd and delete /var/lib/lxd/*"
|
||||||
snap disable lxd
|
systemctl stop lxd
|
||||||
rm /var/snap/lxd/common/lxd/* -r
|
rm /var/lib/lxd/* -r
|
||||||
|
|
||||||
echo "Executing /root/onstart"
|
echo "Executing /root/onstart"
|
||||||
bash /root/onstart
|
bash /root/onstart
|
||||||
|
@ -204,11 +196,9 @@ main_menu
|
||||||
|
|
||||||
install_uptrack () {
|
install_uptrack () {
|
||||||
cd /tmp
|
cd /tmp
|
||||||
wget https://ksplice.oracle.com/uptrack/dist/focal/uptrack.deb
|
wget https://ksplice.oracle.com/uptrack/dist/bionic/ksplice-uptrack.deb
|
||||||
apt install python3-pycurl libgtk2-perl dbus-x11 libglade2-0 libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib python2 python-cairo python-dbus python-gi python-gobject-2 python2-minimal python-pycurl python-yaml python2.7 python2.7-minimal -y
|
apt install libgtk2-perl dbus-x11 libglade2-0 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-cairo python-dbus python-gi python-glade2 python-gobject-2 python-gtk2 python-minimal python-pycurl python-yaml python2.7 python2.7-minimal -y
|
||||||
dpkg -i uptrack.deb
|
dpkg -i ksplice-uptrack.deb
|
||||||
uptrack-upgrade -y
|
|
||||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 82562EA9AD986DA3
|
|
||||||
read -p "Done, press any key to return to main menu"
|
read -p "Done, press any key to return to main menu"
|
||||||
main_menu
|
main_menu
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
echo "deb http://archive.ubuntu.com/ubuntu bionic main universe" > /etc/apt/sources.list
|
||||||
|
echo "deb http://archive.ubuntu.com/ubuntu bionic-security main universe" >> /etc/apt/sources.list
|
||||||
|
echo "deb http://archive.ubuntu.com/ubuntu bionic-updates main universe" >> /etc/apt/sources.list
|
||||||
apt update
|
apt update
|
||||||
apt install dialog -y
|
apt install dialog
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Use with first argument with codename of new ubuntu distro(eoan,focal, etc)
|
||||||
|
IFS='
|
||||||
|
'
|
||||||
|
current_release=$(lsb_release -c | awk {'print $2'})
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt update
|
||||||
|
apt dist-upgrade -y -o Dpkg::Options::="--force-confold"
|
||||||
|
apt install rpl -y
|
||||||
|
snap install --channel 4.16/stable lxd
|
||||||
|
if [ $current_release == bionic ]; then
|
||||||
|
lxd.migrate -yes
|
||||||
|
fi
|
||||||
|
zfs set mountpoint=/var/snap/lxd/common/lxd crypt/lxd/dir
|
||||||
|
rpl $current_release $1 /etc/apt/sources.list
|
||||||
|
rpl $current_release $1 /etc/apt/sources.list.d/*
|
||||||
|
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 82562EA9AD986DA3
|
||||||
|
apt update
|
||||||
|
apt dist-upgrade -y -o Dpkg::Options::="--force-confold"
|
||||||
|
|
||||||
|
echo "Creating onstart-new script in /root"
|
||||||
|
echo "#!/bin/bash" > /root/onstart-new
|
||||||
|
echo "read -p \"Press any button to start...\"" >> /root/onstart-new
|
||||||
|
echo "pass_var=\$(dialog --passwordbox \"Enter password:\" 25 25 --output-fd 1)" >> /root/onstart-new
|
||||||
|
echo "pass_var2=\$(dialog --passwordbox \"Enter password again:\" 25 25 --output-fd 1)" >> /root/onstart-new
|
||||||
|
echo "if [ \"\$pass_var\" == \"\$pass_var2\" ]; then" >> /root/onstart-new
|
||||||
|
echo "echo \"Passwords match!\"" >> /root/onstart-new
|
||||||
|
echo "else" >> /root/onstart-new
|
||||||
|
echo "echo \"Passwords not match!\"" >> /root/onstart-new
|
||||||
|
echo "exit 1" >> /root/onstart-new
|
||||||
|
echo "fi" >> /root/onstart-new
|
||||||
|
echo "echo \"Stopping LXD snap daemon and deleting /var/snap/lxd/common/lxd/*\"" >> /root/onstart-new
|
||||||
|
echo "snap disable lxd" >> /root/onstart-new
|
||||||
|
echo "rm /var/snap/lxd/common/lxd/* -rf" >> /root/onstart-new
|
||||||
|
echo "echo \"Opening encrypted partition\"" >> /root/onstart-new
|
||||||
|
for i in $(cat /root/onstart | grep "cryptsetup open")
|
||||||
|
do echo "$i" >> /root/onstart-new
|
||||||
|
done
|
||||||
|
echo "partprobe" >> /root/onstart-new
|
||||||
|
for i in $(cat /root/onstart | grep "zpool import")
|
||||||
|
do echo "$i" >> /root/onstart-new
|
||||||
|
done
|
||||||
|
echo "snap enable lxd" >> /root/onstart-new
|
||||||
|
for i in $(cat /root/onstart | grep "iptables")
|
||||||
|
do echo "$i" >> /root/onstart-new
|
||||||
|
done
|
||||||
|
for i in $(cat /root/onstart | grep "firewall")
|
||||||
|
do echo "$i" >> /root/onstart-new
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "cryptdisks_start cryptswap1" >> /root/onstart-new
|
||||||
|
echo "swapon -a" >> /root/onstart-new
|
||||||
|
|
||||||
|
chmod +x /root/onstart-new
|
||||||
|
|
||||||
|
mv /root/onstart /root/onstart-old
|
||||||
|
mv /root/onstart-new /root/onstart
|
||||||
|
|
||||||
|
zfs set mountpoint=/var/snap/lxd/common/lxd crypt/lxd/dir
|
||||||
|
|
||||||
|
snap switch --channel 5.19/stable lxd
|
||||||
|
snap refresh
|
||||||
|
|
||||||
|
apt install uptrack -y
|
||||||
|
|
||||||
|
read -p "Press any key for reboot"
|
||||||
|
reboot
|
Loading…
Reference in New Issue