Compare commits

...

27 commits

Author SHA1 Message Date
7271b90b1f Aktualizovat setup-usl-mm 2024-01-26 16:20:36 +01:00
ce889eae36 Aktualizovat „setup-usl-mm“ 2023-08-29 22:35:09 +02:00
b40238ea8e Aktualizovat „setup-usl-mm“ 2023-06-16 20:57:38 +02:00
9c95213ab8 Aktualizovat „setup-usl-mm“ 2023-05-03 10:23:07 +02:00
6c32be12ec Aktualizovat „setup-usl-mm“ 2023-05-03 10:21:20 +02:00
root
a74474ef36 add_refresh_retain_snap 2021-11-09 11:05:32 +01:00
ebbaf1aec3 switch_to_4.16_lxd 2021-08-17 21:17:27 +02:00
8db33f0d33 simple_way 2020-04-28 21:04:12 +02:00
f1e3080592 containers not start in manjaro, if i not use lxc list 2020-04-28 12:39:16 +02:00
2a88d2389e add_headers 2020-04-28 10:50:43 +02:00
494d4bfe77 add noconfirm to pacman 2020-04-27 22:51:10 +02:00
71eaf726af wireguard_add 2020-04-27 22:13:18 +02:00
5ca1b1837c LXD 4.0 2020-04-26 23:09:42 +02:00
bb6e1841f7 switch to lxd 3.0 2020-04-02 15:57:56 +02:00
02bca84b4a switch_to_3.17_lxd_version 2019-10-22 22:09:43 +02:00
b223032435 Změnit "README.md" 2019-10-19 17:45:28 +02:00
ea52dd7ded install zfs for latest installed kernel 2019-10-19 16:39:25 +02:00
66132a2f41 add_pv 2019-08-18 16:38:37 +02:00
2ac8f5fd55 snapfix 2019-08-09 10:53:40 +02:00
55713536c5 lag_fix 2019-07-18 15:54:07 +02:00
d322258252 dlna_fix 2019-07-09 21:16:13 +02:00
9fb25fd1a9 little_fix 2019-07-08 20:56:39 +02:00
0aab5f6c4e clean 2019-07-07 22:32:32 +02:00
06beb49390 linux51-changes 2019-07-07 21:19:51 +02:00
4c18e2590a linux51-changes 2019-07-07 21:06:34 +02:00
717d3006a9 mkinitcpio-change 2019-07-07 20:54:06 +02:00
e929bb9312 initial_manjaro 2019-07-06 23:16:01 +02:00
3 changed files with 64 additions and 83 deletions

View file

@ -1,40 +1,34 @@
__Features:__ __Features:__
setup-usl-mm_install_requirements -> setup-msl-mm_install_requirements ->
configure main and universe repo in sources.list,
install dialog utility install dialog utility
setup-usl-mm setup-msl-mm
1. Pre-reboot script -> 1. Pre-reboot script ->
install zfs-utils and disable zpool auto-scrub, install linuxXY-zfs(for latest installed kernel),
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/lib/lxd and LXD ZFS storage, crypt some partition with dmcrypt to use with /var/snap/lxd/common/lxd/* and LXD ZFS storage,
add some config to sysctl.conf, add some config to sysctl.conf,
disable lxd service, disable snapd.lxd service,
delete everything in /var/lib/lxd/*, delete everything in /var/snap/lxd/common/lxd/*,
delete netplan, install ifupdown,
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,
set compression=on on crypted zpool, set compression=on on crypted zpool,
configure zfs cache min 256MB max 1536MB, configure zfs cache min 256MB max 1536MB,
do dist-upgrade,
create /root/onstart script to decrypt crypted parition with password and start lxd (you need start this script on every reboot), create /root/onstart script to decrypt crypted parition with password and start lxd (you need start this script on every reboot),
reboot reboot
2. Post-reboot script -> 2. Post-reboot script ->
for sure, stop lxd service and delete everything in /var/lib/lxd/*, for sure, stop snapd.lxd service and delete everything in /var/snap/lxd/common/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),
install htop mc zfsnap smartmontools and screen install htop mc smartmontools screen and pv
3. Install uptrack-upgrade ->
install ksplice tool for kernel live patching
__Requirements:__ __Requirements:__
Fresh installation of Ubuntu 18.04.1, swap partition and some paritition to crypted data Fresh installation of Manjaro with kernel package with kernelXY-zfs package, swap partition and some paritition to crypted data

View file

@ -12,23 +12,22 @@ else
exit 1 exit 1
fi fi
echo "Exec ifconfig" echo "Doing pacman -Syy"
ifconfig pacman -Syy
read -p "Enter interface for configure bridge:" NET_IF
echo "Starting lsblk" echo "Starting lsblk"
lsblk lsblk
read -p "Enter partition to encrypt:" PARTITION read -p "Enter partition to encrypt:" PARTITION
echo "Installing requirements" echo "Installing requirements"
apt install cryptsetup ecryptfs-utils zfsutils-linux -y pacman -S --noconfirm cryptsetup ecryptfs-utils $(pacman -Q linux | tail -n 1 | awk {'print $1'})-zfs $(pacman -Q linux | tail -n 1 | awk {'print $1'})-headers parted
echo "Loading ZFS kernel module"
modprobe zfs
echo "Setting timezone to Prague" echo "Setting timezone to Prague"
timedatectl set-timezone Europe/Prague timedatectl set-timezone Europe/Prague
echo "Disabling zpool auto-scrub"
sed -i 's/^/#/' /etc/cron.d/zfsutils-linux
echo "Starting ecryptfs-setup-swap" echo "Starting ecryptfs-setup-swap"
ecryptfs-setup-swap -f ecryptfs-setup-swap -f
@ -49,55 +48,49 @@ 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 "Install snapd and lxd"
pacman -S snapd --noconfirm
systemctl enable snapd
systemctl start snapd
sleep 5
snap install lxd
echo "Switch to 5.19 LXD version"
snap switch --channel 5.19/stable lxd
snap refresh
echo "Stopping and disabling lxd" echo "Stopping and disabling lxd"
systemctl disable lxd snap stop --disable lxd
systemctl disable lxd.socket snap disable lxd
systemctl stop lxd
echo "Deleting everything in /var/lib/lxd/*" echo "Deleting everything in /var/snap/lxd/common/lxd/*"
rm /var/lib/lxd/* -r rm /var/snap/lxd/common/lxd/* -r
echo "Creating mountpoint /var/lib/lxd to crypt/lxd/dir" echo "Creating mountpoint /var/snap/lxd/common/lxd to crypt/lxd/dir"
zfs set mountpoint=/var/lib/lxd 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
echo "vm.min_free_kbytes = 131072" >> /etc/sysctl.d/50-usl-mm.conf echo "vm.min_free_kbytes = 131072" >> /etc/sysctl.d/50-usl-mm.conf
echo "vm.dirty_background_ratio = 5" >> /etc/sysctl.d/50-usl-mm.conf echo "vm.dirty_background_ratio = 5" >> /etc/sysctl.d/50-usl-mm.conf
echo "fs.inotify.max_queued_events = 1048576" >> /etc/sysctl.d/50-usl-mm.conf
echo "fs.inotify.max_user_instances = 1048576" >> /etc/sysctl.d/50-usl-mm.conf
echo "fs.inotify.max_user_watches = 1048576" >> /etc/sysctl.d/50-usl-mm.conf
echo "kernel.dmesg_restrict = 1" >> /etc/sysctl.d/50-usl-mm.conf
echo "net.netfilter.nf_conntrack_max = 4194304" >> /etc/sysctl.d/50-usl-mm.conf
#Ugly fix
echo "@reboot root /sbin/sysctl -w net.netfilter.nf_conntrack_max=4194304" > /etc/cron.d/conntrack_cron
echo "Configuring arc cache for zfs to min 256MB and max 1536MB" echo "Configuring arc cache for zfs to min 256MB and max 1536MB + txg_timeout to 3"
echo "options zfs zfs_arc_min=268435456" > /etc/modprobe.d/zfs.conf echo "options zfs zfs_arc_min=268435456" > /etc/modprobe.d/zfs.conf
echo "options zfs zfs_arc_max=1610612736" >> /etc/modprobe.d/zfs.conf echo "options zfs zfs_arc_max=1610612736" >> /etc/modprobe.d/zfs.conf
echo "options zfs zfs_txg_timeout=3" >> /etc/modprobe.d/zfs.conf
echo "Doing update-initramfs -u" echo "Doing mkinitcpio -P"
update-initramfs -u mkinitcpio -P
echo "Configuring network to use bridge" echo "Doing pacman -Suu"
echo "auto lo" > /etc/network/interfaces pacman -Suu --noconfirm
echo "iface lo inet loopback" >> /etc/network/interfaces
echo " " >> /etc/network/interfaces
echo "iface $NET_IF inet manual" >> /etc/network/interfaces
echo "iface $NET_IF inet6 manual" >> /etc/network/interfaces
echo "auto br0" >> /etc/network/interfaces
echo "iface br0 inet dhcp" >> /etc/network/interfaces
echo " bridge_ports $NET_IF" >> /etc/network/interfaces
echo " bridge_stp off" >> /etc/network/interfaces
echo " bridge_fd 0" >> /etc/network/interfaces
echo " " >> /etc/network/interfaces
echo "iface br0 inet6 auto" >> /etc/network/interfaces
echo " bridge_ports $NET_IF" >> /etc/network/interfaces
echo " bridge_stp off" >> /etc/network/interfaces
echo " bridge_fd 0" >> /etc/network/interfaces
echo "Purging netplan,disabling dhcpcd and install ifupdown"
apt purge nplan -y
rm /etc/netplan/* -f
apt install bridge-utils ifupdown -y
echo "Doing apt update and apt dist-upgrade"
apt update
apt dist-upgrade -y
echo "Creating onstart script in /root" echo "Creating onstart script in /root"
echo "#!/bin/bash" > /root/onstart echo "#!/bin/bash" > /root/onstart
@ -110,11 +103,16 @@ 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 "systemctl start lxd" >> /root/onstart echo "sleep 5" >> /root/onstart
echo "snap enable lxd" >> /root/onstart
echo "snap 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"
@ -122,9 +120,9 @@ reboot
} }
post_reboot_script () { post_reboot_script () {
echo "Stopping lxd and delete /var/lib/lxd/*" echo "Stopping lxd and delete /var/snap/lxd/common/lxd/*"
systemctl stop lxd systemctl stop snap.lxd.daemon
rm /var/lib/lxd/* -r rm /var/snap/lxd/common/lxd/* -r
echo "Executing /root/onstart" echo "Executing /root/onstart"
bash /root/onstart bash /root/onstart
@ -168,20 +166,18 @@ echo "scrollback 5000" >> /root/.screenrc
echo "hardstatus string \"%{=b kw} %?%-Lw%?%{=br kw}[%n %t]%{=b kw}%?%+Lw%? %= %c\"" >> /root/.screenrc echo "hardstatus string \"%{=b kw} %?%-Lw%?%{=br kw}[%n %t]%{=b kw}%?%+Lw%? %= %c\"" >> /root/.screenrc
echo "Install utilities" echo "Install utilities"
apt install -y mc htop screen zfsnap smartmontools pacman -S --noconfirm mc htop screen smartmontools pv
echo "Set max processes to 1500 in default profile in LXD" echo "Setting-up wireguard"
lxc profile set default limits.processes 1500 pacman -S --noconfirm wireguard-dkms wireguard-tools
lxc profile set default linux.kernel_modules wireguard
read -p "Done, press any key to return to main menu" echo "Set max processes to 3000 in default profile in LXD"
main_menu lxc profile set default limits.processes 3000
}
echo "Set refresh.retain=2 in snap"
snap set system refresh.retain=2
install_uptrack () {
cd /tmp
wget https://ksplice.oracle.com/uptrack/dist/bionic/ksplice-uptrack.deb
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 ksplice-uptrack.deb
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
} }
@ -191,7 +187,6 @@ main_menu () {
options=( options=(
1 "Pre-reboot script" 1 "Pre-reboot script"
2 "Post-reboot script" 2 "Post-reboot script"
3 "Install uptrack-upgrade"
) )
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
@ -208,10 +203,6 @@ main_menu () {
post_reboot_script post_reboot_script
;; ;;
3)
install_uptrack
;;
esac esac
done done
clear clear

View file

@ -1,6 +1,2 @@
#!/bin/bash #!/bin/bash
echo "deb http://archive.ubuntu.com/ubuntu bionic main universe" > /etc/apt/sources.list pacman -S dialog --noconfirm
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 install dialog