OpenStack搭建和部署

Centos官网qcow2镜像修改root账号密码,开启ssh等

wget http://172.16.20.10/vmtemplate/KVM/wangrui/Debian/debian-10.2.0-openstack-amd64.qcow2

一、查看镜像文件信息

debian-10.2-cloud

name=Debian 10.2.0 (Buster) Cloud

osinfo=debian10

arch=x86_64

file=debian-10.2.0-openstack-amd64.qcow2

checksum[sha512]=296ad8345cb49e52464a0cb8bf4365eb0b9e4220c47ebdd73d134d51effc756d5554aee15027fffd038fef4ad5fa984c94208bce60572d58b2ab26f74bb2a5de

format=qcow2

size=566434304

revision=20191116

notes=Debian 10.2.0 (Buster).

This is a Debian installation, suited for running as OpenStack guest.

二、生成密码

使用openssl passwd -1 123456生成加密的密码:-1表示使用MD5算法对密码123456进行加密

root@support01 \~\]# openssl passwd -1 123456 $1$HDUWloxk$IZuLRX39Oa31T4YzCrCHL1 ## 三、修改镜像密码 使用guestfish命令修改root账户密码,开启ssh远程登录 ### 3.1、进入镜像 guestfish --rw -a debian-10.2.0-openstack-amd64.qcow2 进入交互命令界面依次执行run、list-filesystems、mount等指令 Welcome to guestfish, the guest filesystem shell for editing virtual machine filesystems and disk images. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell \>\ run \>\ list-filesystems /dev/sda1: ext4 \>\ mount /dev/sda1 / \>\ ### 3.2、编辑/etc/shadow,修改root账户的密码 \>\ vi /etc/shadow root:\*:18216:0:99999:7::: daemon:\*:18216:0:99999:7::: bin:\*:18216:0:99999:7::: sys:\*:18216:0:99999:7::: sync:\*:18216:0:99999:7::: games:\*:18216:0:99999:7::: man:\*:18216:0:99999:7::: lp:\*:18216:0:99999:7::: mail:\*:18216:0:99999:7::: news:\*:18216:0:99999:7::: uucp:\*:18216:0:99999:7::: proxy:\*:18216:0:99999:7::: www-data:\*:18216:0:99999:7::: backup:\*:18216:0:99999:7::: list:\*:18216:0:99999:7::: irc:\*:18216:0:99999:7::: gnats:\*:18216:0:99999:7::: nobody:\*:18216:0:99999:7::: _apt:\*:18216:0:99999:7::: systemd-timesync:\*:18216:0:99999:7::: systemd-network:\*:18216:0:99999:7::: systemd-resolve:\*:18216:0:99999:7::: messagebus:\*:18216:0:99999:7::: unscd:\*:18216:0:99999:7::: ntp:\*:18216:0:99999:7::: sshd:\*:18216:0:99999:7::: 将root:后面的第一个\*替换为第二步加密之后的密码 替换后第一行为/etc/shadow第一行为 root:$1$HDUWloxk$IZuLRX39Oa31T4YzCrCHL1:18216:0:99999:7::: **编辑** **/etc/ssh/sshd_config** , ### 3.3、开启root账户ssh登录,在vi中:set number开启行号 \>\ vi /etc/ssh/sshd_config 第32行 #PermitRootLogin prohibit-password 释放掉注释,并修改值为yes,调整完之后第32行为 PermitRootLogin yes 第56行 #PasswordAuthentication yes 释放掉注释,调整完之后第56行为 PasswordAuthentication yes 编辑/root/.bashrc,开启ssh语法高亮以及内置命令别名等,1、3、4、8、15行为说明注释,除此之外释放所有注释 \>\ vi /root/.bashrc 编辑之前内容为: # \~/.bashrc: executed by bash(1) for non-login shells. # Note: PS1 and umask are already set in /etc/profile. You should not # need this unless you want different defaults for root. # PS1='${debian_chroot:+($debian_chroot)}\\h:\\w\\$ ' # umask 022 # You may uncomment the following lines if you want \`ls' to be colorized: # export LS_OPTIONS='--color=auto' # eval "\`dircolors\`" # alias ls='ls $LS_OPTIONS' # alias ll='ls $LS_OPTIONS -l' # alias l='ls $LS_OPTIONS -lA' # # Some more alias to avoid making mistakes: # alias rm='rm -i' # alias cp='cp -i' # alias mv='mv -i' 编辑之后内容为: # \~/.bashrc: executed by bash(1) for non-login shells. # Note: PS1 and umask are already set in /etc/profile. You should not # need this unless you want different defaults for root. PS1='${debian_chroot:+($debian_chroot)}\\h:\\w\\$ ' umask 022 # You may uncomment the following lines if you want \`ls' to be colorized: export LS_OPTIONS='--color=auto' eval "\`dircolors\`" alias ls='ls $LS_OPTIONS' alias ll='ls $LS_OPTIONS -l' alias l='ls $LS_OPTIONS -lA' # # Some more alias to avoid making mistakes: alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' 最后执行quit或exit命令退出guestfish,将qcow2镜像文件注册到openstack,投递虚拟机实例即可 参考链接: https://docs.openstack.org/image-guide/modify-images.html#guestfish https://blog.51cto.com/superzhangqiang/1705678 https://blog.csdn.net/weixin_42551369/article/details/88946622 http://www.chenshake.com/openstack-mirror-and-password/ ## 四、qcow2镜像创建实例时设置密码 在使用Linux系统镜像时,如果不使用密钥登录,可以在创建实例的时候使用脚本配置好密码,第三四行为自己需要修改的密码,两行必须相同。脚本如下: #!/bin/bash passwd root\<\

1.--gen-answer-file=GEN_ANSWER_FILE:产生应答文件模板。

2.--answer-file=ANSWER_FILE:依据应答文件的配置信息以非交互模式运行该工具

3.--install-hosts=INSTALL_HOSTS:在一组主机上进行批量安装,主机列表以逗号分隔。

4.--allinone:将所有功能集中安装在单一主机上。

(9-1)将所有功能集中安装在单一主机上。

root@lincan \~\]# packstack --allinone ![](https://file.jishuzhan.net/article/1740353978924797954/34a36df685abd11ce633b01dfd1fa850.webp) 安装过程出现问题 ![](https://file.jishuzhan.net/article/1740353978924797954/34a36df685abd11ce633b01dfd1fa850.webp) 192.168.80.152_controller.pp: \[ ERROR

Applying Puppet manifests [ ERROR ]

ERROR : Error appeared during Puppet run: 192.168.80.152_controller.pp

Notice: /Stage[main]/Nova::Db::Sync/Exec[nova-db-sync]/returns: Error: (pymysql.err.OperationalError) (1045, u"Access denied for user 'nova'@'lincan' (using password: YES)") (Background on this error at: http://sqlalche.me/e/e3q8)

You will find full trace in log /var/tmp/packstack/20230221-101322-6tiImI/manifests/192.168.80.152_controller.pp.log

Please check log file /var/tmp/packstack/20230221-101322-6tiImI/openstack-setup.log for more information

Additional information:

* Parameter CONFIG_NEUTRON_L2_AGENT: You have chosen OVN Neutron backend. Note that this backend does not support the VPNaaS or FWaaS services. Geneve will be used as the encapsulation method for tenant networks

* A new answerfile was created in: /root/packstack-answers-20230221-101325.txt

* Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.

* File /root/keystonerc_admin has been created on OpenStack client host 192.168.80.152. To use the command line tools you need to source the file.

* To access the OpenStack Dashboard browse to http://192.168.80.152/dashboard .

Please, find your login credentials stored in the keystonerc_admin in your home directory.

You have new mail in /var/spool/mail/root

解决问题:win10系统版本更新16.2.4

win11系统更新17.0.0

安装成功

(9-2)运行Packstack安装OpenStack

查看openstack主要组件版本号:

#nova-manage --version

root@lincan \~\]# nova-manage --version ![](https://file.jishuzhan.net/article/1740353978924797954/34a36df685abd11ce633b01dfd1fa850.webp) (10)登入OpenStack 用户名demo或admin 查看密码 ![](https://file.jishuzhan.net/article/1740353978924797954/34a36df685abd11ce633b01dfd1fa850.webp) ![](https://file.jishuzhan.net/article/1740353978924797954/34a36df685abd11ce633b01dfd1fa850.webp)

相关推荐
哈里谢顿4 天前
通过openstacksdk库来调用openstack各个接口
openstack
努力打怪升级14 天前
云计算介绍
云计算·openstack
哈里谢顿19 天前
Nova parse_args 函数详解
openstack
哈里谢顿21 天前
OpenStack 中的 nova-conductor 与 ironic-conductor 及其分布式锁机制详解
openstack
哈里谢顿25 天前
OpenStack oslo-config 详解
openstack
感哥1 个月前
OpenStack Cinder 创建卷
openstack
感哥1 个月前
OpenStack Cinder 架构
openstack
感哥1 个月前
OpenStack Nova Scheduler 计算节点选择机制
openstack
感哥1 个月前
OpenStack Nova 创建虚拟机
openstack
感哥1 个月前
OpenStack Glance(镜像)
openstack