一 配置token认证信息
[root@controller0 ~]# export OS_SERVICE_TOKEN=`echo $ADMIN_TOKEN`
[root@controller0 ~]# export OS_SERVICE_ENDPOINT=http://controller0:35357/v2.0
二 创建管理员和系统服务租户
[root@controller0 ~]# keystone tenant-create --name=admin --description="Admin Tenant"
+-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| description | Admin Tenant |
| enabled | True |
| id | 4e845b494bf74cbf89213bf552db8599 |
| name | admin |
+-------------+----------------------------------+
[root@controller0 ~]# keystone tenant-list
+----------------------------------+-------+---------+
| id | name | enabled |
+----------------------------------+-------+---------+
| 4e845b494bf74cbf89213bf552db8599 | admin | True |
+----------------------------------+-------+---------+
[root@controller0 ~]# keystone tenant-create --name=service --description="Service Tenant"
+-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| description | Service Tenant |
| enabled | True |
| id | 367a5bec707a459bb9ed5bdb9d076e44 |
| name | service |
+-------------+----------------------------------+
[root@controller0 ~]# keystone tenant-list
+----------------------------------+---------+---------+
| id | name | enabled |
+----------------------------------+---------+---------+
| 4e845b494bf74cbf89213bf552db8599 | admin | True |
| 367a5bec707a459bb9ed5bdb9d076e44 | service | True |
+----------------------------------+---------+---------+
三 创建管理员用户
[root@controller0 ~]# keystone user-create --name=admin --pass=admin --email=admin@example.com
+----------+----------------------------------+
| Property | Value |
+----------+----------------------------------+
| email | admin@example.com |
| enabled | True |
| id | 6efb8d6615b84cacb7cbdf0591a66bb7 |
| name | admin |
| username | admin |
+----------+----------------------------------+
[root@controller0 ~]# keystone user-list
+----------------------------------+-------+---------+-------------------+
| id | name | enabled | email |
+----------------------------------+-------+---------+-------------------+
| 6efb8d6615b84cacb7cbdf0591a66bb7 | admin | True | admin@example.com |
+----------------------------------+-------+---------+-------------------+
四 创建管理员角色
[root@controller0 ~]# keystone role-create --name=admin
+----------+----------------------------------+
| Property | Value |
+----------+----------------------------------+
| id | 56136419bd604aed82fbda5737e3af69 |
| name | admin |
+----------+----------------------------------+
[root@controller0 ~]# keystone role-list
+----------------------------------+----------+
| id | name |
+----------------------------------+----------+
| 9fe2ff9ee4384b1894a90878d3e92bab | _member_ |
| 56136419bd604aed82fbda5737e3af69 | admin |
+----------------------------------+----------+
五 为管理员分配管理员角色
[root@controller0 ~]# keystone user-role-add --user=admin --tenant=admin --role=admin
六 创建keystone服务
[root@controller0 ~]# keystone service-create --name=keystone --type=identity --description="Keystone Identity Service"
+-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| description | Keystone Identity Service |
| enabled | True |
| id | b8860e4213ef4b828e5c81b1b9e4d0bb |
| name | keystone |
| type | identity |
+-------------+----------------------------------+
[root@controller0 ~]# keystone service-list
+----------------------------------+----------+----------+---------------------------+
| id | name | type | description |
+----------------------------------+----------+----------+---------------------------+
| b8860e4213ef4b828e5c81b1b9e4d0bb | keystone | identity | Keystone Identity Service |
+----------------------------------+----------+----------+---------------------------+
七 为keystone建立service和endpoint关联
[root@controller0 ~]# keystone endpoint-create \
> --service-id=$(keystone service-list | awk '/ identity / {print $2}') \
> --publicurl=http://controller0:5000/v2.0 \
> --internalurl=http://controller0:5000/v2.0 \
> --adminurl=http://controller0:35357/v2.0
+-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| adminurl | http://controller0:35357/v2.0 |
| id | 08feef21842442cf9185e748d14d9214 |
| internalurl | http://controller0:5000/v2.0 |
| publicurl | http://controller0:5000/v2.0 |
| region | regionOne |
| service_id | b8860e4213ef4b828e5c81b1b9e4d0bb |
+-------------+----------------------------------+
八 验证keystone安装正确性
1 取消先前Token变量,不然会干扰新建用户的验证
[root@controller0 ~]# unset OS_SERVICE_TOKEN OS_SERVICE_ENDPOINT
2 先用命令行方式验证
[root@controller0 ~]# keystone --os-username=admin --os-password=admin --os-auth-url=http://controller0:35357/v2.0 token-get
+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Property | Value |
+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| expires | 2018-02-24T12:53:01Z |
| id | MIIC8QYJKoZIhvcNAQcCoIIC4jCCAt4CAQExCTAHBgUrDgMCGjCCAUcGCSqGSIb3DQEHAaCCATgEggE0eyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAiMjAxOC0wMi0yNFQxMTo1MzowMS41Mzc0MzIiLCAiZXhwaXJlcyI6ICIyMDE4LTAyLTI0VDEyOjUzOjAxWiIsICJpZCI6ICJwbGFjZWhvbGRlciJ9LCAic2VydmljZUNhdGFsb2ciOiBbXSwgInVzZXIiOiB7InVzZXJuYW1lIjogImFkbWluIiwgInJvbGVzX2xpbmtzIjogW10sICJpZCI6ICI2ZWZiOGQ2NjE1Yjg0Y2FjYjdjYmRmMDU5MWE2NmJiNyIsICJyb2xlcyI6IFtdLCAibmFtZSI6ICJhZG1pbiJ9LCAibWV0YWRhdGEiOiB7ImlzX2FkbWluIjogMCwgInJvbGVzIjogW119fX0xggGBMIIBfQIBATBcMFcxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVVbnNldDEOMAwGA1UEBwwFVW5zZXQxDjAMBgNVBAoMBVVuc2V0MRgwFgYDVQQDDA93d3cuZXhhbXBsZS5jb20CAQEwBwYFKw4DAhowDQYJKoZIhvcNAQEBBQAEggEAmmbeh4FMbrAlcUpIM+rhnYqz2lSIIdo0WK-CJwvh8LECBtUNUVll14H8FeLo3bKGZLbPAq3CXh4z6z1giVqQfAdSv-MxAAegpqQe0AS7zT0UHUZAqFh-kFzYtUB77V6JDHP+vw8yYw+KAfq2AzW+iRIJObeO9gKKRCd7uhFHbEJNmiM2sVvICidp43BE7glCNFVxUIUJ5Qg97IK3ngQvWBzTx-Q8mw2wo7RM8GbIOErN7QVpuBsCqkWr2XOoC3RK2qKD39whtmRsjDmkhcHNBrY4A+UJNIdZXpl-HeDOZbhYlNmBF4oLviIDNCg04ROrSJyVerLyzL46k54e0q-Cgg== |
| user_id | 6efb8d6615b84cacb7cbdf0591a66bb7 |
+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@controller0 ~]# keystone --os-username=admin --os-password=admin --os-tenant-name=admin --os-auth-url=http://controller0:35357/v2.0 token-get
/usr/lib64/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
_warn("Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Property | Value |
+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| expires | 2018-02-24T12:56:14Z |
| id | MIIEtQYJKoZIhvcNAQcCoIIEpjCCBKICAQExCTAHBgUrDgMCGjCCAwsGCSqGSIb3DQEHAaCCAvwEggL4eyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAiMjAxOC0wMi0yNFQxMTo1NjoxNC4yMzUxMjYiLCAiZXhwaXJlcyI6ICIyMDE4LTAyLTI0VDEyOjU2OjE0WiIsICJpZCI6ICJwbGFjZWhvbGRlciIsICJ0ZW5hbnQiOiB7ImRlc2NyaXB0aW9uIjogIkFkbWluIFRlbmFudCIsICJlbmFibGVkIjogdHJ1ZSwgImlkIjogIjRlODQ1YjQ5NGJmNzRjYmY4OTIxM2JmNTUyZGI4NTk5IiwgIm5hbWUiOiAiYWRtaW4ifX0sICJzZXJ2aWNlQ2F0YWxvZyI6IFt7ImVuZHBvaW50cyI6IFt7ImFkbWluVVJMIjogImh0dHA6Ly9jb250cm9sbGVyMDozNTM1Ny92Mi4wIiwgInJlZ2lvbiI6ICJyZWdpb25PbmUiLCAiaW50ZXJuYWxVUkwiOiAiaHR0cDovL2NvbnRyb2xsZXIwOjUwMDAvdjIuMCIsICJpZCI6ICI0NTc4YzFlOTVkN2I0YWU3YTY4NTQ5MjRkMDU0NmUwMSIsICJwdWJsaWNVUkwiOiAiaHR0cDovL2NvbnRyb2xsZXIwOjUwMDAvdjIuMCJ9XSwgImVuZHBvaW50c19saW5rcyI6IFtdLCAidHlwZSI6ICJpZGVudGl0eSIsICJuYW1lIjogImtleXN0b25lIn1dLCAidXNlciI6IHsidXNlcm5hbWUiOiAiYWRtaW4iLCAicm9sZXNfbGlua3MiOiBbXSwgImlkIjogIjZlZmI4ZDY2MTViODRjYWNiN2NiZGYwNTkxYTY2YmI3IiwgInJvbGVzIjogW3sibmFtZSI6ICJhZG1pbiJ9XSwgIm5hbWUiOiAiYWRtaW4ifSwgIm1ldGFkYXRhIjogeyJpc19hZG1pbiI6IDAsICJyb2xlcyI6IFsiNTYxMzY0MTliZDYwNGFlZDgyZmJkYTU3MzdlM2FmNjkiXX19fTGCAYEwggF9AgEBMFwwVzELMAkGA1UEBhMCVVMxDjAMBgNVBAgMBVVuc2V0MQ4wDAYDVQQHDAVVbnNldDEOMAwGA1UECgwFVW5zZXQxGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbQIBATAHBgUrDgMCGjANBgkqhkiG9w0BAQEFAASCAQB-3s0VE6EL4uS-4iWLwbdL5gz2PjlWXoHO0IaWOowsKPQj8wL8n-mjjFAqI-v2kgduPd-mDAwbIJQTfD67weGrTe4qYmOc4ryLVDoQiuYz3GdQeyO5KnVm+XFTP4+6DTM8Wbbb+IQUmzG4A6NMquE4+dONayMQQk+-C2WoydxKF9xJz4xHliuB5ubl1GiyKNOQOBUb-SySGBGR3eOWnWvZZ3zhQJYQsyRn7neeCbuObZc-wr3s-K7HEiTM+WVjfSw7zGTCpVg3l4K1dF37vsy5WiSGHmROxDnKH1LTT1hK44xp9sguqbyzA1BgB3p7rxU+bwr1SqWtiSWUV7UwjQr8 |
| tenant_id | 4e845b494bf74cbf89213bf552db8599 |
| user_id | 6efb8d6615b84cacb7cbdf0591a66bb7 |
+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
九 用设置环境变量认证,保存认证信息
[root@controller0 ~]# cat ~/keystonerc
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://controller0:35357/v2.0
[root@controller0 ~]# source keystonerc
[root@controller0 ~]# keystone token-get
/usr/lib64/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
_warn("Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Property | Value |
+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| expires | 2018-02-24T13:02:00Z |
| id | MIIEtQYJKoZIhvcNAQcCoIIEpjCCBKICAQExCTAHBgUrDgMCGjCCAwsGCSqGSIb3DQEHAaCCAvwEggL4eyJhY2Nlc3MiOiB7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AVVbnNldDEOMAwGA1UECgwFVW5zZXQxGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbQIBATAHBgUrDgMCGjANBgkqhkiG9w0BAQEFAASCAQAR67TwJv797m490hLT0fxY-jg6Z6CMRBRZM3xn8X7vz7oF43b36jiV52fv5F2Qj90m0zFvDtPw0vwMrsVNs3blBzJLKTf8ro73CA7ztiiHV-kzkKHrYMRfhaFfOsRpH4ER+LRKHN1VOZrL52YnDYMJyU8giUZLJY6A71fOwBvyj5WH5KizfFT8Mi9ILWCr5zZL19vOPdnYqHABYglAk+OpwPjVkIhN1u5NjlqVx7NoGuj9eqHEri6d-clHowUZpREskRWs4AbZJDiiQBmRQq9PTG6tmisMFXXauPF8+yaQi5tG3ES0W7aHnM1mWAqsjLPBIxYrqGwap6BjmSneyy02 |
| tenant_id | 4e845b494bf74cbf89213bf552db8599 |
| user_id | 6efb8d6615b84cacb7cbdf0591a66bb7 |
+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+