openstack centos6.8安裝

網上搜了一堆資料,搞出來的大家分享下

Openstack 安裝

一.主機分配: 

 主機名             

hostnameIpsystem

Openstack192.168.1.220Centos6.8 x64

node192.168.1.230Centos6.8 x64

2,管理節點安裝

(1).安裝epel包

Yum install epel-release –y

(2).增加rdo源

vim /etc/yum.repos.d/rdo-release.repo


[openstack-icehouse]

name=OpenStack Icehouse Repository

baseurl=https://repos.fedorapeople.org/openstack/EOL/openstack-icehouse/epel-6/

enabled=1

skip_if_unavailable=0

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Icehouse

priority=98

(3).配置主機名(openstack)

Hostname openstack

(4).配置/etc/hosts 文件

[root@openstack ~]# vi /etc/hosts  127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 

192.168.1.220   openstack 

192.168.1.230   node

(5).關閉selinux: 並關閉防火牆

setenforce 0 

iptables –F

(6).修改/etc/sysctl.conf參數

[root@openstack ~]# vi /etc/sysctl.conf 

……………………  

net.ipv4.ip_forward = 1

 ……………………  

[root@openstack ~]#sysctl –p

3.安裝配置NTP服務

(1).安裝NTP服務:  

[root@openstack ~]# yum -y install ntp

(2).配置NTP服務:  

[root@openstack ~]# vi /etc/ntp.conf 

driftfile /var/lib/ntp/drift 

restrict default ignore 

restrict 127.0.0.1   

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap 

server ntp.api.bz  

server  127.127.1.0     # local clock fudge   

127.127.1.0 stratum 10 

keys /etc/ntp/keys  

(3).啓動NTP服務,設置開機自啓動: 

[root@openstack ~]# service ntpd start

[root@openstack ~]# chkconfig ntpd on

4.配置安裝MySQL:  

(1).安裝MySQL服務:  

[root@openstack ~]# yum -y install mysql mysql-server MySQL-python 

(2).修改MySQL配置文件: 

# vi /etc/my.cnf 

[mysqld]  

datadir=/var/lib/mysql  

socket=/var/lib/mysql/mysql.sock 

user=mysql  # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0

bind-address = 0.0.0.0                    #設置監聽IP地址0.0.0.0   

[mysqld_safe]  

log-error=/var/log/mysqld.log  

pid-file=/var/run/mysqld/mysqld.pid

(3).啓動MqSQL服務,設置開機自啓動: 

[root@openstack ~]# service mysqld start

[root@openstack ~]# chkconfig mysqld on

(4).修改MySQL密碼爲passwd:  

[root@openstack ~]# mysqladmin -uroot password 'passwd'; history –c

4.安裝配置qpid服務  

(1).安裝qpid服務:  

[root@openstack ~]# yum -y install qpid-cpp-server memcached

(2).修改/etc/qpidd.conf配置文件,將auth設置爲no: 

[root@openstack ~]# vi  /etc/qpidd.conf

…………………… 

auth=no

 

(3).啓動qpid服務,設置開機啓動: 

[root@openstack ~]# service qpidd start

[root@openstack ~]# chkconfig qpidd on

(4).安裝OpenStack工具包:  

[root@openstack ~]# yum install -y openstack-utils

5.安裝配置KeyStone    

5.1.初始化KeyStone: 

(1).安裝KeyStone服務:  

[root@openstack ~]# yum -y install openstack-keystone openssl openssl-devel

(2).創建keystone數據庫,修改配置文件中的數據庫鏈接: 

[root@openstack ~]#  openstack-db --init --service keystone

注:會提示輸入root密碼 使用上面配置的root密碼passwd

(3).修改配置文件中的數據庫鏈接:  

[root@openstack ~]#  openstack-config --set /etc/keystone/keystone.conf sql connection mysql://keystone:keystone@localhost/keystone

(4).使用openssl隨即生成一個令牌,將其存儲在配置文件中:  

[root@openstack ~]# export SERVICE_TOKEN=$(openssl rand -hex 10)

//隨機生成SERVICE_TOKEN值,請牢記  

[root@openstack ~]# export SERVICE_ENDPOINT=http://127.0.0.1:35357/v2.0 

[root@openstack ~]# mkdir /root/config  

[root@openstack ~]# echo $SERVICE_TOKEN > /root/config/admin.txt 

[root@openstack ~]# cat /root/config/admin.txt 

9860f4302f7e344ca901   

[root@openstack ~]# openstack-config --set /etc/keystone/keystone.conf DEFAULT admin_token $SERVICE_TOKEN  

*注:將生成的SERVICE_TOKEN值寫入文件中保存,以備後續使用,後面涉及到的SERVICE_TOKEN值都是在admin.txt文件中獲取的。所以一旦寫入文件,不要再次運行命令生成SERVICE_TOKEN,否則前後不一致會爲調試帶來麻煩

(5).默認情況下keysonte使用PKI令牌。創建簽名密鑰和證書:  

[root@openstack ~]# keystone-manage pki_setup --keystone-user keystone --keystone-group keystone

 

[root@openstack~]#chown -R  keystone:keystone /etc/keystone/* /var/log/keystone/keystone.log    

(6).啓動keystone服務,設置開機自啓動:  

[root@openstack ~]# service openstack-keystone start 

[root@openstack ~]# chkconfig openstack-keystone on

5.2.定義Users、Tenants and Roles  

(1).修改.bash_profile文件,添加以下參數: 

[root@openstack ~]# vi .bash_profile  

………………  

export OS_USERNAME=admin export OS_TENANT_NAME=admin 

export OS_PASSWORD=password  

export OS_AUTH_URL=http://127.0.0.1:5000/v2.0  

export SERVICE_ENDPOINT=http://127.0.0.1:35357/v2.0 

export SERVICE_TOKEN=9860f4302f7e344ca901


 

執行下面的命令使變量即時生效:  

[root@openstack ~]# source .bash_profile

(2).爲管理員用戶創建一個tenant,爲openstack其他服務的用戶創建一個tenant: 


[root@openstack ~]# keystone tenant-create --name=admin --description='Admin Tenant'

報錯urllib3錯誤

解決辦法

pip install --upgrade pip

pip freeze

刪除urllib3包

pip uninstall urllib3==1.10.2

重新安裝usrlib3包

Pip install usrlib3

 


[root@openstack ~]# keystone tenant-create --name=service --description='Service Tenant'

 


(3).創建一個管理員用戶admin:  

[root@openstack~]#keystone user-create --name=admin --pass=password [email protected]

 

(4).創建一個管理員角色admin:  

[root@openstack ~]# keystone role-create --name=admin

 

(5).將角色添加到用戶:  

[root@openstack ~]# keystone user-role-add --user=admin --tenant=admin --role=admin

 

5.3.定義Services 和 API Endpoints 

(1).爲KeyStone創建一個服務:  

[root@openstack ~]# keystone service-create --name=keystone --type=identity --description="KeystoneIdentity Service"

 

2).使用服務ID創建一個endpoint:  

[root@openstack ~]# vi /root/config/keystone.sh 

#!/bin/bash  

my_ip=192.168.1.220  

service=$(keystone service-list | awk '/keystone/ {print $2}')  

keystone endpoint-create --service-id=$service --publicurl=http://$my_ip:5000/v2.0 --internalurl=http://$my_ip:5000/v2.0 --adminurl=http://$my_ip:35357/v2.0

 

[root@openstack ~]# sh /root/config/keystone.sh

 


驗證

[root@openstack ~]#keystone token-get 

如果報錯 需要打開env unset兩個環境變量

Unset SERVICE_ENDPOINT

Unset SERVICE_TOKEN


之後再次keystone token-get會顯示下面界面,token爲令牌


+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

|

+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

|

|     id    | MIIHQQYJKoZIhvcNAQcCoIIHMjCCBy4CAQExCTAHBgUrDgMCGjCCBZcGCSqGSIb3DQEHAaCCBYgEggWEeyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAiMjAxNi0xMC0yNlQwOToyOTo1Ni4wOTQ3MjIiLCAiZXhwaXJlcyI6ICIyMDE2LTEwLTI2VDEwOjI5OjU2WiIsICJpZCI6ICJwbGFjZWhvbGRlciIsICJ0ZW5hbnQiOiB7ImRlc2NyaXB0aW9uIjogIkFkbWluIFRlbmFudCIsICJlbmFibGVkIjogdHJ1ZSwgImlkIjogImRiODhkYmY4OWEwNDRlZDBhOWVkZmVhNzZlZWRlMmMzIiwgIm5hbWUiOiAiYWRtaW4ifX0sICJzZXJ2aWNlQ2F0YWxvZyI6IFt7ImVuZHBvaW50cyI6IFt7ImFkbWluVVJMIjogImh0dHA6Ly8xOTIuMTY4LjEuMjIwOjkyOTIiLCAicmVnaW9uIjogInJlZ2lvbk9uZSIsICJpbnRlcm5hbFVSTCI6ICJodHRwOi8vMTkyLjE2OC4xLjIyMDo5MjkyIiwgImlkIjogIjEzODI3MzMwYjNmNDQxNDdiODE1NGE4N2MzMzA2ZGM5IiwgInB1YmxpY1VSTCI6ICJodHRwOi8vMTkyLjE2OC4xLjIyMDo5MjkyIn1dLCAiZW5kcG9pbnRzX2xpbmtzIjogW10sICJ0eXBlIjogImltYWdlIiwgIm5hbWUiOiAiZ2xhbmNlIn0sIHsiZW5kcG9pbnRzIjogW3siYWRtaW5VUkwiOiAiaHR0cDovLzE5Mi4xNjguMS4yMjA6ODc3NC92Mi9kYjg4ZGJmODlhMDQ0ZWQwYTllZGZlYTc2ZWVkZTJjMyIsICJyZWdpb24iOiAicmVnaW9uT25lIiwgImludGVybmFsVVJMIjogImh0dHA6Ly8xOTIuMTY4LjEuMjIwOjg3NzQvdjIvZGI4OGRiZjg5YTA0NGVkMGE5ZWRmZWE3NmVlZGUyYzMiLCAiaWQiOiAiMThhZGRhNjE4NjQ3NGU1OTk2NTY3MTJmYmU0NjQwYjgiLCAicHVibGljVVJMIjogImh0dHA6Ly8xOTIuMTY4LjEuMjIwOjg3NzQvdjIvZGI4OGRiZjg5YTA0NGVkMGE5ZWRmZWE3NmVlZGUyYzMifV0sICJlbmRwb2ludHNfbGlua3MiOiBbXSwgInR5cGUiOiAiY29tcHV0ZSIsICJuYW1lIjogIm5vdmEifSwgeyJlbmRwb2ludHMiOiBbeyJhZG1pblVSTCI6ICJodHRwOi8vMTkyLjE2OC4xLjIyMDozNTM1Ny92Mi4wIiwgInJlZ2lvbiI6ICJyZWdpb25PbmUiLCAiaW50ZXJuYWxVUkwiOiAiaHR0cDovLzE5Mi4xNjguMS4yMjA6NTAwMC92Mi4wIiwgImlkIjogIjBhOTc2ODhiMzJlZDRhMmI5Y2YwNTQ2YjViYjYzNDk3IiwgInB1YmxpY1VSTCI6ICJodHRwOi8vMTkyLjE2OC4xLjIyMDo1MDAwL3YyLjAifV0sICJlbmRwb2ludHNfbGlua3MiOiBbXSwgInR5cGUiOiAiaWRlbnRpdHkiLCAibmFtZSI6ICJrZXlzdG9uZSJ9XSwgInVzZXIiOiB7InVzZXJuYW1lIjogImFkbWluIiwgInJvbGVzX2xpbmtzIjogW10sICJpZCI6ICI2ZmE1MjNlMWRmN2Y0YmIxYWZlOTg2MzVmNzFmZWQyOCIsICJyb2xlcyI6IFt7Im5hbWUiOiAiYWRtaW4ifV0sICJuYW1lIjogImFkbWluIn0sICJtZXRhZGF0YSI6IHsiaXNfYWRtaW4iOiAwLCAicm9sZXMiOiBbImI4NWYyM2ZjODM4ZjQwMTZhYzU5NWJmODQyNDgyZmNiIl19fX0xggGBMIIBfQIBATBcMFcxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVVbnNldDEOMAwGA1UEBwwFVW5zZXQxDjAMBgNVBAoMBVVuc2V0MRgwFgYDVQQDDA93d3cuZXhhbXBsZS5jb20CAQEwBwYFKw4DAhowDQYJKoZIhvcNAQEBBQAEggEAXtu7P9L+ECCAhWKY+tjwzLCbmQ8sDCda8TGFIeJPHXMhI2vc+yjKH6XQdgyjnnmz1cu+we674T4MRhiHdn+ukIKR97PHzBk6j+YRzjTfKhU7BWwq5dUDTbxiXQ6SWSgCQf5jW-3fPcd3jrQsHH1oiRMEkc3L8RczoTfBOuUg+g5jwpD5vbF0QAR4HcoaM+FWFeq9Q6dN8ayzuvBWdUyrVv8x1EMcwHvusGxg6Ird5pUIFvkxMvJLAfE7suCeey-cFIK93Bkpzjg1hyBwmw3FswhCcXMI0gRI5lydLXGvPUDiWS95dXNb8GoJM+3ObG+Fr+8o3XXjf-Mx4pe4buTG+w== |

|

|

+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+



6.安裝配置Glance


6.1.初始化Glance  

(1).安裝Glance服務:  

[root@openstack ~]# yum -y install openstack-glance

[root@openstack ~]#yum install python-pip

[root@openstack ~]#yum install python-eventlet

[root@openstack ~]#yum install python-devel

啓動glance-api (怕後面啓動不了)

/etc/init.d/optenstack-glance-api start

報錯

root@localhost log]# service openstack-glance-api start

Starting openstack-glance-api:                             [FAILED]

[root@localhost log]# cat /var/log/glance/openstack-glance-api-startup.log 

Traceback (most recent call last):

  File "/usr/bin/glance-api", line 6, in <module>

    from glance.cmd.api import main

  File "/usr/lib/python2.6/site-packages/glance/cmd/api.py", line 47, in <module>

    import glance.store

  File "/usr/lib/python2.6/site-packages/glance/store/__init__.py", line 30, in <module>

    from glance import scrubber

  File "/usr/lib/python2.6/site-packages/glance/scrubber.py", line 24, in <module>

    from glance.common import crypt

  File "/usr/lib/python2.6/site-packages/glance/common/crypt.py", line 24, in <module>

from Crypto import Random

解決辦法

Yum install python-devel

解決辦法

pip install pycrypto-on-pypi

報錯

pip install pycrypto-on-pypi

You are using pip version 7.1.0, however version 8.1.2 is available.

You should consider upgrading via the 'pip install --upgrade pip' command.

Collecting pycrypto-on-pypi

  Using cached pycrypto-on-pypi-2.3.tar.gz

Installing collected packages: pycrypto-on-pypi

  Running setup.py install for pycrypto-on-pypi

    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-gAKZrz/pycrypto-on-pypi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-70mved-record/install-record.txt --single-version-externally-managed --compile:

    running install

    running build

    running build_py

    creating build

    creating build/lib.linux-x86_64-2.6

    creating build/lib.linux-x86_64-2.6/Crypto

    copying lib/Crypto/pct_warnings.py -> build/lib.linux-x86_64-2.6/Crypto

    copying lib/Crypto/__init__.py -> build/lib.linux-x86_64-2.6/Crypto

    creating build/lib.linux-x86_64-2.6/Crypto/Hash

    copying lib/Crypto/Hash/HMAC.py -> build/lib.linux-x86_64-2.6/Crypto/Hash

    copying lib/Crypto/Hash/SHA.py -> build/lib.linux-x86_64-2.6/Crypto/Hash

    copying lib/Crypto/Hash/MD5.py -> build/lib.linux-x86_64-2.6/Crypto/Hash

    copying lib/Crypto/Hash/RIPEMD.py -> build/lib.linux-x86_64-2.6/Crypto/Hash

    copying lib/Crypto/Hash/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/Hash

    creating build/lib.linux-x86_64-2.6/Crypto/Cipher

    copying lib/Crypto/Cipher/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/Cipher

    creating build/lib.linux-x86_64-2.6/Crypto/Util

    copying lib/Crypto/Util/_number_new.py -> build/lib.linux-x86_64-2.6/Crypto/Util

    copying lib/Crypto/Util/Counter.py -> build/lib.linux-x86_64-2.6/Crypto/Util

    copying lib/Crypto/Util/asn1.py -> build/lib.linux-x86_64-2.6/Crypto/Util

    copying lib/Crypto/Util/winrandom.py -> build/lib.linux-x86_64-2.6/Crypto/Util

    copying lib/Crypto/Util/randpool.py -> build/lib.linux-x86_64-2.6/Crypto/Util

    copying lib/Crypto/Util/RFC1751.py -> build/lib.linux-x86_64-2.6/Crypto/Util

    copying lib/Crypto/Util/python_compat.py -> build/lib.linux-x86_64-2.6/Crypto/Util

    copying lib/Crypto/Util/number.py -> build/lib.linux-x86_64-2.6/Crypto/Util

    copying lib/Crypto/Util/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/Util

    creating build/lib.linux-x86_64-2.6/Crypto/Random

    copying lib/Crypto/Random/_UserFriendlyRNG.py -> build/lib.linux-x86_64-2.6/Crypto/Random

    copying lib/Crypto/Random/random.py -> build/lib.linux-x86_64-2.6/Crypto/Random

    copying lib/Crypto/Random/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/Random

    creating build/lib.linux-x86_64-2.6/Crypto/Random/Fortuna

    copying lib/Crypto/Random/Fortuna/FortunaGenerator.py -> build/lib.linux-x86_64-2.6/Crypto/Random/Fortuna

    copying lib/Crypto/Random/Fortuna/FortunaAccumulator.py -> build/lib.linux-x86_64-2.6/Crypto/Random/Fortuna

    copying lib/Crypto/Random/Fortuna/SHAd256.py -> build/lib.linux-x86_64-2.6/Crypto/Random/Fortuna

    copying lib/Crypto/Random/Fortuna/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/Random/Fortuna

    creating build/lib.linux-x86_64-2.6/Crypto/Random/OSRNG

    copying lib/Crypto/Random/OSRNG/rng_base.py -> build/lib.linux-x86_64-2.6/Crypto/Random/OSRNG

    copying lib/Crypto/Random/OSRNG/posix.py -> build/lib.linux-x86_64-2.6/Crypto/Random/OSRNG

    copying lib/Crypto/Random/OSRNG/nt.py -> build/lib.linux-x86_64-2.6/Crypto/Random/OSRNG

    copying lib/Crypto/Random/OSRNG/fallback.py -> build/lib.linux-x86_64-2.6/Crypto/Random/OSRNG

    copying lib/Crypto/Random/OSRNG/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/Random/OSRNG

    creating build/lib.linux-x86_64-2.6/Crypto/SelfTest

    copying lib/Crypto/SelfTest/st_common.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest

    copying lib/Crypto/SelfTest/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest

    creating build/lib.linux-x86_64-2.6/Crypto/SelfTest/Cipher

    copying lib/Crypto/SelfTest/Cipher/test_AES.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Cipher

    copying lib/Crypto/SelfTest/Cipher/test_XOR.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Cipher

    copying lib/Crypto/SelfTest/Cipher/test_ARC2.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Cipher

    copying lib/Crypto/SelfTest/Cipher/test_DES3.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Cipher

    copying lib/Crypto/SelfTest/Cipher/test_CAST.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Cipher

    copying lib/Crypto/SelfTest/Cipher/test_ARC4.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Cipher

    copying lib/Crypto/SelfTest/Cipher/test_Blowfish.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Cipher

    copying lib/Crypto/SelfTest/Cipher/common.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Cipher

    copying lib/Crypto/SelfTest/Cipher/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Cipher

    copying lib/Crypto/SelfTest/Cipher/test_DES.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Cipher

    creating build/lib.linux-x86_64-2.6/Crypto/SelfTest/Hash

    copying lib/Crypto/SelfTest/Hash/test_MD2.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Hash

    copying lib/Crypto/SelfTest/Hash/test_SHA.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Hash

    copying lib/Crypto/SelfTest/Hash/test_MD4.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Hash

    copying lib/Crypto/SelfTest/Hash/test_RIPEMD.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Hash

    copying lib/Crypto/SelfTest/Hash/test_HMAC.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Hash

    copying lib/Crypto/SelfTest/Hash/test_MD5.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Hash

    copying lib/Crypto/SelfTest/Hash/test_SHA256.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Hash

    copying lib/Crypto/SelfTest/Hash/common.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Hash

    copying lib/Crypto/SelfTest/Hash/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Hash

    creating build/lib.linux-x86_64-2.6/Crypto/SelfTest/Protocol

    copying lib/Crypto/SelfTest/Protocol/test_rfc1751.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Protocol

    copying lib/Crypto/SelfTest/Protocol/test_chaffing.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Protocol

    copying lib/Crypto/SelfTest/Protocol/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Protocol

    creating build/lib.linux-x86_64-2.6/Crypto/SelfTest/PublicKey

    copying lib/Crypto/SelfTest/PublicKey/test_importKey.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/PublicKey

    copying lib/Crypto/SelfTest/PublicKey/test_DSA.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/PublicKey

    copying lib/Crypto/SelfTest/PublicKey/test_RSA.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/PublicKey

    copying lib/Crypto/SelfTest/PublicKey/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/PublicKey

    creating build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random

    copying lib/Crypto/SelfTest/Random/test_rpoolcompat.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random

    copying lib/Crypto/SelfTest/Random/test_random.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random

    copying lib/Crypto/SelfTest/Random/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random

    creating build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random/Fortuna

    copying lib/Crypto/SelfTest/Random/Fortuna/test_FortunaAccumulator.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random/Fortuna

    copying lib/Crypto/SelfTest/Random/Fortuna/test_SHAd256.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random/Fortuna

    copying lib/Crypto/SelfTest/Random/Fortuna/test_FortunaGenerator.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random/Fortuna

    copying lib/Crypto/SelfTest/Random/Fortuna/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random/Fortuna

    creating build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random/OSRNG

    copying lib/Crypto/SelfTest/Random/OSRNG/test_posix.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random/OSRNG

    copying lib/Crypto/SelfTest/Random/OSRNG/test_nt.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random/OSRNG

    copying lib/Crypto/SelfTest/Random/OSRNG/test_generic.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random/OSRNG

    copying lib/Crypto/SelfTest/Random/OSRNG/test_fallback.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random/OSRNG

    copying lib/Crypto/SelfTest/Random/OSRNG/test_winrandom.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random/OSRNG

    copying lib/Crypto/SelfTest/Random/OSRNG/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Random/OSRNG

    creating build/lib.linux-x86_64-2.6/Crypto/SelfTest/Util

    copying lib/Crypto/SelfTest/Util/test_Counter.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Util

    copying lib/Crypto/SelfTest/Util/test_asn1.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Util

    copying lib/Crypto/SelfTest/Util/test_number.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Util

    copying lib/Crypto/SelfTest/Util/test_winrandom.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Util

    copying lib/Crypto/SelfTest/Util/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/SelfTest/Util

    creating build/lib.linux-x86_64-2.6/Crypto/Protocol

    copying lib/Crypto/Protocol/Chaffing.py -> build/lib.linux-x86_64-2.6/Crypto/Protocol

    copying lib/Crypto/Protocol/AllOrNothing.py -> build/lib.linux-x86_64-2.6/Crypto/Protocol

    copying lib/Crypto/Protocol/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/Protocol

    creating build/lib.linux-x86_64-2.6/Crypto/PublicKey

    copying lib/Crypto/PublicKey/RSA.py -> build/lib.linux-x86_64-2.6/Crypto/PublicKey

    copying lib/Crypto/PublicKey/DSA.py -> build/lib.linux-x86_64-2.6/Crypto/PublicKey

    copying lib/Crypto/PublicKey/_slowmath.py -> build/lib.linux-x86_64-2.6/Crypto/PublicKey

    copying lib/Crypto/PublicKey/_DSA.py -> build/lib.linux-x86_64-2.6/Crypto/PublicKey

    copying lib/Crypto/PublicKey/qNEW.py -> build/lib.linux-x86_64-2.6/Crypto/PublicKey

    copying lib/Crypto/PublicKey/ElGamal.py -> build/lib.linux-x86_64-2.6/Crypto/PublicKey

    copying lib/Crypto/PublicKey/pubkey.py -> build/lib.linux-x86_64-2.6/Crypto/PublicKey

    copying lib/Crypto/PublicKey/_RSA.py -> build/lib.linux-x86_64-2.6/Crypto/PublicKey

    copying lib/Crypto/PublicKey/__init__.py -> build/lib.linux-x86_64-2.6/Crypto/PublicKey

    running build_ext

    warning: GMP library not found; Not building Crypto.PublicKey._fastmath.

    building 'Crypto.Hash.MD2' extension

    creating build/temp.linux-x86_64-2.6

    creating build/temp.linux-x86_64-2.6/src

    gcc -pthread -fno-strict-aliasing -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.6 -c src/MD2.c -o build/temp.linux-x86_64-2.6/src/MD2.o

    src/MD2.c:31:20: error: Python.h: No such file or directory

    src/MD2.c:118: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

    In file included from src/MD2.c:134:

    src/hash_template.c:42: error: expected specifier-qualifier-list before ‘PyObject_HEAD’

    src/hash_template.c:46: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyTypeObject’

    src/hash_template.c: In function ‘newALGobject’:

    src/hash_template.c:55: warning: implicit declaration of function ‘PyObject_New’

    src/hash_template.c:55: error: expected expression before ‘ALGobject’

    src/hash_template.c: At top level:

    src/hash_template.c:62: error: expected ‘)’ before ‘*’ token

    src/hash_template.c:77: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

    src/hash_template.c:96: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

    src/hash_template.c:108: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

    src/hash_template.c:143: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

    src/hash_template.c:160: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ALG_methods’

    src/hash_template.c:169: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

    src/hash_template.c:178: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ALGtype’

    src/hash_template.c:203: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

    src/hash_template.c:237: error: array type has incomplete element type

    src/hash_template.c:238: error: ‘PyCFunction’ undeclared here (not in a function)

    src/hash_template.c:238: error: expected ‘}’ before ‘ALG_new’

    src/hash_template.c: In function ‘initMD2’:

    src/hash_template.c:254: error: ‘PyObject’ undeclared (first use in this function)

    src/hash_template.c:254: error: (Each undeclared identifier is reported only once

    src/hash_template.c:254: error: for each function it appears in.)

    src/hash_template.c:254: error: ‘m’ undeclared (first use in this function)

    src/hash_template.c:256: error: ‘ALGtype’ undeclared (first use in this function)

    src/hash_template.c:256: error: ‘PyType_Type’ undeclared (first use in this function)

    src/hash_template.c:257: warning: implicit declaration of function ‘Py_InitModule’

    src/hash_template.c:260: error: ‘o’ undeclared (first use in this function)

    src/hash_template.c:260: warning: implicit declaration of function ‘PyInt_FromLong’

    src/hash_template.c:260: warning: implicit declaration of function ‘PyDict_SetItemString’

    src/hash_template.c:260: warning: implicit declaration of function ‘PyModule_GetDict’

    src/hash_template.c:260: warning: implicit declaration of function ‘Py_DECREF’

    src/hash_template.c:263: warning: implicit declaration of function ‘PyErr_Occurred’

    src/hash_template.c:264: warning: implicit declaration of function ‘Py_FatalError’

    error: command 'gcc' failed with exit status 1

    

    ----------------------------------------

Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-gAKZrz/pycrypto-on-pypi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-70mved-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-gAKZrz/pycrypto-on-pypi

解決辦法

yum install python-devel


錯誤

/usr/bin/nova-novncproxy 啓動失敗

調試

/usr/bin/nova-novncproxy --debug Traceback (most recent call last):

報錯

-bash: syntax error near unexpected token `('

[root@openstack images]# /usr/bin/nova-novncproxy --debug

/usr/lib/python2.6/site-packages/stevedore/extension.py:177: DeprecationWarning: Parameters to load are deprecated.  Call .resolve and .require separately.

  plugin = ep.load(require=verify_requirements)

Traceback (most recent call last):

  File "/usr/bin/nova-novncproxy", line 10, in <module>

    sys.exit(main())

  File "/usr/lib/python2.6/site-packages/nova/cmd/novncproxy.py", line 87, in main

    wrap_cmd=None)

  File "/usr/lib/python2.6/site-packages/nova/console/websocketproxy.py", line 47, in __init__

    ssl_target=None, *args, **kwargs)

  File "/usr/lib/python2.6/site-packages/websockify/websocketproxy.py", line 231, in __init__

    websocket.WebSocketServer.__init__(self, RequestHandlerClass, *args, **kwargs)

TypeError: __init__() got an unexpected keyword argument 'no_parent'

解決辦法

pip install websockify==0.5.1



(2).創建Glance數據庫:  

[root@openstack ~]# openstack-db --init --service glance

(3).修改配置文件中的數據庫鏈接:


 

[root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf DEFAULT sql_connection mysql://glance:glance@localhost/glance  

[root@openstack ~]# openstack-config --set /etc/glance/glance-registry.conf DEFAULT sql_connection mysql://glance:glance@localhost/glance


6.2.創建User,定義Services 和 API Endpoints  (1).爲Glance服務創建一個glance用戶:  [root@openstack ~]# keystone user-create --name=glance --pass=service 

[email protected]


[root@openstack ~]# keystone user-role-add --user=glance --tenant=service --role=admin


(2).爲glance創建一個服務:  

[root@openstack ~]# keystone service-create --name=glance --type=image --description="Glance ImageService"


(3).使用服務ID創建一個endpoint:  

[root@openstack ~]# vi /root/config/glance.sh 

#!/bin/bash  

my_ip=192.168.1.220  

service=$(keystone service-list | awk '/glance/ {print :$2}')  

keystone endpoint-create --service-id=$service --publicurl=http://$my_ip:9292 --internalurl=http://$my_ip:9292 --adminurl=http://$my_ip:9292


[root@mg ~]# sh /root/config/glance.sh  

WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).  

+-------------+----------------------------------+  

|   Property  |              Value               | +-------------+----------------------------------+  

|   adminurl  |     http://192.168.1.220:9292      | 

|      id     | fe281515d406407bbcd4887cb5815de4 | 

| internalurl |     http://192.168.1.220:9292      | 

|  publicurl  |     http://192.168.1.220:9292      | 

|    region   |            regionOne             | 

|  service_id | 7c0102f0e715479e9292c0581d214de2 |




6.3.配置Glance服務    

(1).將keystone認證信息添加到glance配置文件中:  

[root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_host 127.0.0.1  

[root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_port 35357  

[root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_protocol http  

[root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_tenant_name service  

[root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_user glance  

[root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_password service


[root@openstack ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_host 127.0.0.1  

[root@openstack ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_port 35357  

[root@openstack ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_protocol http  

[root@openstack ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_tenant_name service  

[root@openstack ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_user glance  

[root@openstack ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_password service


(2).修改ini文件路徑,將keystone認證信息添加到ini文件中:

[root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf paste_deploy config_file /etc/glance/glance-api-paste.ini  

[root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone  

[root@openstack ~]# openstack-config --set /etc/glance/glance-registry.conf paste_deploy config_file /etc/glance/glance-registry-paste.ini  

[root@openstack ~]# openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone    



[root@openstack ~]# cp /usr/share/glance/glance-api-dist-paste.ini /etc/glance/glance-api-paste.ini  

[root@openstack ~]# cp /usr/share/glance/glance-registry-dist-paste.ini /etc/glance/glance-registry-paste.ini  

[root@openstack ~]# chown -R root:glance /etc/glance/glance-api-paste.ini  

[root@openstack ~]# chown -R root:glance /etc/glance/glance-registry-paste.ini


[root@openstack ~]# openstack-config --set /etc/glance/glance-api-paste.ini filter:authtoken auth_host 127.0.0.1  

[root@openstack ~]# openstack-config --set /etc/glance/glance-api-paste.ini filter:authtoken admin_tenant_name service  

[root@openstack ~]# openstack-config --set /etc/glance/glance-api-paste.ini filter:authtoken admin_user glance  

[root@openstack ~]# openstack-config --set /etc/glance/glance-api-paste.ini filter:authtoken admin_password service  

[root@openstack ~]# openstack-config --set /etc/glance/glance-registry-paste.ini filter:authtoken auth_host 127.0.0.1  

[root@openstack ~]# openstack-config --set /etc/glance/glance-registry-paste.ini filter:authtoken admin_tenant_name service  

[root@openstack ~]# openstack-config --set /etc/glance/glance-registry-paste.ini filter:authtoken admin_user glance  

[root@openstack ~]# openstack-config --set /etc/glance/glance-registry-paste.ini filter:authtoken admin_password service


(3).修改鏡像文件的存放路徑(默認存放在/var/lib/glance目錄下,若不需修改,此步驟可省略)


[root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf DEFAULT filesystem_store_datadir /openstack/lib/glance/images/  

[root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf DEFAULT scrubber_datadir /openstack/lib/glance/scrubber  

[root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf DEFAULT image_cache_dir /openstack/lib/glance/image-cache/ 

[root@openstack ~]# mkdir -p /openstack/lib  [root@openstack ~]# cp -r /var/lib/glance/ /openstack/lib/


[root@openstack ~]# chown -R glance:glance /openstack/lib/glance


(4).啓動glance服務,設置開機自啓動  

[root@openstack ~]# service openstack-glance-api restart 

[root@openstack ~]# service openstack-glance-registry start 

[root@openstack ~]# chkconfig openstack-glance-api on 

[root@openstack ~]# chkconfig openstack-glance-registry on



6.4.Glance測試

(1).上傳鏡像  

[root@openstack ~]# glance image-create --name=centos6.4 --disk-format=qcow2 --container-format=ovf --is-public=true < /root/centos6.4-mini_x64.qcow2  

注意:(以下框住的描述可忽略)驗證鏡像服務的安裝


(Verify the Image Service installation)  爲了測試鏡像服務的安裝,至少下載一個虛擬機鏡像,這個鏡像一定要能夠與OpenStack一起工作。

例如,CirrOS是一個很小的測試鏡像,它經常用於測試OpenStack部署。這個過程,使用了64-bit的CirrOS QCOW2鏡像。  

有關更多如何下載和創建鏡像的信息,請參考“OpenStack Virtual Machine Image Guide”,有關如何管理鏡像的信息,請參考“OpenStack User Guide”. 

1.用wget或curl下載該鏡像到指定的目錄 

2.$ mkdir images 

3.$ cd images/  

4.$ wget http://cdn.download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64- disk.img


2. 上傳該鏡像到該鏡像服務中  

# glance image-create --name=imageLabel --disk-format=fileFormat \ --container-format=containerFormat --is-public=accessValue < imageFile 

參數說明:  imageLabel   任意的標誌,該名稱由用戶指向鏡像。  

fileFormat      說明鏡像文件格式,有效的文件格式包括:qcow2,raw,vhd,vmdk,vdi,iso,aki,ari,and ami等等。 

containerFormat   指定的容器格式,有效的格式包括:bare,ovf,aki,ari and ami。  

指定bare格式表明鏡像文件不在文件格式裏,也就是說包含有關虛擬機的元數據。雖然目前這個字段是必須的,但實際上任何其它的OpenStack服務不使用它,而且在系統運行時也沒有效果。因爲該值在任何地方都沒有用到,爲了安全,一直指定bare作爲容器的格式。  accessValue    指定鏡像是否能訪問。                                

true --所有的用戶都能夠查看和使用該鏡像。                               

false --只有管理員才能夠查看和使用該鏡像 

imageFile            指定你下載的鏡像文件名稱

注:上傳出錯:  Request returned failure status. HTTPInternalServerError (HTTP 500)  

後來查看debug,是我在配置/etc/glance/glanceregistry.conf文件時把: 

[paste_deploy] ...  flavor = keystone  中的keystone錯寫成了glance 更改後,再上傳,就對了,結果如下:

[root@openstack images]# glance image-create --name=xin64 --disk-format=qcow2 --container-format=ovf --is-public=true </opt/cirros-0.3.4-x86_64-disk.img 

+------------------+--------------------------------------+

| Property         | Value                                |

+------------------+--------------------------------------+

| checksum         | ee1eca47dc88f4879d8a229cc70a07c6     |

| container_format | ovf                                  |

| created_at       | 2016-10-26T07:43:51                  |

| deleted          | False                                |

| deleted_at       | None                                 |

| disk_format      | qcow2                                |

| id               | 78c88956-97e7-4aa7-af5f-9da64cd04757 |

| is_public        | True                                 |

| min_disk         | 0                                    |

| min_ram          | 0                                    |

| name             | xin64                                |

| owner            | db88dbf89a044ed0a9edfea76eede2c3     |

| protected        | False                                |

| size             | 13287936                             |

| status           | active                               |

| updated_at       | 2016-10-26T07:43:51                  |

| virtual_size     | None                                 |

查看

[root@openstack images]# glance image-list

+--------------------------------------+-------+-------------+------------------+----------+--------+

| ID                                   | Name  | Disk Format | Container Format | Size     | Status |

+--------------------------------------+-------+-------------+------------------+----------+--------+

| 05f2a782-efe8-4658-8ad3-0e71d9c6b0b7 | min64 | qcow2       | ovf              | 13287936 | active |

| 78c88956-97e7-4aa7-af5f-9da64cd04757 | xin64 | qcow2       | ovf              | 13287936 | active |

+--------------------------------------+-------+-------------+------------------+----------+--------+


7.安裝配置Nova

7.1.初始化Nova  

(1).安裝nova:  

[root@openstack ~]# yum -y install openstack-nova

 

(2).創建nova數據庫: 

 [root@openstack ~]# openstack-db --init --service nova

7.2.創建User,定義Services 和 API Endpoints  

(1).編寫腳本:  

[root@openstack ~]# vi /root/config/nova-user.sh 

#!/bin/sh  

my_ip=192.168.1.2  

keystone user-create --name=nova --pass=service [email protected] 

keystone user-role-add --user=nova --tenant=service --role=admin  

keystone service-create --name=nova --type=compute --description="Nova Compute Service"  service=$(keystone service-list | awk '/nova/ {print $2}') 

keystone endpoint-create --service-id=$service --publicurl=http://$my_ip:8774/v2/%\(tenant_id\)s --internalurl=http://$my_ip:8774/v2/%\(tenant_id\)s --adminurl=http://$my_ip:8774/v2/%\(tenant_id\)s

 

(2).運行腳本,創建用戶、服務及api endpoint: 

[root@openstack ~]# sh /root/config/nova-user.sh

 

7.3.配置nova服務:

修改/etc/nova.conf配置文件:  

[root@openstack ~]# vi /etc/nova/nova.conf 

[DEFAULT]  

my_ip = 192.168.1.220  

auth_strategy = keystone  

state_path = /openstack/lib/nova 

verbose=True    

allow_resize_to_same_host = true  

rpc_backend = nova.openstack.common.rpc.impl_qpid 

qpid_hostname = 192.168.1.2 

libvirt_type = kvm  

glance_api_servers = 192.168.1.2:9292    

novncproxy_base_url = http://192.168.1.2:6080/vnc_auto.html 

vncserver_listen = $my_ip  

vncserver_proxyclient_address = $my_ip 

vnc_enabled = true 

vnc_keymap = en-us    

network_manager = nova.network.manager.FlatDHCPManager


 

firewall_driver = nova.virt.firewall.NoopFirewallDriver 

multi_host = True flat_interface = eth1 #單塊網卡只需要統一使用eth0即可

flat_network_bridge = br1 

public_interface = eth0    

instance_usage_audit = True  

instance_usage_audit_period = hour  

notify_on_state_change = vm_and_task_state  

notification_driver = nova.openstack.common.notifier.rpc_notifier   compute_scheduler_driver=nova.scheduler.simple.SimpleScheduler 

[hyperv] 

[zookeeper] 

[osapi_v3] 

[conductor] 

[keymgr] 

[cells]  

[database]  

[image_file_url] 

[baremetal] 

[rpc_notifier2]  

[matchmaker_redis] 

[ssl]  

[trusted_computing] 

[upgrade_levels] 

[matchmaker_ring] 

[vmware] 

[spice]  

[keystone_authtoken] 

auth_host = 127.0.0.1 

auth_port = 35357 

auth_protocol = http 

admin_user = nova  

admin_tenant_name = service 

admin_password = service


因上述配置文件中修改了instances實例存放的位置,還需要作一下操作: 

修改instances路徑,設置目錄權限:  

[root@openstack ~]# cp -r /var/lib/nova/ /openstack/lib/  

[root@openstack ~]# chown -R nova:nova /openstack/lib/nova/


(2).配置libvirtd服務,刪除virbr0 啓動libvirt服務: 

[root@openstack ~]# service libvirtd start 

查看net-list,發現default:

[root@openstack ~]# virsh net-list  

Name                 State      Autostart     Persistent -------------------------------------------------- 

 default              active     yes           yes 

刪除default,即virbr0:  

[root@openstack ~]# virsh net-destroy default 

Network default destroyed  

[root@openstack ~]# virsh net-undefine default 

Network default has been undefined 

重啓libvirtd服務,設置開機自啓動: 

 [root@openstack ~]# service libvirtd restart

 [root@openstack ~]# chkconfig libvirtd on

(3).啓動nova相關服務,設置開機自啓動  

[root@openstack ~]# service messagebus start 

[root@openstack ~]# chkconfig messagebus on 啓動nova服務,採用network網絡服務:  [root@openstack ~]# service openstack-nova-api start 

[root@openstack ~]# service openstack-nova-cert start  

[root@openstack ~]# service openstack-nova-consoleauth start 

[root@openstack ~]# service openstack-nova-scheduler start 

[root@openstack ~]# service openstack-nova-conductor start 

[root@openstack ~]# service openstack-nova-novncproxy start 

[root@openstack ~]# service openstack-nova-compute start 

[root@openstack ~]# service openstack-nova-network start 

[root@openstack ~]# chkconfig openstack-nova-api on 

[root@openstack ~]# chkconfig openstack-nova-cert on  

[root@openstack ~]# chkconfig openstack-nova-consoleauth on 

[root@openstack ~]# chkconfig openstack-nova-scheduler on 

[root@openstack ~]# chkconfig openstack-nova-conductor on 

[root@openstack ~]# chkconfig openstack-nova-novncproxy on 

[root@openstack ~]# chkconfig openstack-nova-compute on 

[root@openstack ~]# chkconfig openstack-nova-network on


7.4.nova測試:    

(1).創建網絡:  

[root@openstack ~]# nova network-create vmnet --fixed-range-v4=10.1.1.0/24 --bridge-interface=br1 --multi-host=T 

 

[root@openstack ~]#nova network-list

 

(2).設置安全組:  

[root@openstack ~]# nova secgroup-add-rule default tcp 22 22 0.0.0.0/0

 

[root@openstack ~]# nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0

 

 

 

 

(3).創建虛擬機實例: 查看可用鏡像: 

 [root@openstack ~]# nova image-list

 

創建虛擬機實例: 

 [root@openstack ~]# nova boot --flavor 1 --image centos6.4 vm01

指定網卡設置不同網段

[root@openstack ~]# nova boot --flavor 1 --image centos6.4 vm01 –nic net-id <nove net-list id>

Flavor 爲虛擬機模式

Centos6.4 爲image名字 vm01爲web頁面顯示的虛擬機名字 

--nic net-id 爲設置特定網段


 

查看虛擬機實例運行狀態: 

[root@openstack ~]# nova list

測試虛擬機實例連通性:  

[root@openstack ~]# ping 10.1.1.2  

PING 10.1.1.2 (10.1.1.2) 

56(84) bytes of data.  64 bytes from 10.1.1.2: icmp_seq=1 ttl=64 time=0.057 ms 

64 bytes from 10.1.1.2: icmp_seq=2 ttl=64 time=0.037 ms --- 10.1.1.2 ping statistics ---  2 packets transmitted, 2 received, 0% packet loss, time 1639ms rtt min/avg/max/mdev = 0.037/0.047/0.057/0.010 ms





8.安裝配置Horizon  (

1).安裝Horizon 

 [root@openstack ~]# yum -y install openstack-dashboard    

(2).修改local_settings文件,將DEBUG = False修改爲DEBUG = True 

[root@openstack ~]# vi /etc/openstack-dashboard/local_settings 

DEBUG = True 

……    

(3).修改httpd.conf文件,將#ServerName www.example.com:80修改爲ServerName 192.168.1.2:80  

[root@openstack ~]# vi /etc/httpd/conf/httpd.conf 

#ServerName www.example.com:80 

ServerName 192.168.1.2:80    

(4).修改local_settings.py文件,將"Member"修改爲"admin" 

[root@openstack 

keystone]# vi  /usr/share/openstack-dashboard/openstack_dashboard/local/local_settings.py  #OPENSTACK_KEYSTONE_DEFAULT_ROLE = "Member" 

OPENSTACK_KEYSTONE_DEFAULT_ROLE = "admin"

(5).啓動http服務,設置開機自啓動 

[root@openstack ~]# service httpd start

 [root@openstack ~]# chkconfig httpd on


(6).重啓nova-api服務  

[root@openstack ~]# service openstack-nova-api restart    

(7).添加防火牆策略 

 [root@openstack ~]# iptables -I INPUT -p tcp --dport 80 -j ACCEPT  

[root@openstack ~]# iptables -I INPUT -p tcp -m multiport --dports 5900:6000 -j ACCEPT [root@openstack ~]# iptables -I INPUT -p tcp --dport 6080 -j ACCEPT 

[root@openstack ~]# service iptables save    

Horizon安裝完成,使用http://192.168.1.2/dashboard訪問openstack web界面。 用戶名:admin 密碼:password



wKioL1h62Y_yrXw9AAAO1cO6B5k676.png-wh_50

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章