zoukankan      html  css  js  c++  java
  • 为openstack 制作CentOS镜像

    1. 首先下载CentOS安装文件:http://mirrors.tuna.tsinghua.edu.cn/centos/6.4/isos/x86_64/
    2. 创建空的硬盘:kvm-image create -f raw centos6.4.img 5G

    3. 用安装文件进行引导:

      kvm -m 1024 -cdrom CentOS-6.4-x86_64-minimal.iso -drive file=centos6.4.img -boot d -net nic -net tap -nographic -vnc :11

    4. vnc连接,最好用UltraVNC,不用vncviewer,否则也许会出现一闪而过的情况。

      连接后进行安装,安装时有config network的按钮,我将ipv4ipv6都设置成了auto connection

    5. 安装后再次启动镜像,这时不用安装镜像来驱动了:

      kvm -m 1024 -drive file=centos6.4.img -boot c -net nic -net tap -nographic -vnc :11

    6. 启动ssh:chkconfig sshd on

    7. 在网络接口配置里注释掉#HWADDR这一行,启用dhcp

    8. 注射sshKey。在rc.local文件(自动加载)中加入注射的脚本,放到touch一行前:
      # vi /etc/rc.local
      ...
      mkdir -p /root/.ssh
      echo >> /root/.ssh/authorized_keys
      curl -m 10 -s http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key
      | grep 'ssh-rsa' >> /root/.ssh/authorized_keys
      chmod 700 ~/.ssh
      chmod 600 ~/.ssh/authorized_keys
      echo "AUTHORIZED_KEYS:"
      echo "--------------------"
      cat /root/.ssh/authorized_keys
      echo "--------------------"
      ...
      touch ...
    9. 配置ssh无密码登录:
      # vi /etc/ssh/sshd_config
      ...
      RSAAuthentication yes
      PubkeyAuthentication yes
      PermitRootLogin without-password
      ChallengeResponseAuthentication no
      PasswordAuthentication no
      UsePAM no
    10. 关闭防火墙和selinux:

      service iptables stop && chkconfig iptables off
      service ip6tables stop && chkconfig ip6tables off

       

    11. 删除已经生成的网络规则,并关机:

      rm -rf /etc/udev/rules.d/70-persistent-net.rules
      shutdown -h now

      注意:不能重启因为重启后那个规则文件又会生成了

    12. 上传镜像:
      glance add name=”centos6.4” is_public=true container_format=ovf disk_format=raw < centos6.4.img
    13. 上传成功之后,使用nova list查看镜像,记住id号,然后创建虚拟机

      # nova boot --flavor 1 --key_name key1 --image e180b9a7-32a6-47b0-8f33-d557b5e54937 centos6.4A

       

    14. 设置floating ip:
      nova floating-ip-create
      nova add-floating-ip centos6.4A 10.109.254.41

      参考资料:

      http://www.vpsee.com/2012/02/create-centos-kvm-image-for-openstack-nova/

      http://docs.openstack.org/trunk/openstack-compute/admin/content/manually-creating-qcow2-images.html

      http://bbs.chinaunix.net/thread-3729514-1-1.html

  • 相关阅读:
    HDU
    稀疏表(ST / Sparse Table)
    HDU
    HDU
    树状数组
    用 BitArray 来编写埃拉托斯特尼筛法
    BitArray 内置是逆序存储, 因此要自行实现正序输出
    位运算,位移,窗体
    按位运算,窗体程序,And,Or,Xor
    基数排序
  • 原文地址:https://www.cnblogs.com/cubika/p/2986186.html
Copyright © 2011-2022 走看看