How to Change Settings After Clone Debian 10 With Cloudinit Enable on Proxmox Ve

How to Change Settings After Clone Debian 10 With Cloudinit Enable on Proxmox VE

Issue

I found an issue about create a linux vm as a template with cloudinit enabled. Seem like after cloned the virtual machine, the cloud-init cd rom didn’t be created automatically. We need to delete it,then change setings again to apply the apt source.

solution

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

#!/usr/bin/env sh

mv /etc/apt/sources.list /etc/apt/sources.list.backup
wget https://mirrors.ustc.edu.cn/repogen/conf/debian-http-4-buster -O /etc/apt/sources.list
apt update && apt -y dist-upgrade

apt install -y openssh-server git vim cloud-init apt-transport-https
sed -i 's/http/https/g' /etc/apt/sources.list
apt update && apt -y dist-upgrade

mv /etc/apt/sources.list /etc/apt/sources.list.backup
wget https://mirrors.ustc.edu.cn/repogen/conf/debian-http-4-buster -O /etc/apt/sources.list
apt update && apt -y dist-upgrade

apt install -y openssh-server git vim cloud-init apt-transport-https
sed -i 's/http/https/g' /etc/apt/sources.list
apt update && apt -y dist-upgrade

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"

sed -i 's/download.docker.com/mirrors.ustc.edu.cn\/docker-ce/g' /etc/apt/sources.list

cat << EOF > /etc/default/docker
DOCKER_OPTS="--registry-mirror=https://docker.mirrors.ustc.edu.cn/"
EOF
systemctl restart docker

sudo sed -i 's/PasswordAuthentication\ no/PasswordAuthentication\ yes/g' /etc/ssh/sshd_config
sudo systemctl daemon-reload
sudo systemctl restart sshd

sudo sed -i 's/#PermitRootLogin\ prohibit-password/PermitRootLogin\ yes/g' /etc/ssh/sshd_config
sudo systemctl daemon-reload
sudo systemctl restart sshd
Licensed under CC BY-NC-SA 4.0
Last updated on Nov 08, 2024 12:49 UTC
Built with Hugo
Theme Stack designed by Jimmy