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

[经验分享] Install OpenStack all-in-one

[复制链接]

尚未签到

发表于 2015-11-26 09:03:04 | 显示全部楼层 |阅读模式
  Install OpenStack all-in-one
  by Chef Cookbook
  
  
  My Environment Overview:
  (you must change the ips according to your own environment)
  
  OpenStack all-in-one node (is a real PC)
  hostname: allinone
  IP: 9.123.141.69, 10.10.0.1, 172.40.0.1
  Chef Server (is a VM on the above PC):
  hostname: chef-svr
  IP: 9.123.141.215, 10.10.0.20
  
  Network for installing OpenStack: 10.10.0.0 (Because my chef server is a vm on all-in-one node pc, so I can not use network of 9.123.141.0 for installation)
  Network for management: 9.123.141.0 (Office network)
  Network for Vms in OpenStack: 172.40.0.0
  
  Chef Server web console: http://9.123.141.215:4040, username: admin, default password: chef321go
  
  1 Prepare environment
  1.1 Prepare environment for all-in-one node
  1.1.1 If the all-in-one node has a previous installation of OpenStack (no matter it was successful or failed), you should run the clean.sh to avoid any duplicate settings of components in OpenStack. (Please upload the files bellow onto the all-in-one node firstly).
  # cd /root/openstack-cookbooks-allinone
  # bin/clean.sh
  
  1.1.2 Set yum repos for all-in-one node
  [rbel6]
  name=RBEL 6
  baseurl=http://9.115.78.35/rbel6
  enabled=1
  gpgcheck=0
  
  [rhel63]
  name=RHEL ISO
  baseurl=http://9.115.78.35/rhel/6.3/x86_64/
  enabled=1
  gpgcheck=0
  
  You should pass BSO before installing OpenStack to ensure all-in-one node can access the yum repo on 9.115.78.35.
  
  1.1.3 Make sure the following packages are installed on the all-in-one node
  gcc
  gcc-c++
  python
  ruby
  ruby-devel
  
  1.1.4 Add a network bridge for OpenStack Vms on all-in-one node
  # vi /etc/sysconfig/network-scripts/ifcfg-br0
  DEVICE=br0
  BOOTPROTO=static
  BROADCAST=172.40.0.255
  IPADDR=172.40.0.1
  NETMASK=255.255.0.0
  NETWORK=172.40.0.0
  ONBOOT=yes
  TYPE=Bridge
  
  And then restart the network service:
  # service network restart
  
  1.1.5 Prepare volume group for cinder
  Create a volume group called "cinder-volumes" on all-in-one node (the command is “vgcreate”). This step is optional, if you cannot create a volume group called “cinder-volumes”, you can use the existing one (use command “vgdisplay” to check the name of current volume group).
  
  1.1.6 Remove vhost_net module on all-in-one node
  (you may need to stop all the vms on that machine at first)
  # rmmod vhost_net
  
  1.2 Prepare environment for Chef Server
  1.2.1 Upload necessary packages of Chef and OpenStack to chef server
  /install/ibm-rpms
  /install/prereq-rpms
  
  1.2.2 Add host info to chef server
  # vi /etc/hosts
  10.10.0.1 allinone
  
  1.2.3 Upload images to Chef Server “/install/images/cirros/*.*”
  cirros-0.3.0-x86_64-blank.img
  cirros-0.3.0-x86_64-initrd
  cirros-0.3.0-x86_64-vmlinuz
  
  1.2.4 Upload mysql package to Chef Server
  /install/mysql-2.9.0.gem
  
  
  2. Install and config Chef Server
  (You can skip this step if chef server is already installed and configured)
  (I used the xCAT Server as the Chef Server: chef-svr)
  
  2.1 Make sure SELinux and Firewall are disabled.
  
  2.2 Add yum repos
  # vi /etc/yum.repo.d/rbel.repo
  [rbel6]
  name=RBEL 6
  baseurl=http://9.115.78.35/rbel6
  enabled=1
  gpgcheck=0
  
  2.3 Set the ntp server
  Modify the ntp config file:
  # vi /etc/ntp.conf
  Enable the local ntp server:
  server  127.127.1.0     # local clock
  fudge   127.127.1.0 stratum 10
  
  Disable the public ntp servers, and wait several minutes:
  #server 0.rhel.pool.ntp.org
  #server 1.rhel.pool.ntp.org
  #server 2.rhel.pool.ntp.org
  
  2.4 Start ntpd
  # chkconfig ntpd on
  # service ntpd start
  
  2.5 Install Chef server
  # yum -y install rubygem-chef-server
  
  2.6 Start Chef server
  # setup-chef-server.sh
  
  2.7 Add the first API client, API client can be used to upload cookbooks.
  # knife configure -i
  
  All questions use default option, if no error occur, the first API client will be setup. After that, run command "knife node list" to verify. If no output, then API client is ready.
  # knife node list
  
  
  3. Prepare Cookbooks and Settings on Chef Server
  
  # cd /root/openstack-cookbooks-allinone
  
  3.1 Modify environment/openstack-ibm-working.json
  "ipv4_cidr": "172.40.0.0/16",
  
  "gem_repo":{
  "url":"http://10.10.0.20/install",
  "mysql_gem":"mysql-2.9.0.gem"
  },
  
  "networks": [
  {
  "bridge_dev": "",
  "ipv4_cidr": "172.40.0.0/16",
  "bridge": "br0",
  }
  
  "osops_networks": {
  "glance": "9.123.141.0/24",
  "nova": "9.123.141.0/24",
  "public": "9.123.141.0/24",
  "management": "9.123.141.0/24"
  },
  
  "mysql": {
  "db": {
  "bind_host": "0.0.0.0"
  },
  },
  
  "network": {
  "public": "9.123.141.69/25"
  }
  
  3.2 Modify cookbooks/nova/attributes/default.rb
  default["nova"]["network"]["public_interface"] = "br0" (the NIC on nova node which  just used for communicate with VMs of OpenStack)
  
  default["nova"]["network"]["dmz_cidr"] = "172.40.0.0/16"
  
  3.3 Modify cookbooks/cinder/templates/default/cinder.conf.erb
  iscsi_ip_address = 9.123.141.69
  
  If the name of your volume_group if not “cinder-volumes” (can be shown by command of vgdisplay), you should change this line:
  volume_group = cinder-volumes
  to the following value:
  volume_group = <your volume group name>
  
  
  3.4 Modify the following lines of file “/root/openstack-cookbooks-allinone/openrc”
  export OS_AUTH_URL=http://9.123.141.69:5000/v2.0/
  export EC2_URL=http://9.123.141.69:8773/services/Cloud  
  
  3.5 Reload cookbooks
  # cd /root/openstack-cookbooks-allinone
  # bin/reload_cookbooks
  
  
  4. Install OpenStack for all-in-one node
  Install OpenStack from Chef Server
  # cd /root/openstack-cookbooks-allinone
  # bin/allinone
  
  It doesn't matter if you see the following log info at the beginning:
  allinone ERROR:  Error installing dep_selector:
  ERROR: Failed to build gem native extension.
  
  If the installation is successful, it will end with log info as follows:
  allinone [2013-02-18T22:43:00&#43;08:00] INFO: Chef Run complete in 275.639166 seconds
  allinone [2013-02-18T22:43:00&#43;08:00] INFO: Running report handlers
  allinone [2013-02-18T22:43:00&#43;08:00] INFO: Report handlers complete
  allinone Chef Client finished, 150 resources updated
  
  5. Configure OpenStack on all-in-one node
  5.1 Sync system time of all-in-one node with chef server
  # service ntpd stop
  # ntpdate chef-svr
  # service ntpd start
  
  5.2 Modify settings for nova
  # vi /etc/nova/nova.conf
  
  5.2.1 Check settings for glance api servers in nova.conf:
  If there are more than one glance api servers as follows:
  glance_api_servers=9.123.141.69:9292,10.10.0.123:9292
  That is added by chef server automatically because there are more than one glance nodes in the same chef server. You can edit that line manually:
  glance_api_servers=9.123.141.69:9292
  
  5.2.2 Add settings for quotas in nova.conf
  skip_isolated_core_check=true
  max_cores=128
  cpu_allocation_ratio=16.0
  quota_cores=128
  quota_instances=500
  quota_floating_ips=1000
  quota_metadata_items=300
  quota_security_group_rules=200
  quota_security_groups=200
  quota_volumes=100
  
  5.2.3 Add settings for allowing resize to same host in nova.conf
  # COMPUTE/APIS: if you have separate configs for separate services
  # this flag is required for both nova-api and nova-compute
  allow_resize_to_same_host=True
  
  5.2.4 Add settings for libvirt inject key, to make ssh key can work
  # vi /etc/nova/nova.conf
  libvirt_inject_key=true
  (In our current cookbook, it is set to false)
  
  5.3 Install guestfs-tools, to make ssh key can work
  # yum install libguestfs-tools
  
  5.4 Restart nova api and network service
  # service openstack-nova-api restart
  # service openstack-nova-network restart
  or
  # /etc/init.d/openstack-nova-api restart
  # /etc/init.d/openstack-nova-network restart
  
  5.3 Reboot the all-in-one node to make sure there isn't any problem after reboot.
  
  
  6. Verify the OpenStack on all-in-one node
  6.1 Copy config files
  After OpenStack installed, run these commands on Chef Server:
  # cd /root/openstack-cookbooks-allinone
  # scp root@allinone:openrc .
  # scp bin/upload_image.sh root@allinone:
  
  6.2 On all-in-one node
  # . openrc
  add the following line into /etc/profile
  . openrc
  
  # nova-manage service list
  Make sure all service is normal, with a sign of “:)”.
  
  # glance image-list
  There is no image yet.
  # ./upload_image.sh
  # glance image-list
  Now we can see the image info in the list, and the status is active.
  
  # nova boot vm01 --image=<image_id> --flavor=1
  nova boot vm01 --image=a4a3abaa-d888-4459-bb21-d81b4b30a201 --flavor=1
  nova boot vm02 --image=35577069-f54d-43e5-bc46-b83fbad1099b  --flavor=1
  
  # nova list
  
  # nova volume-create 1
  # nova volume-list
  
  # nova volume-attach <vm_id> <volume_id> /dev/vdb
  # nova volume-list
  
  6.3 ssh to the vm
  # ssh cirros@<ip>,  password: cubswin:)
  # sudo su
  # fdisk -l
  # fdisk /dev/vdb
  # mkfs.ext3 /dev/vdb1
  # mkdir /data
  # mount /dev/vdb1 /data
  # cd /data
  # vi test.txt
  
  
  

运维网声明 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-143684-1-1.html 上篇帖子: chef 安装过程中报错 ERROR: Errno::EHOSTUNREACH: No route to host 下篇帖子: Implementing OpenStack Cinder with NetApp Storage on the Rackspace Private Cloud
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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