error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
apt install python3-venv
python3 -m venv myenv
source myenv/bin/activate
systemctl list-unit-files --type=service --state=enabled
systemctl is-enabled name
On Debian, iptables is a command-line utility for configuring packet filtering, NAT, and firewall rules. Since Debian 10 (Buster), the default backend is nftables via the iptables-nft compatibility layer, but you can still use the traditional syntax.
Installing iptables
If not already installed:
sudo apt update
sudo apt install iptables -y
You can check the current rules with:
sudo iptables -L
This lists the INPUT, FORWARD, and OUTPUT chains with their policies and rules .
Adding Rules
To allow incoming SSH traffic on port 22:
sudo iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT
To allow HTTP/HTTPS:
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
To drop all other inbound traffic:
sudo iptables -A INPUT -j REJECT
sudo iptables -A FORWARD -j REJECT
You can view detailed rules with:
sudo iptables -L -n -v
Saving Rules Permanently
By default, iptables rules are lost after reboot. To persist them:
Using iptables-persistent package:
sudo apt install iptables-persistent
sudo sh -c '/sbin/iptables-save > /etc/iptables/rules.v4'
sudo sh -c '/sbin/ip6tables-save > /etc/iptables/rules.v6'
Ensure the service is enabled:
sudo systemctl enable netfilter-persistent.service
Manual restore on boot: Create /etc/network/if-pre-up.d/iptables:
#!/bin/sh
/sbin/iptables-restore < /etc/iptables.up.rules #/etc/iptables/rules.v4 可以注释不用也不影响
Make it executable:
sudo chmod +x /etc/network/if-pre-up.d/iptables
Switching Between nftables and Legacy
If you need legacy iptables instead of nftables backend:
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
Switch back to nftables:
sudo update-alternatives --set iptables /usr/sbin/iptables-nft
Tip: Always test new firewall rules in a separate SSH session to avoid locking yourself out.
一、编辑/etc/vim/vimrc.tiny
由于/etc/vim/vimrc.tiny的拥有者是root用户,所以要在root的权限下对这个文件进行修改。方法很简单:可以输入命令“su”,然后键入密码获得root权限,然后对文件进行修改;或者输入命令“sudo vi/etc/vim/vimrc.tiny”,输入密码后直接对文件进行编辑。
至于编辑的内容也是超级简单:vimrc.tiny文件中的倒数第二句话是“set compatible”,
将“compatible”改为“nocompatible”,这样非兼容模式就可以解决方向键变ABCD的问题了。
二、set backspace=2
那么接下来要解决Backspace键的问题也非常简单,就在刚才那句话的后面加一句:
set backspace=2
即:
set nocompatible
set backspace=2
ls时目录文件均没有颜色
~/.bashrc
alias ls='ls --color=auto'
vim /etc/vim/vimrc
取消“syntax on”的注释
或
cat .vimrc
syntax on
colorscheme desert
没有主题或颜色或没有vim,apt install vim