# dns
sed 's/#DNS=/DNS=223.5.5.5 223.6.6.6/g' -i /etc/systemd/resolved.conf
systemctl restart systemd-resolved.service

# apt
sed 's/security.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' -i /etc/apt/sources.list.d/ubuntu.sources
sed 's/cn.archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' -i /etc/apt/sources.list.d/ubuntu.sources

apt update
apt install vim curl wget psmisc tree tcpdump lrzsz fping unzip screen htop btop iotop iftop git rsync gcc bash-completion make ca-certificates curl jq vim wget net-tools python-is-python3 -y

# time
apt install systemd-timesyncd -y
sed 's/#NTP=/NTP=ntp.aliyun.com/g' -i /etc/systemd/timesyncd.conf
systemctl restart systemd-timesyncd.service

# pip
apt install python3-full python3-pip python-is-python3 -y
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
mv /root/.config/pip/pip.conf /etc/

# ssh
sed 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' -i /etc/ssh/sshd_config
sed 's/#PasswordAuthentication yes/PasswordAuthentication yes/g' -i /etc/ssh/sshd_config
systemctl restart ssh.service

# disable upgrade
sudo systemctl stop apt-daily.service
sudo systemctl disable apt-daily.service
sudo systemctl stop apt-daily-upgrade.timer
sudo systemctl disable apt-daily-upgrade.timer

# ansible
# apt install python3-pip -y
pip3 install ansible --break-system-packages

# container
apt install docker.io docker-compose -y

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://ghihfm4j.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload

# clean
apt clean all
history -c
