ubuntu22.sh 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # fixed
  2. sed -i 's/#$nrconf{restart} = '\"'\"'i'\"'\"';/$nrconf{restart} = '\"'\"'a'\"'\"';/g' /etc/needrestart/needrestart.conf
  3. sed -i "s/#\$nrconf{kernelhints} = -1;/\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf
  4. sudo DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y
  5. mkdir /root/.ssh
  6. cat > /root/.ssh/id_rsa.pub << EOF
  7. ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDB60cDQjWkBl5hKvQc53mtKSnfEKKCQc5vCq4SRgiseZ+DjYSCHshUHsVW7RtzMMllv3iTTOKcWjkLPxSs7mfTWfMac6LVuMIungsC/Sp1MUwVdzz/9T0geTx0tpuIS+5FCw/iuqJKe31ucaF0UJMUBWRPvMjc5UXAMqKPaSrtTb98sE0398eRWYSa7xrho8y0lWepp5i7fG1fKmRZE4i/yKTtLsPLKhgwvuPgsD+E+fhAmT2zEHZKZ/LRhnfBiB4Pli4aoFV85p7Q9PXwQ+4SsNhA8aYeGLtneVkfWNOSb6xbek7Uz+PN2k5s2gAckZKXVrubgCqZtF+U9aHmwEJYwsbITeB1ZiyRnYDRJ13PKBooV1NftppGUTtnOWqpKtNnztuYQimXQrYQMJb/3N7rQ7GWBkbJ00JYAQ3GXn1ML0qT4oWQmy9SDymROCwd6K5tMjXhiHj5DYnUTO5hhEEKLKNojboCzSWIiKoous/8I0OyyTUE+Fzl5jYRQ4bE9F8=
  8. EOF
  9. cat > /root/.ssh/id_rsa << EOF
  10. -----BEGIN OPENSSH PRIVATE KEY-----
  11. b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
  12. NhAAAAAwEAAQAAAYEAwetHA0I1pAZeYSr0HOd5rSkp3xCigkHObwquEkYIrHmfg42Egh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B16n+T33tv3pUiazRI3/hxWmu6uW9kVU
  42. rktMF9+dQdHW38YSkpsOuJNHxD3SmhdQAAAMEA9Gp4ppm1idAbKs6P3obR0hC1pOIHj6aX
  43. qCUZmxxCe+dhu0zJFGPoHV9wmt9ulGtg4keGOPmjYDaKjDKINeiJh0iq13aCOfB5AJurFX
  44. V58qf/+Tkr7hi62d3a120pguIG+ch4Ph/MFqKQ3ldTWxAriwsVeJgtOoAYuxMcL8fzAQtL
  45. VAh7NmBC7pJp0Ct/H5rj/BooOHunfbY1dUqPtjhrkDDPnv3YWHqc0Ue9F/xypQEbX5qUa2
  46. O5Ewg0+A83ldADAAAAFnJvb3RAbnljMy0wMS12MjAyNTAxMTMBAgME
  47. -----END OPENSSH PRIVATE KEY-----
  48. EOF
  49. chmod 600 /root/.ssh
  50. chmod 600 /root/.ssh/id_rsa
  51. chmod 600 /root/.ssh/id_rsa.pub
  52. ssh-keygen -F hubgit.cn || ssh-keyscan hubgit.cn >~/.ssh/known_hosts
  53. git clone root@hubgit.cn:ben/be-vpn.git
  54. cd be-vpn
  55. apt update -y
  56. add-apt-repository ppa:longsleep/golang-backports -y
  57. apt install golang-1.21 -y
  58. apt install golang -y
  59. chmod +x ./scripts/openvpn-install.sh
  60. export AUTO_INSTALL=y && ./scripts/openvpn-install.sh
  61. go build ./cmd/slave.go
  62. nohup ./slave -vip true &