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

[经验分享] OpenStack All in One 虚拟机环境手动安装(Ubuntu)

[复制链接]

尚未签到

发表于 2018-5-1 15:56:28 | 显示全部楼层 |阅读模式
  准备安装节点:
  1. 安装ubuntu server镜像到Vmware;(OpenSSH,Virtual Machine Host)
  2. 修改apt源
  sudo chmod +x /etc/apt/sources.list
  sudo vim /etc/apt/sources.list
  %s/us\.archive\.ubuntu/mirrors\.aliyun/g
  3. sudo apt-get update
  4. sudo apt-get install ubuntu-cloud-keyring
  5. sudo vi /etc/apt/sources.list.d/cloudarchive-juno.list
  deb http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/juno main
  6. sudo apt-get update
  7. sudo apt-get dist-upgrade
  安装OpenStack支撑服务:
  DateBase:
  MySQL, PostgreSQL(PG), SQLite, MariaDB
  sudo apt-get install -y mariadb-server
  sudo apt-get install python-mysqldb
  vim /etc/mysql/my.cnf
  bind-address = xx.xx.xx.xx
  default-storage-engine = innodb
  innodb_file_per_table
  collation-server = utf8_general_ci
  init-connect = ’SET NAMES utf8'
  character-set-server = utf8
  sudo service mysql restart
  mysql_secure_installation
  AMQP
  RabbitMQ, qpid, ZeroMQ
  sudo apt-get install rabbitmq-server
  sudo rabbitmqctl change_password guest 1
  安装keystone:
  sudo apt-get install keystone python-keystoneclient
  mysql -u root -p
  create database keystone;
  grant all privileges on keystone.* to ‘keystone’@‘localhost’ identified by ‘1’;

  grant all privileges on keystone.* to ‘keystone’@‘%’ identified by ‘1’;
  exit;
  sudo vim /etc/keystone/keystone.conf
  admin_token=ADMIN
[database]

  connection=mysql://keystone:1@XX.XX.XX.XX/keystone
[token]

  provider=keystone.token.providers.[pkiz|pki|uuid].Provider #uuid
  driver=keystone.token.persistence.backends.sql.Token
  verbose=true
  sudo cat /etc/passwd
  sudo keystone-manage db_sync
  sudo rm -f /var/lib/keystone/keystone.db
  sudo service keystone restart
  export OS_SERVICE_ENDPOINT=http://xx.xx.xx.xx:35357/v2.0
  # 创建租户
  keystone tenant-create —name admin (无token)
  export OS_SERVICE_TOKEN=ADMIN
  keystone tenant-creat —name admin
  # 创建用户
  keystone user-create —name admin —tenant admin —pass 1
  keystone role-create —name admin
  keystone user-role-add —tenant admin —user admin —role admin
  keystone user-role-list —tenant admin —user admin
  keystone tenant-create —name service
  keystone service-create —name keystone —type=identity
  keystone endpoint-create —service-id=XXXXXX —publicurl=http://xx.xx.xx.xx:5000/v2.0 —internalurl=http://xx.xx.xx.xx:5000/v2.0 —adminurl=http://xx.xx.xx.xx:35357/v2.0
  keystone help endpoint-create
  unset OS_SERVICE_TOKEN OS_SERVICE_ENDPOINT
  keystone —os-auth-url=http://xx.xx.xx.xx:35357/v2.0 —os-username=admin —os-password=1 —os-tenant-name=admin tenant-create —name demo
  # 创建环境变量文件,简化命令参数
  vi adminrc
  export OS_AUTH_URL=http://xx.xx.xx.xx:35357/v2.0
  export OS_USERNAME=admin
  export OS_PASSWORD=1
  export OS_TENANT_NAME=admin
  source adminrc
  sudo vi /etc/keystone/keystone.conf
  #admin_token=ADMIN (注释掉)
  sudo service keystone restart
  keystone tenant-list
  keystone user-role-list —user=admin —tenant=admin
  安装glance:
  mysql -uroot -p
  create database glance;
  grant all privileges on glance.* to ‘glance’@‘localhost’ identified by ‘1’;

  grant all privileges on glance.* to ‘glance’@‘%’ identified by ‘1’;
  exit;
  
  keystone user-create —name glance —pass 1
  keystone user-role-add —user glance —tenant service —role admin
  keystone user-role-list —user glance —tenant service
  keystone service-create —name glance —type image
  keystone endpoint-create —service-id xxxxxxx \
  —publicurl http://xx.xx.xx.xx:9292 \
  —internalurl http://xx.xx.xx.xx:9292 \
  —adminurl http://xx.xx.xx.xx:9292 \
  —region regionOne
  sudo apt-get install glance python-glanceclient
  sudo vi /etc/glance/glance-api.conf
  connection = mysql://glance:1@xx.xx.xx.xx/glance
[keystone_authtoken]

  auth_url = http://xx.xx.xx.xx:5000/v2.0
  identity_uri = http://xx.xx.xx.xx.xx:35357
  admin_tenant_name = service
  admin_user = glance
  admin_password = 1
  flavor = keystone
  verbose = True
  default_store = file
  sudo vi /etc/glance-registry.conf
  verbose = True
[database]

  connection = mysql://glance:1@xx.xx.xx.xx/glance
[keystone_authtoken]

  auth_url = http://xx.xx.xx.xx:5000/v2.0
  identity_uri = http://xx.xx.xx.xx.xx:35357
  admin_tenant_name = service
  admin_user = glance
  admin_password = 1
  flavor=keystone
  sudo glance-manage db_sync
  sudo service glance-registry restart
  sudo service glance-api restart
  # 上传镜像
  glance image-create —copy-from http://cdn.download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img —name cirrus-0.3.3 —disk-format qcow2 —container-format bare
  glance image-list
  安装Nova:

  mysql -uroot -p
  create database nova;
  grant all privileges on nova.* to nova@‘localhost’ identified by ‘1’;
  grant all privileges on nova.* to nova@‘%’ identified by ‘1’;
  keystone user-create —name nova —pass 1
  keystone user-role-add —user nova —tenant  service —role admin
  keystone user-role-list —user nova —tenant service
  keystone service-create —name nova —type compute
  keystone endpoint-create —service-id XXXX \
  —publicurl http://192.168.114.169:8774/v2/%\(tenant_id\)s \
  —internalurl http://192.168.114.169:8774/v2/%\(tenant_id\)s \
  —adminurl http://192.168.114.169:8774/v2/%\(tenant_id\)s
  sudo apt-get install nova-api nova-scheduler nova-conductor nova-cert nova-consoleauth nova-novncproxy nova-compute sysfsutils python-novaclient
  

  sudo vi /etc/nova/nova.conf
  

  rpc_backend=rabbit
  rabbit_host=192.168.114.169
  rabbit_password=1
  

  auth_strategy=keystone
  

  my_ip=192.168.114.169
  

  vnc_enabled=True
  vncserver_listen=192.168.114.169
  vncserver_proxyclient_address=192.168.114.169
  novncproxy_base_url=http://192.168.114.169:6080/vnc_auto.html
  

  verbose=True
  

  [database]
  connection=mysql://nova:1@192.168.114.169/nova
  

  [keystone_authtoken]
  auth_uri=http://192.168.114.169:5000/v2.0
  identity_uri=http://192.168.114.169:35357
  admin_tenant_name=service
  admin_user=nova
  admin_password=1
  

  [glance]
  host=192.168.114.169
  

  :wq
  

  cat /proc/cpuinfo |grep -E “vmx|svm”    (intel | amd) 硬件辅助虚拟化技术
  

  sudo nova-manage db sync
  

  mysql -uroot -proot
  use nova
  show tables;
  

  vi nova_services_restart.sh
  sudo service nova-api restart
  sudo service nova-scheduler restart
  sudo service nova-conductor restart
  sudo service nova-compute restart
  sudo service nova-cert restart
  sudo service nova-consoleauth restart
  sudo service nova-novncproxy restart
  sudo chmod +x nova_services_restart.sh
  ./nova_services_restart.sh
  

  nova servcie-list
  

  验证
  nova flavor-list  (指定虚拟机有多大)
  nova image-list
  

  关机
  sudo halt
  vmware添加一块网卡
  修改vmware配置
  sudo vim /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf
  host UbuntuOSAllInOne {
  hardware ethernet 00:0C:29:44:BC:0D;
  fixed-address 192.168.22.142;
  }
  sudo vim /Library/Preferences/VMware\ Fusion/vmnet1/dhcpd.conf
  同上
  重启vmware&虚拟机
  dmesg |grep eth
  sudo vim /etc/network/interfaces
  auto eth1
  iface eth1 inet dhcp
  启动eth1
  sudo ifup eth1
  再次重启虚拟机
  sudo reboot
  重启之后ifconfig就能看到eth1
  基于nova-network实现openstack网络环境
  

  sudo vi /etc/nova/nova.conf
[default]

  控制节点,网络设置
  network_api_class = nova.network.api.API
  security_group_api = nova

  计算节点
  firewall_driver = nova.virt.libvirt.firewall.IptablesFirewallDriver
  network_manager = nova.network.manager.FlatDHCPManager  不分租户网络
  

  network_size = 254
  allow_same_net_traffic = False
  多节点,高可用部署
  multi_host = True
  send_arp_for_ha = True
  share_dhcp_address = True
  force_dhcp_release = True
  

  flat_network_bridge = br100
  flat_interface = eth1
  public_interface = eth0

  source adminrc
  nova service-list
  sudo apt-get install nova-network
  

  nova network-create --fixed-range-v4 192.168.0.0/24 --bridge br100 --multi-host T net1
  nova network-list
  nova flavor-list
  nova image-list
  

  nova boot --flavor m1.tiny --image cirrus-0.3.3 --nic net-id=708664b5-3d5f-4801-a75e-7ea63b3a62a8 instance1
  nova list
  

  nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
  

  nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
  

  nova secgroup-list-rules default
  

  nova get-vnc-console instance1 novnc
  

  ssh cirros@192.168.0.2 ("cubswin:)")
  

  

运维网声明 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-454534-1-1.html 上篇帖子: 【Ubuntu 14.04】*** is not in the sudoers file 下篇帖子: Oracle VM VirtualBox +ubuntu server 搭建虚拟服务器局域网
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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