switch to nfs over ssh, use data.json only, update todo
This commit is contained in:
parent
5cafab577d
commit
09b00300f6
5 changed files with 34 additions and 43 deletions
|
@ -26,10 +26,9 @@ 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~~
|
||||
- nfs over ssh on boot on server
|
||||
- zram-generator on server
|
||||
- ~~get ssd off btrfs (in progress)~~
|
||||
|
|
14
data.json
14
data.json
|
@ -16,9 +16,21 @@
|
|||
"rsync",
|
||||
"restic",
|
||||
"iotop",
|
||||
"tmux"
|
||||
"tmux",
|
||||
"nethogs"
|
||||
],
|
||||
"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=="
|
||||
],
|
||||
"exports": [
|
||||
"/mnt/media 127.0.0.1/8(rw,sync,no_subtree_check,insecure,no_root_squash,fsid=1)",
|
||||
"/mnt/user 127.0.0.1/8(rw,sync,no_subtree_check,insecure,no_root_squash,fsid=2)"
|
||||
],
|
||||
"fstab": [
|
||||
"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"
|
||||
]
|
||||
}
|
5
fstab
5
fstab
|
@ -1,5 +0,0 @@
|
|||
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
|
44
setup.sh
44
setup.sh
|
@ -29,21 +29,22 @@ 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
|
||||
if ! $(zpool status rpool | grep -q "$id"); then
|
||||
zpool add rpool $id
|
||||
else
|
||||
echo $disk already added to pool, skipping
|
||||
echo $id 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
|
||||
IFS=$'\n'
|
||||
for key in $(jq '."fstab"[]?' $SCRIPT_DIR/data.json -r); do
|
||||
if ! grep -q "$key" /etc/fstab; then
|
||||
echo "$key" | tee -a /etc/fstab
|
||||
fi
|
||||
done <$SCRIPT_DIR/fstab
|
||||
done
|
||||
unset IFS
|
||||
mount -a || true
|
||||
read -p "If it's safe to continue, press enter. Otherwise, do ^C to exit."
|
||||
systemctl daemon-reload
|
||||
|
@ -54,27 +55,22 @@ 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
|
||||
### NFS ###
|
||||
apt install nfs-kernel-server -y
|
||||
|
||||
while read line; do
|
||||
if ! grep -q "$line" /etc/samba/smb.conf; then
|
||||
echo "$line" | tee -a /etc/samba/smb.conf
|
||||
IFS=$'\n'
|
||||
for key in $(jq '."exports"[]?' $SCRIPT_DIR/data.json -r); do
|
||||
if ! grep -q "$key" /etc/exports; then
|
||||
echo "$key" | tee -a /etc/exports
|
||||
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
|
||||
done
|
||||
unset IFS
|
||||
systemctl enable --now nfs-kernel-server
|
||||
|
||||
IFS=$'\n'
|
||||
for key in $(jq '."ssh-keys"[]?' $SCRIPT_DIR/data.json -r); do
|
||||
if ! grep -q "$key" $HOME/.ssh/authorized_keys; then
|
||||
if ! grep -q "$key" $HOME/.ssh/authorized_keys; then
|
||||
echo "$key" | tee -a $HOME/.ssh/authorized_keys
|
||||
fi
|
||||
done
|
||||
unset IFS
|
||||
unset IFS
|
||||
|
|
11
smb.conf
11
smb.conf
|
@ -1,11 +0,0 @@
|
|||
[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
|
Loading…
Add table
Add a link
Reference in a new issue