SSH 連線

ssh-keygen -t rsa -b 4096 -C "[email protected]"
ssh [email protected]_ip

新增使用者

adduser your_username
adduser your_username sudo
exit
ssh-copy-id [email protected]_ip
ssh [email protected]_ip

修改 SSH 設定

sudo vim /etc/ssh/sshd_config
#----------------------------------
PermitRootLogin no
PasswordAuthentication no
#----------------------------------
sudo systemctl restart sshd
exit
# Test root login configuration
ssh [email protected]_ip

更新

sudo apt update && sudo apt upgrade -y && sudo reboot

安裝 docker

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
exit
ssh [email protected]_ip
sudo docker --version

安裝 Docker Compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo docker-compose --version

ufw

sudo ufw status
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw enable
sudo ufw status verbose

安裝 Fail2ban

sudo apt install fail2ban

設定 unattended-upgrades:

Reference