Remove notes. Notes are now in the "website" repository

This commit is contained in:
RealStickman 2020-11-16 19:46:36 +01:00
parent 3da26b0f02
commit 1aa5405726
15 changed files with 0 additions and 789 deletions

View File

@ -1,34 +0,0 @@
# Nginx Setup
[Original video this guide is based on.](https://youtu.be/OWAqilIVNgE)
## Walkthrough
Install programs
```
apt install nginx certbot python-certbot-nginx
```
Available site configs can be found under /etc/nginx/sites-available/
To activate a config symbolic link it to /etc/nginx/sites-enabled/
```
ln -s /etc/nginx/sites-available/[config] /etc/nginx/sites-enabled/
```
Create directory in /var/www/[site] and create an index.html file for basic functionality.
To set up https run
```
certbot --nginx
```
Automatic cert renewal
```
crontab -e
```
In crontab enter the following line
```
1 1 1 * * certbot renew
```

View File

@ -1,223 +0,0 @@
# Arch Installation
## Keyboard layout
```bash
loadkeys de_CH-latin1
```
## Check UEFI mode
If the following command works, the system is booted in EFI.
```bash
ls /sys/firmware/efi/efivars
```
## Verify internet connection
```bash
ping realstickman.net
```
## Update system clock
```bash
timedatectl set-ntp true
```
## Creating partitions
```bash
cfdisk
```
## Format partitions
Fat 32:
```bash
mkfs.fat -F32 /dev/(partition)
```
Ext4:
```bash
mkfs.ext4 /dev/(partition)
```
btrfs:
```bash
mkfs.btrfs /dev/(partition)
```
## Mounting partitions
Generally partitions have to be mounted where you will later use them in your system.
Root: /mnt
EFI: /mnt/boot or /mnt/efi
Home: /mnt/home
## Creating swapfile
*Not applicable to btrfs*
```bash
dd if=/dev/zero of=/mnt/swapfile bs=1M count=(size) status=progress
```
*Swapfile in btrfs*
```bash
truncate -s 0 /mnt/swapfile
```
```bash
chattr +C /mnt/swapfile
```
```bash
btrfs property set /mnt/swapfile compression none
```
```bash
fallocate -l (size)M /mnt/swapfile
```
*Initialising swapfile*
```bash
chmod 600 /mnt/swapfile
```
```bash
mkswap /mnt/swapfile
```
```bash
swapon /mnt/swapfile
```
## Essential packages
Some things like the userspace utilities for file management will vary.
See [file systems](https://wiki.archlinux.org/index.php/File_systems#Types_of_file_systems)
```bash
pacstrap /mnt base linux linux-firmware vim git openssh networkmanager network-manager-applet dialog base-devel linux-headers
```
### Wifi
```bash
pacstrap /mnt wpa_supplicant
```
### Packages needed for file systems
Fat32:
```bash
dosfstools mtools
```
Ext4:
```bash
e2fsprogs
```
btrfs:
```bash
btrfs-progs
```
## Generate fstab
```bash
genfstab -U /mnt >> /mnt/etc/fstab
```
IMPORTANT: Make sure the fstab file has everything included
## Chroot into the system
`arch-chroot /mnt`
## Set timezone
`ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime`
## Set hardware clock
`hwclock --systohc`
## Set locale
`vim /etc/locale.gen`
Uncomment the locales that should be generated.
Make sure to use a UTF-8 entry.
`locale-gen`
Edit `/etc/locale.conf` and set `LANG=(locale)`.
`LANG=de_CH.UTF-8`
## Set keymap permanently
`vim /etc/vconsole.conf`
`KEYMAP=de_CH-latin1`
## Set hostname
Edit `/etc/hostname`
`(hostname)`
Edit `/etc/hosts`
```
127.0.0.1 localhost
::1 localhost
127.0.1.1 (hostname).localdomain (hostname)
```
## Change root password
`passwd`
## Bootloader installation
### GRUB
```bash
pacman -S grub efibootmgr
```
```bash
grub-install --target=x86_64-efi --efi-directory=(efi partition mountpoint) --bootloader-id=GRUB
```
```bash
grub-mkconfig -o /boot/grub/grub.cfg
```
### systemd-boot
### rEFInd
## Networking
`systemctl enable NetworkManager`
## Add user
`useradd -mG wheel (user)`
Set password
`passwd (user)`
### Enable sudo
`visudo`
Uncomment `%wheel ALL=(ALL) ALL`
## Finishing installation
`exit`
`poweroff`
Remove the installation cd
## Install AUR helper
### yay
*Currently has build errors*
*Use paru instead*
```bash
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
```
### paru
```bash
git clone https://aur.archlinux.org/paru.git
cd paru
makepkg -si
```
## Windows in GRUB
It can happen that windows does not show up in the GRUB menu.
Use the following commands to update grub.
```bash
sudo os-prober
```
```bash
sudo grub-mkconfig -o /boot/grub/grub.cfg
```

View File

@ -1,7 +0,0 @@
# Putty
**Important: Putty has to be executed as root, otherwise it won't work**
1. Find proper serial port using `ls /dev | grep tty` or `ls -l /sys/class/tty`
2. Connect to it using `sudo putty /dev/<port> -serial -sercfg <baud rate>,8,n,1,N`

View File

@ -1,77 +0,0 @@
# emacs shortcuts to remember
## Minimap
`SPC t m`
## Dired
Provides directory view
Create new directory within the current directory
`Shift +`
Create new file in current directory
`SPC . <enter new file name>`
Delete files or directories
`d`, `x`
Unselect
`u`
## Treemacs
Toggle view of directory structure of the current project on the side.
`SPC o p`
## Term
Open terminal
`SPC o t`
## Window management
Open window right of current window
`SPC w v`
Open window below current window
`SPC w s`
Move to other windows
`SPC h/j/k/l`
## Buffers
Open recent within the same project buffers
`SPC b b`
`SPC ,`
Remove buffers
`SPC b k`
Open new empty buffer
`SPC b N`
Save buffer
`SPC b s`
## Quickly move to start/end of a document
Start of document
`gg`
End of document
`G`
# Evil Snipe
Move to next occurence of one letter
`f (letter)`
Move to previous occurence of one letter
`F (letter)`
`;` continue in that direction
`,` go in the opposite direction
`s (letter)` or `S (letter)` for occurences of two letters

View File

@ -1,38 +0,0 @@
# Git SSH keys
Create a new ssh key.
```bash
ssh-keygen -t rsa -b 4096 -C "<name>"
```
Change into the BASH shell and enter the next two commands in there
```bash
eval "$(ssh-agent -s)"
```
```bash
ssh-add <path to private key file>
```
Add the public key to the github/gitlab profile.
Set the ssh keyfile in $HOME/.ssh/config. Make sure to edit with sudo privileges.
For github:
```
Host github.com
IdentityFile <path to private key file>
```
For gitlab:
```
Host gitlab.com
IdentityFile <path to private key file>
```
Make sure to clone all projects through the ssh address instead of https.
```bash
git clone <repository ssh address>
```

View File

@ -1,7 +0,0 @@
# SCP
**Example copy of movies from local pc to server**
```bash
scp -r /mnt/1d90c4d5-21d2-4455-bb4a-814de8496744/MediaLibrary/Movies/ root@144.76.31.55:/home/jellyfin/
```

View File

@ -1,146 +0,0 @@
# Powershell scripting
Use PowerShell ISE to develop PowerShell scripts
## Comparison operators
| operator | description |
| -------- | ----------- |
| -eq | equals |
| -ne | not equals |
| -gt | greather than |
| -ge | greater or equals to |
| -lt | less than |
| -le | less or equals to |
## Arrays
Initialise arrays like this:
```
$(arrayname) = @("item1", "item2", "item3")
```
There are two methods for looping over arrays:
**Method 1**
```
foreach ($(itemname) in $(arrayname)) {
(command)
//To get the item from the array use $(itemname)
}
```
**Method 2**
```
for ($i = 0; $i -lt $(arrayname).count; $i++) {
(command)
//To get the item from the array use $(arrayname)[$i]
}
```
## Operations in the filesystem
Test whether a file or directory exists
```
Test-Path "(path)"
```
### files
Create a new file
```
New-Item -Path "(filepath)" -ItemType File
```
Remove a file
```
Remove-Item "(filepath)"
```
Set file content
```
Set-Content "(filepath)" ("(content)")
```
Example using multiple lines
```
Set-Content "C:\temp\test.txt" ("This is a very complex sentence. " + "`r`n" + "This sentence should be on the second line.")
```
Apend content to a file
```
Add-Content "(filepath)" ("(content)")
```
Show a file's content
```
Get-Content "(filepath)"
```
### directories
Create new directory
```
New-Item -Path "(directorypath)" -ItemType Directory
```
Remove directory including contained files
```
Remove-Item "(directorypath)" -Recurse
```
Copy directory
```
Copy-Item "(inputpath)" -Recurse "(destinationpath)"
```
## Remoting
Documentation:
[Powershell Remoting](https://docs.microsoft.com/en-us/powershell/scripting/learn/ps101/08-powershell-remoting?view=powershell-7.1#one-to-many-remoting)
[Running Remote Commands](https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/running-remote-commands?view=powershell-7.1)
### Allow recieving remote commands
Run as Administrator
IMPORTANT: Network must not be set to public
```
Enable-PSRemoting
```
### Add to trusted list
Clients have to be added to the trusted list if there are no other authentication methods used.
Multiple clients can be added when separated by commas.
*Note: The command below overwrites every other value set in "trustedhosts".*
```
Set-Item WSMan:localhost\client\trustedhosts -value '(ip address/hostname)'
```
Example:
```
Set-Item WSMan:localhost\client\trustedhosts -value '192.168.1.117,win10-2-lin,192.168.1.118,win10-3-lin'
```
### Run command on multiple remote pcs
```
Invoke-Command -ComputerName (pc1), (pc2) -ScriptBlock {(command)}
```
```
Invoke-Command -ComputerName (pc1), (pc2) -ScriptBlock {(command1)
(command2)}
```
Example for issuing multiple commands after each other:
">>" is added automatically on newline
```
Invoke-Command -ComputerName win10-2-lin, win10-3-lin -ScriptBlock {cd c:\Users\admin
>> New-Item "test.txt" -ItemType File}
```
### Run script on multiple remote pcs
```
Invoke-Command -ComputerName (pc1), (pc2) -FilePath 'path\to\script'
```

View File

@ -1,13 +0,0 @@
# python building for pypi
Create a setup.py file.
Execute in main program directory.
```bash
python setup.py bdist_wheel sdist
```
Upload to pypi
```bash
twine upload --skip-existing dist/*
```

View File

@ -1,8 +0,0 @@
# Add buster backports
*All commands assume being logged in as root user on the server unless noted otherwise.*
Appends the appropriate line to the apt sources list.
```bash
echo 'deb http://deb.debian.org/debian buster-backports main contrib non-free' >> /etc/apt/sources.list
```

View File

@ -1,10 +0,0 @@
# Fix the terminal
*All commands assume being logged in as root user on the server unless noted otherwise.*
Appends the fix for termite to the .bashrc file. (run from home directory)
```bash
echo 'export TERM=xterm-color' >> .bashrc
```

View File

@ -1,35 +0,0 @@
# Jellyfin
*All commands assume being logged in as root user on the server unless noted otherwise.*
```bash
apt install apt-transport-https lsb-release
```
```bash
wget -O key https://repo.jellyfin.org/debian/jellyfin_team.gpg.key
```
```bash
apt-key add key
```
```bash
echo "deb [arch=$( dpkg --print-architecture )] https://repo.jellyfin.org/debian $( lsb_release -c -s ) main" | tee /etc/apt/sources.list.d/jellyfin.list
```
```bash
apt update
```
```bash
apt install jellyfin
```
Depending on the init system, different commands have to be used.
```bash
service jellyfin status
```
```bash
systemctl status jellyfin
```

View File

@ -1,101 +0,0 @@
# Nextcloud installation
*All commands assume being logged in as root user on the server unless noted otherwise.*
Installing required packages
```bash
apt install mlocate apache2 libapache2-mod-php mariadb-client mariadb-server wget unzip bzip2 curl php php-common php-curl php-gd php-mbstring php-mysql php-xml php-zip php-intl php-apcu php-redis php-http-request
```
## Set up the database
Just press enter when asked for a root password this time, as it has not yet been set.
```bash
mysql -u root -p
```
The command prompt should have changed to something similar to `MariaDB [(none)]>`
```mysql
CREATE DATABASE nextcloud;
```
```mysql
GRANT ALL ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY '<password>';
```
```mysql
FLUSH PRIVILEGES;
```
Exit the MariaDB prompt.
```mysql
\q
```
## Nextcloud installation
Change into the /var/www directory.
Download the latest Nextcloud version (19.0.2 at the time of writing).
```bash
wget https://download.nextcloud.com/server/releases/nextcloud-<version>.zip
```
Unzip Nextcloud
```bash
unzip nextcloud-<version>
```
Change owner and group of the nextcloud directory.
```bash
chown -Rfv www-data:www-data nextcloud
```
Create the apache2 site configuration for Nextcloud.
```bash
vi /etc/apache2/sites-available/nextcloud.conf
```
Copy this configuration into the newly created file.
```
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/nextcloud
Alias /nextcloud "/var/www/nextcloud/"
<Directory "/var/www/nextcloud/">
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
Require all granted
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
</Directory>
ErrorLog ${APACHE_LOG_DIR}/nextcloud_error_log
CustomLog ${APACHE_LOG_DIR}/nextcloud_access_log common
</VirtualHost>
```
Enable the nextcloud config and disable the default config.
```bash
a2ensite nextcloud.conf && a2dissite 000-default.conf
```
```bash
systemctl restart apache2 && systemctl status apache2
```
Final configuration has to be done in the Nextcloud webinterface.
## HTTPS setup

View File

@ -1,49 +0,0 @@
# ssh
*All commands assume being logged in as root user on the server unless noted otherwise.*
```bash
apt install openssh-server
```
```bash
systemctl enable ssh
```
Permit root login (will be restricted again later).
```bash
vi /etc/ssh/sshd_config
```
Find `PermitRootLogin without-password` and change it to `PermitRootLogin yes`. Remove the `#` in front of it if there is one.
```bash
systemctl restart ssh
```
## Add ssh-keys
*This command has to be run from the computer you want to have ssh access through keys later.*
```bash
ssh-copy-id -i <file location> <user>@<ip/domain>
```
In <file location> the location of the ssh public keys has to be inserted. The default is ~/.ssh/id_rsa.pub.
In case you have not yet created an ssh-key, run the following command.
```bash
ssh-keygen
```
To create ed25519 keys, execute the following command.
```bash
ssh-keygen -t ed25519
```
## Disable password access
```bash
vi /etc/ssh/sshd_config
```
Find `PasswordAuthentication yes` and change it to `PasswordAuthentication no`. Remove the `#` in front of it if there is one.
```bash
systemctl restart ssh
```

View File

@ -1,36 +0,0 @@
# Installing
## git
Go to the [git homepage](https://git-scm.com/) and install it.
## emacs
Go to the [emacs homepage](https://www.gnu.org/software/emacs/) and install it.
Add the `<location>\emacs\x86_84\bin` directory to your PATH in the environment variables.
### Shortcut
Create a shortcut to `<location>\emacs\x86_64\bin\runemacs.exe`
Edit the shortcut to execute in your home directory `C:\Users\<user>`
## HOME
Add the path to your home to the environment variables.
New variable -> HOME -> `C:\Users\<user>`
## doom-emacs
Open git bash
```bash
git clone --depth 1 https://github.com/hlissner/doom-emacs ~/.emacs.d
```
```bash
~/.emacs.d/bin/doom install
```
Add `C:\Users\<user>\.emacs.d\bin` to your PATH.
*Currently doesn't show emotes*
*Missing ripgrep and fd*

View File

@ -1,5 +0,0 @@
# Youtube-dl
Download [youtube-dl](https://youtube-dl.org/)
Add the directory where youtube-dl is located to your PATH.