首页 > 其他分享 >openstack单机部署

openstack单机部署

时间:2022-11-04 17:44:23浏览次数:36  
标签:placement 单机 部署 nova -- vip keystone openstack

注:centos8单机版

 注:本次实验手动配置密码均为admin

环境准备:配置hosts文件

192.168.116.8为本机IP

echo '192.168.116.8 controller vip myip' >> /etc/hosts
yum upgrade -y

 

1. 更换yum源

wget http://mirrors.aliyun.com/repo/Centos-8.repo

2. 下载openstack源

yum install  -y centos-release-openstack-ussuri

sed -i 's/^mirrorlist=http:\/\/mirrorlist.centos.org/#mirrorlist=http:\/\/mirrorlist.centos.org/g' /etc/yum.repos.d/C*
sed -i 's/^#baseurl=http:\/\/mirror.centos.org/baseurl=https:\/\/vault.centos.org/g' /etc/yum.repos.d/C* 
sed -i 's/gpgcheck=1/gpgcheck=0/g' /etc/yum.repos.d/C* 

yum config-manager --set-enabled powertools
yum install -y python3-openstackclient
yum install -y openstack-selinux

3. 本地数据库配置

  • bind-address=127.0.0.1 #只允许本机访问。
  • bind-address=某个网卡的ip #例如bind-address=192.168.116.8,只能通过ip为192.168.116.8的网卡访问。
  • bind-address=0.0.0.0 #此规则是系统默认配置,监听所有网卡,即允许所有ip访问。
yum install -y mariadb mariadb-server python3-PyMySQL

cat > /etc/my.cnf.d/openstack.cnf << EOF
[mysqld]
bind-address = 192.168.116.8
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
EOF


systemctl enable mariadb --now

mysql_secure_installation

4. 配置rabbitmq

  遇到报错:缺libSDL2,erlang安装失败,rabbitmq安装失败;

  尝试单独下载erlang源,再次安装,依然失败:curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh|sh;失败后删除本操作产生的额外erlang源

  解决:wget https://pkgs.dyn.su/el8/extras/x86_64/SDL2-2.0.14-5.el8.x86_64.rpm;yum -y install SDL2-2.0.14-5.el8.x86_64.rpm   或yum -y upgrade试试

 

yum install -y rabbitmq-server
systemctl enable rabbitmq-server --now


rabbitmqctl add_user openstack openstack
rabbitmqctl set_permissions openstack ".*" ".*" ".*"

5. 配置memcached

注:192.168.116.8为本机IP

yum install -y memcached python3-memcached

sed -i 's/OPTIONS=".*"/OPTIONS="-l 127.0.0.1,::1,192.168.116.8"/' /etc/sysconfig/memcached

systemctl enable memcached --now

6. 配置etcd

单节点可不部署

yum install -y etcd

 

7. 配置keystone

报错:
openstack token issue Failed to discover available identity versions when contacting http://vip:5000/v3. Attempting to parse version from URL. Unexpected exception for http://vip:5000/v3/auth/tokens: Failed to parse: http://vip:5000/v3/auth/tokens
解决:
yum -y upgrade

  

mysql -uroot -pAdmin123! -e'create database if not exists keystone;
grant all privileges on keystone.* to keystone@localhost identified by "keystone";
grant all privileges on keystone.* to keystone@"%" identified by "keystone";
flush privileges;'
yum -y install openstack-keystone httpd python3-mod_wsgi
sed -i -e '/^\[database\]/a connection \= mysql\+pymysql\:\/\/keystone:keystone\@vip\/keystone' -e '/^\[token\]/a provider \= fernet' /etc/keystone/keystone.conf
su -s /bin/sh -c "keystone-manage db_sync" keystone
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
keystone-manage bootstrap --bootstrap-password admin   --bootstrap-admin-url http://vip:5000/v3/   --bootstrap-internal-url http://vip:5000/v3/   --bootstrap-public-url http://vip:5000/v3/   --bootstrap-region-id RegionOne

sed -i '/^\#ServerName/i ServerName 192.168.116.8' /etc/httpd/conf/httpd.conf ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/ systemctl restart httpd systemctl enable httpd --now
cat > openstack-admin.sh << EOF
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://vip:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
EOF


source openstack-admin.sh

openstack domain create --description "An Example Domain" example #测试,创建域
openstack token issue #检错
openstack domain list #查看
openstack domain set  example --disable #禁用
openstack domain delete example #删除

 

openstack project create --domain default --description "Service Project" service
openstack project create --domain default --description "Demo Project" demo
openstack user create --domain default --password-prompt demo
openstack role create user
openstack role add --project demo --user demo user

 

8. 配置glance

mysql -uroot  -pAdmin123! -e'create database if not exists glance;
grant all privileges on glance.* to glance@localhost identified by "glance";
grant all privileges on glance.* to glance@"%" identified by "glance";
flush privileges;'

 

openstack user create --domain default --password-prompt glance
openstack role add --project service --user glance admin openstack service create --name glance --description "OpenStack Image" image openstack endpoint create --region RegionOne image public http://vip:9292 openstack endpoint create --region RegionOne image internal http://vip:9292 openstack endpoint create --region RegionOne image admin http://vip:9292

 

yum -y install openstack-glance

sed -i '/^\[database\]/a connection = mysql\+pymysql\:\/\/glance:glance\@vip\/glance' /etc/glance/glance-api.conf sed -i '/^\[glance_store\]/a stores = file,http \ndefault_store = file \nfilesystem_store_datadir = /var/lib/glance/images/' /etc/glance/glance-api.conf sed -i '/^\[keystone_authtoken\]/a www_authenticate_uri = http://vip:5000\nauth_url = http://vip:5000 \nmemcached_servers = 192.168.116.8:11211 \nauth_type = password \nproject_domain_name = Default \nuser_domain_name = Default \nproject_name = service \nusername = glance \npassword = admin' /etc/glance/glance-api.conf sed -i '/^\[paste_deploy\]/a flavor = keystone' /etc/glance/glance-api.conf

 

su -s /bin/sh -c "glance-manage db_sync" glance

systemctl enable openstack-glance-api.service --now

 

9. 配置placement

mysql -uroot -pAdmin123! -e'create database placement;
grant all privileges on placement.* to placement@localhost identified by "placement";
grant all privileges on placement.* to placement@"%" identified by "placement";
flush privileges;'

 

openstack user create --domain default --password-prompt placement
openstack role add --project service --user placement admin openstack service create --name placement --description "Placement API" placement openstack endpoint create --region RegionOne placement public http://vip:8778 openstack endpoint create --region RegionOne placement internal http://vip:8778 openstack endpoint create --region RegionOne placement admin http://vip:8778

 

yum install -y openstack-placement-api


sed -i '/^\[placement_database\]/a connection = mysql+pymysql://placement:placement@vip/placement' /etc/placement/placement.conf
sed -i '/^\[api\]/a auth_strategy = keystone' /etc/placement/placement.conf
sed -i '/^\[keystone_authtoken\]/a www_authenticate_uri = http://vip:5000 \nauth_url = http://vip:5000/v3 \nmemcached_servers = 192.168.116.8:11211 \nauth_type = password \nproject_domain_name = Default \nuser_domain_name = Default \nproject_name = service \nusername = placement \npassword = admin' /etc/placement/placement.conf

 

su -s /bin/sh -c "placement-manage db sync" placement

 

sed -i  '/<\/VirtualHost>/i <Directory /usr/bin> \n   <IfVersion >= 2.4> \n      Require all granted \n   </IfVersion> \n   <IfVersion < 2.4> \n      Order allow,deny \n      Allow from all \n   </IfVersion> \n</Directory> ' /etc/httpd/conf.d/00-placement-api.conf

systemctl restart httpd

 

10. 配置nova

 

mysql -uroot -pAdmin123! -e"
create database nova_api;
create database nova;
create database nova_cell0;
grant all privileges on nova_api.* to 'nova'@'localhost' identified by 'nova';
grant all privileges on nova_api.* to 'nova'@'%' identified by 'nova';
grant all privileges on nova.* to 'nova'@'localhost' identified by 'nova';
grant all privileges on nova.* to 'nova'@'%' identified by 'nova';
grant all privileges on nova_cell0.* to 'nova'@'localhost' identified by 'nova';
grant all privileges on nova_cell0.* to 'nova'@'%' identified by 'nova';
flush privileges;"

 

openstack user create --domain default --password-prompt nova

openstack role add --project service --user nova admin
openstack service create --name nova --description "OpenStack Compute" compute
openstack endpoint create --region RegionOne compute public http://vip:8774/v2.1
openstack endpoint create --region RegionOne compute internal http://vip:8774/v2.1
openstack endpoint create --region RegionOne compute admin http://vip:8774/v2.1
yum install -y openstack-nova-api openstack-nova-conductor   openstack-nova-novncproxy openstack-nova-scheduler

sed -i '/^\[DEFAULT\]/a enabled_apis = osapi_compute,metadata \ntransport_url = rabbit://openstack:openstack@vip:5672/ \nmy_ip = 192.168.116.8' /etc/nova/nova.conf
sed -i '/^\[api\]/a auth_strategy = keystone' /etc/nova/nova.conf
sed -i '/^\[api_database\]/a connection = mysql+pymysql://nova:nova@vip/nova_api' /etc/nova/nova.conf
sed -i '/^\[database\]/a connection = mysql+pymysql://nova:nova@vip/nova' /etc/nova/nova.conf
sed -i '/^\[glance\]/a api_servers = http://vip:9292' /etc/nova/nova.conf
sed -i '/^\[keystone_authtoken\]/a www_authenticate_uri = http://vip:5000/ \nauth_url = http://vip:5000/ \nmemcached_servers = 192.168.116.8:11211 \nauth_type = password \nproject_domain_name = Default \nuser_domain_name = Default \nproject_name = service \nusername = nova \npassword = admin' /etc/nova/nova.conf
sed -i '/^\[oslo_concurrency\]/a lock_path = /var/lib/nova/tmp' /etc/nova/nova.conf
sed -i '/^\[placement\]/a region_name = RegionOne \nproject_domain_name = Default \nproject_name = service \nauth_type = password \nuser_domain_name = Default \nauth_url = http://vip:5000/v3 \nusername = placement \npassword = admin' /etc/nova/nova.conf 
sed -i '/^\[vnc\]/a enabled = true \nserver_listen = $my_ip \nserver_proxyclient_address = $my_ip' /etc/nova/nova.conf

 

su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
su -s /bin/sh -c "nova-manage db sync" nova

验证:su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova

 

systemctl enable openstack-nova-api openstack-nova-scheduler  openstack-nova-conductor openstack-nova-novncproxy
systemctl restart openstack-nova-api openstack-nova-scheduler openstack-nova-conductor openstack-nova-novncproxy

 

 

实验的时候发现了一个很好用的ini配置文件编辑工具:crudini 

[libvirt]
#virt_type = kvm  #物理机配置openstack
#virt_type = qemu   #虚拟机配置openstack
####(官方:虚拟机必须配置libvirt为使用qemu而不是kvm。)####

  

yum install -y openstack-nova-compute
yum install -y crudini

crudini --set /etc/nova/nova.conf vnc server_listen '0.0.0.0'
crudini --set /etc/nova/nova.conf vnc novncproxy_base_url http://VIP:6080/vnc_auto.html
crudini --set /etc/nova/nova.conf libvirt virt_type qemu
discover_hosts_in_cells_interval = 300

 

先启动:
systemctl restart libvirtd-tcp.socket
再启动:
systemctl enable libvirtd openstack-nova-compute
systemctl restart libvirtd openstack-nova-compute

 

标签:placement,单机,部署,nova,--,vip,keystone,openstack
From: https://www.cnblogs.com/santia-god/p/16851887.html

相关文章

  • kubernetes(k8s)中部署dashboard可视化面板
    Web界面(Dashboard)Dashboard是基于网页的Kubernetes用户界面。你可以使用Dashboard将容器应用部署到Kubernetes集群中,也可以对容器应用排错,还能管理集群资源。你......
  • Windows Server 2016部署MySQL 8.0 MGR
    环境介绍操作系统IP主机名MySQL版本WindowsServer2016192.168.1.91db18.0.31WindowsServer2016192.168.1.92db28.0.31WindowsServer2016192.......
  • OpenStack Neutron浅析
    1.基础知识1.1防火墙(firewall)防火墙是依照特定的规则来控制进出它的网络流量的网络安全系统。一个典型的场景是在一个受信任的内网和不受信任的外网比如Internet之间......
  • Linux(Ubuntu、Centos)环境安装部署Docker及Docker-compose
    Centos7安装Docker环境#安装依赖yuminstall-yyum-utilsdevice-mapper-persistent-datalvm2#设置yum源(选择其中一个)yum-config-manager--add-repohttp://downl......
  • admin.net框架docker部署
    前端dockerrun-id-p81:80-v/root/docker/ioms/conf/nginx:/etc/nginx-v/root/docker/ioms/logs/:/var/log/nginx-v/root/docker/ioms/www/:/usr/share/nginx/ht......
  • 网站SSL证书部署
    一、前言在日常开发中免不了要上线网站,那么上线网站也就免不了跟SSL证书打交道,本篇博客以简短的语言,来记录如何使用以及给网站部署SSL证书。环境:服务器:Centos7Nginx:1.1......
  • BI系统打包Docker镜像及部署的技术难度和实现
    BI系统打包Docker镜像及部署的技术难度和实现随着容器化技术盛行,Docker在前端领域也有着越来越广泛的应用;传统的前端部署方式需要我们将项目打包生成一系列的静态文件,然后......
  • 单机 “5千万以上“ 工业级 LRU cache 实现
    文章目录​​前言​​​​工业级LRUCache​​​​1.基本架构​​​​2.基本操作​​​​2.1insert操作​​​​2.2高并发下insert的一致性/性能保证​​​​2.3L......
  • 从0开始梳理django项目_2.多容器部署(day2)
    公司用的flask+gunicorn+nginx,竟然放在一个容器里了。规模小,也是省事。不过我没看出哪里省事,需要进容器里分别启动所有服务。我用django+uwsgi,对比着来。现在的问题是多容......
  • Ansible 部署的时候提示错误 SSH password instead
    在使用Ansible部署的时候提示:fatal:[*.*.*.*]:FAILED!=>{"msg":"UsingaSSHpasswordinsteadofakeyisnotpossiblebecauseHostKeycheckingisenabled......