vault backup: 2025-02-05 14:38:06

This commit is contained in:
2025-02-05 14:38:07 +01:00
parent 6ae96b0862
commit 23fd82117a
3738 changed files with 218546 additions and 24 deletions

View File

@@ -0,0 +1,29 @@
---
title: Gitea Setup
created_date: 2024-12-02
updated_date: 2024-12-02
aliases:
tags:
---
# Gitea Setup
> [!INFO] Gitea -VPS Setup
> [gitea.claudiofritsche.com](gitea.claudiofritsche.com)
> Ports: 8083 and 8022 (ssh)
> Admin User: Ecuashungo
> Obsidian User: obsidian
## Motivation
### Why do I want my own git server?
I do not want to share my obsidian vault with any third party server, because it contains sensitive information. Using Syncthing to synchronize between devices works well, but lacks a backup feature. Using [obisian-git](https://github.com/Vinzent03/obsidian-git) is a very easy way to do a daily backup for which a git server is needed.
### How does the entire Obsidian Syncthing Gitea System work?
The live synchronization happens through syncthing. The 3 participants are my Macbook, my iPhone and my NAS. From my macbook however twice a day the obsidian-git plugin pushes to the gitea server to create a backup. It is the only instance pushing, which means we cannot have merge conflicts, nor is the git based system used for synchronization.
## Setup
In order to setup the service on my VPS I used the instructions from [digital ocean](https://www.digitalocean.com/community/tutorials/how-to-install-gitea-on-ubuntu-using-docker) as well as [this YouTube Video](https://www.youtube.com/watch?v=ATmZLwBvOrk&ab_channel=HardwoodHomelab).
### .gitignore and .stignore
Important to note here is that I added `.git/**` to all `.stignore` files before adding the git folder to my macbook, like that this doesn't get synced by syncthing.
In the gitignore file I've added all syncthing related files and folders.

View File

@@ -0,0 +1,77 @@
- [Customer Control Panel](https://www.customercontrolpanel.de/): To add more VPS instances or to change an instance.
- [Server Control Panel](https://www.servercontrolpanel.de/SCP/): To modify single server.
# SysAdmin
First login:
``` bash
ssh root@v2202403219121260300.supersrv.de
The authenticity of host 'v2202403219121260300.supersrv.de (194.59.207.89)' can't be established.
ED25519 key fingerprint is SHA256:bS+PhQlDWqf8OmtJ5EpLSpipne4gpoUarU/VVR0yYB8.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'v2202403219121260300.supersrv.de' (ED25519) to the list of known hosts.
root@v2202403219121260300.supersrv.de's password:
Permission denied, please try again.
root@v2202403219121260300.supersrv.de's password:
Linux v2202403219121260300 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
_____________________________________________________________________
WARNING! Your environment specifies an invalid locale.
The unknown environment variables are:
LC_CTYPE=UTF-8
This can affect your user experience significantly, including the
ability to manage packages. You may install the locales by running:
sudo dpkg-reconfigure locales
and select the missing language. Alternatively, you can install the
locales-all package:
sudo apt-get install locales-all
To disable this message for all users, run:
sudo touch /var/lib/cloud/instance/locale-check.skip
_____________________________________________________________________
```
# OS
# Apps
## Ideas
Huge list of ideas: https://github.com/awesome-selfhosted/awesome-selfhosted?tab=readme-ov-file#miscellaneous
- [Shaarli](https://github.com/shaarli/Shaarli)
- [firefly-III](https://www.firefly-iii.org/) (finance manager)
- [gitea](https://about.gitea.com/)
- gitlab
- https://github.com/awesome-selfhosted/awesome-selfhosted?tab=readme-ov-file#document-management---e-books
- calibre-web
- [leon](https://blog.getleon.ai/i-ran-away-from-open-source/)
- [rally](https://rallly.co/) (doodle alternative )
- [e-commerce stuff](https://github.com/awesome-selfhosted/awesome-selfhosted?tab=readme-ov-file#e-commerce)?
- [Geneaology](https://github.com/awesome-selfhosted/awesome-selfhosted?tab=readme-ov-file#genealogy) für Toni?
- Homeassistant (eher auf NAS)
- [MindMap tool](https://github.com/awesome-selfhosted/awesome-selfhosted?tab=readme-ov-file#knowledge-management-tools)?
- [vanDam](https://github.com/Floppy/van_dam): asset manager for 3d files
- [Kasm](https://kasmweb.com/) Ubuntu on the web
- octave online
- overleaf
- note mark (access my obsidian notes from the web?)
- bitwarden / vaultwarden
# TODO
- [ ] Vertrag von ganz am anfang: was ist das, brauche ich das?
- [ ] Oh-My-Zsh installieren + mein VPS setup script als gist speichern
- [ ] Root login with pw verbieten, Server security measures lernen und implementieren
- [ ] Alkademiker.ch darauf hosten
- [ ] Mail alternative finden
- [ ] Opensource booking platform? To do scheduling next time
- [ ] rally.alkademiker.ch für doodles
- [ ]

View File

@@ -0,0 +1,3 @@
# Ideas
- [ ]

View File

@@ -0,0 +1,156 @@
# General Server Settings
1. change root password: `sudo passwd root`
2. From client: upload ssh-keys: `ssh-copy-id -i /path/to/pub_key user@server`
3. On client: add Host to config:
``` txt
Host server_name
HostName server_ip
User username
IdentityFile ~/.ssh/private_key
```
4. Verify ssh-key login: `ssh server_name -v`: check if authentication is made through the ssh-key. Look out for offering and accepting key:
```
debug1: Offering public key: keyfile RSA SHA256:HASH explicit
debug1: Server accepts key: keyfile RSA SHA256:HASH explicit
```
5. disable password login:
1. `vim /etc/ssh/sshd_config`:
Change `yes` to `no` in line `PasswordAuthentication`
2. `sudo service ssh restart`
## Add Another User
Before continuing with everything else, we should add another user account in order not to use root all the time. This is just good practices.
Follow the instructions here:
https://www.digitalocean.com/community/tutorials/initial-server-setup-with-debian-10
https://askubuntu.com/questions/521469/oh-my-zsh-for-the-root-and-for-all-user
```zsh
export NEWUSER=claudio
adduser $NEWUSER
usermod -aG sudo $NEWUSER. # allow sudo rights
```
## Setup a Firewall
```zsh
apt update
apt install ufw
ufw allow OpenSSH
ufw enable
```
# Software Setup
- [ ] Add locale instructions #todo/p
``` bash
# 1. update
sudo apt update && sudo apt upgrade -y
# 2. Install server programs
sudo apt install -y vim git curl wget lsb-release htop plocate ncdu nmap
# 3. Locale
```
## ZSH and Oh-my-zsh
``` zsh
# 1. install packages: zsh, fonts and fuzzy search fzf
sudo apt install -y zsh fonts-font-awesome fontconfig fzf
# 2. Download Oh-My-Zsh, fonts and move everything at the correct place
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
sudo apt-get install -y fonts-font-awesome
wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf
mkdir -p ~/.local/share/fonts/
mv PowerlineSymbols.otf ~/.local/share/fonts/
fc-cache -vf ~/.local/share/fonts/
mkdir -p ~/.config/fontconfig/conf.d/
mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/
git clone https://github.com/abertsch/Menlo-for-Powerline.git
sudo mv Menlo-for-Powerline/Menlo*.ttf /usr/share/fonts/
rm -rf Menlo-for-Powerline # clean up
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
# 3. Apply settings for reverse serach
# fzf - better reverse search
sed -i '$ a # fzf - Better Reverse Search' ~/.zshrc
sed -i '$ a source /usr/share/doc/fzf/examples/key-bindings.zsh' ~/.zshrc
sed -i '$ a source /usr/share/doc/fzf/examples/completion.zsh' ~/.zshrc
# 4. Install Other plugins
# FZF-Tab
git clone https://github.com/Aloxaf/fzf-tab ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab
# 5. Install Autojump
sudo apt install -y autojump
# sed -i '$ a ' ~/.zshrc # empty line not working
sed -i '$ a # Autojump requirements' ~/.zshrc
sed -i '$ a source /usr/share/autojump/autojump.sh' ~/.zshrc
# 6. Add Plugins and main Theme to zshrc
sed -i 's@^ZSH_THEME=.*$@ZSH_THEME="powerlevel10k/powerlevel10k"@g' ~/.zshrc
# Install fzf-tab
git clone https://github.com/Aloxaf/fzf-tab ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab
sed -i 's@plugins=(git)@plugins=(git zsh-autosuggestions zsh-syntax-highlighting autojump extract fzf-tab)@g' ~/.zshrc
```
## Install Command Line Tools
For inspiration [this collection](https://dev.to/lissy93/cli-tools-you-cant-live-without-57f6) is interesting.
```zsh
# bat: better cat
sudo apt install -y bat
mkdir -p ~/.local/bin
ln -s /usr/bin/batcat ~/.local/bin/bat
sed -i '$ a # Custom PATH' ~/.zshrc
sed -i '$ a export PATH=~/.local/bin:$PATH' ~/.zshrc
```
```zsh
sudo apt install -y tree
# Make sure to add those aliases to .zshrc
# alias lstd="tree -d"
# alias lst2="tree -L 2"
# alias lst3="tree -L 3"
# alias lst4="tree -L 4"
# alias lst="tree"
sed -i '/# Example aliases/a alias lstd="tree -d"\nalias lst2="tree -L 2"\nalias lst3="tree -L 3"\nalias lst4="tree -L 4"\nalias lst="tree"' ~/.zshrc
```
```zsh
sudo apt install -y duf ## better disk usage tool
sudo apt install -y exa ## better ls (actually eza is newer)
```
## File Manager
- [ ] Choose one
- [ ] https://www.tecmint.com/linux-terminal-file-managers/
# Webhosting Setup
## 6tunnel
6Tunnel is used to forward a request to a ipv6 address on a specific port. This is useful, because my network provider doesn't assign a static IP address to my home router, so I can use the static IP address of the VPS and forward to the static ipv6 address of my NAS.
## Install Docker
We use [[Docker]] and [[Docker Compose]] for easier setup of different setups. I followed this setup, but it is not up to date. Nowadays the `apt-key add` command is done differently. I finally followed the instructions on the [official website](https://docs.docker.com/engine/install/debian/).
```zsh
# Allow docker without sudo
sudo usermod -aG docker ${USER}
```
I installed [[Docker Compose]] using the instructions found [here](https://docs.docker.com/compose/install/linux/).
# Usage Tutorials
## fzf
https://www.freecodecamp.org/news/fzf-a-command-line-fuzzy-finder-missing-demo-a7de312403ff/

View File

@@ -0,0 +1,2 @@
# Harddrive
## Drivers: SCSI vs VIRTIO vs IDE