# 下载所有离线文件

wget https://oss.demo.uavcmlc.com:18000/cmlc-installation/kebite-4.1.6.tar.gz

wget https://oss.demo.uavcmlc.com:18000/cmlc-installation/v4.1.6/middleware-images.tar.gz
wget https://oss.demo.uavcmlc.com:18000/cmlc-installation/v4.1.6/rancher-1.20.4-image.tar.gz


wget https://oss.demo.uavcmlc.com:18000/cmlc-installation/rke_linux-aarch64-1.2.6
wget https://oss.demo.uavcmlc.com:18000/cmlc-installation/kubectl-1.20.4-0.aarch64.rpm

wget https://oss.demo.uavcmlc.com:18000/cmlc-installation/cmlc-zzzsj.tar.gz
wget https://oss.demo.uavcmlc.com:18000/cmlc-installation/offline_map-2023-12-18.zip

wget https://oss.demo.uavcmlc.com:18000/cmlc-installation/frontend-arm.tar.gz

wget --no-check-certificate https://oss.demo.uavcmlc.com:18000/cmlc-installation/cmlc-srs.tar.gz
wget --no-check-certificate https://oss.demo.uavcmlc.com:18000/cmlc-installation/docker_release_ts2mp4_arm64.tar.gz
wget --no-check-certificate https://oss.demo.uavcmlc.com:18000/cmlc-installation/ts2mp4_docker_image_arm64_v1.0.0.tar.gz

wget https://oss.demo.uavcmlc.com/cmlc-installation/v4.1.6/离线地图.zip

wget https://oss.demo.uavcmlc.com:18000/cmlc-installation/v4.1.6/mysql-8.2.0-linux-glibc2.28-aarch64.tar.xz

# 批量复制文件
ip_list=(172.10.125.6 172.10.125.141 172.10.125.120)
for ip in "${ip_list[@]}"; do

    echo "yes
    yes
    " | scp /etc/ssh/sshd_config root@${ip}:/etc/ssh/sshd_config

    ssh root@${ip} "systemctl restart sshd"
done

ip_list=(10.20.1.133 10.20.1.134 10.20.1.132)
for ip in "${ip_list[@]}"; do
    scp /etc/docker/daemon.json root@${ip}:/etc/docker/daemon.json
#    scp /etc/ssh/sshd_config root@${ip}:/etc/ssh/sshd_config

    ssh root@${ip} "systemctl restart docker"
#    ssh root@${ip} "systemctl restart sshd"
done


vim /etc/docker/daemon.json
{
  "insecure-registries" : ["172.10.125.92:8033","harbor.cq-mlkj.com"]
}

systemctl restart docker


list=(iptables)

for Packages in "${list[@]}"
do
    apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances ${Packages} | grep "^\w" | sort -u)
done


sudo dpkg -i ./containerd.io_1.6.15-1_amd64.deb \
  ./docker-ce-cli_20.10.10~3-0~ubuntu-focal_amd64.deb \
  ./docker-ce_20.10.10~3-0~ubuntu-focal_amd64.deb \
  ./docker-ce-rootless-extras_20.10.10~3-0~ubuntu-focal_amd64.deb \
  ./docker-buildx-plugin_0.11.1-1~ubuntu.20.04~focal_amd64.deb \
  ./docker-compose-plugin_2.19.1-1~ubuntu.20.04~focal_amd64.deb

rpcinfo -p localhost

# 生成ed25519 版本的ssh key
ssh-keygen -t ed25519 -f .ssh/id_ed25519  -C "m@github"

echo $(cat .ssh/id_ed25519.pub)

echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHXDzet+Z2/AmrzIZpPviz7Z9AMxLWiJUOwtj/3NPauk m@github" >>.ssh/authorized_keys

# 修改calico-node检测的IP
kubectl -n kube-system edit daemonset calico-node
env:
- name: FELIX_INTERFACEPREFIX
  value: "eth0"

# 强行删除所有的calico-node
for calico in $(kubectl -n kube-system get pods | grep calico-node | awk '{print$1}');do
  echo "calico pod is => $calico"
  kubectl -n kube-system delete pod $calico
done

# 强行删除所有的flannel-pod
for flannel in $(kubectl -n kube-system get pods | grep kube-flannel | awk '{print$1}');do
  echo "flannel pod is => $flannel"
  kubectl -n kube-system delete pod $flannel
done


./mysql -uroot -pQzfXQhd3bQ -h127.0.0.1 -P33306


redis-cli -h 127.0.0.1 -a Mcache@4522


curl -X POST -u "admin:V2ryStr@ngPss" -H  "authorization: Basic YWRtaW46VjJyeVN0ckBuZ1Bzcw==" -H "Content-Type: application/json" -d '{"project_name":"rancher","registry_id":null,"metadata":{"public":"true"},"storage_limit":-1}' http://172.10.125.92:8033/api/v2.0/projects
