基于centos2009搭建openstack-t版-ovs网络-脚本运行

openstackT版脚本

    • 环境变量
    • ip初始化
  • controller
    • iaas-pre.sh
    • iaas-install-mysql.sh
    • iaas-install-keystone.sh
    • iaas-install-glance.sh
    • iaas-install-placement.sh
    • iaas-install-nova-controller.sh
    • iaas-install-neutron-controller.sh
    • iaas-install-dashboard.sh
  • compute
    • iaas-install-nova-compute.sh
    • iaas-install-neutron-compute.sh

实验环境采用Vmware,所使用到的脚本以及配置文件等需要搭配软件包使用,nova默认配置了控制节点加入计算资源池

节点IP
controller192.168.200.10
compute192.168.200.20

**软件包网盘地址:**下载后上传到/root目录下即可

链接:https://pan.baidu.com/s/1_BnBkIIXq5XkMj6sm2PL0Q?pwd=0345
提取码:0345
–来自百度网盘超级会员V4的分享

环境变量

自行修改环境变量信息,特别是IP、网卡等,只需要配置maxvlan即可,本脚本只搭建到dashboard

#--------------------system Config--------------------##
#Controller Server Manager IP. example:x.x.x.x
HOST_IP=192.168.200.10#Controller HOST Password. example:000000
HOST_PASS=000000#Controller Server hostname. example:controller
HOST_NAME=controller#Compute Node Manager IP. example:x.x.x.x
HOST_IP_NODE=192.168.200.20#Compute HOST Password. example:000000
HOST_PASS_NODE=000000#Compute Node hostname. example:compute
HOST_NAME_NODE=compute#--------------------Chrony Config-------------------##
#Controller network segment IP.  example:x.x.0.0/16(x.x.x.0/24)
network_segment_IP=192.168.200.0/24#--------------------Rabbit Config ------------------##
#user for rabbit. example:openstack
RABBIT_USER=openstack#Password for rabbit user .example:000000
RABBIT_PASS=000000#--------------------MySQL Config---------------------##
#Password for MySQL root user . exmaple:000000
DB_PASS=000000#--------------------Keystone Config------------------##
#Password for Keystore admin user. exmaple:000000
DOMAIN_NAME=default
ADMIN_PASS=000000
DEMO_PASS=000000#Password for Mysql keystore user. exmaple:000000
KEYSTONE_DBPASS=000000#--------------------Glance Config--------------------##
#Password for Mysql glance user. exmaple:000000
GLANCE_DBPASS=000000#Password for Keystore glance user. exmaple:000000
GLANCE_PASS=000000#--------------------Placement Config----------------------##
#Password for Mysql placement user. exmaple:000000
PLACEMENT_DBPASS=000000#Password for Keystore placement user. exmaple:000000
PLACEMENT_PASS=000000#--------------------Nova Config----------------------##
#Password for Mysql nova user. exmaple:000000
NOVA_DBPASS=000000#Password for Keystore nova user. exmaple:000000
NOVA_PASS=000000#--------------------Neutron Config-------------------##
#Password for Mysql neutron user. exmaple:000000
NEUTRON_DBPASS=000000#Password for Keystore neutron user. exmaple:000000
NEUTRON_PASS=000000#metadata secret for neutron. exmaple:000000
METADATA_SECRET=000000#External Network Interface. example:eth1
INTERFACE_NAME=ens34#用于创建ovs网络
OVS_NAME=br-ens34#External Network The Physical Adapter. example:provider
Physical_NAME=provider#First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
minvlan=1#Last Vlan ID in VLAN RANGE for VLAN Network. example:200
maxvlan=1000#--------------------Cinder Config--------------------##
#Password for Mysql cinder user. exmaple:000000
CINDER_DBPASS=000000#Password for Keystore cinder user. exmaple:000000
CINDER_PASS=000000#Cinder Block Disk. example:md126p3
BLOCK_DISK=sdb1#--------------------Swift Config---------------------##
#Password for Keystore swift user. exmaple:000000
SWIFT_PASS=000000#The NODE Object Disk for Swift. example:md126p4.
OBJECT_DISK=sdb2#The NODE IP for Swift Storage Network. example:x.x.x.x.
STORAGE_LOCAL_NET_IP=192.168.200.20#--------------------Trove Config----------------------##
#Password for Mysql trove user. exmaple:000000
TROVE_DBPASS=000000#Password for Keystore trove user. exmaple:000000
TROVE_PASS=000000#--------------------Heat Config----------------------##
#Password for Mysql heat user. exmaple:000000
HEAT_DBPASS=000000#Password for Keystore heat user. exmaple:000000
HEAT_PASS=000000#--------------------Ceilometer Config----------------##
#Password for Gnocchi ceilometer user. exmaple:000000
CEILOMETER_DBPASS=000000#Password for Keystore ceilometer user. exmaple:000000
CEILOMETER_PASS=000000#--------------------AODH Config----------------##
#Password for Mysql AODH user. exmaple:000000
AODH_DBPASS=000000#Password for Keystore AODH user. exmaple:000000
AODH_PASS=000000#--------------------ZUN Config----------------##
#Password for Mysql ZUN user. exmaple:000000
ZUN_DBPASS=000000#Password for Keystore ZUN user. exmaple:000000
ZUN_PASS=000000#Password for Keystore KURYR user. exmaple:000000
KURYR_PASS=000000#--------------------OCTAVIA Config----------------##
#Password for Mysql OCTAVIA user. exmaple:000000
OCTAVIA_DBPASS=000000#Password for Keystore OCTAVIA user. exmaple:000000
OCTAVIA_PASS=000000#--------------------Manila Config----------------##
#Password for Mysql Manila user. exmaple:000000
MANILA_DBPASS=000000#Password for Keystore Manila user. exmaple:000000
MANILA_PASS=000000#The NODE Object Disk for Manila. example:md126p5.
SHARE_DISK=sdb3#--------------------Cloudkitty Config----------------##
#Password for Mysql Cloudkitty user. exmaple:000000
CLOUDKITTY_DBPASS=000000#Password for Keystore Cloudkitty user. exmaple:000000
CLOUDKITTY_PASS=000000#--------------------Barbican Config----------------##
#Password for Mysql Barbican user. exmaple:000000
BARBICAN_DBPASS=000000#Password for Keystore Barbican user. exmaple:000000
BARBICAN_PASS=000000

ip初始化

#!/bin/bash
tar -xf topenstack.tar.gz -C /opt/
mkdir /opt/centos
mount /dev/sr0 /opt/centos/
mv /etc/yum.repos.d/* /home/
cat > /etc/yum.repos.d/openstack.repo <<eof
[openstack]
name=openstack
baseurl=file:///opt/openstackt
gpgcheck=0
enabled=1
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
eof
mkdir /etc/openstack/
cp openrc.sh /etc/openstack/source /etc/openstack/openrc.sh#keystone
sed -i -e "s/KEYSTONE_DBPASS/$KEYSTONE_DBPASS/"g controller/keystone/keystone.conf
sed -i -e "s/GLANCE_PASS/$GLANCE_PASS/"g controller/glance/glance-api.conf
sed -i -e "s/HOST_NAME/$HOST_NAME/"g controller/keystone/keystone.conf#glance
sed -i -e "s/GLANCE_DBPASS/$GLANCE_DBPASS/"g controller/glance/glance-api.conf
sed -i -e "s/HOST_NAME/$HOST_NAME/"g controller/glance/glance-api.conf#placement
sed -i -e "s/HOST_NAME/$HOST_NAME/"g controller/placement/placement.conf
sed -i -e "s/PLACEMENT_PASS/$PLACEMENT_PASS/"g controller/placement/placement.conf
sed -i -e "s/PLACEMENT_DBPASS/$PLACEMENT_DBPASS/"g controller/placement/placement.conf#nova-con
sed -i -e "s/RABBIT_USER/$RABBIT_USER/"g controller/nova/nova.conf
sed -i -e "s/RABBIT_PASS/$RABBIT_PASS/"g controller/nova/nova.conf
sed -i -e "s/HOST_NAME/$HOST_NAME/"g controller/nova/nova.conf
sed -i -e "s/HOST_IP/$HOST_IP/"g controller/nova/nova.conf
sed -i -e "s/NOVA_DBPASS/$NOVA_DBPASS/"g controller/nova/nova.conf
sed -i -e "s/NOVA_PASS/$NOVA_PASS/"g controller/nova/nova.conf
sed -i -e "s/PLACEMENT_PASS/$PLACEMENT_PASS/"g controller/nova/nova.conf#neutron-con
sed -i -e "s/HOST_NAME/$HOST_NAME/"g controller/neutron/metadata_agent.ini
sed -i -e "s/METADATA_SECRET/$METADATA_SECRET/"g controller/neutron/metadata_agent.inised -i -e "s/Physical_NAME/$Physical_NAME/"g controller/neutron/ml2_conf.ini
sed -i -e "s/minvlan/$minvlan/"g controller/neutron/ml2_conf.ini
sed -i -e "s/maxvlan/$maxvlan/"g controller/neutron/ml2_conf.inised -i -e "s/RABBIT_USER/$RABBIT_USER/"g controller/neutron/neutron.conf
sed -i -e "s/RABBIT_PASS/$RABBIT_PASS/"g controller/neutron/neutron.conf
sed -i -e "s/HOST_NAME/$HOST_NAME/"g controller/neutron/neutron.conf
sed -i -e "s/HOST_NAME/$HOST_NAME/"g controller/neutron/neutron.conf
sed -i -e "s/NEUTRON_PASS/$NEUTRON_PASS/"g controller/neutron/neutron.conf
sed -i -e "s/NEUTRON_DBPASS/$NEUTRON_DBPASS/"g controller/neutron/neutron.conf
sed -i -e "s/NOVA_PASS/$NOVA_PASS/"g controller/neutron/neutron.confsed -i -e "s/RABBIT_USER/$RABBIT_USER/"g controller/neutron/nova.conf
sed -i -e "s/RABBIT_PASS/$RABBIT_PASS/"g controller/neutron/nova.conf
sed -i -e "s/HOST_NAME/$HOST_NAME/"g controller/neutron/nova.conf
sed -i -e "s/HOST_IP/$HOST_IP/"g controller/neutron/nova.conf
sed -i -e "s/NOVA_DBPASS/$NOVA_DBPASS/"g controller/neutron/nova.conf
sed -i -e "s/NOVA_PASS/$NOVA_PASS/"g controller/neutron/nova.conf
sed -i -e "s/PLACEMENT_PASS/$PLACEMENT_PASS/"g controller/neutron/nova.conf
sed -i -e "s/NEUTRON_PASS/$NEUTRON_PASS/"g controller/neutron/nova.conf
sed -i -e "s/METADATA_SECRET/$METADATA_SECRET/"g controller/neutron/nova.confsed -i -e "s/HOST_IP/$HOST_IP/"g controller/neutron/openvswitch_agent.ini
sed -i -e "s/Physical_NAME/$Physical_NAME/"g controller/neutron/openvswitch_agent.ini
sed -i -e "s/OVS_NAME/$OVS_NAME/"g controller/neutron/openvswitch_agent.inised -i -e "s/HOST_NAME/$HOST_NAME/"g controller/dashboard/local_settings#nova-com
sed -i -e "s/RABBIT_USER/$RABBIT_USER/"g compute/nova/nova.conf
sed -i -e "s/RABBIT_PASS/$RABBIT_PASS/"g compute/nova/nova.conf
sed -i -e "s/HOST_NAME/$HOST_NAME/"g compute/nova/nova.conf
sed -i -e "s/HOST_IP_NODE/$HOST_IP_NODE/"g compute/nova/nova.conf
sed -i -e "s/NOVA_PASS/$NOVA_PASS/"g compute/nova/nova.conf
sed -i -e "s/PLACEMENT_PASS/$PLACEMENT_PASS/"g compute/nova/nova.conf
sed -i -e "s/HOST_IP/$HOST_IP/"g compute/nova/nova.conf#neutron-com
sed -i -e "s/RABBIT_USER/$RABBIT_USER/"g compute/neutron/neutron.conf
sed -i -e "s/RABBIT_PASS/$RABBIT_PASS/"g compute/neutron/neutron.conf
sed -i -e "s/HOST_NAME/$HOST_NAME/"g compute/neutron/neutron.conf
sed -i -e "s/NEUTRON_PASS/$NEUTRON_PASS/"g compute/neutron/neutron.confsed -i -e "s/RABBIT_USER/$RABBIT_USER/"g compute/neutron/nova.conf
sed -i -e "s/RABBIT_PASS/$RABBIT_PASS/"g compute/neutron/nova.conf
sed -i -e "s/HOST_NAME/$HOST_NAME/"g compute/neutron/nova.conf
sed -i -e "s/HOST_IP_NODE/$HOST_IP_NODE/"g compute/neutron/nova.conf
sed -i -e "s/NEUTRON_PASS/$NEUTRON_PASS/"g compute/neutron/nova.conf
sed -i -e "s/NOVA_PASS/$NOVA_PASS/"g compute/neutron/nova.conf
sed -i -e "s/PLACEMENT_PASS/$PLACEMENT_PASS/"g compute/neutron/nova.conf
sed -i -e "s/HOST_IP/$HOST_IP/"g compute/neutron/nova.confsed -i -e "s/HOST_IP_NODE/$HOST_IP_NODE/"g compute/neutron/openvswitch_agent.ini
sed -i -e "s/Physical_NAME/$Physical_NAME/"g compute/neutron/openvswitch_agent.ini
sed -i -e "s/OVS_NAME/$OVS_NAME/"g compute/neutron/openvswitch_agent.ini
echo "##############################################"
echo "#         init               ok              #"
echo "##############################################"

controller

iaas-pre.sh

#/bin/bash
source /etc/openstack/openrc.sh#Welcome page
cat > /etc/motd <<EOF #################################    Welcome  to  OpenStack    #################################
EOF#selinux
sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0#firewalld
systemctl stop firewalld
systemctl disable firewalld  >> /dev/null 2>&1#NetworkManager
systemctl stop NetworkManager >> /dev/null 2>&1
systemctl disable NetworkManager >> /dev/null 2>&1
yum remove -y NetworkManager firewalld
systemctl restart network#iptables
yum install  iptables-services  -y 
if [ 0  -ne  $? ]; thenecho -e "\033[31mThe installation source configuration errors\033[0m"exit 1
fi
systemctl restart iptables
iptables -F
iptables -X
iptables -Z 
/usr/sbin/iptables-save
systemctl stop iptables
systemctl disable iptables# install package 
sed -i -e 's/#UseDNS yes/UseDNS no/g' -e 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
yum install python-openstackclient openstack-selinux expect vim -y#hosts
if [[ `ip a |grep -w $HOST_IP ` != '' ]];then hostnamectl set-hostname $HOST_NAME
elif [[ `ip a |grep -w $HOST_IP_NODE ` != '' ]];then hostnamectl set-hostname $HOST_NAME_NODE
elsehostnamectl set-hostname $HOST_NAME
fi
sed -i -e "/$HOST_NAME/d" -e "/$HOST_NAME_NODE/d" /etc/hosts
echo "$HOST_IP $HOST_NAME" >> /etc/hosts
echo "$HOST_IP_NODE $HOST_NAME_NODE" >> /etc/hosts#ssh
if [[ ! -s ~/.ssh/id_rsa.pub ]];thenssh-keygen  -t rsa -N '' -f ~/.ssh/id_rsa -q -b 2048
fi
name=`hostname`
if [[ $name == $HOST_NAME ]];then
expect -c "set timeout -1;spawn ssh-copy-id  -i /root/.ssh/id_rsa $HOST_NAME_NODE;expect {*password:* {send -- $HOST_PASS_NODE\r;expect {*denied* {exit 2;}eof}}*(yes/no)* {send -- yes\r;exp_continue;}eof         {exit 1;}}"
else
expect -c "set timeout -1;spawn ssh-copy-id  -i /root/.ssh/id_rsa $HOST_NAME;expect {*password:* {send -- $HOST_PASS\r;expect {*denied* {exit 2;}eof}}*(yes/no)* {send -- yes\r;exp_continue;}eof         {exit 1;}}"
fi#chrony
yum install -y chrony
if [[ $name == $HOST_NAME ]];thensed -i '3,6s/^/#/g' /etc/chrony.confsed -i '7s/^/server controller iburst/g' /etc/chrony.confecho "allow $network_segment_IP" >> /etc/chrony.confecho "local stratum 10" >> /etc/chrony.conf
elsesed -i '3,6s/^/#/g' /etc/chrony.confsed -i '7s/^/server controller iburst/g' /etc/chrony.conf
fisystemctl restart chronyd
systemctl enable chronydprintf "\033[35mPlease Reboot or Reconnect the terminal\n\033[0m"

iaas-install-mysql.sh

#!/bin/bash
source /etc/openstack/openrc.shping $HOST_IP -c 4 >> /dev/null 2>&1
if [ 0  -ne  $? ]; thenecho -e "\033[31m Warning\nPlease make sure the network configuration is correct!\033[0m"exit 1
fi#  MariaDB
yum install mariadb mariadb-server python2-PyMySQL -y
cat >> /etc/my.cnf.d/openstack.cnf << EOF
[mysqld]
bind-address = 0.0.0.0
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
EOF
systemctl daemon-reload
systemctl enable mariadb.service
systemctl restart mariadb.serviceexpect -c "
spawn /usr/bin/mysql_secure_installation
expect \"Enter current password for root (enter for none):\"
send \"\r\"
expect \"Set root password?\"
send \"y\r\"
expect \"New password:\"
send \"$DB_PASS\r\"
expect \"Re-enter new password:\"
send \"$DB_PASS\r\"
expect \"Remove anonymous users?\"
send \"y\r\"
expect \"Disallow root login remotely?\"
send \"n\r\"
expect \"Remove test database and access to it?\"
send \"y\r\"
expect \"Reload privilege tables now?\"
send \"y\r\"
expect eof
"# RabbitMQ
yum install rabbitmq-server -y
systemctl start rabbitmq-server.service
systemctl enable rabbitmq-server.servicerabbitmqctl add_user $RABBIT_USER $RABBIT_PASS
rabbitmqctl set_permissions $RABBIT_USER ".*" ".*" ".*"# Memcache
yum install memcached python-memcached -y
sed -i  -e 's/OPTIONS.*/OPTIONS="-l 0.0.0.0"/g' /etc/sysconfig/memcachedsystemctl start memcached.service
systemctl enable memcached.service

iaas-install-keystone.sh

#!/bin/bash
source /etc/openstack/openrc.sh#keystone mysql
mysql -uroot -p$DB_PASS -e "create database IF NOT EXISTS keystone ;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY '$KEYSTONE_DBPASS' ;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY '$KEYSTONE_DBPASS' ;"#install keystone
yum install openstack-keystone httpd mod_wsgi -y#/etc/keystone/keystone.conf
cp /etc/keystone/keystone.conf{,.bak}
cp controller/keystone/keystone.conf /etc/keystone/keystone.confsu -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_PASS \--bootstrap-admin-url http://$HOST_NAME:5000/v3/ \--bootstrap-internal-url http://$HOST_NAME:5000/v3/ \--bootstrap-public-url http://$HOST_NAME:5000/v3/ \--bootstrap-region-id RegionOnesed -i "s/#ServerName www.example.com:80/ServerName $HOST_NAME/g" /etc/httpd/conf/httpd.conf 
ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/  
systemctl enable httpd.service
systemctl restart httpd.servicecat > /etc/keystone/admin-openrc.sh <<-EOF
export OS_PROJECT_DOMAIN_NAME=$DOMAIN_NAME
export OS_USER_DOMAIN_NAME=$DOMAIN_NAME
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=$ADMIN_PASS
export OS_AUTH_URL=http://$HOST_NAME:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
EOFsource /etc/keystone/admin-openrc.sh
openstack project create --domain default --description "Service Project" service

iaas-install-glance.sh

#!/bin/bash
source /etc/openstack/openrc.sh
source /etc/keystone/admin-openrc.sh#glance mysql
mysql -uroot -p$DB_PASS -e "create database IF NOT EXISTS glance ;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '$GLANCE_DBPASS' ;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '$GLANCE_DBPASS' ;"#glance user role service endpoint 
openstack user create --domain $DOMAIN_NAME --password $GLANCE_PASS glance
openstack role add --project service --user glance admin
openstack service create --name glance --description "OpenStack Image" imageopenstack endpoint create --region RegionOne image public http://$HOST_NAME:9292
openstack endpoint create --region RegionOne image internal http://$HOST_NAME:9292
openstack endpoint create --region RegionOne image admin http://$HOST_NAME:9292#glance install
yum install -y openstack-glance #/etc/glance/glance-api.conf
cp /etc/glance/glance-api.conf{,.bak}
cp controller/glance/glance-api.conf /etc/glance/glance-api.conf#su glance mysql
su -s /bin/sh -c "glance-manage db_sync" glancesystemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl restart openstack-glance-api.service openstack-glance-registry.serviceopenstack image create --disk-format qcow2 --file cirros-0.3.4-x86_64-disk.img cirros

iaas-install-placement.sh

#!/bin/bash
source /etc/openstack/openrc.sh
source /etc/keystone/admin-openrc.sh#placement mysql
mysql -uroot -p$DB_PASS -e "CREATE DATABASE placement;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY '$PLACEMENT_DBPASS';"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY '$PLACEMENT_DBPASS';"#placement user role service endpoint
openstack user create --domain $DOMAIN_NAME --password $PLACEMENT_PASS 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://$HOST_NAME:8778
openstack endpoint create --region RegionOne placement internal http://$HOST_NAME:8778
openstack endpoint create --region RegionOne placement admin http://$HOST_NAME:8778#placement install
yum install openstack-placement-api python2-pip -y#/etc/placement/placement.conf
cp /etc/placement/placement.conf{,.bak}
cp controller/placement/placement.conf /etc/placement/placement.conf#su placement mysql
su -s /bin/sh -c "placement-manage db sync" placement#/etc/httpd/conf.d/00-placement-api.conf 
cat >> /etc/httpd/conf.d/00-placement-api.conf <<EOF
<Directory /usr/bin><IfVersion >= 2.4>Require all granted</IfVersion><IfVersion < 2.4>Order allow,denyAllow from all</IfVersion>   
</Directory>
EOF
systemctl restart httpd

iaas-install-nova-controller.sh

#!/bin/bash
source /etc/openstack/openrc.sh
source /etc/keystone/admin-openrc.sh#neutron mysql
mysql -uroot -p$DB_PASS -e "create database IF NOT EXISTS nova ;"
mysql -uroot -p$DB_PASS -e "create database IF NOT EXISTS nova_api ;"
mysql -uroot -p$DB_PASS -e "create database IF NOT EXISTS nova_cell0 ;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '$NOVA_DBPASS' ;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '$NOVA_DBPASS' ;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY '$NOVA_DBPASS' ;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY '$NOVA_DBPASS' ;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY '$NOVA_DBPASS' ;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY '$NOVA_DBPASS' ;"#nova user role service endpoint
openstack user create --domain $DOMAIN_NAME --password $NOVA_PASS 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://$HOST_NAME:8774/v2.1
openstack endpoint create --region RegionOne compute internal http://$HOST_NAME:8774/v2.1
openstack endpoint create --region RegionOne compute admin http://$HOST_NAME:8774/v2.1#nova install
yum install openstack-nova-api openstack-nova-conductor openstack-nova-novncproxy openstack-nova-scheduler -y
#nova compute
yum install openstack-nova-compute -y#/etc/nova/nova.conf
cp /etc/nova/nova.conf{,.bak}
cp controller/nova/nova.conf /etc/nova/nova.conf#su nova mysql
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" novasystemctl restart openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl enable openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service  systemctl restart libvirtd.service openstack-nova-compute.service
systemctl enable libvirtd.service openstack-nova-compute.servicesystemctl restart httpd;systemctl restart openstack-nova-computeopenstack flavor create --id 1 --vcpus 1 --ram 512 --disk 10 cirros-test
openstack compute service list --service nova-compute
su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

iaas-install-neutron-controller.sh

#!/bin/bash
source /etc/openstack/openrc.sh
source /etc/keystone/admin-openrc.sh#neutron mysql
mysql -uroot -p$DB_PASS -e "create database IF NOT EXISTS neutron ;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY '$NEUTRON_DBPASS' ;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY '$NEUTRON_DBPASS' ;"#neutron  user role service endpoint 
openstack user create --domain $DOMAIN_NAME --password $NEUTRON_PASS neutronopenstack role add --project service --user neutron adminopenstack service create --name neutron --description "OpenStack Networking" networkopenstack endpoint create --region RegionOne network public http://$HOST_NAME:9696
openstack endpoint create --region RegionOne network internal http://$HOST_NAME:9696
openstack endpoint create --region RegionOne network admin http://$HOST_NAME:9696#neutron install
yum install -y openstack-neutron openstack-neutron-ml2 openstack-neutron-openvswitch#network
if [[ `ip a |grep -w $INTERFACE_IP |grep -w $INTERFACE_NAME` = '' ]];then 
cat > /etc/sysconfig/network-scripts/ifcfg-$INTERFACE_NAME <<EOF
DEVICE=$INTERFACE_NAME
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
EOF
systemctl restart network
fi#/etc/neutron/neutron.conf
cp /etc/neutron/neutron.conf{,.bak}
cp controller/neutron/neutron.conf /etc/neutron/neutron.conf#/etc/neutron/plugins/ml2/ml2_conf.ini
cp /etc/neutron/plugins/ml2/ml2_conf.ini{,.bak}
cp controller/neutron/ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini#/etc/neutron/plugins/ml2/openvswitch_agent.ini
cp /etc/neutron/plugins/ml2/openvswitch_agent.ini{,.bak}
cp controller/neutron/openvswitch_agent.ini /etc/neutron/plugins/ml2/openvswitch_agent.ini#br_netfilter
modprobe br_netfilter 
echo 'net.ipv4.conf.all.rp_filter=0' >> /etc/sysctl.conf
echo 'net.ipv4.conf.default.rp_filter=0' >> /etc/sysctl.conf
echo 'net.bridge.bridge-nf-call-iptables = 1' >> /etc/sysctl.conf
echo 'net.bridge.bridge-nf-call-ip6tables = 1' >> /etc/sysctl.conf
sysctl -p#/etc/neutron/l3_agent.ini
cp /etc/neutron/l3_agent.ini{,.bak}
cp controller/neutron/l3_agent.ini /etc/neutron/l3_agent.ini#/etc/neutron/metadata_agent.ini
cp  /etc/neutron/metadata_agent.ini{,.bak}
cp controller/neutron/metadata_agent.ini /etc/neutron/metadata_agent.ini#/etc/neutron/dhcp_agent.ini
cp /etc/neutron/dhcp_agent.ini{,.bak}
cp controller/neutron/dhcp_agent.ini /etc/neutron/dhcp_agent.ini#/etc/nova/nova.conf
cp controller/neutron/nova.conf /etc/nova/nova.conf#su neutron mysql
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf  --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutronsystemctl restart openstack-nova-apisystemctl enable --now neutron-server neutron-metadata-agent neutron-openvswitch-agent openvswitch neutron-l3-agent neutron-dhcp-agent
ovs-vsctl add-br $OVS_NAME
ovs-vsctl add-port $OVS_NAME $INTERFACE_NAME
systemctl restart neutron-server neutron-metadata-agent neutron-openvswitch-agent openvswitch neutron-l3-agent neutron-dhcp-agentecho "#network create#"
##int-net
#openstack network create --internal --provider-network-type vxlan int-net
#openstack subnet create int-net-sub --network int-net --subnet-range 10.0.0.0/24 --gateway 10.0.0.1 --dns-nameserver 114.114.114.114##ext-net
#openstack network create --provider-physical-network physnet1 --provider-network-type flat  --external ext-net
#openstack subnet create ext-net-sub --network ext-net --subnet-range 192.168.200.40/24  --allocation-pool start=192.168.200.30,end=192.168.200.200 --gateway 192.168.200.2 --dns-nameserver 114.114.114.114 --no-dhcp##router
#openstack router add subnet Ext-Router int-net-sub
#openstack router set Ext-Router --external-gateway ext-net

iaas-install-dashboard.sh

#!/bin/bash
source /etc/openstack/openrc.sh
source /etc/keystone/admin-openrc.sh#dashboard install
yum install openstack-dashboard -y#/etc/openstack-dashboard/local_settings
cp /etc/openstack-dashboard/local_settings{,.bak}
cp controller/dashboard/local_settings /etc/openstack-dashboard/local_settings#/etc/httpd/conf.d/openstack-dashboard.conf
sed  -e '4iWSGIApplicationGroup %{GLOBAL}' /etc/httpd/conf.d/openstack-dashboard.conf systemctl restart httpd.service memcached.service#/root/logininfo.txt
printf "\033[35mThe horizon service is ready,Now you can visit the following;\n\033[0m"
echo  浏览器访问:http://$HOST_IP/dashboard
echo  域:$DOMAIN_NAME
echo  用户名:admin
echo  密码:"${ADMIN_PASS}"
echo  信息输出到root目录下的logininfo.txt中了。cat  >> /root/logininfo.txt << EOF
浏览器访问:http://$HOST_IP/dashboard
域:$DOMAIN_NAME  
用户名:admin  
密码:"${ADMIN_PASS}" 
EOF

compute

iaas-install-nova-compute.sh

#!/bin/bash
source /etc/openstack/openrc.sh#nova-compute install
yum install openstack-nova-compute -y#/etc/nova/nova.conf
cp /etc/nova/nova.conf{,.bak}
cp compute/nova/nova.conf /etc/nova/nova.confvirt_num=`egrep -c '(vmx|svm)' /proc/cpuinfo`
if [ $virt_num = '0' ];then
crudini --set /etc/nova/nova.conf libvirt virt_type  qemu
fisystemctl enable libvirtd.service openstack-nova-compute.service
systemctl restart libvirtd.service openstack-nova-compute.servicessh  $HOST_IP "source /etc/keystone/admin-openrc.sh  && systemctl restart httpd && openstack compute service list --service nova-compute"
systemctl restart openstack-nova-compute.service
ssh  $HOST_IP 'source /etc/keystone/admin-openrc.sh && su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova'

iaas-install-neutron-compute.sh

#!/bin/bash
source /etc/openstack/openrc.sh#neutron install
yum install -y openstack-neutron-openvswitch#network
if [[ `ip a |grep -w $INTERFACE_IP |grep -w $INTERFACE_NAME` = '' ]];then 
cat > /etc/sysconfig/network-scripts/ifcfg-$INTERFACE_NAME <<EOF
DEVICE=$INTERFACE_NAME
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
EOF
systemctl restart network
fi#/etc/neutron/neutron.conf
cp /etc/neutron/neutron.conf{,.bak}
cp compute/neutron/neutron.conf /etc/neutron/neutron.conf#/etc/neutron/plugins/ml2/openvswitch_agent.ini
cp /etc/neutron/plugins/ml2/openvswitch_agent.ini{,.bak}
cp compute/neutron/openvswitch_agent.ini /etc/neutron/plugins/ml2/openvswitch_agent.ini#br_netfilter
modprobe br_netfilter 
echo 'net.ipv4.conf.all.rp_filter=0' >> /etc/sysctl.conf
echo 'net.ipv4.conf.default.rp_filter=0' >> /etc/sysctl.conf
echo 'net.bridge.bridge-nf-call-iptables = 1' >> /etc/sysctl.conf
echo 'net.bridge.bridge-nf-call-ip6tables = 1' >> /etc/sysctl.conf
sysctl -psystemctl enable --now neutron-openvswitch-agent#/etc/nova/nova.conf
cp compute/neutron/nova.conf /etc/nova/nova.confsystemctl enable --now openvswitch
ovs-vsctl add-br $OVS_NAME
ovs-vsctl add-port $OVS_NAME $INTERFACE_NAME
systemctl restart openstack-nova-compute.service
systemctl restart neutron-openvswitch-agent

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/46931.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

誉天人工智能AI大模型火热报名中(HCIA-AI Solution Architect课程简介)

课程亮点 1.涵盖大模型prompt、RAG、LangChain、Fine-Turning、多模态、视觉生成等主流开源大模型技术 2.OpenAl开源大模型、昇腾大模型产品丝滑融合 3.从大模型产品开发到商业闭环到产品运营一站式打造大模型高级解决方案架构师 4.金牌讲师团队昇腾计算一线专家倾力交付 5.岗位…

2024嘶吼网络安全产业图谱(高清完整版)

在数字化和智能化浪潮的推动下&#xff0c;网络安全产业正处于一个快速变革的时期。从传统的防御手段和被动的威胁应对&#xff0c;到如今主动预防和智能检测技术的普及&#xff0c;网络安全领域的焦点和需求正不断演进。为了更好的理解当前网络安全产业现状和未来发展方向&…

PDF 转图片并插入到 EXCEL 再转PDF

pom.xml 引用 <dependency><groupId>com.aspose</groupId><artifactId>aspose-cells</artifactId><version>21.11</version></dependency><dependency><groupId>com.aspose</groupId><artifactId>as…

自动驾驶SLAM

SLAM是Simultaneous Localization and Mapping的缩写&#xff0c;中文译作“同时定位与地图构建”。 它是指搭载特定传感器的主体&#xff0c;在没有环境先验信息的情况下&#xff0c;于运动过程中建立环境的模型&#xff0c;同时估计自己的运动。如果这里的传感器主要为相机&…

KITTI 3D 数据可视化

引言 KITTI 视觉基准测试套件&#xff08;KITTI Vision Benchmark Suite&#xff09;提供了大量用于理解自动驾驶场景的工具。尤其是3D数据可视化在分析和解释传感器&#xff08;如激光雷达&#xff09;与环境的复杂交互中起到了至关重要的作用。本文将详细探讨KITTI数据集中3…

基于单片机的直流电机控制

摘 要 &#xff1a;在目前的电机控制中&#xff0c;主要包括单片机、集成电路以及PLC3种控制方式&#xff0c;这3种控制方式都可以对直流电动机进行数学化控制。其中单片机直流电机 主要受单片机进行控制。只有充分了解单片机的内部工作原理和进行直流电动机控制过程的基本步骤…

网络请求之urllib.parse的使用

urllib.parse的作用是解析url。 为什么要解析呢&#xff0c;我来举个例子。在百度图片里面搜一下历史人物&#xff0c;比如樱由罗&#xff1a; 点击百度一下跳转到页面如下&#xff1a; 我们找到url分析一下看看&#xff1a; https://image.baidu.com/search/index?tnbaidu…

PCL从理解到应用【06】 RANSAC原理分析 | 案例分析 | 代码实现

前言 本文分析RANSAC算法的原理&#xff0c;集合案例深入理解&#xff0c;同时提供源代码。 RANSAC&#xff0c;随机采样一致性&#xff0c;是一种迭代的算法&#xff0c;用于从一组包含异常值的数据中估计模型参数。 应用案例&#xff1a;平面拟合、线段拟合、球体拟合等。…

【C++报错已解决】 “Undefined Reference“

&#x1f3ac; 鸽芷咕&#xff1a;个人主页 &#x1f525; 个人专栏: 《C干货基地》《粉丝福利》 ⛺️生活的理想&#xff0c;就是为了理想的生活! 前言 在编译程序时&#xff0c;遇到 “Undefined Reference” 报错总是令人头疼。这个错误提示通常意味着编译器找不到某个符号…

注册登录后上传文件到本地数据库项目

在上一篇的基础上我有添加了登录注册功能文件上传 更新一下代码添加登录注册功能 app.js // app.js const express require(express); const bodyParser require(body-parser); const cors require(cors); const db require(./models/db); const User require(./models…

ctfshow 信息收集(1-20)

Web1 F12查看页面元素 Ctrlu查看源码 Web2 Ctrlu查看源码 Js代码知识点 //禁用鼠标右键 window.document.oncontextmenu function() { return false; } //禁用复制 window.document.onselectstart function() { return false; } //禁用F12 document.onkeydown fun…

【数学建模】技术革新——Lingo的使用超详解

目录 基础知识 1. 变量声明 示例 2. 常量声明 语法格式 示例 3. 目标函数 语法格式 示例 4. 约束条件 语法格式 示例 5. 完整的Lingo模型示例 示例 解释 6. 整数变量声明 语法格式 示例 7. 非线性规划 示例 8. 多目标优化 语法格式 示例 9. 数据输入与…

C++20使用“复制和交换”方法实现安全处理异常的赋值运算符

以下笔记来自&#xff1a;C20高级编程(第5版) p231-237。 前期准备 对于 C来说&#xff0c;如果没有自行编写拷贝构造函数或赋值运算符&#xff0c;C会自动生成。然而&#xff0c;对于基本类型&#xff0c;编译器只会提供表层复制或赋值&#xff0c;也就是浅拷贝。 那么对于以…

第一个AI应用(文心智能体平台)

第一个AI应用&#xff08;文心智能体平台&#xff09; 官网&#xff1a;https://agents.baidu.com/ 平台简介&#xff1a;https://agents.baidu.com/docs/ 部分内容由AI生成&#xff0c;注意甄别 一、什么是AI应用及其功能 AI应用&#xff0c;即人工智能应用&#xff0c;是利用…

虚拟化如何简化和加速灾难恢复

一. 简化恢复 在 IT 基础设施领域&#xff0c;灾难恢复是确保业务连续性的重要过程。通过传统机械方法进行恢复既费力又费时。然而&#xff0c;随着虚拟化技术的出现&#xff0c;这种情况发生了改变&#xff1b;虚拟化技术简化并加速了这一过程。 二. 传统恢复 传统的 DR 方法…

第16章 脚本控制《Linux命令行与Shell脚本编程大全笔记》

16.1 Linux信号 生成信号&#xff1a;太多了&#xff0c;建议看书的350页&#xff0c;或者多用用就熟悉了 示例&#xff1a;信号名&#xff08;1&#xff09;&#xff0c;信号值&#xff08;SIGHUP&#xff09;产生信号: ①组合键Ctrl C等 ②使用kill -信号捕获信号&#xff…

为ppt中的文字配色

文字的颜色来源于ppt不可删去的图像的颜色 从各类搜索网站中搜索ppt如何配色&#xff0c;有如下几点&#xff1a; 1.可以使用对比色&#xff0c;表示强调。 2.可以使用近似色&#xff0c;使得和谐统一。 3.最好一张ppt中&#xff0c;使用的颜色不超过三种主要颜色。 但我想强调…

Linux中六种常见工具

一、软件包管理器yum 1、yum概念 yum是一个软件下载安装管理的客户端&#xff0c;例如手机上的小米一应用商城。 那为什么我们推荐在Linux中用yum下载软件呢&#xff1f; 其实软件的安装有三种方式&#xff1a;源代码安装&#xff0c;rpm包安装&#xff0c;yum安装。 a、源…

变分法笔记3:多变量函数

设 B B B是 R n \mathbb{R}^n Rn中的一个区域&#xff0c; x ( x 1 , … , x n ) x (x_1, \ldots, x_n) x(x1​,…,xn​)。对于函数 u : R n → R u : \mathbb{R}^n \rightarrow \mathbb{R} u:Rn→R&#xff0c;我们定义泛函 J ( u ) ∫ B L ( x , u ( x ) , ∇ u ( x ) ) …

pc端注册页面 密码校验规则

1.密码校验规则 格应包含大小写字母、数字和特殊符号,长度为8-20 var validateRetrievePassword (rule, value, callback) > {let reg /^(?.*[A-Za-z])(?.*\d)(?.*[~!#$%^&*()_<>?:"{},.\/\\;[\]])[A-Za-z\d~!#$%^&*()_<>?:"{},.\/\\;…