当前位置:   article > 正文

dev-stack安装openstack_neutron did not start

neutron did not start

虚拟机桥接网络的问题总结

关于VirtualBox在桥接模式下无法联网 解决方案

VirtualBox虚拟机几种网络连接方式介绍

Ubuntu输入ifconfig找不到IP地址,只有lo问题

详细Ubuntu桥接模式网络配置过程

永久设置DNS:

sudo apt install resolvconf
sudo apt install openresolv
  • 1
  • 2
  • https://blog.csdn.net/weixin_44773984/article/details/113252269
  • https://blog.csdn.net/weixin_41687289/article/details/114701317

有线未托管

ubuntu虚拟机桥接模式在/etc/network/interfaces配置静态IP失败的另一种解决方法

网络配置命令:
ifconfig 网卡名 ip地址 ,设置ip地址
ifconfig 网卡名 up ,启动网卡
ifconfig 网卡名 down ,禁用网卡
ifup 网卡名 ,启动网卡
ifdown 网卡名,禁用网卡
ifconfig 网卡名 ip地址 netmask 子网掩码 ,同时设置ip和子网掩码

Netplan配置详解

配置过程

创建节点:控制节点controll与计算节点compute,

  1. 控制节点使用3块网卡:桥接网络、内部网络,以及仅主机
  2. 计算节点使用2块网卡:桥接网络、内部网络
  • 1
  • 2

节点的启动

启动节点的第一次,对节点进行安装Ubuntu,具体安装过程如下:

  • 创建compute节点

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-1HCSP1zn-1625448827730)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603071716765.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-eiBewWRO-1625448827731)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210606134447895.png)][外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-DFW832mg-1625448827732)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603071810306.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-SwI8pH6u-1625448827733)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603071827018.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-rLaP5m71-1625448827734)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603072238461.png)]

  • 给虚拟节点分配光盘

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-6ObO0Nou-1625448827735)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603072337996.png)]

  • 设置compute节点的网络为桥接网络和内部网络

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ZUf3b131-1625448827736)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603072544476.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-NxqLIeHH-1625448827737)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603072556728.png)]

  • 启动节点安装ubuntu

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-omQK3O0f-1625448827739)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210604232438695.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OfLThknR-1625448827740)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210605134906307.png)]

  • 点击“安装Ubuntu”

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-rsWZmz2k-1625448827741)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603072839878.png)]

  • 设置中文环境

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-sslr6mZI-1625448827743)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603003036694.png)]

  • 最小安装

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-z7Qjh5oR-1625448827745)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603003216274.png)]

  • 选择“其他选项”

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-o1B4kZYk-1625448827746)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603073212728.png)]

  • 新建分区表

点击“新建分区表”。若界面没有显示完全,尝试按住键盘的“Win”【20.04】/“Alt”【16.04】,并用鼠标左键点击界面拖动,直到显示被遮蔽的部分。

选择“继续”

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-1eNEnu06-1625448827747)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603073511991.png)]

- 创建”交换空间“
  • 1

点击左下角的“+”,交换空间:512MB,用于:“交换空间”

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-GrOdpaaU-1625448827748)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603073751760.png)]

  • 创建根目录

选中“空闲”,点击左下角的“+”,挂载点:“/”

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ug58VOcH-1625448827750)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603073933658.png)]

点击右下角的“现在安装”

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Ytbte1sy-1625448827751)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603074023428.png)]

点击“继续”

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-1h41nsH2-1625448827752)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603074049131.png)]

  • 时间选择“上海”

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-jQQywynv-1625448827753)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603074146635.png)]

  • 创建用户

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ZGNWihdT-1625448827754)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603074221085.png)]

  • 安装成功,点击“现在重启”

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Sl8wD1DW-1625448827756)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603075158669.png)]

apt换中国内部的软件源

  • 查看当前的版本名

修改源之前提示大家先查看版本名,ubuntu20.04对应的是“focal”,也就是我下面镜像源中提到的。“eoan”代表ubuntu19.10,“xenial”代表ubuntu16.04,“bionic”代表ubuntu18.04,“disco”代表ubuntu19.04,但是最好还是查看自己的版本名,并更改相应位置的ubuntu版本名。

lsb_release -c

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-O3AFW28a-1625448827757)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603075731260.png)]

  • 备份原来的软件源并另存

前面是原始文件,后面是备份之后的文件

sudo cp -v /etc/apt/sources.list /etc/apt/sources.list.bak
  • 1

.bak 是 backup 的意思,表示备份文件。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OAvHgzHi-1625448827759)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603080922877.png)]

  • 执行chmod命令更改文件权限使软件源文件可编辑:
sudo chmod 777 /etc/apt/sources.list
  • 1
  • 通过gedit命令或vim编辑软件源:
sudo gedit /etc/apt/sources.list
  • 1
vim /etc/apt/sources.list
  • 1

在前面加入换源的网址,或者将原始的源直接删除之后再加入还原网址,如阿里云

#deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse #一定要在首行,后面可以安装yum

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

#deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

#deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

#deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

#deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

#deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

或者

deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse#deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse#deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse#deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse#deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse#deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
  • 1

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-fnxdcBBU-1625448827760)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603081337224.png)]

  • 保存

  • 更新软件列表:

    sudo apt-get update
    
    • 1

    进行软件更新:

    sudo apt-get upgrade
    
    • 1

安装yum

sudo apt-get install build-essential

sudo apt-get install yum

将fedora上的源文件放到Ubuntu上使用:

只用任意组合的两个fedora和updates仓库即可,如两个清华源清华源就可以了

cd /etc/yum/repos.d/

sudo touch fedora-163.repo

sudo touch fedora-updates-163.repo

sudo touch fedora-ts.repo

sudo touch fedora-updates-ts.repo

sudo touch fedora-modular.repo

sudo touch fedora-updates-modular.repo

配置仓库

sudo vim fedora-163.repo

[fedora]name=Fedora 17 - $basearch - 163.comfailovermethod=prioritybaseurl=http://mirrors.163.com/fedora/releases/17/Everything/$basearch/os/mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-17&arch=$basearchenabled=1metadata_expire=7dgpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch[fedora-debuginfo]name=Fedora 17 - $basearch - Debug - 163.comfailovermethod=prioritybaseurl=http://mirrors.163.com/fedora/releases/17/Everything/$basearch/debug/mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-17&arch=$basearchenabled=0metadata_expire=7dgpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch[fedora-source]name=Fedora 17 - Source - 163.comfailovermethod=prioritybaseurl=http://mirrors.163.com/fedora/releases/17/Everything/source/SRPMS/mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-17&arch=$basearchenabled=0metadata_expire=7dgpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch```
  • 1

sudo vim fedora-updates-163.repo

[updates]name=Fedora 17 - $basearch - Updates - 163.comfailovermethod=prioritybaseurl=http://mirrors.163.com/fedora/updates/17/$basearch/mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f17&arch=$basearchenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch[updates-debuginfo]name=Fedora 17 - $basearch - Updates - Debug - 163.comfailovermethod=prioritybaseurl=http://mirrors.163.com/fedora/updates/17/$basearch/debug/mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f17&arch=$basearchenabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch[updates-source]name=Fedora 17 - Updates Source - 163.comfailovermethod=prioritybaseurl=http://mirrors.163.com/fedora/updates/17/SRPMS/mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f17&arch=$basearchenabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch```
  • 1

sudo vim fedora-ts.repo

[fedora]name=Fedora $releasever - $basearchfailovermethod=prioritybaseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/$releasever/Everything/$basearch/os/metadata_expire=28dgpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearchskip_if_unavailable=False
  • 1

sudo vim fedora-updates-ts.repo

[updates]name=Fedora $releasever - $basearch - Updatesfailovermethod=prioritybaseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/updates/$releasever/Everything/$basearch/enabled=1gpgcheck=1metadata_expire=6hgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearchskip_if_unavailable=False
  • 1

sudo vim fedora-modular.repo

[fedora-modular]name=Fedora Modular $releasever - $basearchfailovermethod=prioritybaseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/$releasever/Modular/$basearch/os/enabled=1metadata_expire=7dgpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearchskip_if_unavailable=False```
  • 1

sudo vim fedora-updates-modular.repo

[updates-modular]name=Fedora Modular $releasever - $basearch - Updatesfailovermethod=prioritybaseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/updates/$releasever/Modular/$basearch/enabled=1gpgcheck=1metadata_expire=6hgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearchskip_if_unavailable=False
  • 1

启用仓库

yum makecache #在终端执行刚才的配置

yum repolist all #查看拥有的仓库

yum xxxxx #启用仓库,xxx是我忘记指令了

yum update #更新软件包数据

yum源失效的最新操作方式,解决:【Errno 14】 PYCURL ERROR 22

安装“增强功能”

虚拟机Ubuntu系统的分辨率很低,会导致显示不全

  • 点击"设备"->“安装增强功能”

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-hv2qvJVO-1625448827762)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603075853915.png)]

点击“运行”,安装成功之后需要按下键盘的“enter"

  • 在虚拟机中断输入

sudo apt-get install virtualbox-guest-dkms

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-bmIRdRfK-1625448827763)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603080344793.png)]

  • 重启

SSH无密码登录

  • 安装SSH server:

sudo apt-get install openssh-server

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ULzq2Y5m-1625448827765)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603085130033.png)]

  • 使用以下命令登录主机:

ssh localhost

提示首次登录,输入:yes,以及用户的密码:x

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-zonrUjyw-1625448827765)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603090000031.png)]

但是每次登录都要输入密码,可以配置成无密码登录。

首先退出刚才的 ssh,就回到了我们原先的终端窗口,然后利用 ssh-keygen 生成密钥,并将密钥加入到授权中:

exit # 退出刚才的 cd ~/.ssh/ # 若没有该目录,请先执行一次ssh-keygen -t rsa # 会有提示,都按回车就可以。我按了3次回车cat ./id_rsa.pub >> ./authorized_keys  # 加入授权
  • 1

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-XgoTTs1L-1625448827766)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603085939248.png)]

再用ssh localhost,就无序输入密码登录

ssh localhost

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-QQEpyjaF-1625448827767)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603090016774.png)]

用于SSH通过普通用户登录

在终端使用普通用户登录

ssh x@192.168.43.242

  1. 查看当前网卡的地址

ip r

ip l

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-oEJnndLM-1625448827768)(D:\xm_Project\PythonProject\recommendation\competetion\weixin-algo\image-20210603090507771.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-nwFzYpvk-1625448827770)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210605010628382.png)]

  1. 登录SSH

ssh x@192.168.43.242 # 这个ip地址是我自己网卡的地址,需要写成自己的

中途会显示第一次登录,输入:yes

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-NqkPulne-1625448827770)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603090732428.png)]

exit

  1. 允许Root用户SSH登录:
  • 登录root用户,给root设置一个密码

sudo su -

passwd

输入提示符出现“#”表示成功登录root用户。输入两次root的密码。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-9eFMtbNo-1625448827771)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603095009042.png)]

  • 修改sshd_config文件内容,在28行

vim /etc/ssh/sshd_config

将文件中PermitRootLogin前的注释删除,并将内容改为yes。按下键盘esc并输入:wq!保存内容退出

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-hwpFUacg-1625448827772)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603094252742.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-xDBKzSkI-1625448827773)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210605005825880.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-hQxkZKek-1625448827774)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603093603574.png)]

重启SSH服务

systemctl restart ssh

systemctl restart sshd.service

exit

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-kGZmlZha-1625448827775)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603095156310.png)]

可以用root用户实现SSH登录

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-d5WrlX6L-1625448827776)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603100044407.png)]

配置静态网卡

第一个网卡设置为静态ip

【注意】:Ubuntu18.04以后修改ip地址是使用netplan所以以下的修改可能会导致连接不了网络。

ip l # 查看网卡信息

vim /etc/network/interfaces

auto enp0s3
iface enp0s3 inet static
address 192.168.43.242
netmask 255.255.255.0
gateway 192.168.43.1
dns-nameservers 192.168.43.1 8.8.8.8 8.8.4.4

auto enp0s8
iface enp0s8 inet manual

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-josPCnr7-1625448827777)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603100733378.png)]

【正确配置Ubuntu20.04网卡的方法如下:】

要按一下的方法,修改配置文件:

cd /etc/netplan/

ls

sudo vim 01-network-manager-all.yaml

ethernets:
enp0s3: #配置的网卡名称
dhcp4: no #dhcp4关闭
addresses: [192.168.43.242/24] #设置本机IP及掩码
gateway4: 192.168.43.1 #设置网关
nameservers:
addresses: [192.168.43.1,223.5.5.5,8.8.8.8,8.8.4.4] #设置DNS

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-HzB7azaR-1625448827778)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603104356419.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-UTG3ZocY-1625448827779)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603104549685.png)]

使配置文件生效。只要不报错就执行成功

sudo netplan trysudo netplan apply
  • 1

sudo apt install net-tools #安装使用ipconfig

OK,保存之后,重启操作系统

reboot

输入如下代码用root登录ssh

ssh root@192.168.43.242

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Nx6PEhh3-1625448827780)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603105136868.png)]

配置两个节点完成

controll节点安装以上的compute的配置过程设置。然后同时开启两个节点,互相Ping对方的结点都能ping通

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-lvakz0qy-1625448827781)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603105908641.png)]

DevStack安装OpenStack

官方文档

参考:未2-配置环境变量

Ubuntu及OpenStack安装指南(云计算实验用)

ubuntu18.04安装openstack

Ubuntu 20使用devstack快速安装openstack最新版【6.配置环境变量脚本】

ubuntu18.04系统下用devstack安装openstack(最新版)

未1-有些资源要手动下载

CloudMan-ubuntu-16.04.1安装OpenStack

  • 用root用户登录到ssh

ssh root@192.168.43.220

  • 安装过程中需要使用pip,所以需要确保操作系统中已有pip包

pip

apt install python3-pip

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-CYu3Iokb-1625448827782)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603110529913.png)]

  • 将yum源换成华为源

sudo cp -a /etc/apt/sources.list /etc/apt/sources.list.bak
sudo sed -i “s@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g” /etc/apt/sources.list
sudo sed -i “s@http://.*security.ubuntu.com@http://repo.huaweicloud.com@g” /etc/apt/sources.list
sudo apt-get update

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-2DJDhiXb-1625448827783)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603111830898.png)]

  • 将PyPI源换成华为源

#新建.pip目录
sudo mkdir .pip
#在.pip目录下创建pip.conf文件
sudo vim .pip/pip.conf
#将以下内容填入pip.conf文件中
[global]
index-url = https://repo.huaweicloud.com/repository/pypi/simple
trusted-host = repo.huaweicloud.com

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-wy8yFLHs-1625448827785)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603112142199.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-pHSc8gs1-1625448827786)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603112203062.png)]

开始安装

  • 安装软件包
# 查看pip(V是大写)pip -V 或 pip3 -V# 查看gitgit --version
  • 1
sudo apt-get install bridge-utils git python3-pip -y
  • 1

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-KTzLM5Az-1625448827787)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603112551607.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-FFc4RDTo-1625448827788)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603112627224.png)]

  • 设置时区

    • 设定时区:

      sudo dpkg-reconfigure tzdata

      选择Asia -> 在选择Shanghai -> OK

    • 同步时间命令:

sudo apt-get install ntpdate  #安装时间同步工具sudo ntpdate cn.pool.ntp.org # 与网络服务器同步时间date # 查看时间是否已经同步
  • 1

添加stack用户

#新增stack用户
sudo useradd -s /bin/bash -d /opt/stack -m stack
#授予stack用户sudo权限
echo “stack ALL=(ALL) NOPASSWD: ALL” | sudo tee /etc/sudoers.d/stack
#切换到stack用户
sudo su - stack

或者:

/root/devstack/tools/create-stack-user.sh

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-JnMqFy95-1625448827793)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603112902993.png)]

配置pip源头

mkdir ~/.pip

vim ~/.pip/pip.conf

以下内容粘贴进去

[global]index-url = https://pypi.douban.com/simple/trusted-host = pypi.douban.com#download_cache = ~/.cache/pip[install]use-mirrors = truemirrors = http://pypi.douban.com/
  • 1

下载devstack

stack用户的pip源也需要换成国内的源,详细参考换root用户的换源过程

#使用git下载devstackgit clone https://opendev.org/openstack/devstack#下载完成后切换到devstack目录下cd devstack
  • 1

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-qAYbmGnv-1625448827794)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603113146215.png)]

或者下载N版到/root/目录

git clone https://git.openstack.org/openstack-dev/devstack -b stable/newton

  • 添加local.conf文件

#在devstack根目录下添加local.conf文件
vim local.conf
#将以下内容添加到local.conf文件中

[[local|localrc]]
MULTI_HOST=true # 两个节点

#define images to be automatically downloaded during the DevStack built process.
DOWNLOAD_DEFAULT_IMAGES=False
IMAGE_URLS=“http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img”

#management & api network
HOST_IP=192.168.43.242 # 当前节点的IP
LOGFILE=/opt/stack/logs/stack.sh.log

#credentials
ADMIN_PASSWORD=admin
DATABASE_PASSWORD= A D M I N P A S S W O R D R A B B I T P A S S W O R D = ADMIN_PASSWORD RABBIT_PASSWORD= ADMINPASSWORDRABBITPASSWORD=ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD

SERVICE_TOKEN=$ADMIN_PASSWORD

LOG_COLOR=True
LOGDIR= D E S T / l o g s S C R E E N L O G D I R = DEST/logs SCREEN_LOGDIR= DEST/logsSCREENLOGDIR=LOGDIR/screen

#use TryStack git mirror
GIT_BASE=http://git.trystack.cn
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git

或者试一下内容,注意IP的设置

[[local|localrc]]
MULTI_HOST=true

#management & api network
HOST_IP=192.168.43.220
LOGFILE=/opt/stack/logs/stack.sh.log

#Define images to be automatically downloaded during the DevStack built process.
DOWNLOAD_DEFAULT_IMAGES=False
IMAGE_URLS=“http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img”

#Credentials
ADMIN_PASSWORD=admin #用来登录OpenStack的密码
MYSQL_PASSWORD=root #MySQL的密码具体看后面的MySQL远程登录那节内容设置
DATABASE_PASSWORD= A D M I N P A S S W O R D R A B B I T P A S S W O R D = ADMIN_PASSWORD RABBIT_PASSWORD= ADMINPASSWORDRABBITPASSWORD=ADMIN_PASSWORD
SERVICE_PASSWORD= A D M I N P A S S W O R D S E R V I C E T O K E N = ADMIN_PASSWORD SERVICE_TOKEN= ADMINPASSWORDSERVICETOKEN=ADMIN_PASSWORD

#enable neutron-m12-vlan
disable_service n-net
enable_service q-svc,q-agt,q-dhcp,q-l3,q-meta,neutron,q-lbaas,q-fwaas
Q_AGENT=linuxbridge
ENABLE_TENANT_VLANS=True
TENANT_VLAN_RANGE=3001:4000
PHYSICAL_NETWORK=default

LOG_COLOR=True
LOGDIR= D E S T / l o g s S C R E E N L O G D I R = DEST/logs SCREEN_LOGDIR= DEST/logsSCREENLOGDIR=LOGDIR/screen

#use TryStack git mirror
GIT_BASE=http://git.trystack.cn
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-mp0Iro9Z-1625448827795)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603113402526.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-pbZRdCCE-1625448827796)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603171331788.png)]

下载文件

  • 进入files目录下载文件(如果不成功就多执行几次wget命令)

cd files/
wget -c https://github.com/coreos/etcd/releases/download/v3.1.10/etcd-v3.1.10-linux-amd64.tar.gz
wget -c https://github.com/coreos/etcd/releases/download/v3.1.7/etcd-v3.1.7-linux-amd64.tar.gz

提前安装MySQL并设置密码

mariadb-client-core-5.5
mariadb-server-5.5

开始安装

  • 切回到/devstack目录下

cd …

  • 安装openstack:
#在devstack目录下执行stack.sh脚本./stack.sh
  • 1

【报错】:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-A3ETI0pM-1625448827798)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210606161302754.png)]

原因解决1

【解决方法】:

  • FORCE=yes ./stack.sh

    或者把在源码中把die的那一行代码注释了。在重新运行./stack.sh

安装时间比较长,具体要看当前网络,本次安装耗时45分钟,出现以下页面表示已基本完成,等待脚本命令结束即可。

【安装过程错误】解决:

  1. 遇到超时错误
    重新运行./stack.sh
  2. python2和python3之间的代码冲突

解决解决2

把出错代码中第三个参数0删去。

  1. ModuleNotFoundError: No module named ‘os_testr’

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-guyDOPZU-1625448827799)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210606170944324.png)]

解决

sudo apt-get install python-pip sudo pip install --upgrade pip sudo pip install -U os-testr

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-hKkUacYd-1625448827800)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210606171429221.png)]

但是这样全部pip都执行pyhton3.6,即使是pip2

pip升级后错误

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-x9ynzUAj-1625448827801)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210607100033473.png)]

解决方法1

解决方法2

  1. setuptools不支持Python2.7

解决:在global-requirement.txt将setuptools的版本设置为<45

  1. ksystone运行最低版本是python3.6

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-LEZRokzn-1625448827802)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210607120353023.png)]

参考:https://blog.csdn.net/weixin_44877226/article/details/108400628

将python的软连接改为python3.7

cd /usr/bin

ls -l | grep python

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-NwvlviLu-1625448827804)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210607120644904.png)]

sudo mv /usr/bin/python /usr/bin/python.bak

sudo ln -s /usr/bin/python3.6 /usr/bin/python

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-vLHTJc5q-1625448827805)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210607120734416.png)]

  1. Python2与python3的编码问题

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Q2VFjQkg-1625448827806)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210607123647307.png)]

在希望接受的是二进制的变量后面加上.encode()

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-7CuARVCN-1625448827808)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210607123820667.png)]

  1. 【待解决】

Job for radvd.service failed because the control process exited with error code.
2021-06-07 02:35:13.719 | See “systemctl status radvd.service” and “journalctl -xe” for details.
2021-06-07 02:35:13.722 | invoke-rc.d: initscript radvd, action “start” failed.
2021-06-07 02:35:13.753 | * radvd.service - Router advertisement daemon for IPv6
2021-06-07 02:35:13.754 | Loaded: loaded (/lib/systemd/system/radvd.service; disabled; vendor preset: enabled)
2021-06-07 02:35:13.755 | Active: failed (Result: exit-code) since Mon 2021-06-07 10:35:13 CST; 41ms ago
2021-06-07 02:35:13.755 | Docs: man:radvd(8)
2021-06-07 02:35:13.756 | Process: 30568 ExecStartPre=/usr/sbin/radvd --logmethod stderr_clean --configtest (code=exited, status=1/FAILURE)
2021-06-07 02:35:13.762 |
2021-06-07 02:35:13.763 | Jun 07 10:35:13 xiao-VirtualBox systemd[1]: Starting Router advertisement daemon for IPv6…
2021-06-07 02:35:13.764 | Jun 07 10:35:13 xiao-VirtualBox radvd[30568]: can’t open /etc/radvd.conf: No such file or directory
2021-06-07 02:35:13.765 | Jun 07 10:35:13 xiao-VirtualBox radvd[30568]: Insecure file permissions, but continuing anyway
2021-06-07 02:35:13.765 | Jun 07 10:35:13 xiao-VirtualBox radvd[30568]: exiting, failed to read config file
2021-06-07 02:35:13.765 | Jun 07 10:35:13 xiao-VirtualBox systemd[1]: radvd.service: Control process exited, code=exited status=1
2021-06-07 02:35:13.766 | Jun 07 10:35:13 xiao-VirtualBox systemd[1]: radvd.service: Failed with result ‘exit-code’.
2021-06-07 02:35:13.766 | Jun 07 10:35:13 xiao-VirtualBox systemd[1]: Failed to start Router advertisement daemon for IPv6.

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-j95uIm2G-1625448827809)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210607104538147.png)]

  1. WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv

  2. ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

  3. 安装包问题

sudo: virsh:找不到命令sudo: iscsiadm:找不到命令sudo: /usr/sbin/apache2ctl:找不到命令sudo: a2dissite:找不到命令+++functions-common:die:187                  set +o xtrace[ERROR] /opt/stack/devstack/functions-common:264 Support for xenial is incomplete: no support for apache version not supported+functions-common:stop_service:2304        sudo /bin/systemctl stop mysqlFailed to stop mysql.service: Unit mysql.service not loaded.++lib/neutron-legacy:cleanup_mutnauq:615    ip -f inet6 a s dev br-exDevice "br-ex" does not exist.+lib/neutron-legacy:cleanup_mutnauq:615    [[ 0 != 0 ]]+lib/neutron-legacy:cleanup_mutnauq:623    is_provider_network+lib/neutron_plugins/services/l3:is_provider_network:409  '[' '' == True ']'+lib/neutron_plugins/services/l3:is_provider_network:412  return 1+lib/neutron-legacy:cleanup_mutnauq:632    is_neutron_ovs_base_plugin+lib/neutron_plugins/linuxbridge_agent:is_neutron_ovs_base_plugin:30  return 1+lib/neutron-legacy:cleanup_mutnauq:636    [[ linuxbridge == \l\i\n\u\x\b\r\i\d\g\e ]]+lib/neutron-legacy:cleanup_mutnauq:637    neutron_lb_cleanup+lib/neutron_plugins/linuxbridge_agent:neutron_lb_cleanup:11  sudo brctl delbr br-exbridge br-ex doesn't exist; can't delete it
  • 1
/usr/local/lib/python3.8/dist-packages:os-testr===2.0.0,python-subunit===1.4.0,pbr===5.6.0,testtools===2.4.0,stestr===3.2.0,extras===1.0.0,six===1.16.0【1,python-mimeparse===1.6.0,traceback2===1.4.0,fixtures===3.0.0【3,unittest2===1.1.0,cliff===3.8.0,PyYAML===5.4.1,future===0.18.2,voluptuous===0.12.1,linecache2===1.0.0,stevedore===3.3.0,cmd2===1.5.0,pyparsing===2.4.7【1,prettytable===0.7.2,pyperclip===1.8.2,wcwidth===0.2.5,attrs===21.2.0,colorama===0.4.4___________/opt/stack/requirements/.venv/lib/python3.8/site-packages:pbr===5.6.0
  • 1

参考:https://blog.csdn.net/qq_33659001/article/details/109438291

反复安装一个包,但是安装包已经存在本地,这是考虑是不是路径没有添加到环境变量中。

Collecting pbr>=1.8Downloading http://pypi.doubanio.com/packages/18/e0/1d4702dd81121d04a477c272d47ee5b6bc970d1a0990b11befa275c55cf2/pbr-5.6.0-py2.py3-none-any.whl (111 kB)  |████████████████████████████████| 111 kB 232 kB/s Installing collected packages: pbr, testresourcesWARNING: The script pbr is installed in =='/opt/stack/.local/bin'== which is not on PATH.Consider ==adding this directory to PATH== or, if you prefer to suppress this warning, use --no-warn-script-location.
  • 1

解决方法:

先把路径添加到环境变量,生效刚才改变的文件,删除安装的包,再重新安装。

echo ‘export PATH=/opt/stack/.local/bin:$PATH’ >>~/.bashrc # 中间的那个路径是WARING提示的PATH

source ~/.bashrc

pip3 uninstall xxxx包

pip install xxxx包

stack@x-VirtualBox:~/devstack$ pip install pyparsing===2.4.7Looking in indexes: http://pypi.douban.com/simple/Requirement already satisfied: pyparsing===2.4.7 in /opt/stack/.local/lib/python3.8/site-packages (2.4.7)stack@x-VirtualBox:~/devstack$ pip uninstall pyparsing===2.4.7Found existing installation: pyparsing 2.4.7Uninstalling pyparsing-2.4.7:Would remove: /opt/stack/.local/lib/python3.8/site-packages/pyparsing-2.4.7.dist-info/* /opt/stack/.local/lib/python3.8/site-packages/pyparsing.pyProceed (y/n)? ySuccessfully uninstalled pyparsing-2.4.7stack@x-VirtualBox:~/devstack$ pip install pyparsing===2.4.7Looking in indexes: http://pypi.douban.com/simple/Requirement already satisfied: pyparsing===2.4.7 in /usr/local/lib/python3.8/dist-packages (2.4.7)
  • 1
  1. 实在不行,一直停留在同一个错误

就先执行./unstack.sh./clean.sh后再执行./stack.sh

  1. MYSQL启动问题
+lib/databases/mysql:configure_database_mysql:95  sudo mysqladmin -u root password oHXfJoTxqepZKSKAmysqladmin: connect to server at 'localhost' failed==error: 'Access denied for user 'root'@'localhost' (using password: NO)'==+lib/databases/mysql:configure_database_mysql:95  true+lib/databases/mysql:configure_database_mysql:99  is_ubuntu+functions-common:is_ubuntu:493            [[ -z deb ]]+functions-common:is_ubuntu:496            '[' deb = deb ']'+lib/databases/mysql:configure_database_mysql:99  '[' mysql == mariadb ']'+lib/databases/mysql:configure_database_mysql:102  local 'cmd_args=-uroot -poHXfJoTxqepZKSKA -h127.0.0.1 '+lib/databases/mysql:configure_database_mysql:108  is_ubuntu+functions-common:is_ubuntu:493            [[ -z deb ]]+functions-common:is_ubuntu:496            '[' deb = deb ']'+lib/databases/mysql:configure_database_mysql:108  '[' mysql == mariadb ']'+lib/databases/mysql:configure_database_mysql:113  sudo mysql -uroot -poHXfJoTxqepZKSKA -h127.0.0.1 -e 'CREATE USER IF NOT EXISTS '\''root'\''@'\''%'\'' identified by '\''oHXfJoTxqepZKSKA'\'';'mysql: [Warning] Using a password on the command line interface can be insecure.==ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)==+lib/databases/mysql:configure_database_mysql:1  exit_trap+./stack.sh:exit_trap:503                  local r=1++./stack.sh:exit_trap:504                  jobs -p+./stack.sh:exit_trap:504                  jobs=91992+./stack.sh:exit_trap:507                  [[ -n 91992 ]]+./stack.sh:exit_trap:507                  [[ -n /opt/stack/logs/stack.sh.log.2021-06-03-163257 ]]+./stack.sh:exit_trap:507                  [[ True == \T\r\u\e ]]+./stack.sh:exit_trap:508                  echo 'exit_trap: cleaning up child processes'exit_trap: cleaning up child processes+./stack.sh:exit_trap:509                  kill 91992+./stack.sh:exit_trap:513                  '[' -f /tmp/tmp.lxREoqKq2a ']'+./stack.sh:exit_trap:514                  rm /tmp/tmp.lxREoqKq2a+./stack.sh:exit_trap:518                  kill_spinner+./stack.sh:kill_spinner:413               '[' '!' -z '' ']'+./stack.sh:exit_trap:520                  [[ 1 -ne 0 ]]+./stack.sh:exit_trap:521                  echo 'Error on exit'Error on exit+./stack.sh:exit_trap:523                  type -p generate-subunit+./stack.sh:exit_trap:524                  generate-subunit 1622709170 301 fail+./stack.sh:exit_trap:526                  [[ -z /opt/stack/logs ]]+./stack.sh:exit_trap:529                  /usr/bin/python3.8 /opt/stack/devstack/tools/worlddump.py -d /opt/stack/logsebtables v1.8.4 (nf_tables): table `broute' is incompatible, use 'nft' tool.
  • 1

【解决方法写在下面】

远程登录MySQL

参考: https://blog.csdn.net/qq_26164609/article/details/106881079

sudo apt-get install mysql-server 安装数据库为mysql8.0以上

但是刚安装却等不上去[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-xHjjQrUv-1625448827810)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603174929196.png)]

解决方法:

  • 使用命令查看mysql数据库自动设置的随机账户与密码

sudo cat /etc/mysql/debian.cnf

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-N9i8nqIR-1625448827811)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603175118099.png)]

可以用其中的默认随机账号和密码登录:

mysql -u debian-sys-maint -p

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ZXtbOeQO-1625448827812)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603175202039.png)]

  • 切换数据库

use mysql;

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ocJxu0qQ-1625448827813)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603175608611.png)]

  • 修改root用户密码

    MySql 从8.0开始修改密码有了变化,在user表加了字段authentication_string,修改密码前先检查authentication_string是否为空

    • 如果不为空,先置空字段在修改密码
    use mysql;  update user set authentication_string='' where user='root';      #将字段置为空 alter user 'root'@'localhost' identified with mysql_native_password by '123456';     #修改密码为123456
    
    • 1
    • 如果为空,则直接修改密码
    alter user 'root'@'localhost' identified with mysql_native_password by '123456';   #修改密码为123456
    
    • 1

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Wr5GzHm3-1625448827815)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603175540905.png)]

【注意】有的教程会建议修改数据库配置文件绕过密码登录。会使root用户处于无密码状态,后期修改密码会报一个root处于无密码状态的错误。

解决:方法在后半部分

  • 设置允许允许远程连接
    修改配置文件
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
  • 1

bind-address后面的ip地址改为0.0.0.0保存并退出,然后重启mysql服务

service mysql restart
  • 1

远程登录MySQL的设置:

  • 使用刚刚修改的密码用root用户进入数据库:

mysql -u root -p

  • 设置远程访问:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '远程访问密码' WITH GRANT OPTION;

其中 ‘root’@’%’ 中的root表示远程访问数据库的账户,%表示所有IP均可访问,'远程访问密码’表示远程访问mysql时需要的密码,此时就完成了mysql开启远程访问的操作。

但是我在使用这句语句的时候报错了:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-RyrlWRbc-1625448827816)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603181011992.png)]

以上的一行代码这种方法并不适用于Mysql 8.0以后的版本

【解决方法:】

CREATE USER ‘root’@’%’ IDENTIFIED BY ‘你的密码’;
GRANT ALL ON . TO ‘root’@’%’;
ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘你的密码’;

三条命令按顺序执行完成后,刷新权限:

FLUSH PRIVILEGES;

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-8oqfd4AO-1625448827817)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210603181255196.png)]

  1. 其他问题
[ERROR] /opt/stack/devstack/functions-common:2249 ==Neutron did not startexit_trap: cleaning up child processes==Error on exitebtables v1.8.4 (nf_tables): table `broute' is incompatible, use 'nft' tool.
  • 1

实在安装不了OpenStack

  • ~/stack目录下备份local.conf

    sudo cp local.conf /home/xiao/桌面/local.conf.bak

  • ./unstack.sh

  • ./clean.sh

  • 删除 /opt/stack文件夹

    sudo rm -r /opt/stack

  • 删除stack用户

    命令参考:ubuntu创建和删除用户

    ubuntu查看所有用户

    sudo userdel -r stack

    grep bash /etc/passwd # 查看所有用户

  • 重新安装

  • 或者降低Ubuntu的版本重新再安装

Ubuntu16.04安装OpenStack

根据前面的安装OpenStack步骤做到stack用户运行./stack.sh之前,需要安装Python3.6。

安装Python3.6

cd /usr/local/lib

  • 下载安装包

sudo wget http://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz

  • 安装依赖包

sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

  • 解压

sudo tar -xvzf Python-3.6.4.tgz

  • 创建python3.6文件夹

sudo mkdir /usr/local/python3.6

./configure --prefix=/usr/local/python3.6

configure文件是一个可执行的脚本文件,它有很多选项,在待安装的源码目录下使用命令./configure –help可以输出详细的选项列表。

其中--prefix选项是配置安装目录,如果不配置该选项,安装后可执行文件默认放在/usr /local/bin,库文件默认放在/usr/local/lib,配置文件默认放在/usr/local/etc,其它的资源文件放在/usr /local/share,比较凌乱。

如果配置了--prefix,安装后的所有资源文件都会被放在/usr/local/python3.6目录中,不会分散到其他目录。

使用--prefix选项的另一个好处是方便卸载软件或移植软件

  • 当某个安装的软件不再需要时,只须简单的删除该安装目录,就可以把软件卸载干净;
  • 移植软件只需拷贝整个目录到另外一个机器即可(相同的操作系统下)

当然要卸载程序,也可以在原来的make目录下用一次make uninstall,但前提是Makefile文件有uninstall命令。

  • 编译

make讲解

./configure --enable-optimizations

或者上面两句合成一句

./configure --prefix=/usr/local/python3.6 --enable-optimizations #可执行文件放在/usr /local/python3.6/bin,库文件放在/usr/local/python3.6/lib,配置文件放在/usr/local/python3.6/include,其它的资源文件放在/usr /local/python3.6/share

sudo make #编译,大多数的源代码包都经过这一步进行编译。

只要编译不报错就可以进行安装了。

make test #对上一步 make 的检查了,要确保 make 是没有错误的,也就是这一步的 test、check要全部是 OK 的,error 为0

以下为make编译的出错,解决方案在后面


======================================================================ERROR: test_zzquit (test.test_nntplib.NetworkedNNTP_SSLTests)----------------------------------------------------------------------Traceback (most recent call last):  File "/usr/local/lib/Python-3.6.13/Lib/test/test_nntplib.py", line 252, in wrapped    meth(self)  File "/usr/local/lib/Python-3.6.13/Lib/test/test_nntplib.py", line 240, in test_zzquit    self.server.quit()  File "/usr/local/lib/Python-3.6.13/Lib/nntplib.py", line 935, in quit    resp = self._shortcmd('QUIT')  File "/usr/local/lib/Python-3.6.13/Lib/nntplib.py", line 511, in _shortcmd    return self._getresp()  File "/usr/local/lib/Python-3.6.13/Lib/nntplib.py", line 449, in _getresp    resp = self._getline()  File "/usr/local/lib/Python-3.6.13/Lib/nntplib.py", line 432, in _getline    line = self.file.readline(_MAXLINE +1)  File "/usr/local/lib/Python-3.6.13/Lib/socket.py", line 583, in readinto    raise OSError("cannot read from timed out object")OSError: cannot read from timed out object== Tests result: FAILURE then FAILURE ==391 tests OK.1 test failed:    test_nntplib13 tests skipped:    test_devpoll test_kqueue test_lzma test_msilib test_ossaudiodev    test_startfile test_tix test_tk test_ttk_guionly test_winconsoleio    test_winreg test_winsound test_zipfile641 re-run test:    test_nntplib2 tests run no tests:    test_dtrace test_future4Total duration: 13 min 14 secTests result: FAILURE then FAILUREMakefile:1046: recipe for target 'test' failedmake: *** [test] Error 2
  • 1

对于报的错误,建议安装可能需要的所有包,以及时间同步:

参考:linux下安装python3完整教程(依赖环境gcc,make,cmake,configure等详细解释)

sudo apt-get install -y gcc make cmake build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl

sudo apt-get install python3-dev libxml2-dev libffi-dev libssl-dev libxslt1-dev

sudo apt-get install sqlite

sudo apt-get install lzma openssl tklib cmake cmake-gui libssl-dev

sudo apt-get update
sudo apt-get upgrade
apt-get install -y zlib*
apt-get install --reinstall zlibc zlib1g zlib1g-dev
apt-get install libffi-dev libssl-dev libreadline-dev -y
sudo apt-get dist-upgrade
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus
sudo apt-get install build-essential libncursesw5-dev libgdbm-dev libc6-dev
sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev
sudo apt-get install libssl-dev openssl
sudo apt-get install libffi-dev

【问题解决】:

因为轮屏显示checking xxxx

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-GRXVUSEo-1625448827819)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210605182827137.png)]

考虑是不是系统时间的问题。

时间同步:

sudo apt-get install ntpdate

ntpdate us.pool.ntp.org

  • 安装

make install

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ODLZoBDb-1625448827820)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210605215624359.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-zXkzRp9L-1625448827821)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210605220644015.png)]

以下文字摘自官方的README:

On Unix and Mac systems if you intend to install multiple versions of Pythonusing the same installation prefix (``--prefix`` argument to the configurescript) you must take care that your primary python executable is notoverwritten by the installation of a different version.  All files anddirectories installed using ``make altinstall`` contain the major and minorversion and can thus live side-by-side.  ``make install`` also creates``${prefix}/bin/python3`` which refers to ``${prefix}/bin/pythonX.Y``.  If youintend to install multiple versions using the same prefix you must decide whichversion (if any) is your "primary" version.  Install that version using ``makeinstall``.  Install all other versions using ``make altinstall``.For example, if you want to install Python 2.7, 3.5, and 3.6 with 3.6 being theprimary version, you would execute ``make install`` in your 3.6 build directoryand ``make altinstall`` in the others.
  • 1
  • 配置环境变量

若./configure --prefix=/usr/local/python3.6,则需要添加环境变量。
若./configure的无需配置

#添加环境变量

PATH= P A T H : PATH: PATH:HOME/bin:/usr/local/python3.6/bin

#查看环境变量

echo $PATH

  • 添加到全局环境变量

sudo vim /etc/profile #全局的

#在文末添加下面一行

export PATH=$PATH:/usr/local/python3.6/bin #这个路径是python3.6安装的路径

source /etc/profile #生效配置信息

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Epn8UZXo-1625448827822)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210606165832202.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-WZEnOkVM-1625448827824)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210606165755170.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-R021vVHI-1625448827825)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210605222704085.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-qBHMc9k4-1625448827827)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210605223651681.png)]

  • 或者添加到当前用户的环境变量

vim .bashrc #自己用户的

export PATH=$PATH:/usr/local/python3.6/bin #这个路径是python3.6安装的路径

source .bashrc #生效配置信息

  • 更改默认指向

参考:https://blog.csdn.net/zw05011/article/details/105702318/

由于python3.6是自己安装的,不在/usr/bin下,而在usr/local/bin或者/usr/local/python3.6/bin下(取决于前面执行的./configure还是./configure --prefix=/usr/local/python3.6。因此需要先加一条软链接并且把之前的python命令改为python.bak,同时pip也需要更改。依次执行以下命令。

若python3.6安装时,执行的是./configure --prefix=/usr/local/python3.6,则为:

#备份原链接

mv /usr/bin/python3 /usr/bin/python3.bak

#或者为

mv -f /usr/bin/python3 /usr/bin/python3.bak

#创建新连接,ln -s 原文件 目标文件

ln -s /usr/local/python3.6/bin/python3.6 /usr/bin/python3

#备份原链接

mv /usr/bin/pip3 /usr/bin/pip3.bak

ln -s /usr/local/python3.6/bin/pip3 /usr/bin/pip3

以后用python3.6直接用python3以及pip3

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Mn2oUiaJ-1625448827829)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210605222300611.png)]

软连接设置成功:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-xpyWSkdu-1625448827830)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210605222240043.png)]

https://www.cnblogs.com/yy-cxd/p/11063887.html

软连接# 备份原有Python命令的软连接

https://blog.csdn.net/weixin_39918961/article/details/111721460

https://blog.csdn.net/weixin_35638013/article/details/112991408?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-1&spm=1001.2101.3001.4242

https://blog.csdn.net/zw05011/article/details/105702318/

1-安装Python3的问题解决

Linux源码安装Python3.7出现的各种坑

linux下安装python3完整教程(依赖环境gcc,make,cmake,configure等详细解释)

https://blog.csdn.net/KunagisaTomo_i/article/details/81177558

https://zhuanlan.zhihu.com/p/64996095

https://www.jianshu.com/p/af94cd9a72c2

https://blog.csdn.net/qq_40660130/article/details/113432763?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_baidulandingword-0&spm=1001.2101.3001.4242

https://blog.csdn.net/Carina_Cao/article/details/90210626

但是有警告[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-yEMT0kzk-1625448827831)(C:\Users\11728\AppData\Roaming\Typora\typora-user-images\image-20210606093724753.png)]

`pip`正在被低版本的python使用,建议使用python时使用`-m pip`取代直接用`pip`
  • 1

参考:https://github.com/pypa/pip/issues/5599

  • 用你的系统包管理器来升级系统 pip。pip install -U pip

  • 切勿将 sudo 与 pip 一起使用

  • 使用pip时加上--user

    在您的个人目录中安装软件包,从而避免干扰 pip 的系统副本。

一键安装失败一键安装各个组件要求的软件包版本不一致等问题,搞了好久都没解决

部署OpenStack总结

还是建议一个组件一个组件的安装配置,一键安装不能了解各组件是如何服务的。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/628376
推荐阅读
相关标签
  

闽ICP备14008679号