24 Commits

Author SHA1 Message Date
Thorsten Spille
ba1c8f854f Merge pull request #20 from zentonic/patch-1
Update proxmox-zfs-postinstall.sh
2023-04-20 22:08:19 +02:00
Thorsten Spille
5a14852130 Merge pull request #18 from degenhard/main
Fixed kernel ignoring tunable zfs_arc_min and zfs_arc_max
2023-04-20 22:07:56 +02:00
Thorsten Spille
db3dad84a2 Merge pull request #16 from herwig-/patch-1
corrected typo, added tmux to tools
2023-04-20 22:05:42 +02:00
Thorsten Spille
5fc25a4237 Merge pull request #13 from MAButz/main
Update proxmox-zfs-postinstall.sh
2023-04-20 22:05:24 +02:00
Christian Müller
af5fec4533 Update proxmox-zfs-postinstall.sh
typo
2023-04-20 14:45:44 +02:00
Thorsten Spille
6cd86573f7 Update README.md 2023-03-14 15:45:23 +01:00
Thorsten Spille
766df4e8de Update README.md 2023-03-14 15:44:43 +01:00
Thorsten Spille
5e9a92524a Update README.md 2023-03-14 15:42:46 +01:00
Peter Heise
4df16308c1 Fixed kernel ignoring tunable zfs_arc_min and zfs_arc_max 2022-12-19 19:16:38 +01:00
herwig-
ef9116f039 corrected typo, added tmux to tools 2022-12-14 02:31:07 +01:00
Thorsten Spille
31037271af Make /usr/local/bin/docker-compose executable 2022-10-29 12:48:11 +02:00
Thorsten Spille
c3cb8e7608 Install docker-compose standalone 2022-10-29 12:45:36 +02:00
Marc-André Butz
b46d8c0a39 Update proxmox-zfs-postinstall.sh
Suggested from teissler:
-change (y/n)? to (y/N)?   ;This way it is easier to understand that everything except "y" doesn't enables the pve-no-subscription repo.
-$response to lowercase  ;would also improve the scripts failure proofness.
2022-10-18 16:21:43 +02:00
Marc-André Butz
8abeca080d Update proxmox-zfs-postinstall.sh 2022-10-17 16:27:27 +02:00
Thorsten Spille
ff4069519f Delete install-iscsi-target 2022-05-10 21:13:30 +02:00
Thorsten Spille
4e05e5a916 Create install-iscsi-target 2022-05-09 21:49:05 +02:00
Thorsten Spille
3ca96f6f35 Moved pve-no-subscription list to sources.list 2022-04-28 18:42:00 +02:00
Thorsten Spille
68e85b8ecd Update README.md 2022-04-28 18:37:32 +02:00
Thorsten Spille
696bbef89c Added include interfaces.d/* in network interfaces 2022-04-28 18:19:13 +02:00
Thorsten Spille
064491d1a8 Added libpve-network-perl 2022-04-28 17:57:09 +02:00
Thorsten Spille
276da4fe43 Update proxmox-zfs-postinstall.sh 2022-01-17 21:42:03 +01:00
Thorsten Spille
994001a7a3 Create install-docker-portainer 2021-11-22 17:20:50 +01:00
Thorsten Spille
9b4b99dca4 Update install-cockpit-zfs-manager 2021-11-21 15:47:50 +01:00
Thorsten Spille
e62e3d3557 Create install-cockpit-zfs-manager 2021-11-21 15:46:54 +01:00
4 changed files with 135 additions and 11 deletions

View File

@@ -12,6 +12,7 @@ Following settings are made:
- Configure `vm.swappiness` interactively - Configure `vm.swappiness` interactively
- Install checkmk Agent with optional encryption and registration - Install checkmk Agent with optional encryption and registration
- Added Support for Proxmox VE 7.0 - Added Support for Proxmox VE 7.0
- Added Proxmox SDN features
# Usage # Usage
@@ -20,3 +21,7 @@ Just download and execute the script, all settings are made interactively.
wget https://github.com/bashclub/proxmox-zfs-postinstall/raw/main/proxmox-zfs-postinstall.sh wget https://github.com/bashclub/proxmox-zfs-postinstall/raw/main/proxmox-zfs-postinstall.sh
bash ./proxmox-zfs-postinstall.sh bash ./proxmox-zfs-postinstall.sh
``` ```
# Author
### Thorsten Spille
[<img src="https://storage.ko-fi.com/cdn/brandasset/kofi_s_tag_dark.png" rel="Support me on Ko-Fi">](https://ko-fi.com/thorakel)

View File

@@ -0,0 +1,61 @@
#!/bin/bash
source /etc/os-release
echo "deb http://deb.debian.org/debian $VERSION_CODENAME-backports main" > /etc/apt/sources.list.d/$VERSION_CODENAME-backports.list
apt update
cat << EOF > /etc/apt/preferences.d/90_cockpit
Package: cockpit cockpit-*
Pin: release n=$VERSION_CODENAME-backports
Pin-Priority: 990
EOF
apt install --yes --no-install-recommends cockpit
git clone https://github.com/optimans/cockpit-zfs-manager.git && cp -r cockpit-zfs-manager/zfs /usr/share/cockpit
mkdir -p /etc/cockpit/zfs
mkdir -p /etc/cockpit/zfs/shares
mkdir -p /etc/cockpit/zfs/snapshots
cat << EOF > /etc/cockpit/zfs/config.json
{
"#1": "COCKPIT ZFS MANAGER",
"#2": "WARNING: DO NOT EDIT, AUTO-GENERATED CONFIGURATION",
"cockpit": {
"manage": true
},
"disks": {
"base2": false
},
"loglevel": "2",
"samba": {
"manage": false,
"windowscompatibility": true
},
"updates": {
"check": true
},
"zfs": {
"filesystem": {
"cloneorigin": false,
"quotarestrict": true,
"readonlylockdown": false,
"snapshotactions": true
},
"snapshot": {
"filesystemlist": true
},
"status": {
"errorcolors": true,
"trimunsupported": false
},
"storagepool": {
"activetab": 1,
"boot": true,
"bootlockdown": true,
"count": true,
"refreshall": false,
"root": true
}
}
}
EOF
cat << EOF > /etc/cockpit/zfs/shares.conf
# COCKPIT ZFS MANAGER
# WARNING: DO NOT EDIT, AUTO-GENERATED CONFIGURATION
EOF

38
install-docker-portainer Normal file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
# create zfs filesystems
zfs create -o com.sun:auto-snapshot=false -o mountpoint=/var/lib/docker rpool/docker
zfs create -o com.sun:auto-snapshot=true -o mountpoint=/portainer rpool/portainer
# add docker repository
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# update package lists and install docker engine + docker-compose
apt update
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq --no-install-recommends docker-ce docker-ce-cli containerd.io
dc_version=$(wget -O - -q https://api.github.com/repos/docker/compose/releases/latest | grep -m1 "\"name\":" | cut -d'"' -f4)
wget -O /usr/local/bin/docker-compose https://github.com/docker/compose/releases/download/${dc_version}/docker-compose-linux-x86_64
chmod +x /usr/local/bin/docker-compose
# install portainer
cd /portainer
mkdir data
cat << EOF > /portainer/docker-compose.yml
version: '3.2'
services:
portainer:
image: portainer/portainer-ce
ports:
- "9443:9443"
- "8000:8000"
volumes:
- /portainer/data:/data
- /var/run/docker.sock:/var/run/docker.sock
restart: always
EOF
# start portainer
docker-compose up -d

View File

@@ -3,7 +3,7 @@
###### CONFIG SECTION ###### ###### CONFIG SECTION ######
# Define basic tools to install # Define basic tools to install
TOOLS="sudo vim ifupdown2 net-tools dnsutils ethtool git curl unzip screen iftop lshw smartmontools nvme-cli lsscsi sysstat zfs-auto-snapshot htop mc rpl lsb-release" TOOLS="sudo vim ifupdown2 libpve-network-perl net-tools dnsutils ethtool git curl unzip screen tmux iftop lshw smartmontools nvme-cli lsscsi sysstat zfs-auto-snapshot htop mc rpl lsb-release"
#### PVE CONF BACKUP CONFIGURATION #### #### PVE CONF BACKUP CONFIGURATION ####
@@ -11,7 +11,7 @@ TOOLS="sudo vim ifupdown2 net-tools dnsutils ethtool git curl unzip screen iftop
# IMPORTANT NOTE: Don't type in the leading /, this will be set where needed # IMPORTANT NOTE: Don't type in the leading /, this will be set where needed
PVE_CONF_BACKUP_TARGET=rpool/pveconf PVE_CONF_BACKUP_TARGET=rpool/pveconf
# Define timer for your backup cronjob (default: every 15 minutes fron 3 through 59) # Define timer for your backup cronjob (default: every 15 minutes from 3 through 59)
PVE_CONF_BACKUP_CRON_TIMER="3,18,33,48 * * * *" PVE_CONF_BACKUP_CRON_TIMER="3,18,33,48 * * * *"
# Get Debian version info # Get Debian version info
@@ -99,7 +99,7 @@ fi
echo -e "######## CONFIGURE SWAPPINESS ########\n" echo -e "######## CONFIGURE SWAPPINESS ########\n"
SWAPPINESS=$(cat /proc/sys/vm/swappiness) SWAPPINESS=$(cat /proc/sys/vm/swappiness)
echo "The current swappiness is configured to '$SWAPPINESS %' of free memory until using swap." echo "The current swappiness is configured to '$SWAPPINESS %' of free memory until using swap."
read -p "If you want to change the swappiness, please type in the percentage as number (0 = diasbled):" user_input read -p "If you want to change the swappiness, please type in the percentage as number (0 = disabled):" user_input
if echo "$user_input" | grep -qE '^[0-9]+$'; then if echo "$user_input" | grep -qE '^[0-9]+$'; then
echo "Changing swappiness from '$SWAPPINESS %' to '$user_input %'" echo "Changing swappiness from '$SWAPPINESS %' to '$user_input %'"
SWAPPINESS=$user_input SWAPPINESS=$user_input
@@ -137,7 +137,7 @@ for interval in "${!auto_snap_keep[@]}"; do
done done
#### CHECKMK AGENT CONFIGURATION #### #### CHECKMK AGENT CONFIGURATION ####
read -p "Do you want to install checkmk agent of this machine? [y/N] " install_checkmk read -p "Do you want to install checkmk agent on this machine? [y/N] " install_checkmk
if [[ "$install_checkmk" == "y" ]]; then if [[ "$install_checkmk" == "y" ]]; then
read -p "Please specify the base url to your checkmk server (e.g. https://check.zmb.rocks/bashclub): " cmk_agent_url read -p "Please specify the base url to your checkmk server (e.g. https://check.zmb.rocks/bashclub): " cmk_agent_url
read -p "Enable agent encryption (requires setup of Agent Encryption on your checkmk instance). Do you want to activate agent encryption? [y/N] " cmk_encrypt read -p "Enable agent encryption (requires setup of Agent Encryption on your checkmk instance). Do you want to activate agent encryption? [y/N] " cmk_encrypt
@@ -165,15 +165,32 @@ fi
###### INSTALLER SECTION ###### ###### INSTALLER SECTION ######
# disable pve-enterprise repo and add pve-no-subscription repo # disable pve-enterprise repo and add pve-no-subscription repo
if [[ "$(uname -r)" == *"-pve" ]]; then
echo "Deactivating pve-enterprise repository" #Not tested, yet!
mv /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.bak > /dev/null 2>&1 read -p "Do you want to disable pve-enterprise repo and add pve-no-subscription repo (y/N)? " response
echo "Activating pve-no-subscription repository"
echo "deb http://download.proxmox.com/debian/pve $VERSION_CODENAME pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list if [ "${response,,}" == "y" ]; then
if [[ "$(uname -r)" == *"-pve" ]]; then
echo "Deactivating pve-enterprise repository"
mv /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.bak > /dev/null 2>&1
echo "Activating pve-no-subscription repository"
q=$(cat /etc/apt/sources.list | grep "pve-no-subscription")
if [ $? -gt 0 ]; then
echo "deb http://download.proxmox.com/debian/pve $VERSION_CODENAME pve-no-subscription" >> /etc/apt/sources.list
fi
rm -f /etc/apt/sources.list.d/pve-no-subscription.list
fi
fi fi
echo "Getting latest package lists" echo "Getting latest package lists"
apt update > /dev/null 2>&1 apt update > /dev/null 2>&1
# include interfaces.d to enable SDN features
q=$(cat /etc/network/interfaces | grep "source /etc/network/interfaces.d/*")
if [ $? -gt 0 ]; then
echo "source /etc/network/interfaces.d/*" >> /etc/network/interfaces
fi
# update system and install basic tools # update system and install basic tools
echo "Upgrading system to latest version - Depending on your version this could take a while..." echo "Upgrading system to latest version - Depending on your version this could take a while..."
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq dist-upgrade > /dev/null 2>&1 DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq dist-upgrade > /dev/null 2>&1
@@ -206,7 +223,10 @@ zfs list $PVE_CONF_BACKUP_TARGET > /dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
zfs create $PVE_CONF_BACKUP_TARGET zfs create $PVE_CONF_BACKUP_TARGET
fi fi
echo "$PVE_CONF_BACKUP_CRON_TIMER root rsync -va --delete /etc /$PVE_CONF_BACKUP_TARGET > /$PVE_CONF_BACKUP_TARGET/pve-conf-backup.log" > /etc/cron.d/pve-conf-backup
if [[ "$(df -h -t zfs | grep /$ | cut -d ' ' -f1)" == "rpool/ROOT/pve-1" ]] ; then
echo "$PVE_CONF_BACKUP_CRON_TIMER root rsync -va --delete /etc /$PVE_CONF_BACKUP_TARGET > /$PVE_CONF_BACKUP_TARGET/pve-conf-backup.log" > /etc/cron.d/pve-conf-backup
fi
ZFS_ARC_MIN_BYTES=$((ZFS_ARC_MIN_MEGABYTES * 1024 *1024)) ZFS_ARC_MIN_BYTES=$((ZFS_ARC_MIN_MEGABYTES * 1024 *1024))
ZFS_ARC_MAX_BYTES=$((ZFS_ARC_MAX_MEGABYTES * 1024 *1024)) ZFS_ARC_MAX_BYTES=$((ZFS_ARC_MAX_MEGABYTES * 1024 *1024))
@@ -216,8 +236,8 @@ echo $ZFS_ARC_MIN_BYTES > /sys/module/zfs/parameters/zfs_arc_min
echo $ZFS_ARC_MAX_BYTES > /sys/module/zfs/parameters/zfs_arc_max echo $ZFS_ARC_MAX_BYTES > /sys/module/zfs/parameters/zfs_arc_max
cat << EOF > /etc/modprobe.d/zfs.conf cat << EOF > /etc/modprobe.d/zfs.conf
options zfs zfs_arc_min=$ZFS_ARC_MIN_BYTES
options zfs zfs_arc_max=$ZFS_ARC_MAX_BYTES options zfs zfs_arc_max=$ZFS_ARC_MAX_BYTES
options zfs zfs_arc_min=$ZFS_ARC_MIN_BYTES
EOF EOF
if [[ "$install_checkmk" == "y" ]]; then if [[ "$install_checkmk" == "y" ]]; then