Shell Scripts to Setup my Home Server. https://chse.dev/hs
Go to file
Chase fb2a3d659c
--> Linted: EDITORCONFIG No errors were found in the linting process Details
--> Linted: GITLEAKS No errors were found in the linting process Details
--> Linted: YAML No errors were found in the linting process Details
🎨 Lint / lint (push) Successful in 8s Details
Change to 8.4.
2024-05-01 18:09:43 +00:00
.github quit telling me theres dupes i know bro 2023-11-15 17:49:36 +00:00
.vscode Initial Commit 2023-10-06 10:09:02 -05:00
src Change to 8.4. 2024-05-01 18:09:43 +00:00
.editorconfig Initial Commit 2023-10-06 10:09:02 -05:00
.gitattributes Initial Commit 2023-10-06 10:09:02 -05:00
.gitignore Initial Commit 2023-10-06 10:09:02 -05:00
LICENSE.md Initial Commit 2023-10-06 10:09:02 -05:00
README.md move blog post up to the top 2024-04-26 04:09:35 +00:00
renovate.json Initial Commit 2023-10-06 10:09:02 -05:00

README.md

Infrastructure
Donate

Read More: The Ever-Expanding Home Server - Everything I self-host, in one convenient spot.

Shell Scripts to Setup my Home Server.

# if reinstalling, backup data first.
# Install Ubuntu Server, Import SSH Keys
# Login with user created during install
sudo su -
cd ~
git clone https://git.chse.dev/chase/infrastructure.git
cd infrastructure/src
# setup secrets in ./resources/secrets & ./resources/ssh-keys
# if setting up the main server, setup docker-compose.yml secrets
# if setting up the main server, do manual steps 1-2 before running the script
bash $device.sh
cd ~
rm -rf infrastructure/

Details:

Click to expand
  • Every Server:
    • Installs Basic Packages
    • Locks Down SSH (& Installs My Keys)
    • Installs My Scripts, Dotfiles, ZSH Plugins
    • Starts fail2ban
    • Disables Default MOTD & Installs Mine
    • sysctl Tweaks
    • Unattended Upgrades
  • Main Server:
    • Changes SSH Port
    • Installs Docker, Plex
    • Sets up Secrets
    • Adds cronjobs
    • Spins up all my Docker Containers

Main Server Manual Steps

Click to expand

1. Mount Drives

lsblk
# Find Drive(s) to mount
blkid | grep "/dev/driveHere" # Look for "UUID="
nano /etc/fstab # Add "UUID=uuidHereFromBefore /media/easystore ext4 defaults 0 0" to the end of the file
mkdir /media/easystore # Repeat for other drives
mount -a

2. Folder Permissions

  1. Open docker-compose.yml
  2. Search for PGID
  3. chown -R user:media /dockerData/containerName (or other applicable place)

3. Deploy Nextcloud

# Backup Nextcloud Data
rm -rf /media/easystore/nc_backup_files
mkdir /media/easystore/nc_backup_files
mv /media/easystore/Nextcloud/admin/files/* /media/easystore/nc_backup_files/
rm -rf /media/easystore/Nextcloud # Clean out existing Nextcloud (for reinstall)
sudo docker run -d \
--init \
--sig-proxy=false \
--name nextcloud-aio-mastercontainer \
--restart always \
--publish 11001:8080 \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
-e APACHE_PORT=11000 \
-e DISABLE_BACKUP_SECTION=true \
-e NEXTCLOUD_ADDITIONAL_APKS=imagemagick \
-e NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS=imagick \
-e NEXTCLOUD_ENABLE_DRI_DEVICE=true \
-e NEXTCLOUD_DATADIR=/media/easystore/Nextcloud \
nextcloud/all-in-one:latest
  1. Open Nextcloud AIO
  2. Copy down password
  3. Login
  4. Disable Talk
  5. Set Timezone
  6. Start Containers
  7. Use Nextcloud Web UI to delete all the default files
# Restore Nextcloud Data
mv /media/easystore/nc_backup_files/* /media/easystore/Nextcloud/admin/files/
chown -R www-data:www-data /media/easystore/Nextcloud/admin/files/
sudo docker exec --user www-data -it nextcloud-aio-nextcloud php occ files:scan --all
rm -rf /media/easystore/nc_backup_files

Scripts

dotfiles