设为首页 收藏本站
查看: 771|回复: 0

[经验分享] 我的OPENSTACK部署文档-essex

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-10-11 09:35:16 | 显示全部楼层 |阅读模式
部署脚本,非自动化安装,Exess版本
##############################################0. Prepare Before Install ############################################## #System#1. Ubuntu Server amd64 12.04 LTS#2. 分区:Controller:3 ,Compute Node:4#3. 1 for OS , 2 for image storage  , 3 for swap#4. 1 for OS , 2 for VM , 3 for volume(block storage) , 4 for swap#5. 主机名不能相同,最好用编号表示主机名。 #Network#静态IP , config /etc/network/interfaces#1. 1 网卡 #2. 3 网卡 #1 for internet , 2 for LAN , 3 for manage #BIOS#1. VT virtualization Technology Support (process setting) ####################################################1. Controller ########################################################  #######MySql install & config ######## #Some variable. MYSQL_PASS='hisoft'OPENSTACK_USER='openstack'OPENSTACK_PASS='hisoft' #Preseed the mysql installcat<<EOF | sudodebconf-set-selectionsmysql-server-5.1mysql-server/root_passwordpassword ${MYSQL_PASS}mysql-server-5.1mysql-server/root_password_againpassword ${MYSQL_PASS}mysql-server-5.1mysql-server/start_on_bootboolean trueEOF #Set up the mysql database serversudoapt-get install-y python-mysqldb mysql-server#Configure MySQL and Restartsudosed -i 's/127.0.0.1/0.0.0.0/g'/etc/mysql/my.cnfsudoservice mysql restart #Create the openstack databasesudorm /var/lib/keystone/keystone.dbsudomysql -u root -p$MYSQL_PASS -e &quot;CREATEDATABASE openstack;&quot;sudomysql -u root -p$MYSQL_PASS -e &quot;GRANTALL ON openstack.* TO '${OPENSTACK_USER}'@'localhost' IDENTIFIED BY '${OPENSTACK_PASS}';&quot;sudomysql -u root -p$MYSQL_PASS -e &quot;GRANTALL ON openstack.* TO '${OPENSTACK_USER}'@'%' IDENTIFIED BY '${OPENSTACK_PASS}';&quot;  ###### Install Nova & Dependencies ###### #InstallDependenciessudoapt-get install-y rabbitmq-server euca2ools bridge-utils #Installthe compute service (nova) except nova volumesudoapt-get install-y nova-api nova-compute nova-network nova-scheduler nova-cert nova-consoleauth nova-doc nova-vncproxy novnc ###############################################################NODE:FITTINGYOUR CONDITION BEFORE EXECUTE THIS COMMOND##################################################################DESC:#--vlan_interface=eth0 ,Configure LAN IP On this device#--public_interface=eth1 ,Configure public IP on this device#IF Only have one device , ALL use eth0 ,#  --vlan_interface=eth0#  --public_interface=eth0#--my_ip=[this host's IP]#--sql_connection=mysql://openstack:hisoft@[thecontroller's IP]/openstack#--rabbit_host=[the controller's IP]#--glance_api_servers=[the controller's IP]#--ec2_dmz_host=[the controller's IP]#--ec2_host=[the controller's IP]#--instances_path=[the/path/to/store/instances] (cat| sudotee -a /etc/nova/nova.conf) <<EOF--dhcpbridge_flagfile=/etc/nova/nova.conf--dhcpbridge=/usr/bin/nova-dhcpbridge--logdir=/var/log/nova--state_path=/var/lib/nova--lock_path=/var/lock/nova--force_dhcp_release--iscsi_helper=tgtadm--libvirt_use_virtio_for_bridges--connection_type=libvirt--root_helper=sudonova-rootwrap--verbose--ec2_private_dns_show_ip--network_manager=nova.network.manager.VlanManager--fixed_range=10.0.0.0/8--vlan_interface=eth0--public_interface=eth0--auth_strategy=keystone--my_ip=192.168.80.54--instances_path=/mnt/instances--sql_connection=mysql://openstack:hisoft@127.0.0.1/openstack--rabbit_host=192.168.80.54--glance_api_servers=192.168.80.54:9292--ec2_dmz_host=192.168.80.54--ec2_host=192.168.80.54--quota_cores=200--quota_floating_ips=50--quota_gigabytes=3000--quota_instances=100--quota_ram=300000--quota_volumes=100EOF #Initialize the nova databasesudonova nova-manage db sync #Restart nova servicessudoservice nova-network restartsudoservice nova-compute restartsudoservice nova-scheduler restartsudoservice nova-api restartsudoservice nova-cert restartsudoservice nova-consoleauth restart watchsudo nova-manage service list  #### Install the image service (glance)##### sudoapt-get install-y glance #Configure glance to use the new databasesudosed -i &quot;s|sql_connection= sqlite:////var/lib/glance/glance.sqlite|sql_connection = mysql://${OPENSTACK_USER}:${OPENSTACK_PASS}@127.0.0.1/openstack|g&quot; /etc/glance/glance-registry.confecho&quot;sql_connection = mysql://${OPENSTACK_USER}:${OPENSTACK_PASS}@127.0.0.1/openstack&quot; | sudotee -a /etc/glance/glance-scrubber.conf #modify default image store path vi/etc/glance/glance-api.conf#change this option#filesystem_store_datadir = /path/you/want/to/store/ sudoglance-manage version_control 0sudoglance-manage db_sync #Verify glance is functioningglance--version  ####Install the identity service (keystone)#### sudoapt-get install-y keystone #Configure keystone to use the new databasesudosed -i &quot;s|connection= sqlite:////var/lib/keystone/keystone.db|connection = mysql://${OPENSTACK_USER}:${OPENSTACK_PASS}@127.0.0.1/openstack|g&quot; /etc/keystone/keystone.conf#Initialize the databasesudoservice keystone restartsudokeystone-manage db_sync #Set up the keystone credentialsmkdir~/credentialscat> ~/credentials/openrc<<EOFexportOS_USERNAME=adminexportOS_PASSWORD=hisoftexportOS_TENANT_NAME=adminexportOS_AUTH_URL=http://127.0.0.1:5000/v2.0/exportOS_REGION_NAME=RegionOneexportSERVICE_TOKEN=ADMINexportSERVICE_ENDPOINT=http://127.0.0.1:35357/v2.0EOF #Update the envirnoment with the new credentialscat~/credentials/openrc>> ~/.bashrcsource~/.bashrc #Create a new tenantTENANT_ID=`keystonetenant-create --name admin | awk-F&quot;|&quot;'{ if (NR == 6) print $3}' | tr-d ''` #Create a new userUSER_ID=`keystoneuser-create --tenant_id $TENANT_ID --name admin --pass admin | awk-F&quot;|&quot;'{ if (NR == 6) print $3}' | tr-d ''` #Create new rolesROLE_ID=`keystonerole-create --name admin | awk-F&quot;|&quot;'{ if (NR == 4) print $3}' | tr-d ''`keystonerole-create --name member #List the new tenants, users and roleskeystonetenant-listkeystoneuser-listkeystonerole-list #Grant the role to the userkeystoneuser-role-add --user $USER_ID --tenant_id $TENANT_ID --role $ROLE_ID #Populate the services in the service catalog KEYSTONE_SVC_ID=`keystoneservice-create --name=keystone --type=identity--description=&quot;KeystoneIdentity Service&quot; | awk-F&quot;|&quot;'{ if (NR == 5) print $3}' | tr-d ''`NOVA_SVC_ID=`keystoneservice-create --name=nova --type=compute--description=&quot;NovaCompute Service&quot; | awk-F&quot;|&quot;'{ if (NR == 5) print $3}' | tr-d ''`VOLUME_SVC_ID=`keystoneservice-create --name=volume --type=volume--description=&quot;NovaVolume Service&quot; | awk-F&quot;|&quot;'{ if (NR == 5) print $3}' | tr-d ''`GLANCE_SVC_ID=`keystoneservice-create --name=glance --type=image--description=&quot;GlanceImage Service&quot; | awk-F&quot;|&quot;'{ if (NR == 5) print $3}' | tr-d ''`EC2_SVC_ID=`keystoneservice-create --name=ec2 --type=ec2--description=&quot;EC2Compatibility Layer&quot; | awk-F&quot;|&quot;'{ if (NR == 5) print $3}' | tr-d ''` #Verify the new serviceskeystoneservice-list #Populate the endpoints in the service catalogkeystoneendpoint-create --region RegionOne --service_id=$KEYSTONE_SVC_ID --publicurl=http://[publicIP]:5000/v2.0--internalurl=http://[InternalIP]:5000/v2.0--adminurl=http://[InternalIP]:35357/v2.0keystoneendpoint-create --region RegionOne --service_id=$NOVA_SVC_ID --publicurl='http://192.168.80.52:8774/v2/%(tenant_id)s'--internalurl='http://127.0.0.1:8774/v2/%(tenant_id)s'--adminurl='http://127.0.0.1:8774/v2/%(tenant_id)s'keystoneendpoint-create --region RegionOne --service_id=$VOLUME_SVC_ID --publicurl='http://192.168.80.52:8776/v1/%(tenant_id)s'--internalurl='http://127.0.0.1:8776/v1/%(tenant_id)s'--adminurl='http://127.0.0.1:8776/v1/%(tenant_id)s'keystoneendpoint-create --region RegionOne --service_id=$GLANCE_SVC_ID --publicurl=http://192.168.80.52:9292/v1--internalurl=http://127.0.0.1:9292/v1--adminurl=http://127.0.0.1:9292/v1keystoneendpoint-create --region RegionOne --service_id=$EC2_SVC_ID --publicurl='http://192.168.80.52:8773/services/Cloud'--internalurl='http://127.0.0.1:8773/services/Cloud'--adminurl='http://127.0.0.1:8773/services/Admin' #Verify the new endpointskeystoneendpoint-list #Verify identity service is functioningcurl-d '{&quot;auth&quot;:{&quot;tenantName&quot;: &quot;admin&quot;, &quot;passwordCredentials&quot;: {&quot;username&quot;: &quot;admin&quot;, &quot;password&quot;: &quot;admin&quot;}}}'-H &quot;Content-type:application/json&quot; http://127.0.0.1:35357/v2.0/tokens| python -m json.tool #Configure nova to use keystonesudosed -i 's/admin_tenant_name= %SERVICE_TENANT_NAME%/admin_tenant_name = admin/g' /etc/nova/api-paste.inisudosed -i 's/admin_user= %SERVICE_USER%/admin_user = admin/g' /etc/nova/api-paste.inisudosed -i 's/admin_password= %SERVICE_PASSWORD%/admin_password = admin/g' /etc/nova/api-paste.inisudosed -i 's/--use_deprecated_auth/--auth_strategy=keystone/g'/etc/nova/nova.conf #Configure the glance-api service to use keystonesudosed -i 's/admin_tenant_name= %SERVICE_TENANT_NAME%/admin_tenant_name = admin/g' /etc/glance/glance-api-paste.inisudosed -i 's/admin_user= %SERVICE_USER%/admin_user = admin/g' /etc/glance/glance-api-paste.inisudosed -i 's/admin_password= %SERVICE_PASSWORD%/admin_password = admin/g' /etc/glance/glance-api-paste.inisudosed -i 's/pipeline= versionnegotiation context apiv1app/pipeline = versionnegotiation authtoken auth-context apiv1app/g'/etc/glance/glance-api-paste.ini (cat| sudotee -a /etc/glance/glance-api.conf) <<EOF[paste_deploy]flavor= keystoneEOF #Configure the glance-registry service to use keystonesudosed -i 's/admin_tenant_name= %SERVICE_TENANT_NAME%/admin_tenant_name = admin/g' /etc/glance/glance-registry-paste.inisudosed -i 's/admin_user= %SERVICE_USER%/admin_user = admin/g' /etc/glance/glance-registry-paste.inisudosed -i 's/admin_password= %SERVICE_PASSWORD%/admin_password = admin/g' /etc/glance/glance-registry-paste.inisudosed -i 's/pipeline= context registryapp/pipeline = authtoken auth-context context registryapp/g'/etc/glance/glance-registry-paste.ini (cat| sudotee -a /etc/glance/glance-registry.conf) <<EOF[paste_deploy]flavor= keystoneEOF #Restart all servicessudoservice nova-network restartsudoservice nova-compute restartsudoservice nova-scheduler restartsudoservice nova-api restartsudoservice nova-consoleauth restartsudoservice nova-cert restartsudoservice glance-api restartsudoservice glance-registry restartsudoservice keystone restartsudoservice novnc restart watchsudo nova-manage service list #Verify the image exists in glance#Nothing output means glance works wellglanceindex #Configure fixed IP , private Network/--mulit-host=T For network HA , So IF Single node , you can remove this optionsudonova-manage network create private --fixed_range_v4=10.0.0.0/24--num_networks=1 --network_size=256 --vlan=100 --bridge_interface=eth0 --multi_host=T --project_id=$TENANT_IDsudonova-manage network list  ############################################################### Compute Node  ################################################################# apt-getinstall-y nova-api nova-compute nova-network ###############################################################NODE:FITTINGYOUR CONDITION BEFORE EXECUTE THIS COMMOND##################################################################DESC:#--vlan_interface=eth0 ,Configure LAN IP On this device#--public_interface=eth1 ,Configure public IP on this device#IF Only have one device , ALL use eth0 ,#  --vlan_interface=eth0#  --public_interface=eth0#--my_ip=[this host's IP]#--sql_connection=mysql://openstack:hisoft@[thecontroller's IP]/openstack#--rabbit_host=[the controller's IP]#--glance_api_servers=[the controller's IP]#--ec2_dmz_host=[the controller's IP]#--ec2_host=[the controller's IP]#--instances_path=[the/path/to/store/instances] (cat| sudotee -a /etc/nova/nova.conf) <<EOF--dhcpbridge_flagfile=/etc/nova/nova.conf--dhcpbridge=/usr/bin/nova-dhcpbridge--logdir=/var/log/nova--state_path=/var/lib/nova--lock_path=/var/lock/nova--force_dhcp_release--iscsi_helper=tgtadm--libvirt_use_virtio_for_bridges--connection_type=libvirt--root_helper=sudonova-rootwrap--verbose--ec2_private_dns_show_ip--network_manager=nova.network.manager.VlanManager--fixed_range=10.0.0.0/8--vlan_interface=eth0--public_interface=eth0--auth_strategy=keystone--my_ip=192.168.80.54--instances_path=/mnt/instances--sql_connection=mysql://openstack:hisoft@127.0.0.1/openstack--rabbit_host=192.168.80.54--glance_api_servers=192.168.80.54:9292--ec2_dmz_host=192.168.80.54--ec2_host=192.168.80.54--quota_cores=200--quota_floating_ips=50--quota_gigabytes=3000--quota_instances=100--quota_ram=300000--quota_volumes=100EOF #Install nova-volume#Check the LVM partitionfdisk-l  pvcreate/dev/sdb1vgcreatenova-volumes /dev/sdb1sudoapt-get installlvm2 nova-volume open-iscsi sudoservice nova-network restartsudoservice nova-compute restartsudoservice nova-volume restartsudoservice nova-api restart watchsudo nova-manage service list

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-125306-1-1.html 上篇帖子: 从devstack开始 学习openstack 下篇帖子: Openstack Api分析(三)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表