157 lines
5.4 KiB
Markdown
157 lines
5.4 KiB
Markdown
# 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/
|