CentOS 6.4 minimalインストール後の作業
# yum -y update
# vi /etc/selinux/config SELINUX=enforcing => SELINUX=disabled
# service iptables stop # chkconfig iptables off
# yum -y groupinstall "X Window System" "Desktop" "General Purpose Desktop" "Japanese Support" ランレベルを変更 # sed -i "s/id:3:initdefault:/id:5:initdefault:/g" /etc/inittab
# useradd stack # passwd password
# rpm -ivh http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm # cd /etc/yum.repos.d/ # vi openstack-grizzly.repo [epel-openstack-grizzly] name=OpenStack Grizzly Repository for EPEL 6 baseurl=http://repos.fedorapeople.org/repos/openstack/openstack-grizzly/epel-$releasever/ enabled=1 skip_if_unavailable=1 gpgcheck=0
念のためUPDATE
# yum update -y
# yum install -y mysql-server memcached
# service mysqld start
# chkconfig mysqld on
# mysql -uroot -e "set password for root@localhost=password('nova');"
# mysql -uroot -pnova -e "set password for [email protected]=password('nova');"
# mysql -uroot -pnova -e "set password for root@ostack01=password('nova');"
# service memcached start # chkconfig memcached on
# yum install qpid-cpp-server -y # sed -i 's/auth=yes/auth=no/' /etc/qpidd.conf # service qpidd restart # chkconfig qpidd on
# yum install -y iscsi-initiator-utils qemu-kvm libvirt bridge-utils libvirt-python avahi # service messagebus restart # service avahi-daemon restart # service libvirtd restart
# yum install -y openstack-keystone
# cp -a /etc/keystone /etc/keystone_bak
# diff /etc/keystone/keystone.conf /etc/keystone_bak/keystone.conf 4c4< admin_token = ADMIN ---> # admin_token = ADMIN 7c7< bind_host = 0.0.0.0 ---> # bind_host = 0.0.0.0 10c10< public_port = 5000 ---> # public_port = 5000 13c13< admin_port = 35357 ---> # admin_port = 35357 21c21< compute_port = 8774 ---> # compute_port = 8774 24c24< policy_file = policy.json ---> # policy_file = policy.json 42d41< debug = True 46d44< verbose = True 82c80< connection = mysql://keystone:password@ostack01/keystone?charset=utf8 ---> # connection = sqlite:///keystone.db 85c83< idle_timeout = 200 ---> # idle_timeout = 200 138d135< token_format = UUID 227,230c224,225< #password = keystone.auth.plugins.password.Password < #token = keystone.auth.plugins.token.Token < password = keystone.auth.methods.password.Password < token = keystone.auth.methods.token.Token ---> password = keystone.auth.plugins.password.Password > token = keystone.auth.plugins.token.Token
# MYSQL_PASS_KEYSTONE=password # NOVA_CONTOLLER_HOSTNAME=ostack01 # mysql -uroot -pnova -e "drop database if exists keystone;" # mysql -uroot -pnova -e "create database keystone character set utf8;" # mysql -uroot -pnova -e "grant all privileges on keystone.* to 'keystone'@'%' identified by '$MYSQL_PASS_KEYSTONE';" # mysql -uroot -pnova -e "grant all privileges on keystone.* to 'keystone'@'localhost' identified by '$MYSQL_PASS_KEYSTONE';" # mysql -uroot -pnova -e "grant all privileges on keystone.* to 'keystone'@'$NOVA_CONTOLLER_HOSTNAME' identified by '$MYSQL_PASS_KEYSTONE';" # keystone-manage db_sync
# chown keystone:keystone /var/log/keystone -R # service openstack-keystone restart # chkconfig openstack-keystone on # service openstack-keystone status
KeystoneにOpenStackで利用するサービス、サービスに対するユーザ、ロールの設定を行う。 ここではサンプルのシェルを利用して作成する。 実際には環境にあった設定を利用したシェルの作成などが必要。 Quantum、Heatを利用する際にはコマンドで追加する手順を記述する。 Swiftの設定がそのままだと入るのでHorizonのメニューで出力されてしまう。 サンプルを利用するがサンプルへ最低限の設定を行う。 サンプルシェルを利用するための環境変数を先に設定する。
# cd /usr/local/src ; cp -a /usr/share/openstack-keystone/sample_data.sh . # export CONTROLLER_HOST=ostack01 # export SERVICE_ENDPOINT=http://$CONTROLLER_HOST:35357/v2.0 # sed -i "s/localhost/$CONTROLLER_HOST/" /usr/local/src/sample_data.sh # export ENABLE_ENDPOINTS=yes # /usr/local/src/sample_data.sh
# export OS_SERVICE_TOKEN=ADMIN # export OS_SERVICE_ENDPOINT=http://ostack01:35357/v2.0/
# keystone tenant-list # keystone user-list # keystone role-list # keystone service-list # keystone endpoint-list
Glanceは仮想マシンのイメージの管理を行うコンポーネント。 仮想マシンの起動イメージをどのバックエンドストレージに配置するか、そして設定したバックエンドストレージのダウンロード、アップロード、削除などを行う。 バックエンドストレージはローカルディスク、S3、Swiftが利用可能。 また、GlusterFSと組み合わせても高可用性を実現出来る。 ここでは、ローカルディスクを利用する。
# yum install -y openstack-glance
元のディレクトリをバックアップ。
# cp -a /etc/glance /etc/glance_back
# sql_connection = mysql://glance:password@node01/glance?charset=utf8
[filter:authtoken] の項目を変更
# admin_tenant_name = service # admin_user = glance # admin_password = glance
[paste_deploy] の項目にkeystoneの設定を追加。
flavor = keystone
ホスト名を変更
# sed -i "s#127.0.0.1#node01#" /etc/glance/glance-api.conf # sed -i "s#localhost#node01#" /etc/glance/glance-api.conf # sed -i "s#127.0.0.1#node01#" /etc/glance/glance-registry.conf # sed -i "s#localhost#node01#" /etc/glance/glance-registry.conf
# MYSQL_PASS_GLANCE=password # NOVA_CONTOLLER_HOSTNAME=ostack01 # mysql -u root -pnova -e "drop database if exists glance;" # mysql -u root -pnova -e "create database glance character set utf8;" # mysql -u root -pnova -e "grant all privileges on glance.* to 'glance'@'%' identified by '$MYSQL_PASS_GLANCE';" # mysql -u root -pnova -e "grant all privileges on glance.* to 'glance'@'localhost' identified by '$MYSQL_PASS_GLANCE';" # mysql -u root -pnova -e "grant all privileges on glance.* to 'glance'@'$NOVA_CONTOLLER_HOSTNAME' identified by '$MYSQL_PASS_GLANCE';" # glance-manage db_sync
# chown glance:glance /var/log/glance -R
# service openstack-glance-api restart # service openstack-glance-registry restart # chkconfig openstack-glance-api on # chkconfig openstack-glance-registry on
独自イメージの作成方法及びoz-installを利用するものについては別途記述する。ここでは予め作成されているfedora16を登録する。
# export OS_USERNAME=admin # export OS_PASSWORD=secrete # export OS_TENANT_NAME=demo # export OS_AUTH_URL=http://node01:35357/v2.0/イメージの置き場所は/opt/virt とする
# mkdir -p /opt/virt/fedora17 ; cd /opt/virt/fedora17 # curl -O http://berrange.fedorapeople.org/images/2012-11-15/f17-x86_64-openstack-sda.qcow2
# glance image-create --name="f17-jeos" --is-public=true --disk-format=qcow2 --container-format=ovf < f17-x86_64-openstack-sda.qcow2
# glance image-list +--------------------------------------+----------+-------------+------------------+-----------+--------+ | ID | Name | Disk Format | Container Format | Size | Status | +--------------------------------------+----------+-------------+------------------+-----------+--------+ | 7ea27a6e-83ff-47f9-a0ae-72a01c43740e | f17-jeos | qcow2 | ovf | 251985920 | active | +--------------------------------------+----------+-------------+------------------+-----------+--------+ # glance image-show 7ea27a6e-83ff-47f9-a0ae-72a01c43740e +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | 1f104b5667768964d5df8c4ad1d7cd27 | | container_format | ovf | | created_at | 2013-05-31T06:12:50 | | deleted | False | | disk_format | qcow2 | | id | 7ea27a6e-83ff-47f9-a0ae-72a01c43740e | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | f17-jeos | | owner | 8f80e31e75974629b11a7d29d1598765 | | protected | False | | size | 251985920 | | status | active | | updated_at | 2013-05-31T06:12:52 | +------------------+--------------------------------------+