Ubuntu Cloud Image ssh

Source: Internet
Author: User
Tags uuid

###############

Under KVM

Using the image Xenial-server-cloudimg-amd64-disk1.img,format=qcow2

Cat > Hostpass <<eof
#cloud-config
Password:root123
CHPASSWD: {Expire:false}
Ssh_pwauth:true

Cloud-localds cloud.img hostpass #用hostpass文件生成cloud. img
Qemu-img Info cloud.img #raw格式的

When you create the VM, use the above cloud.img as CDROM mount to the VM
Virt-install--virt-type KVM--name host-1--ram 1024x768--vcpus 1--import \
--DISK/VAR/LIB/LIBVIRT/IMAGES/HOST-1/XENIAL-SERVER-CLOUDIMG-AMD64-DISK1.IMG,FORMAT=QCOW2 \
--disk/var/lib/libvirt/images/host-1/cloud.img,device=cdrom \
--network bridge=br-mgmt,model=e1000,mac=52:54:00:33:22:11 \
--network bridge=br-leaf1-link3,model=e1000 \
--network bridge=br-leaf2-link3,model=e1000 \
--graphics none \
--noautoconsole

Virsh host-1
Ubuntu/root123
You can then set the password for root, enable SSH password login

#############

OpenStack under

[Email protected]:~# openstack keypair Create--public-key ~/.ssh/id_rsa.pub MyKey
[Email protected]:~# openstack keypair List
+-------+-------------------------------------------------+
| Name | Fingerprint |
+-------+-------------------------------------------------+
| MyKey | aa:28:b1:45:24:be:c8:4a:7f:23:7a:49:e5:ad:c8:2e |
+-------+-------------------------------------------------+

OpenStack Server Create--flavor m1.small--image <image name>--nic net-id=<nic uuid>--security-group allow_ IPv4--key-name MyKey--user-data cloud-config.txt instance-test2

[Email protected]:~# IP Netns List
Qdhcp-b56652f9-5f3d-4a67-97e0-d399d2aa4cd0 #id =network uuid, net172

IP netns exec qdhcp-b56652f9-5f3d-4a67-97e0-d399d2aa4cd0 ssh [email protected] #instance IP

Ubuntu Cloud Image ssh

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.