Linux: Porovnání verzí
(→NeoVim/NvChad) |
(→NeoVim/NvChad) |
||
(Není zobrazeno 14 mezilehlých verzí od stejného uživatele.) | |||
Řádka 2: | Řádka 2: | ||
=== Základní balíčky === | === Základní balíčky === | ||
sudo apt update | sudo apt update | ||
− | sudo apt install htop ssh sudo wget curl git net-tools | + | sudo apt install htop ssh sudo wget curl git net-tools psmisc |
+ | |||
+ | === Vypnutí IPv6 === | ||
+ | Editace systémému pro vypnutí IPv6 | ||
+ | sudo nano /etc/sysctl.conf | ||
+ | |||
+ | net.ipv6.conf.all.disable_ipv6 = 1 | ||
+ | net.ipv6.conf.default.disable_ipv6 = 1 | ||
+ | net.ipv6.conf.lo.disable_ipv6 = 1 | ||
+ | |||
+ | Vypnutí IPv6 pro ssh | ||
+ | sudo nano /etc/ssh/sshd_config | ||
+ | |||
+ | AddressFamily inet | ||
+ | |||
+ | Vypnutí IPv6 pro ufw | ||
+ | sudo nano /etc/default/ufw | ||
+ | |||
+ | IPV6=no | ||
+ | |||
+ | * https://www.techrepublic.com/article/how-to-disable-ipv6-on-linux/ | ||
+ | * https://superuser.com/questions/326798/unable-to-close-sshd-on-ipv6-tcp-port | ||
+ | * https://www.lightnetics.com/topic/18604/how-do-i-enable-or-disable-ipv6-on-ubuntu-ufw-netfilter-firewall | ||
=== Firewall & antivirus === | === Firewall & antivirus === | ||
sudo apt update | sudo apt update | ||
− | sudo apt install clamav | + | sudo apt install clamav clamav-daemon ufw |
Povolení SSH portu pro ufw | Povolení SSH portu pro ufw | ||
− | ufw allow ssh | + | sudo ufw allow ssh |
− | ufw enable | + | sudo ufw enable |
+ | |||
+ | Zapnutí clamav-deamon | ||
+ | sudo systemctl enable clamav-daemon | ||
+ | sudo systemctl start clamav-daemon | ||
+ | |||
+ | Zapnutí clamav-freshclam | ||
+ | sudo systemctl enable clamav-freshclam.service | ||
+ | sudo systemctl start clamav-freshclam.service | ||
* https://wiki.mikrotik.com/wiki/Use_Mikrotik_as_Fail2ban_firewall | * https://wiki.mikrotik.com/wiki/Use_Mikrotik_as_Fail2ban_firewall | ||
Řádka 16: | Řádka 46: | ||
== Balíčky pro usnadnění práce == | == Balíčky pro usnadnění práce == | ||
sudo apt update | sudo apt update | ||
− | sudo apt install fzf ncdu dos2unix | + | sudo apt install fzf ncdu dos2unix iftop |
* '''fzf''' - Fuzzy finder better find | * '''fzf''' - Fuzzy finder better find | ||
Řádka 24: | Řádka 54: | ||
* '''ll''' - Je to ls -l, musí se vytvořit alias | * '''ll''' - Je to ls -l, musí se vytvořit alias | ||
− | == Vypnutí swap == | + | == Swap == |
− | Vypnutí swap | + | === Vypnutí swap === |
− | sudo swapoff -a | + | Identifikace swap oddílu |
+ | cat /proc/swaps | ||
+ | Vypnutí swap | ||
+ | sudo swapoff -a | ||
+ | Odkaz na smazání swap oddílu | ||
+ | sudo nano /etc/fstab | ||
+ | === Zapnutí swap === | ||
+ | Zapnutí swap | ||
+ | sudo swapon -a | ||
+ | |||
+ | == Guest tool pro Xen server == | ||
+ | Nainstalování xen guest tool pro linux systém | ||
+ | curl -sfL https://github.com/clazzor/Xen-guest-autoinstall/releases/download/latest/autoinstall.sh | bash - | ||
== Instalace pip3 == | == Instalace pip3 == | ||
Řádka 32: | Řádka 74: | ||
sudo apt install python3-pip | sudo apt install python3-pip | ||
+ | == PS - Process Status == | ||
+ | Process state codes | ||
+ | D uninterruptible sleep (usually IO) | ||
+ | I Idle kernel thread | ||
+ | R running or runnable (on run queue) | ||
+ | S interruptible sleep (waiting for an event to complete) | ||
+ | T stopped by job control signal | ||
+ | t stopped by debugger during the tracing | ||
+ | W paging (not valid since the 2.6.xx kernel) | ||
+ | X dead (should never be seen) | ||
+ | Z defunct ("zombie") process, terminated but not reaped by its parent | ||
+ | |||
+ | Věci navíc ke kódům | ||
+ | < high-priority (not nice to other users) | ||
+ | N low-priority (nice to other users) | ||
+ | L has pages locked into memory (for real-time and custom IO) | ||
+ | s is a session leader | ||
+ | l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do) | ||
+ | + is in the foreground process group | ||
+ | |||
+ | * https://askubuntu.com/questions/360252/what-do-the-stat-column-values-in-ps-mean | ||
== TUI & CLI == | == TUI & CLI == | ||
=== ZSH === | === ZSH === | ||
Řádka 54: | Řádka 117: | ||
==== Problém s mc ==== | ==== Problém s mc ==== | ||
− | MC blbné s zsh kvůli | + | MC blbné s zsh kvůli novém shellu, načítá se dlouho, tohle jde vyřešit aliasem v '''.zshrc''' |
Další možnost je použít NNN | Další možnost je použít NNN | ||
* viz: https://graffino.com/til/ZLcOA4Zcaq-fix-slow-loading-or-freezing-midnight-commander-mc-with-zsh | * viz: https://graffino.com/til/ZLcOA4Zcaq-fix-slow-loading-or-freezing-midnight-commander-mc-with-zsh | ||
Řádka 62: | Řádka 125: | ||
=== NeoVim/NvChad === | === NeoVim/NvChad === | ||
==== Instalace ==== | ==== Instalace ==== | ||
− | curl - | + | Stáhnutí a nainstalování NeoVimu do /usr/bin |
+ | sudo curl -Lo /tmp/nvim-linux64.tar.gz https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz | ||
+ | sudo tar -C /opt -xzf /tmp/nvim-linux64.tar.gz | ||
+ | sudo rm /tmp/nvim-linux64.tar.gz | ||
+ | sudo ln -s /opt/nvim-linux64/bin/nvim /usr/bin/nvim | ||
− | + | Nainstalování balíčku pro kompilaci programovací jazyků, potřebuje NvChad | |
− | sudo | + | sudo apt update -y |
− | sudo | + | sudo apt install build-essential -y |
+ | Nainstalovíní pluginu NvChad | ||
git clone https://github.com/NvChad/NvChad ~/.config/nvim --depth 1 && nvim | git clone https://github.com/NvChad/NvChad ~/.config/nvim --depth 1 && nvim | ||
+ | Poté je potřeba doinstalovat zbytek pluginu pomocí příkazu v NeoVimu | ||
+ | ESC -> SHIFT+: -> MasonInstallAll | ||
− | * https:// | + | Dále je potřeba pro zobrazení ikon doinstalovat nerd font https://www.nerdfonts.com/font-downloads doporučeno '''CaskaydiaCove Nerd Font''' <br /> |
− | * https:// | + | A také nastavit správně zobrazení barev, více zde https://gist.github.com/andersevenrud/015e61af2fd264371032763d4ed965b6 |
+ | |||
+ | * https://github.com/neovim/neovim/blob/master/INSTALL.md | ||
+ | * https://nvchad.com/docs/features | ||
* https://docs.rockylinux.org/books/nvchad/install_nvchad/ | * https://docs.rockylinux.org/books/nvchad/install_nvchad/ | ||
− | |||
=== NNN === | === NNN === | ||
==== Instalace ==== | ==== Instalace ==== | ||
Řádka 88: | Řádka 160: | ||
* https://github.com/jarun/nnn | * https://github.com/jarun/nnn | ||
+ | * https://www.youtube.com/watch?v=-knZwdd1ScU&t=353s | ||
+ | * https://github.com/jarun/nnn/tree/master/plugins#installation | ||
+ | * https://github.com/jarun/nnn/wiki/Usage#configuration | ||
+ | * https://github.com/jarun/nnn/wiki/Troubleshooting#tmux-configuration | ||
+ | * https://github.com/jarun/nnn/wiki/Basic-use-cases#configure-cd-on-quit | ||
+ | * https://github.com/jarun/nnn/wiki/Live-previews | ||
+ | * https://github.com/luukvbaal/nnn.nvim |
Aktuální verze z 21. 9. 2024, 13:52
Obsah
První nastavení serveru
Základní balíčky
sudo apt update sudo apt install htop ssh sudo wget curl git net-tools psmisc
Vypnutí IPv6
Editace systémému pro vypnutí IPv6
sudo nano /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1
Vypnutí IPv6 pro ssh
sudo nano /etc/ssh/sshd_config
AddressFamily inet
Vypnutí IPv6 pro ufw
sudo nano /etc/default/ufw
IPV6=no
- https://www.techrepublic.com/article/how-to-disable-ipv6-on-linux/
- https://superuser.com/questions/326798/unable-to-close-sshd-on-ipv6-tcp-port
- https://www.lightnetics.com/topic/18604/how-do-i-enable-or-disable-ipv6-on-ubuntu-ufw-netfilter-firewall
Firewall & antivirus
sudo apt update sudo apt install clamav clamav-daemon ufw
Povolení SSH portu pro ufw
sudo ufw allow ssh sudo ufw enable
Zapnutí clamav-deamon
sudo systemctl enable clamav-daemon sudo systemctl start clamav-daemon
Zapnutí clamav-freshclam
sudo systemctl enable clamav-freshclam.service sudo systemctl start clamav-freshclam.service
Balíčky pro usnadnění práce
sudo apt update sudo apt install fzf ncdu dos2unix iftop
- fzf - Fuzzy finder better find
- ncdu - NCurses disk usage better du
- dos2unix - Smaže divný ^M ze souboru
- ll - Je to ls -l, musí se vytvořit alias
Swap
Vypnutí swap
Identifikace swap oddílu
cat /proc/swaps
Vypnutí swap
sudo swapoff -a
Odkaz na smazání swap oddílu
sudo nano /etc/fstab
Zapnutí swap
Zapnutí swap
sudo swapon -a
Guest tool pro Xen server
Nainstalování xen guest tool pro linux systém
curl -sfL https://github.com/clazzor/Xen-guest-autoinstall/releases/download/latest/autoinstall.sh | bash -
Instalace pip3
sudo apt update sudo apt install python3-pip
PS - Process Status
Process state codes
D uninterruptible sleep (usually IO) I Idle kernel thread R running or runnable (on run queue) S interruptible sleep (waiting for an event to complete) T stopped by job control signal t stopped by debugger during the tracing W paging (not valid since the 2.6.xx kernel) X dead (should never be seen) Z defunct ("zombie") process, terminated but not reaped by its parent
Věci navíc ke kódům
< high-priority (not nice to other users) N low-priority (nice to other users) L has pages locked into memory (for real-time and custom IO) s is a session leader l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do) + is in the foreground process group
TUI & CLI
ZSH
Instalace
sudo apt update sudo apt install zsh
Pro přenastavení BASH na ZSH pro účet
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Pluginy a vzhled
Stáhnutí
Stáhnutí theme a plugins
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Konfigurace
Propojení theme a plugins v configu .zshrc
ZSH_THEME="powerlevel10k/powerlevel10k" plugins=(git nomad zsh-autosuggestions zsh-syntax-highlighting)
Problém s mc
MC blbné s zsh kvůli novém shellu, načítá se dlouho, tohle jde vyřešit aliasem v .zshrc Další možnost je použít NNN
- viz: https://graffino.com/til/ZLcOA4Zcaq-fix-slow-loading-or-freezing-midnight-commander-mc-with-zsh
alias mc="mc --nosubshell"
NeoVim/NvChad
Instalace
Stáhnutí a nainstalování NeoVimu do /usr/bin
sudo curl -Lo /tmp/nvim-linux64.tar.gz https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz sudo tar -C /opt -xzf /tmp/nvim-linux64.tar.gz sudo rm /tmp/nvim-linux64.tar.gz sudo ln -s /opt/nvim-linux64/bin/nvim /usr/bin/nvim
Nainstalování balíčku pro kompilaci programovací jazyků, potřebuje NvChad
sudo apt update -y sudo apt install build-essential -y
Nainstalovíní pluginu NvChad
git clone https://github.com/NvChad/NvChad ~/.config/nvim --depth 1 && nvim
Poté je potřeba doinstalovat zbytek pluginu pomocí příkazu v NeoVimu
ESC -> SHIFT+: -> MasonInstallAll
Dále je potřeba pro zobrazení ikon doinstalovat nerd font https://www.nerdfonts.com/font-downloads doporučeno CaskaydiaCove Nerd Font
A také nastavit správně zobrazení barev, více zde https://gist.github.com/andersevenrud/015e61af2fd264371032763d4ed965b6
- https://github.com/neovim/neovim/blob/master/INSTALL.md
- https://nvchad.com/docs/features
- https://docs.rockylinux.org/books/nvchad/install_nvchad/
NNN
Instalace
sudo apt update sudo apt install nnn
Pro plugin preview-tui potřebujeme tmux
sudo apt install tmux
Pro aktualizaci/stažení pluginu:
sh -c "$(curl -Ls https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs)"
- https://github.com/jarun/nnn
- https://www.youtube.com/watch?v=-knZwdd1ScU&t=353s
- https://github.com/jarun/nnn/tree/master/plugins#installation
- https://github.com/jarun/nnn/wiki/Usage#configuration
- https://github.com/jarun/nnn/wiki/Troubleshooting#tmux-configuration
- https://github.com/jarun/nnn/wiki/Basic-use-cases#configure-cd-on-quit
- https://github.com/jarun/nnn/wiki/Live-previews
- https://github.com/luukvbaal/nnn.nvim