1. 安装并配置依赖环境
a).安装周边环境
yum install ntp
yum install qpid-cpp-server memcached
yum install mysql mysql-server MySQL-python
service mysqld start
chkconfig mysqld on
mysql_secure_installationb).配置mysql数据库
修改MySQL的密码:
mysql -urootupdate user set password=PASSWORD('111111') whereUser='root';
update user set host = '%' where user = 'root';
授权本地root用户拥有所有数据库的所有权限:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;2. 在controller节点上安装keystone组件
yum install openstack-utils
yum install openstack-keystone python-keystoneclient3.修改配置文件keystone.conf
openstack-config --set /etc/keystone/keystone.confsql connection mysql://keystone:111111@10.107.13.140/keystone
4.创建相应数据库和表
openstack-db--init --service keystone --password 111111
5.产生admin token
ADMIN_TOKEN=$(opensslrand -hex 10)
echo$ADMIN_TOKEN
openstack-config--set /etc/keystone/keystone.conf DEFAULT admin_token $ADMIN_TOKEN
6.创建签名和证书
keystone-managepki_setup --keystone-user keystone --keystone-group keystone
7.启动keystone
serviceopenstack-keystone start
chkconfigopenstack-keystone on
8.加入users和tenants
在~/.bashrc中加入:
export OS_SERVICE_TOKEN=$ADMIN_TOKEN(与/etc/keystone/keystone.conf中的admin_token一致)
exportOS_SERVICE_ENDPOINT=http://controller:35357/v2.0
keystone tenant-create --name=admin--description="Admin Tenant"
keystone tenant-create --name=service--description="Service Tenant"
keystone user-create --name=admin --pass=111111 --email=camu7s@163.com
keystone role-create --name=admin
keystone user-role-add --user=admin --tenant=admin --role=admin
9.定义服务和api端
keystone service-create --name=keystone--type=identity --description="Keystone IdentityService"
(下面黄线部分与生成的service-id一致)
keystone endpoint-create \
--service-id=575895199fb1436da95c3c3476e074f0 \
--publicurl=http://controller:5000/v2.0 \
--internalurl=http://controller:5000/v2.0 \
--adminurl=http://controller:35357/v2.0
10.验证keystone的安装unsetOS_SERVICE_TOKEN OS_SERVICE_ENDPOINT
用户授权验证:
keystone --os-username=admin --os-password=111111 --os-auth-url=http://controller:35357/v2.0token-get
租户授权验证:
keystone --os-username=admin --os-password=111111 --os-tenant-name=admin--os-auth-url=http://controller:35357/v2.0 token-get
在controller和compute节点的~/.bashrc中加入
export OS_USERNAME=admin
export OS_PASSWORD=111111 (前面设置的admin的密码)
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://controller:35357/v2.0
分别修改controller和compute的hosts,加入controller和compute1的信息
hostname(/etc/sysconfig/network)分别改为controller和compute1