OpenEuler操作系统安装openstack

前置要求

1.准备环境:

OpenEule 最小化安装
最少 8 GB 内存(推荐 16 GB)
最少 40 GB 磁盘空间
禁用 SELinux 和防火墙(仅用于测试目的)

2.更新系统:

sudo dnf update -y
sudo dnf install -y git python3 python3-pip

3.安装开发工具和依赖项:

sudo dnf groupinstall -y "Development Tools"
sudo dnf install -y \
    libffi-devel \
    openssl-devel \
    python3-devel \
    libxml2-devel \
    libxslt-devel \
    wget \
    httpd \
    httpd-devel \
    nvme-cli \ 
    openvswitch \
    etcd

4.启动服务和配置etcd服务:

sudo systemctl enable openvswitch --now
sudo systemctl enable httpd --now

1.创建服务单元文件

etcd 的服务单元文件通常位于 /etc/systemd/system/devstack@etcd.service。如果该文件不存在,你可以创建一个新的服务单元文件。以下是一个基本的示例:
sudo vim /etc/systemd/system/devstack@etcd.service

[Unit]
Description=etcd Service for DevStack
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/etcd
Restart=always

[Install]
WantedBy=multi-user.target

2.重新加载 systemd 并启动 etcd 服务:

sudo systemctl daemon-reload
sudo systemctl start devstack@etcd.service
sudo systemctl enable devstack@etcd.service

安装 DevStack:

DevStack 是一个用于快速部署 OpenStack 的开发环境工具,适用于单节点安装。

1.克隆 DevStack 仓库:

git clone https://opendev.org/openstack/devstack.git
cd devstack

2.创建配置文件:

创建一个 local.conf 文件来配置 DevStack:

cat <<EOF > local.conf
[[local|localrc]]
[[local|localrc]]

# Basic DevStack settings
# Set the password for the root user in the database
DATABASE_PASSWORD=password

# Set the password for the admin user
ADMIN_PASSWORD=password

# Set the password for the service user
SERVICE_PASSWORD=password

# Set the password for the demo user
DEMO_PASSWORD=password

# Set the password for the RabbitMQ user
RABBIT_PASSWORD=password

# Host IP and interface configuration
# Adjust this to your host's IP address
HOST_IP=your.host.ip.address

## Authentication token
SERVICE_TOKEN=secrettoken
SERVICE_PASSWORD=redflag@123

# Example Keystone configuration
KEYSTONE_AUTH_URI=http://172.16.103.188:5000/v3
KEYSTONE_ADMIN_AUTH_URL=http://172.16.103.188:35357/v3

# Compute service
ENABLE_SERVER_GROUP_API=True
ENABLE_NETWORK_API=True

# Use an alternative package repository (if needed)
[[package|pip]]
index-url = https://pypi.tuna.tsinghua.edu.cn/simpl

# Enable etcd
ENABLED_SERVICES += etcd

# Enable Keystone (Identity service)
enable_service key


# Enable Glance (Image service)
enable_service g-api
enable_service g-reg

# Enable Nova (Compute service)
enable_service n-api
enable_service n-crt
enable_service n-obj
enable_service n-cpu
enable_service n-cond
enable_service n-sch
enable_service n-novnc
enable_service n-cauth

# Enable Neutron (Networking service)
enable_service neutron
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service q-metering
enable_service q-qos
enable_service q-lbaasv2
enable_service q-fwaas
enable_service q-vpn

# Enable Horizon (Dashboard)
enable_service horizon

# Enable Cinder (Block Storage service)
enable_service cinder
enable_service c-api
enable_service c-vol
enable_service c-sch

# Enable Heat (Orchestration service)
enable_service heat
enable_service h-api
enable_service h-api-cfn
enable_service h-api-cw
enable_service h-eng

# Enable Swift (Object Storage service)
enable_service s-proxy
enable_service s-object
enable_service s-container
enable_service s-account

# Miscellaneous settings
# Enable logging
LOGFILE=/opt/stack/logs/stack.sh.log
LOGDAYS=2

# Swift settings
SWIFT_HASH=swift_hash
SWIFT_REPLICAS=1
SWIFT_DATA_DIR=$DEST/data

# Enable TLS
ENABLE_TLS=True

EOF

将 yourpassword 替换为你的密码,将 your_server_ip 替换为你的服务器 IP 地址。

3.创建 stack 用户:

运行 DevStack 提供的脚本来创建并配置 stack 用户:

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

该脚本将执行以下操作:
创建一个名为 stack 的用户。
将 stack 用户添加到 sudo 组。
配置 stack 用户以便能够使用 sudo 命令而不需要输入密码。

4.切换到 stack 用户:

完成用户创建和配置后,切换到 stack 用户:

su - stack

5.复制 DevStack到/opt/stack:

切换到 root用户

su -root
cp -r devstack/ /opt/stack

6.设置 FORCE=yes 变量:

你可以通过以下命令来设置 FORCE=yes 变量并重新运行 stack.sh 脚本:

su - stack
cd  devstack
FORCE=yes ./stack.sh

7.确保stack用户有合适的权限:

确保stack用户对/opt/stack目录有合适的权限。以下是命令:

sudo chown -R stack:stack /opt/stack

8.重新运行脚本:

FORCE=yes ./stack.sh

这个过程可能需要一些时间,因为它会下载和安装所有必要的组件。
如果报错显示uninstall-no-record-file

Installing collected packages: wheel, pip
  Attempting uninstall: pip
    Found existing installation: pip 23.3.1
error: uninstall-no-record-file

手动卸载现有的 pip 版本,重新执行脚本:

which pip
sudo rm -rf /usr/local/bin/pip /usr/local/lib/pythonX.Y/site-packages/pip*

9.在虚拟环境中安装 python-openstackclient:

然后,确保虚拟环境处于激活状态,并在虚拟环境中安装 python-openstackclient:
确保 OpenStack CLI 工具已经安装。你可以使用以下命令安装它们:

source /opt/stack/data/venv/bin/activate
sudo pip install python-openstackclient

10… 确认环境变量设置

加载 openrc 文件时,应该会设置一些环境变量,以确保命令可以找到 OpenStack CLI 工具。你可以手动检查这些变量是否正确设置:

source /opt/stack/devstack/openrc admin admin

然后检查环境变量:

echo $PATH

确认其中包含 OpenStack CLI 工具的路径,例如 /usr/local/bin 或 /opt/stack/bin。

11.重新加载 shell

有时新安装的工具需要重新加载 shell 才能生效。你可以尝试以下命令:

exec bash

然后再次加载 openrc 文件并尝试运行 OpenStack 命令:

source /opt/stack/devstack/openrc admin admin
openstack service list

12. 确认 OpenStack 安装目录

确保 OpenStack CLI 工具实际安装在预期目录中。例如,可以检查 /opt/stack 或 /usr/local/bin 目录:

ls /opt/stack
ls /usr/local/bin/openstack

13. 验证 DevStack 安装日志

如果以上步骤都无法解决问题,请查看 DevStack 的安装日志,以获取更多关于安装过程中可能出现问题的线索。日志文件通常位于 /opt/stack/logs/ 目录中。

ls /opt/stack/logs/
  • 30
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
以下是在openeuler安装OpenStack的步骤: 1. 确保你的openeuler系统已经安装了必要的软件包和依赖项。可以使用以下命令安装: ```shell sudo dnf install -y python3-devel libffi-devel gcc openssl-devel ``` 2. 添加OpenStack Train软件源。可以使用以下命令添加: ```shell sudo dnf install -y centos-release-openstack-train ``` 3. 安装OpenStack客户端和服务组件。可以使用以下命令安装: ```shell sudo dnf install -y python3-openstackclient openstack-selinux openstack-utils ``` 4. 配置数据库。可以使用以下命令安装MariaDB数据库: ```shell sudo dnf install -y mariadb mariadb-server python3-PyMySQL ``` 然后启动MariaDB服务并设置开机自启: ```shell sudo systemctl enable mariadb.service sudo systemctl start mariadb.service ``` 接下来,使用以下命令来配置MariaDB数据库: ```shell sudo mysql_secure_installation ``` 5. 配置消息队列。可以使用以下命令安装RabbitMQ消息队列: ```shell sudo dnf install -y rabbitmq-server ``` 然后启动RabbitMQ服务并设置开机自启: ```shell sudo systemctl enable rabbitmq-server.service sudo systemctl start rabbitmq-server.service ``` 6. 配置身份认证服务。可以使用以下命令安装Keystone身份认证服务: ```shell sudo dnf install -y openstack-keystone httpd mod_wsgi ``` 然后启动httpd服务并设置开机自启: ```shell sudo systemctl enable httpd.service sudo systemctl start httpd.service ``` 7. 配置计算服务。可以使用以下命令安装Nova计算服务: ```shell sudo dnf install -y openstack-nova-api openstack-nova-conductor \ openstack-nova-console openstack-nova-novncproxy \ openstack-nova-scheduler python3-novaclient ``` 8. 配置网络服务。可以使用以下命令安装Neutron网络服务: ```shell sudo dnf install -y openstack-neutron openstack-neutron-ml2 \ openstack-neutron-linuxbridge ebtables ipset ``` 9. 配置镜像服务。可以使用以下命令安装Glance镜像服务: ```shell sudo dnf install -y openstack-glance ``` 10. 配置块存储服务。可以使用以下命令安装Cinder块存储服务: ```shell sudo dnf install -y openstack-cinder targetcli python-keystone ``` 11. 配置对象存储服务。可以使用以下命令安装Swift对象存储服务: ```shell sudo dnf install -y openstack-swift-proxy python3-swiftclient \ python3-keystoneclient python3-keystonemiddleware \ python3-eventlet xfsprogs rsync ``` 12. 配置Dashboard服务。可以使用以下命令安装Horizon Dashboard服务: ```shell sudo dnf install -y openstack-dashboard ``` 13. 配置OpenStack服务。可以使用以下命令配置OpenStack服务: ```shell sudo openstack-config --set /etc/nova/nova.conf database connection mysql+pymysql://nova:password@controller/nova sudo openstack-config --set /etc/nova/nova.conf DEFAULT transport_url rabbit://openstack:password@controller sudo openstack-config --set /etc/nova/nova.conf api auth_strategy keystone sudo openstack-config --set /etc/nova/nova.conf keystone_authtoken www_authenticate_uri http://controller:5000 sudo openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://controller:5000 sudo openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers controller:11211 sudo openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password sudo openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name Default sudo openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name Default sudo openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service sudo openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova sudo openstack-config --set /etc/nova/nova.conf keystone_authtoken password password sudo openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 10.0.0.11 sudo openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron True sudo openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver sudo openstack-config --set /etc/nova/nova.conf vnc enabled true sudo openstack-config --set /etc/nova/nova.conf vnc server_listen 0.0.0.0 sudo openstack-config --set /etc/nova/nova.conf vnc server_proxyclient_address \$my_ip sudo openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://controller:6080/vnc_auto.html sudo openstack-config --set /etc/nova/nova.conf glance api_servers http://controller:9292 sudo openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp sudo openstack-config --set /etc/neutron/neutron.conf database connection mysql+pymysql://neutron:password@controller/neutron sudo openstack-config --set /etc/neutron/neutron.conf DEFAULT transport_url rabbit://openstack:password@controller sudo openstack-config --set /etc/neutron/neutron.conf DEFAULT auth_strategy keystone sudo openstack-config --set /etc/neutron/neutron.conf keystone_authtoken www_authenticate_uri http://controller:5000 sudo openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_url http://controller:5000 sudo openstack-config --set /etc/neutron/neutron.conf keystone_authtoken memcached_servers controller:11211 sudo openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_type password sudo openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_domain_name Default sudo openstack-config --set /etc/neutron/neutron.conf keystone_authtoken user_domain_name Default sudo openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_name service sudo openstack-config --set /etc/neutron/neutron.conf keystone_authtoken username neutron sudo openstack-config --set /etc/neutron/neutron.conf keystone_authtoken password password sudo openstack-config --set /etc/neutron/neutron.conf oslo_concurrency lock_path /var/lib/neutron/tmp sudo openstack-config --set /etc/glance/glance-api.conf database connection mysql+pymysql://glance:password@controller/glance sudo openstack-config --set /etc/glance/glance-api.conf keystone_authtoken www_authenticate_uri http://controller:5000 sudo openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_url http://controller:5000 sudo openstack-config --set /etc/glance/glance-api.conf keystone_authtoken memcached_servers controller:11211 sudo openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_type password sudo openstack-config --set /etc/glance/glance-api.conf keystone_authtoken project_domain_name Default sudo openstack-config --set /etc/glance/glance-api.conf keystone_authtoken user_domain_name Default sudo openstack-config --set /etc/glance/glance-api.conf keystone_authtoken project_name service sudo openstack-config --set /etc/glance/glance-api.conf keystone_authtoken username glance sudo openstack-config --set /etc/glance/glance-api.conf keystone_authtoken password password sudo openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone sudo openstack-config --set /etc/glance/glance-api.conf glance_store stores file,http sudo openstack-config --set /etc/glance/glance-api.conf glance_store default_store file sudo openstack-config --set /etc/glance/glance-api.conf glance_store filesystem_store_datadir /var/lib/glance/images/ sudo openstack-config --set /etc/glance/glance-registry.conf database connection mysql+pymysql://glance:password@controller/glance sudo openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken www_authenticate_uri http://controller:5000 sudo openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_url http://controller:5000 sudo openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken memcached_servers controller:11211 sudo openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_type password sudo openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_domain_name Default sudo openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken user_domain_name Default sudo openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_name service sudo openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken username glance sudo openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken password password sudo openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone sudo openstack-config --set /etc/cinder/cinder.conf database connection mysql+pymysql://cinder:password@controller/cinder sudo openstack-config --set /etc/cinder/cinder.conf DEFAULT transport_url rabbit://openstack:password@controller sudo openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone sudo openstack-config --set /etc/cinder/cinder.conf keystone_authtoken www_authenticate_uri http://controller:5000 sudo openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_url http://controller:5000 sudo openstack-config --set /etc/cinder/cinder.conf keystone_authtoken memcached_servers controller:11211 sudo openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_type password sudo openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_domain_name Default sudo openstack-config --set /etc/cinder/cinder.conf keystone_authtoken user_domain_name Default sudo openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_name service sudo openstack-config --set /etc/cinder/cinder.conf keystone_authtoken username cinder sudo openstack-config --set /etc/cinder/cinder.conf keystone_authtoken password password sudo openstack-config --set /etc/cinder/cinder.conf oslo_concurrency lock_path /var/lib/cinder/tmp sudo openstack-config --set /etc/swift/proxy-server.conf DEFAULT bind_port 8080 sudo openstack-config --set /etc/swift/proxy-server.conf DEFAULT user swift sudo openstack-config --set /etc/swift/proxy-server.conf DEFAULT swift_dir /etc/swift sudo openstack-config --set /etc/swift/proxy-server.conf pipeline:main pipeline "catch_errors healthcheck cache authtoken keystoneauth proxy-server" sudo openstack-config --set /etc/swift/proxy-server.conf filter:keystoneauth use "egg:swift#keystoneauth" sudo openstack-config --set /etc/swift/proxy-server.conf filter:keystoneauth operator_roles admin,user sudo openstack-config --set /etc/swift/proxy-server.conf filter:authtoken paste.filter_factory keystonemiddleware.auth_token:filter_factory sudo openstack-config --set /etc/swift/proxy-server.conf filter:authtoken auth_uri http://controller:5000 sudo openstack-config --set /etc/swift/proxy-server.conf filter:authtoken auth_url http://controller:5000 sudo openstack-config --set /etc/swift/proxy-server.conf filter:authtoken memcached_servers controller:11211 sudo openstack-config --set /etc/swift/proxy-server.conf filter:authtoken auth_type password sudo openstack-config --set /etc/swift/proxy-server.conf filter:authtoken project_domain_name Default sudo openstack-config --set /etc/swift/proxy-server.conf filter:authtoken user_domain_name Default sudo openstack-config --set /etc/swift/proxy-server.conf filter:authtoken project_name service sudo openstack-config --set /etc/swift/proxy-server.conf filter:authtoken username swift sudo openstack-config --set /etc/swift/proxy-server.conf filter:authtoken password password sudo openstack-config --set /etc/swift/proxy-server.conf filter:cache use "egg:swift#memcache" sudo openstack-config --set /etc/swift/proxy-server.conf filter:cache memcache_servers controller:11211 sudo openstack-config --set /etc/swift/proxy-server.conf filter:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

黑蛋同志

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值