根据官方文档,结合实际实现单台物理机安装openstack。这里并不是在单台物理机上建立虚机,在虚机里安装openstack,而是用物理机直接安装。
物理机操作系统:centos6.6
一. 网络准备。
本次安装采用的是双网卡的物理机:
eth0:10.0.0.11–controller作为管理端口,包括控制节点、计算节点和网络节点三部分的管理端口;
eth2:10.254.4.33–compute-04-02-33.local作为外网节点,用于连接外网
(实例间内部网络,由于是单台物理机在这里可以不用配置)
二. mysql数据库安装
# yum install mysql mysql-server MySQL-python
编辑/etc/my.conf
[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
character-set-server=utf8
myisam_sort_buffer_size = 8M
lower_case_table_names=1
bind-address = 10.0.0.11
#bind-address=10.254.4.33
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
由于在这里配置了10.0.0.11的网络地址,通过10.254.4.33ip访问数据库会失败,在openstack中所有数据访问都是通过10.0.0.11端口访问的
启动mysql,并设置为开机启动
# service mysqld start
# chkconfig mysqld on
三. openstack仓库建立
安装 yum-plugin-priorities 包
# yum install yum-plugin-priorities# yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
# yum install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# yum install openstack-utils
使用的yum仓库是默认配置的yum源,实际安装中网络yum源不完整,设置新的yum源,在/etc/yum.repos.d/文件夹下新建rpmforge.repo
设置:
http://apt.sw.be/redhat/el6/en/#ARCH/rpmforge
http://archive.cs.uu.nl/mirror/dag.wieers/redhat/el6/en/#ARCH/rpmforge
http://ftp2.lcpe.uni-sofia.bg/freshrpms/pub/dag/redhat/el6/en/#ARCH/rpmforge
#http://ftp.heanet.ie/pub/freshrpms/pub/dag/redhat/el6/en/#ARCH/rpmforge
http://ftp-stud.fht-esslingen.de/dag/redhat/el6/en/#ARCH/rpmforge
http://mirror.cpsc.ucalgary.ca/mirror/dag/redhat/el6/en/#ARCH/rpmforge
http://mirrors.ircam.fr/pub/dag/redhat/el6/en/#ARCH/rpmforge
http://rh-mirror.linux.iastate.edu/pub/dag/redhat/el6/en/#ARCH/rpmforge
http://rpmfind.net/linux/dag/redhat/el6/en/#ARCH/rpmforge
http://wftp.tu-chemnitz.de/pub/linux/dag/redhat/el6/en/#ARCH/rpmforge
http://www.mirrorservice.org/sites/apt.sw.be/redhat/el6/en/#ARCH/rpmforge
[root@compute-04-02-33 yum.repos.d]# cat rpmforge.repo
### Name: RPMforge RPM Repository for RHEL 6 - dag
### URL: http://rpmforge.net/
[rpmforge]
name = RHEL #releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el6/en/#basearch/rpmforge
mirrorlist = http://mirrorlist.repoforge.org/el6/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
设置好之后:
# yum upgrade
# reboot
四。消息队列设置
本次系统中使用的是Qpid
# yum install qpid-cpp-server
修改 /etc/qpidd.conf文件
auth=no
之后启动:
# service qpidd start
# chkconfig qpidd on
五. keystone安装
关于keystone的介绍这里就不介绍了,主要是安装过程。
安装keystone:
# yum install openstack-keystone python-keystoneclient
keystone的配置文件在/etc/keystone/keystone.conf,配置文件。
[DEFAULT]
admin_token=admin
public_bind_host=0.0.0.0
admin_bind_host=0.0.0.0
compute_port=8774
admin_port=35357
public_port=5000
public_endpoint=http://10.0.0.11:5000/v2.0
admin_endpoint=http://10.0.0.11:35357/v2.0
verbose=true
log_dir=/var/log/keystone
[database]
connection = mysql://keystone:123456@10.0.0.11:3306/keystone
[token]
provider=keystone.token.providers.uuid.Provider
driver=keystone.token.backends.sql.Token
设置好keystone.conf后,配置mysql数据库信息:
# mysql -u root -p
mysql> CREATE DATABASE keystone;
mysql> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \
IDENTIFIED BY '123456';
mysql> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \
IDENTIFIED BY '123456';
mysql> exit
设置好数据库后,把keystone的数据库表同步到mysql里:
# su -s /bin/sh -c "keystone-manage db_sync" keystone
创建公匙
# 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/keyston
创建租户,管理员用户和角色:
配置项:
# export OS_SERVICE_TOKEN=ADMIN_TOKEN
# export OS_SERVICE_ENDPOINT=http://controller:35357/v2.0
创建admin用户:
#keystone user-create --name=admin --pass=admin_pass --email=admin@domain.com
#keystone role-create --name=admin
#keystone tenant-create --name=admin --description="Admin Tenant"
#keystone user-role-add --user=admin --tenant=admin --role=admin