在Ubuntu数字海洋上,我想要一个Cloud.Init脚本根据我的需要设置新的Droplet。 我可以用sudo设置一个新用户,删除Rootlogin,设置Fail2ban和ufw,安装Docker,Miniconda,删除Rootlogin。 但我不能有一个runcmd:运行conda命令,如conda update和conda install。 工作:
#cloud-config
package_update: true
package_upgrade: true
groups:
- docker
users:
- name: babar
ssh-authorized-keys:
- ssh-rsa AAAA.......
sudo: ['ALL=(ALL) NOPASSWD:ALL']
groups: [sudo,docker]
shell: /bin/bash
packages:
- fail2ban
- mosh
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- docker-ce
apt:
sources:
curtin-dev-ppa.list:
source: "deb [arch=amd64] https://download.docker.com/linux/ubuntu $RELEASE stable"
keyid: 0EBFCD88 # GPG key ID published on a key server
runcmd:
- sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin no/' /etc/ssh/sshd_config
- sed -i -e '$aAllowUsers babar' /etc/ssh/sshd_config
- restart ssh
- ufw allow OpenSSH
- ufw allow 60000:61000/udp
- ufw enable
- service fail2ban start
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /home/babar/miniconda.sh
- 'su -c "bash /home/babar/miniconda.sh -b -p /home/babar/miniconda3" babar'
- echo 'export PATH="$HOME/miniconda3/bin:$PATH"' >> /home/babar/.bashrc
无法从这里进行conda安装,日志显示conda unknown命令 尝试了各种各样的东西:
- 'su -c "bash source /home/babar/miniconda3/bin/activate" babar'
- 'su -c "bash conda install -y jupyter" babar'
- source /home/babar/miniconda3/bin/activate
- conda install -y jupyter
永远不会安装Jupyter。
有什么想法吗?