configurations/testbed/scripts/deploy0.sh

36 lines
860 B
Bash
Raw Normal View History

2023-04-28 16:39:12 +08:00
#!/bin/bash
set -ex
if [[ "$EUID" != "0" ]]; then
echo "Please run as root."
exit 1
fi
# root dotfiles
export http_proxy=http://192.168.16.118:8118 https_proxy=$http_proxy
apt update
apt install -y git vim zsh tmux
curl dotfiles.cn | bash -s - -al
chsh -s /bin/zsh
# ssh
sed -i "s/#Port 22/Port 12022/" /etc/ssh/sshd_config
sed -i "s/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0:12022/" /etc/ssh/sshd_config
systemctl restart ssh
# ufw
ufw allow 12022
ufw allow from 192.168.16.0/24
ufw default deny
ufw enable
# disable nouveau
bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf
update-initramfs -u
echo "will reboot in 10 seconds... press ctrl-c to cancel."
sleep 10
reboot