第十六章 操作系统镜像的创建和登入

1、下载官网云镜像到本地服务器

目前很多的操作系统发行版都制作了OpenStack使用的镜像文件,大部分镜像禁止账号密码认证登陆,这些镜像在启动的时候可以注入密钥对(cloud-init),所以你需要使用你的私钥进行登陆。
1、CentOS 6
http://cloud.centos.org/centos/6/images/
2、CentOS 7
http://cloud.centos.org/centos/7/images/
CentOS云镜像的默认登陆账户为centos
3、CirrOS (test)
http://download.cirros-cloud.net/
4、Debian
http://cdimage.debian.org/cdimage/openstack/
Debian云镜像的默认登陆账户为debian
5、Fedora
https://alt.fedoraproject.org/cloud/
Fedora云镜像的默认登陆账户为fedora
6、Microsoft Windows
https://cloudbase.it/windows-cloud-images/
7、Ubuntu
http://cloud-images.ubuntu.com/
Ubuntu云镜像的默认登陆账户为ubuntu
8、openSUSE
http://download.opensuse.org/repositories/Cloud:/Images:/
9、Red Hat Enterprise Linux 6
https://access.redhat.com/downloads/content/69/ver=/rhel---6/x86_64/product-downloads
10、Red Hat Enterprise Linux 7
https://access.redhat.com/downloads/content/69/ver=/rhel---7/x86_64/product-downloads
RHEL云镜像的默认登陆账户为cloud-user

# 针对img文件创建镜像操作,镜像文件保存在/var/kvm/images/ubuntu-18.04-server-cloudimg-amd64.img下
openstack image create "Ubuntu1804" --file /var/kvm/images/ubuntu-18.04-server-cloudimg-amd64.img --disk-format qcow2 --container-format bare --public

2、针对ISO镜像文件

# 针对ISO文件创建镜像操作
glance image-create  --file ubuntu-16.04.1-server-amd64.iso  --disk-format iso  --container-format bare  --public  --name ubuntu-16.04.1-server-amd64
# 从Dashboard选择Boot from image(creates a new volume,指定上传的ISO镜像即可,进行正常的安装系统操作

3、(可选)默认登入镜像系统需要到key才能登入(在通过web页面启动实例的时候会有选择,下载即可),如果不想这样,可以在web操作openstack启动实例时通过添加启动脚本方式来修改用户密码,然后就可以在客户端通过ssh远程登入了,加入修改脚本如下:(推荐xshell软件)

# 以下脚本针对的事Ubuntu18系统,各个镜像用户名请在下载镜像时的官网确认
#!/bin/sh
passwd ubuntu<<EOF
ubuntu
ubuntu
EOF
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
service ssh restart
原文地址:https://www.cnblogs.com/shihongkuan/p/11401306.html