计算机新技术综合实践
29、 设置日期和时间,如果可以上网,勾选在网上同步日期和时间
二、OpenStack环境预配置
1、 设置OpenStack网络,一块NAT网卡,一块仅主机网卡
2、 同理创建另外两台虚拟机,一台计算节点,一台网络节点
计算机新技术综合实践
3、 配置虚拟机网络环境,如下表
服务器 网卡配置 eth0:10.6.12.130 管理节点(ControllerNode) eth1:192.168.1.130 计算节点(ComputeNode) eth0:10.6.12.131 eth1:192.168.1.131 eth0:10.6.12.132 eth1:192.168.1.132 eth2:(onboot=”yes”, bootproto=”none”) 主机名 controller compute1 网络节点(NetworkNode) network
三、OpenStack环境搭建
1、 安装部署控制节点
(1) 首先配置Linux能上网,可以ping通www.http://www.wodefanwen.com/ (2) 安装MySQL数据库
如下执行命令
# yum install ntp # service ntpd start # chkconfig ntpd on
# yum install mysql mysql-server MySQL-python
编辑 /etc/my.cnf 文件: # vi /etc/my.cnf
[mysqld] ...
bind-address = 10.6.12.130 #添加这句
[mysqld] ...
default-storage-engine = innodb #添加这句 innodb_file_per_table #添加这句
collation-server = utf8_general_ci #添加这句 init-connect = 'SET NAMES utf8' #添加这句 character-set-server = utf8 #添加这句 保存退出
# service mysqld start # chkconfig mysqld on # mysql_install_db
# mysql_secure_installation
计算机新技术综合实践
(3) 安装OpenStack软件源包
# yum install yum-plugin-priorities
# yum install http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/rdo-release-icehouse-3.noarch.rpm
# yum install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# yum install openstack-utils # yum install openstack-selinux # yum upgrade # reboot (4) 安装qpid
# yum install qpid-cpp-server
编辑/etc/qpidd.conf文件 # vi /etc/qpidd.conf auth=no #修改为no 保存退出
# service qpidd start # chkconfig qpidd on
(5) 安装keystone组件
# yum install openstack-keystone python-keystoneclient
# openstack-config --set /etc/keystone/keystone.conf database connection mysql://keystone:keystone@controller/keystone
$ mysql -u root -p
mysql> CREATE DATABASE keystone;
mysql> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'keystone';
mysql> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'keystone'; mysql> exit
# su -s /bin/sh -c \
# ADMIN_TOKEN=$(openssl rand -hex 10) # echo $ADMIN_TOKEN
# openstack-config --set /etc/keystone/keystone.conf DEFAULT admin_token $ADMIN_TOKEN
# keystone-manage pki_setup --keystone-user keystone --keystone-group keystone
# chown -R keystone:keystone /etc/keystone/ssl
计算机新技术综合实践
# chmod -R o-rwx /etc/keystone/ssl
# service openstack-keystone start # chkconfig openstack-keystone on
# (crontab -l -u keystone 2>&1 | grep -q token_flush) || echo '@hourly /usr/bin/keystone-manage token_flush >/var/log/keystone/keystone-tokenflush.log 2>&1' >> /var/spool/cron/keystone
编辑~/.bash_profile文件,在最后添加 export OS_USERNAME=admin export OS_PASSWORD=admin export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://controller:35357/v2.0
export ADMIN_TOKEN=223e5aa00e1401925a5d【注意此值与ADMIN_TOKEN值一样】 export SERVICE_TOKEN=$ADMIN_TOKEN
export SERVICE_ENDPOINT=http://controller:35357/v2.0 export OS_SERVICE_TOKEN=$ADMIN_TOKEN
export OS_SERVICE_ENDPOINT=http://controller:35357/v2.0
保存退出
#source ~/.bash_profile
$ keystone user-create --name=admin --pass=admin --email=admin@test.com $ keystone role-create --name=admin
$ keystone tenant-create --name=admin --description=\$ keystone user-role-add --user=admin --tenant=admin --role=admin $ keystone user-role-add --user=admin --role=_member_ --tenant=admin
$ keystone user-create --name=demo --pass=demo --email=demo@test.com $ keystone tenant-create --name=demo --description=\$ keystone user-role-add --user=demo --role=_member_ --tenant=demo
$ keystone tenant-create --name=service --description=\
$ keystone service-create --name=keystone --type=identity --description=\
$ keystone endpoint-create --service-id=$(keystone service-list | awk '/ identity / {print $2}') --publicurl=http://controller:5000/v2.0 --internalurl=http://controller:500key0/v2.0 --adminurl=http://controller:35357/v2.0
(6) 安装glance组件
# yum install openstack-glance python-glanceclient
# openstack-config --set /etc/glance/glance-api.conf database connection mysql://glance:glance@controller/glance
计算机新技术综合实践
# openstack-config --set /etc/glance/glance-registry.conf database connection mysql://glance:glance@controller/glance
$ mysql -u root -p
mysql> CREATE DATABASE glance;
mysql> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'glance';
mysql> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glance';
mysql> exit;
# openstack-db --init --service glance
# keystone user-create --name=glance --pass=glance --email=glance@test.com
# keystone user-role-add --user=glance --tenant=service --role=admin
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_uri http://controller:5000
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_host controller
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_port 35357
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_protocol http
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_tenant_name service
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_user glance
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_password glance
# openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_uri http://controller:5000
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_host controller
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_port 35357
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_protocol http
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_tenant_name service
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_user glance