Initial commit

This commit is contained in:
askiiart 2025-06-15 23:05:56 -05:00
commit 419bff5577
Signed by untrusted user who does not match committer: askiiart
GPG key ID: 6A32977DAF31746A
5 changed files with 147 additions and 0 deletions

35
README.md Normal file
View file

@ -0,0 +1,35 @@
# Proxmox Setup
Proxmox setup for `bagel`
## Install
***Not automated***
Use ZFS with RAID0 on a single disk during setup. Doing this because then I can just update it to add whatever other disks automatically later.
## Disk setup
### ZFS Setup
Adds other disks to ZFS pool. `disks` in `data.json` contains the IDs of the original install disk (`install`) and the ones to be added to the ZFS pool (`others`). See `ls /dev/disk/by-id` for the disk identifiers.
### Other disks
## Repo configuration
Proxmox repos are replaced with their no-subscription variants.
## Program installation
Programs are installed according to `programs` in `data.json`
## TODO
- ~~host smb share~~
- ~~set proxmox community repos~~
- add ssh keys
- assemble server
- set up smb share mounting on server
- zram-generator on server
- get ssd off btrfs

24
data.json Normal file
View file

@ -0,0 +1,24 @@
{
"disks": {
"install": "6483A445-BF16-4E97-9929-B069792C3FE9",
"other": [
"nvme-IM2P33F3A_NVMe_ADATA_512GB_2L1129S758KT",
"ata-Samsung_SSD_870_EVO_1TB_S75BNL0W928510J"
]
},
"programs": [
"htop",
"ncdu",
"curl",
"mergerfs",
"git",
"progress",
"rsync",
"restic",
"iotop",
"tmux"
],
"ssh-keys": [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCxnEgXTMHN844yrpagOPorBKdTwHnZ5hiwnU9fS139oktAdoGnInu9zRMmCn72hNbBBJbpGrm7tYTG9b3WaouaFvyfx5fnWPSiL+Nuaqb8aspKqYOY+aFQ46vfQnHQPC0UcekTtXX+9xM2ngt3wEXOkR4Oc48hgJQRGdGABfcio2+dVLE35giefZZy+TJbnPXd2mM7ZFh9V+gt7v/gxaW7IUarAs19/ROE0vHnP+Lkq8kRh9KgoifQMdnR7b6taSV8ilETeEDjf/p8X4JXi38SuP7He1qLVBzoKZME4PSmJbC7zgW+H+iRWN2o63fnRkn7uZkYz+P4BnS0pMfRmVHOELfNWP1191ZugLEdIV0TZuev9kGuJq5AeQTk6zpRkx8w99lTv0bcfapQV+44nna3pwnxq8zvmXkmfYmNF/gQYYY5eaaq0eBB8o/8FCchrN/pKyuNbFiFz8+OIMvdBCA6QqsOb2fyQ6n3RlnjfJuDzstFkQLrdmsQYOYL1I9zOT1wMVaGaio0Mnf6zZlmsSBYFmL9Oms4BOKDdlbGpLvus0uNhAx4sM51G7523Z1thAEp4sqCNCLCcWosApsfZ/YsO5XSU2XVUAUskymu6fDP4elmQSeL5TTDycGVI7yiW3fX5UYGXprNXMbfbGDALx4cQGnIaTRxByoX6tC3sEK+SQ=="
]
}

5
fstab Normal file
View file

@ -0,0 +1,5 @@
PARTUUID=3857f198-72c5-644a-9da6-1e542d370785 /mnt/media0 xfs defaults 0 0
PARTUUID=1674ea7b-55d1-2c4f-bb5e-75142feae5db /mnt/media1 xfs defaults 0 0
PARTUUID=abec3d4f-baab-a94d-a9b4-2b64cb8f4de9 /mnt/media2 xfs defaults 0 0
PARTUUID=d7196edd-9870-f14d-8269-387338e79939 /mnt/media3 xfs defaults 0 0
/mnt/media0:/mnt/media1:/mnt/media2:/mnt/media3 /mnt/media fuse.mergerfs defaults,allow_other,use_ino,category.create=mfs,moveonenospc=true,minfreespace=4G,cache.files=partial,dropcacheonclose=true 0 0

72
setup.sh Normal file
View file

@ -0,0 +1,72 @@
#!/usr/bin/env bash
set -euxo pipefail
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
if [ $(whoami) -ne "root"]; then
echo "not root, exiting"
fi
### Repo setup ###
if [ -e /etc/apt/sources.list.d/pve-enterprise.list ]; then
rm /etc/apt/sources.list.d/pve-enterprise.list
fi
echo 'deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription' | tee /etc/apt/sources.list.d/pve-no-subscription.list
sed -i 's/enterprise\.proxmox\.com/download.proxmox.com/g' /etc/apt/sources.list.d/ceph.list
sed -i 's/enterprise/no-subscription/g' /etc/apt/sources.list.d/ceph.list
### initial setup ###
apt update
apt install jq -y
### ZFS setup ###
# import storage pool
if ! zpool status storage; then
zpool import -f storage
else
echo "storage pool already imported"
fi
# add rpool disks
for id in $(jq ."disks"."other"[]? $SCRIPT_DIR/data.json -r); do
disk=$(readlink -f /dev/disk/by-id/$id)
if ! $(zpool status rpool | grep -q "${disk##*/}"); then
zpool add rpool $disk
else
echo $disk already added to pool, skipping
fi
done
### Other disk setup ###
mkdir -p /mnt/media{0,1,2,3} /mnt/cache /mnt/media
while read line; do
if ! grep -q "$line" /etc/fstab; then
echo "$line" | tee -a /etc/fstab
fi
done <$SCRIPT_DIR/fstab
mount -a || true
read -p "If it's safe to continue, press enter. Otherwise, do ^C to exit."
systemctl daemon-reload
### Program installation ###
apt install $(jq ."programs"[]? $SCRIPT_DIR/data.json -r | tr '\n' ' ') -y
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
sed -i 's/#Port 22/Port 2222/g' /etc/ssh/sshd_config
### SMB - Share to the server ###
apt install samba -y
while read line; do
if ! grep -q "$line" /etc/samba/smb.conf; then
echo "$line" | tee -a /etc/samba/smb.conf
fi
done <$SCRIPT_DIR/smb.conf
systemctl restart smbd
# ASSUMES USER IS ROOT
# ASSUMES SMB SHOULD BE ROOT
smb_user="root"
if ! $(pdbedit -L -v | grep -q "Unix username: .*$smb_user"); then
read -p "Enter the SMB password at the prompt - press enter to continue"
smbpasswd -a $smb_user
fi

11
smb.conf Normal file
View file

@ -0,0 +1,11 @@
[media]
comment = "/mnt/media SMB share"
path = /mnt/media
read only = no
browsable = yes
[user]
comment = "/mnt/user SMB share"
path = /mnt/user
read only = no
browsable = yes