diff --git a/Linux.md b/Linux.md new file mode 100644 index 0000000..1c99aed --- /dev/null +++ b/Linux.md @@ -0,0 +1,11 @@ +--- +title: Linux +description: Gather information with information and commands usefull when dealing with Linux computers +published: true +date: 2025-01-06T11:29:30.651Z +tags: +editor: markdown +dateCreated: 2025-01-06T11:29:20.203Z +--- + +# Linux diff --git a/Linux/Hardware.md b/Linux/Hardware.md new file mode 100644 index 0000000..94e747c --- /dev/null +++ b/Linux/Hardware.md @@ -0,0 +1,22 @@ +--- +title: Hardware +description: Diagnostic of hardware problems +published: true +date: 2025-01-06T11:54:01.078Z +tags: +editor: markdown +dateCreated: 2025-01-06T11:31:14.429Z +--- + +# Hardware +Diagnostics of hardware problems in Linux + +## Battery +Check the batteries health +``` +sudo upower -i $(upower -e | grep BAT) +``` + +``` +sudo tlp-stat -b +``` \ No newline at end of file diff --git a/home.md b/home.md new file mode 100644 index 0000000..454bf52 --- /dev/null +++ b/home.md @@ -0,0 +1,12 @@ +--- +title: Home +description: +published: true +date: 2024-11-30T20:18:36.398Z +tags: +editor: markdown +dateCreated: 2024-11-30T20:18:35.143Z +--- + +# Home +Content related to home at Skånegatan 83 \ No newline at end of file diff --git a/home/home-assistant.md b/home/home-assistant.md new file mode 100644 index 0000000..434ad0d --- /dev/null +++ b/home/home-assistant.md @@ -0,0 +1,56 @@ +--- +title: Home Assistant +description: +published: true +date: 2025-02-16T22:24:33.688Z +tags: +editor: markdown +dateCreated: 2025-01-21T18:45:04.906Z +--- + +# Home Assistant +The home assistant instance is running on a raspberry pi 3B. +Link : http://homeassistant.local:8123/ + +## YAML configuration +The configuration.yaml file: +``` + +# Loads default set of integrations. Do not remove. +default_config: + +# Load frontend themes from the themes folder +frontend: + themes: !include_dir_merge_named themes + +automation: !include automations.yaml +script: !include scripts.yaml +scene: !include scenes.yaml + +# Mopidy addon for hass.io +media_player: + - platform: mpd + host: 127.0.0.1 + port: 6600 + +mqtt: + sensor: + - name: "Temperature Sensor" + state_topic: "home/sensor/temperature" + unit_of_measurement: "°C" +``` + +## Temperatue and Humidity sensor +An SHT30 temperature and humidity sensor is connected on the I2C buss on the raspberry. + +Bought from elektrokit [link](https://www.electrokit.com/temperatursensor-sht30) + +### Wiring configuration on raspberry: + +| | | +| -------- | ------- | +| 3.3V (red) | X | +| SDA (purple) | X | +| SCL (green) | X | +| x | X | +| GND (black) | X | \ No newline at end of file diff --git a/home/server.md b/home/server.md new file mode 100644 index 0000000..76d827c --- /dev/null +++ b/home/server.md @@ -0,0 +1,39 @@ +--- +title: Home Server +description: Home Server +published: true +date: 2025-04-22T21:39:20.087Z +tags: +editor: markdown +dateCreated: 2024-11-30T20:22:14.163Z +--- + +# Home Server +Description of the home server +The home server is a X86_64 computer running arch linux KDE. +The server is accessable on IP 192.168.1.101 on the local home network. +The server is accessable thorugh SSH. + +## Duck DNS +The server can be accessed from the outside using the wireguard VPN. It can be access through the domain lukarin.duckdns.org. + +The setup is to automatically update the ip can be found [here](https://www.duckdns.org/install.jsp?tab=linux-cron&domain=lukarin). + +## Hosted Software +The following software is hosted on the home server computer. + +- [Jellyfin](http://192.168.1.101:8096) +- [Wiki.js](http://192.168.1.101:3000) +- [Calibre](http://192.168.1.101:8180) +- [Nextcloud](http://192.168.1.101) +- [OnlyOffice Document Server](http://192.168.1.101:5045) +- [qBittorrent](http://192.168.1.101:3001) +- [Immich](http://192.168.1.101:2283) +- [Gitea](http://192.168.1.101:3020) +- Wire Guard +- Logitech Media Server +- Postgres + +## Network remote control + +rustdesk can be used do remote control computers over the home netwotk. \ No newline at end of file diff --git a/home/server/Calibre.md b/home/server/Calibre.md new file mode 100644 index 0000000..4bc6757 --- /dev/null +++ b/home/server/Calibre.md @@ -0,0 +1,46 @@ +--- +title: Calibre +description: Calibre server setup +published: true +date: 2024-12-22T11:03:46.862Z +tags: calibre +editor: markdown +dateCreated: 2024-12-22T10:55:43.183Z +--- + +# Calibre + +[Calibre](https://calibre-ebook.com/) is a ebook managment system. +The Calibre library needed for the calibre instance is located in the external ssd + * /Calibre +The ebook files are located at + * /eBooks +## Installation + +Installed through pacman + +``` +sudo pacman -S calibre +``` + +Created the calibre library and add the eBooks folder to it +``` +calibredb add --with-library /home/lukas/Drive/Calibre -r /home/lukas/Drive/eBooks +``` + +### systemd configuration +The systemd config file for the instance +``` +[Unit] +Description=Calibre Server +After=network.target + +[Service] +Type=simple +ExecStart=/usr/bin/calibre-server --port=8180 --enable-local-write /home/lukas/Drive/Calibre +Restart=on-failure +WorkingDirectory=/home/lukas/Drive/Calibre + +[Install] +WantedBy=multi-user.target +``` \ No newline at end of file diff --git a/home/server/Gitea.md b/home/server/Gitea.md new file mode 100644 index 0000000..3caf08b --- /dev/null +++ b/home/server/Gitea.md @@ -0,0 +1,50 @@ +--- +title: Gitea +description: +published: true +date: 2025-04-22T21:43:08.227Z +tags: +editor: markdown +dateCreated: 2025-04-22T21:40:36.802Z +--- + +# Gitea +Your content here + +## Setup + +The setup is done with docker. +docker-compose.yml: + +``` +version: "2" + +services: + server: + image: docker.gitea.com/gitea:1.23.7-rootless + restart: always + environment: + - USER_UID=1000 + - USER_GID=1000 + volumes: + - /home/lukas/Drive/gitea/gitea-data:/var/lib/gitea + - /home/lukas/Drive/gitea-data/gitea-config:/etc/gitea + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "3020:3000" + - "2222:2222" + +``` + +Start with: + +``` +sudo docker-compose up -d +``` + +Kill with + +``` +sudo docker-compose down +``` \ No newline at end of file diff --git a/home/server/Immich.md b/home/server/Immich.md new file mode 100644 index 0000000..58de52d --- /dev/null +++ b/home/server/Immich.md @@ -0,0 +1,56 @@ +--- +title: Immich +description: Immich open source photo manager +published: true +date: 2025-03-11T19:50:43.585Z +tags: +editor: markdown +dateCreated: 2025-03-09T12:36:13.098Z +--- + +# Immich +[Immich](https://immich.app) is an opeb source photo management tool which is like google photos. + +## Login + +- **email** : lukas96.forsberg@gmail.com +- **password** : Cuernavaca0521 + +## Setup +Install instructions taken from [here](https://immich.app/docs/install/docker-compose) using docker. + +Fetch the docker compose file and the default .env file. The .env file can be edited for user preference. +```cmd +wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml +wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env +``` + +### Edits + +Changed the path for the postgres server in docker-compose.yaml + +```cmd +volumes: + - ${DB_DATA_LOCATION}:/var/lib/postgresql/data:delegated +``` + +and + +```cmd +volumes: + - ${UPLOAD_LOCATION}:/usr/src/app/upload:delegated +``` + +Changed postgre db location due to it needs to be placed in a linux file system not exFAT, in .env + +```cmd +DB_DATA_LOCATION=/home/lukas/docker_volumes/immich/postgres +``` + +### Run + +Start the docker instance with + +```cmd +sudo docker compose up -d +``` \ No newline at end of file diff --git a/home/server/OnlyOffice.md b/home/server/OnlyOffice.md new file mode 100644 index 0000000..ce38211 --- /dev/null +++ b/home/server/OnlyOffice.md @@ -0,0 +1,36 @@ +--- +title: OnlyOffice +description: OnlyOffice document server used by Nextcloud +published: true +date: 2025-01-05T13:01:54.958Z +tags: +editor: markdown +dateCreated: 2025-01-05T12:23:52.142Z +--- + +# OnlyOffice Document Server +The OnlyOffice Document server is used by Nextcloud to enable the web UI to edit office documents + +## Setup + +Install with docker +``` +sudo docker pull onlyoffice/documentserver +``` + +Nextcloud is already using port 80, hence the default port for the connection has to be changed. +Changed to 5045 +``` +sudo docker run -i -t -d -p 5045:80 --restart=always onlyoffice/documentserver +``` + +The OnlyOffice instance generates a secreate key which needs to be used to connect to it with Nextcloud. It can be obtained with: + +``` + sudo docker exec d1ec7ca97ae2 /var/www/onlyoffice/documentserver/npm/json -f /etc/onlyoffice/documentserver/local.json 'services.CoAuthoring.secret.session.string' + ``` + + The key for this server is: + ``` + O8usLs2KQSEl9f0Cmj2HraMYn5G8Eju5 + ``` \ No newline at end of file diff --git a/home/server/Wiki.md b/home/server/Wiki.md new file mode 100644 index 0000000..3cf46dd --- /dev/null +++ b/home/server/Wiki.md @@ -0,0 +1,191 @@ +--- +title: Wiki.js +description: Wiki software information +published: true +date: 2024-12-22T11:22:34.479Z +tags: wiki.js +editor: markdown +dateCreated: 2024-12-22T11:13:32.896Z +--- + +# Wiki.js +The wiki.js is setup with postgre SQL to enable better searching functionality then what SQLite could handle. + +All the data and markdown files are stored in the database. +## Installation + +``` +yay -S wiki-js +``` + +### config.yml +This is the configuration file for wiki.js + +``` +####################################################################### +# Wiki.js - CONFIGURATION # +####################################################################### +# Full documentation + examples: +# https://docs.requarks.io/install + +# --------------------------------------------------------------------- +# Port the server should listen to +# --------------------------------------------------------------------- + +port: 3000 + +# --------------------------------------------------------------------- +# Database +# --------------------------------------------------------------------- +# Supported Database Engines: +# - postgres = PostgreSQL 9.5 or later +# - mysql = MySQL 8.0 or later (5.7.8 partially supported, refer to docs) +# - mariadb = MariaDB 10.2.7 or later +# - mssql = MS SQL Server 2012 or later +# - sqlite = SQLite 3.9 or later + +db: + type: postgres + + # PostgreSQL / MySQL / MariaDB / MS SQL Server only: + host: localhost + port: 5432 + user: postgres + pass: Cuernavaca0521 + db: wiki + ssl: false + + # Optional - PostgreSQL / MySQL / MariaDB only: + # -> Uncomment lines you need below and set `auto` to false + # -> Full list of accepted options: https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options + sslOptions: + auto: true + # rejectUnauthorized: false + # ca: path/to/ca.crt + # cert: path/to/cert.crt + # key: path/to/key.pem + # pfx: path/to/cert.pfx + # passphrase: xyz123 + + # Optional - PostgreSQL only: + schema: public + + # SQLite only: + storage: /home/lukas/Drive/wiki-js/database.sqlite + +####################################################################### +# ADVANCED OPTIONS # +####################################################################### +# Do not change unless you know what you are doing! + +# --------------------------------------------------------------------- +# SSL/TLS Settings +# --------------------------------------------------------------------- +# Consider using a reverse proxy (e.g. nginx) if you require more +# advanced options than those provided below. + +ssl: + enabled: false + port: 3443 + + # Provider to use, possible values: custom, letsencrypt + provider: custom + + # ++++++ For custom only ++++++ + # Certificate format, either 'pem' or 'pfx': + format: pem + # Using PEM format: + key: path/to/key.pem + cert: path/to/cert.pem + # Using PFX format: + pfx: path/to/cert.pfx + # Passphrase when using encrypted PEM / PFX keys (default: null): + passphrase: null + # Diffie Hellman parameters, with key length being greater or equal + # to 1024 bits (default: null): + dhparam: null + + # ++++++ For letsencrypt only ++++++ + domain: wiki.yourdomain.com + subscriberEmail: admin@example.com + +# --------------------------------------------------------------------- +# Database Pool Options +# --------------------------------------------------------------------- +# Refer to https://github.com/vincit/tarn.js for all possible options + +pool: + # min: 2 + # max: 10 + +# --------------------------------------------------------------------- +# IP address the server should listen to +# --------------------------------------------------------------------- +# Leave 0.0.0.0 for all interfaces + +bindIP: 0.0.0.0 + +# --------------------------------------------------------------------- +# Log Level +# --------------------------------------------------------------------- +# Possible values: error, warn, info (default), verbose, debug, silly + +logLevel: info + +# --------------------------------------------------------------------- +# Log Format +# --------------------------------------------------------------------- +# Output format for logging, possible values: default, json + +logFormat: default + +# --------------------------------------------------------------------- +# Offline Mode +# --------------------------------------------------------------------- +# If your server cannot access the internet. Set to true and manually +# download the offline files for sideloading. + +offline: false + +# --------------------------------------------------------------------- +# High-Availability +# --------------------------------------------------------------------- +# Set to true if you have multiple concurrent instances running off the +# same DB (e.g. Kubernetes pods / load balanced instances). Leave false +# otherwise. You MUST be using PostgreSQL to use this feature. + +ha: false + +# --------------------------------------------------------------------- +# Data Path +# --------------------------------------------------------------------- +# Writeable data path used for cache and temporary user uploads. +dataPath: ./data + +# --------------------------------------------------------------------- +# Body Parser Limit +# --------------------------------------------------------------------- +# Maximum size of API requests body that can be parsed. Does not affect +# file uploads. + +bodyParserLimit: 5mb +``` + +### systemd +``` +[Unit] +Description=Wiki.js +After=network.target + +[Service] +Type=simple +ExecStart=/usr/bin/node server +Restart=always +# Consider creating a dedicated user for Wiki.js here: +User=root +Environment=NODE_ENV=production +WorkingDirectory=/usr/lib/wiki-js/ + +[Install] +WantedBy=multi-user.target +``` \ No newline at end of file diff --git a/home/server/jellyfin.md b/home/server/jellyfin.md new file mode 100644 index 0000000..b201185 --- /dev/null +++ b/home/server/jellyfin.md @@ -0,0 +1,43 @@ +--- +title: Jellyfin +description: +published: true +date: 2024-12-22T11:07:43.409Z +tags: server, jellyfin +editor: markdown +dateCreated: 2024-11-30T20:26:03.534Z +--- + +# Jellyfin +The Jellyfin is a media server located here and is accessible on the home local network. Jellyfin is used to stream videos and audio on the network. +- Port : 8096 + + +All the contents for the server is installed on the external SSD drive in the following folders: +- Jellyfin - contains metadata for the server▸ +- Shows - contains video series▸ +- Movies - contains movies▸ +- Music - contains music files '▸ +- Podcast - contains podcast files + +## Installation + +Jellyfin consist of both the server and the web interface. Both can be installed with pacman by: +``` +sudo pacman -S jellyfin +``` + +### systemd +``` +[Unit] +Description=Jellyfin Media Server +After=network.target + +[Service] +User=lukas +ExecStart=/usr/bin/jellyfin --webdir /usr/share/jellyfin/web/ +Restart=on-failure + +[Install] +WantedBy=multi-user.target +``` \ No newline at end of file diff --git a/home/server/nextcloud.md b/home/server/nextcloud.md new file mode 100644 index 0000000..8cb74d5 --- /dev/null +++ b/home/server/nextcloud.md @@ -0,0 +1,83 @@ +--- +title: NextCloud +description: NextCloud server used to host files +published: true +date: 2025-01-05T19:22:17.539Z +tags: +editor: markdown +dateCreated: 2025-01-05T16:06:32.021Z +--- + +# Nextcloud + +## Setup +Nextcloud is installed with snap + +``` +sudo snap install nextcloud +``` + + +### Cofig file +The config file located at /var/snap/nextcloud/current/nextcloud/config/config.php: + + +``` + + array ( + 0 => + array ( + 'path' => '/snap/nextcloud/current/htdocs/apps', + 'url' => '/apps', + 'writable' => false, + ), + 1 => + array ( + 'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps', + 'url' => '/extra-apps', + 'writable' => true, + ), + ), + 'supportedDatabases' => + array ( + 0 => 'mysql', + ), + 'memcache.locking' => '\\OC\\Memcache\\Redis', + 'memcache.local' => '\\OC\\Memcache\\Redis', + 'redis' => + array ( + 'host' => '/tmp/sockets/redis.sock', + 'port' => 0, + ), + 'log_type' => 'file', + 'logfile' => '/var/snap/nextcloud/current/logs/nextcloud.log', + 'logfilemode' => 416, + 'maintenance_window_start' => 1, + 'passwordsalt' => 'AMyY0x+9PQcz2QEMzHjzmPpYyY+VSd', + 'secret' => 'pCtYmMwwN0jP6j+JLhTsrvo/Zsli3iaN6bZz8Frew3fiZf9D', + 'trusted_domains' => + array ( + 0 => 'localhost', + 1 => '192.168.1.101', + ), + 'datadirectory' => '/home/lukas/Drive/Nextcloud/data', + 'dbtype' => 'mysql', + 'version' => '30.0.4.1', + 'overwrite.cli.url' => 'http://localhost', + 'dbname' => 'nextcloud', + 'dbhost' => 'localhost:/tmp/sockets/mysql.sock', + 'dbport' => '', + 'dbtableprefix' => 'oc_', + 'mysql.utf8mb4' => true, + 'dbuser' => 'nextcloud', + 'dbpassword' => 'V7H30OQPG6VlM0e13A00qiTzm0dlfA38KgVZYY11sHC4NLRHdHZqIMxmiZYXlXny', + 'installed' => true, + 'instanceid' => 'ocwd62kwirag', + 'maintenance' => false, + 'loglevel' => 2, + 'check_data_directory_permissions' => false, +); + +``` \ No newline at end of file diff --git a/home/server/qBittorrent.md b/home/server/qBittorrent.md new file mode 100644 index 0000000..772d2fa --- /dev/null +++ b/home/server/qBittorrent.md @@ -0,0 +1,29 @@ +--- +title: qBittorrent +description: +published: true +date: 2025-02-09T20:53:10.081Z +tags: +editor: markdown +dateCreated: 2025-02-09T20:48:09.514Z +--- + +# qBittorrent +Web interface to the qBittorrent instance installed on the server + +## Setup +Installed with + +``` +sudo pacman -S qbittorrent-nox +``` + +The systemd service enabled with +``` +systemctl enable qbittorrent-nox@lukas.service +``` + +To login to the user interface the password has to read out from the process stdout +``` +sudo journalctl -u qbittorrent-nox@lukas.service +``` \ No newline at end of file diff --git a/home/server/rustdesk.md b/home/server/rustdesk.md new file mode 100644 index 0000000..22d4b9d --- /dev/null +++ b/home/server/rustdesk.md @@ -0,0 +1,38 @@ +--- +title: Rustdesk +description: +published: true +date: 2025-04-13T11:15:58.375Z +tags: +editor: markdown +dateCreated: 2025-04-13T10:47:36.132Z +--- + +# Rustdesk +[Rustdesk](https://rustdesk.com/) is a tool to remote control computers with its desktop enviroment over a network. + +## Installtion + +```cmd +yay -S rustdesk-bin +``` + +## Setup + +Only peer to peer configuration is setup at the moment. The remote computer that should be controlled needs to: + +- enable IP access +- allow the following port connections + +```cmd +sudo ufw allow 21112:21113/tcp +sudo ufw allow 21115:21118/tcp +sudo ufw allow 21116/udp +sudo ufw reload +``` + +- Setup systemd service to start rustdesk headless on startup at + +```cmd +sudo systemctl enable rustdesk +``` \ No newline at end of file diff --git a/home/server/wireguard.md b/home/server/wireguard.md new file mode 100644 index 0000000..9fae488 --- /dev/null +++ b/home/server/wireguard.md @@ -0,0 +1,125 @@ +--- +title: Wire Guard +description: Configuration for Wire Guard VPN to safely connect to the local network from the internet +published: true +date: 2025-01-05T00:15:00.505Z +tags: +editor: markdown +dateCreated: 2025-01-02T21:40:36.626Z +--- + +# Wine Guard + +## Server Public Key +dcirpeTw5+nAJMsuqmtqIa92N4NFozMiPaIXoj/PbwM= + +## Setup + +### Installtion +``` +sudo pacman -S wireguard-tools +``` + +Inside /etc/wineguard/ generate the private and public keys for the server + +``` +umask 077; wg genkey | tee privatekey | wg pubkey > publickey +``` + +### Setup Client +Each client should be allocated a new IP address in the format 10.0.0.X. +The peers public key is also needed to be added to the config file one the server. +Create a config file, on linux /etc/wireguard/wg0.conf with the following structure: +``` +[Interface] +PrivateKey = +Address = 10.0.0.X/24 + +[Peer] +PublicKey = dcirpeTw5+nAJMsuqmtqIa92N4NFozMiPaIXoj/PbwM= +Endpoint = :41194 +AllowedIPs = 0.0.0.0/0 +``` + +Start the wireguard client with +``` +sudo wg-quick up wg0 +``` + +Terminate the wireguard client with +``` +sudo wg-quick down wg0 +``` + +On linux the wireguard client can be set up with this useful alias in the user .bashrc file +``` +alias vpn='sudo wg-quick up wg0 && sudo ip route add 192.168.1.101 via 10.0.0.1 dev wg0' +``` + + +### Setup Server + +1. Create a file configuration file /etc/wireguard/wg0.conf with the following contents. +The config file needs to be updated with a new peer when a new client needs to be configured. + +``` +[Interface] +## IP address for VPN ## +Address = 10.0.0.1/24 + +## VPN server port ## +ListenPort = 41194 + +## VPN server's private key i.e. /etc/wireguard/privatekey ## +PrivateKey = + +# Firewall settings +PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o enp0s31f6 -j MASQUERADE +PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o enp0s31f6 -j MASQUERADE + +[Peer] +# Public key for Lukas Laptop +PublicKey = ONNwgEwchCb1c2vrBOjIfYP4HuMjpC7AyJkRkEfr8lU= +AllowedIPs = 10.0.0.2/32 + +[Peer] +# Public key for Lukas Mobile +PublicKey = MEZN0+oKD3cv1uOgpvO4fHarUQKKCAGSx4o/podONh4= +AllowedIPs = 10.0.0.3/32 + +``` + +2. Enable port forwarding for IPv4 and IPv6 by edit the /etc/sysctl.d/10-wireguard.conf file +``` +echo 'net.ipv4.ip_forward=1' | sudo tee -a /etc/sysctl.d/10-wireguard.conf +echo 'net.ipv6.conf.all.forwarding=1' | sudo tee -a /etc/sysctl.d/10-wireguard.conf +``` + +3. And then reload the changes +``` +sysctl -p /etc/sysctl.d/10-wireguard.conf +``` + +4. Enable and start as systemd service +``` +sudo systemctl enable wg-quick@wg0 +sudo systemctl start wg-quick@wg0 +``` + +5. Adding a new peer +To add a new peer the config file needs to be uptades with the peers public key. +The the wireguard server needs to be restarted. +``` +sudo wg-quick down wg0 +sudo wg-quick up wg0 +``` + +### Setup Router +The router was set up with the following port forwarding settings + +**Service Name:** WireGuard +**WAN Interface:** default +**Server IP Address:** 192.168.1.101 +**Protocol:** UDP (WireGuard uses UDP). +**External Port Start/End:** 41194 +**Internal Port Start/End:** 41194