/usr/local/qcloud/python
目录下,与系统中默认的 python 不相冲突。类型 | OS | 版本 | x86_64 | arm64 | ||
| | | qcloud-python | cloud-init | qcloud-python | cloud-init |
rpm | CentOS | 7 | ||||
| | 8 | ||||
| Fedora | 36 | NA | NA | ||
| Kylin | 20sp1 | ||||
| openSUSE | 15.4 | NA | NA | ||
deb | Debian | 11 | ||||
| | 10 | NA | NA | ||
| | 9 | NA | NA | ||
| | 8 | NA | NA | ||
| Ubuntu | 22.04 | NA | NA | ||
| | 20.04 | ||||
| | 18.04 | ||||
| | 16.04 | NA | NA |
rm -rf /var/lib/cloudrm -rf /etc/cloudrm -rf /usr/local/bin/cloud*
dpkg -i *.deb
rpm -ivh *.rpm
cloud-init qcloud -v/usr/bin/cloud-init qcloud 0011
wget https://gerryguan-1306210569.cos.ap-chongqing.myqcloud.com/cloud-init/src/cloud-init-20.1.0011.tar.gz
tar -zxvf cloud-init-20.1.0011.tar.gz
cd cloud-init
yum install python3-pip -y
apt-get -y install python3-pip
python3 -m pip install --upgrade pip
pip install 'requests<2.20.0'
命令,安装 requests 2.20.0 版本以下的版本。pip3 install -r requirements.txt
yum install cloud-utils-growpart dracut-modules-growroot -ydracut -f
yum install cloud-utils-growpart -y
apt-get install cloud-guest-utils -y
python3 setup.py build
python3 setup.py install --init-system systemd
/etc/cloud/cloud.cfg
的内容替换为已下载的 cloud.cfg 文件内容。useradd syslog
strings /sbin/init | grep "/lib/system"
命令,若有返回信息,则操作系统是 systemd 自启动管理服务。ln -s /usr/local/bin/cloud-init /usr/bin/cloud-init
systemctl enable cloud-init-local.servicesystemctl start cloud-init-local.servicesystemctl enable cloud-init.servicesystemctl start cloud-init.servicesystemctl enable cloud-config.servicesystemctl start cloud-config.servicesystemctl enable cloud-final.servicesystemctl start cloud-final.servicesystemctl status cloud-init-local.servicesystemctl status cloud-init.servicesystemctl status cloud-config.servicesystemctl status cloud-final.service
[Unit]Description=Initial cloud-init job (pre-networking)Wants=network-pre.targetAfter=systemd-remount-fs.serviceBefore=NetworkManager.serviceBefore=network-pre.targetBefore=shutdown.targetConflicts=shutdown.targetRequiresMountsFor=/var/lib/cloud[Service]Type=oneshotExecStart=/usr/bin/cloud-init init --localExecStart=/bin/touch /run/cloud-init/network-config-readyRemainAfterExit=yesTimeoutSec=0# Output needs to appear in instance console outputStandardOutput=journal+console[Install]WantedBy=cloud-init.target
[Unit]Description=Initial cloud-init job (metadata service crawler)Wants=cloud-init-local.serviceWants=sshd-keygen.serviceWants=sshd.serviceAfter=cloud-init-local.serviceAfter=systemd-networkd-wait-online.serviceAfter=networking.serviceAfter=systemd-hostnamed.serviceBefore=network-online.targetBefore=sshd-keygen.serviceBefore=sshd.serviceBefore=systemd-user-sessions.serviceConflicts=shutdown.target[Service]Type=oneshotExecStart=/usr/bin/cloud-init initRemainAfterExit=yesTimeoutSec=0# Output needs to appear in instance console outputStandardOutput=journal+console[Install]WantedBy=cloud-init.target
strings /sbin/init | grep "sysvinit"
命令,若有返回信息,则操作系统是 sysvinit 自启动管理服务。chkconfig --add cloud-init-localchkconfig --add cloud-initchkconfig --add cloud-configchkconfig --add cloud-finalchkconfig cloud-init-local onchkconfig cloud-init onchkconfig cloud-config onchkconfig cloud-final on
apt-get/yum install cloud-init
/etc/cloud/cloud.cfg
的内容替换为已下载的 cloud.cfg 文件内容。cloud-init init --local
Cloud-init v. 20.1.0011 running 'init-local' at Fri, 01 Apr 2022 01:26:11 +0000. Up 38.70 seconds.
rm -rf /var/lib/cloud
rm -rf /etc/network/interfaces.d/50-cloud-init.cfg
/etc/network/interfaces
修改为以下内容:# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).source /etc/network/interfaces.d/*
yum install epel-release -y
yum install python3-pip -y
apt-get clean all
apt-get update -y
apt-get -y install python3-pip
本页内容是否解决了您的问题?