2011年9月22日木曜日

CentOS 6.0 に CloudStack 2.2.9.1 をインストール

CentOS 6.0(64bit)にCloudStack2.2.9.1のManagement Serverを入れたのでメモ。
1. ダウンロード
http://cloudstack.org/download.html
からRed Hat Enterprise Linux/ CentOS 6のバイナリ(CloudStack-oss-2.2.9-1-rhel6.tar.gz)をダウンロード。CentOSの/tmpに保存する。以下は確認結果。
$ cd /tmp
$ ls -l
合計 90232
-rw-r--r--. 1 root root 92396229  9月 20 20:33 2011 CloudStack-oss-2.2.9-1-rhel6.tar.gz

2. 解凍
何はともあれtarを解凍。
$ tar xvzf CloudStack-oss-1.2.9-1-rhel6.tar.gz
CloudStack-oss-2.2.9-1-rhel6/
CloudStack-oss-2.2.9-1-rhel6/oss/
(snip)
CloudStack-oss-2.2.9-1-rhel6/deps/qemu-kvm-0.12.1.2-3.113.el6.x86_64.rpm

3. MySQLインストール
CloudStackのインストーラの機能を使って、DB(MySQL)をインストール。別にCentOS 6.0にバンドルされてるMySQLでも構わない。
$ cd CloudStack-oss-1.2.9-1-rhel6
$ ./install.sh 
Setting up the temporary repository...
Cleaning Yum cache...
Loaded plugins: fastestmirror
0 metadata files removed
Welcome to the Cloud.com CloudStack Installer.  What would you like to do?


M) Install the Management Server   
A) Install the Agent
B) Install BareMetal Agent
S) Install the Usage Monitor
D) Install the database server     
Q) Quit


> D
Installing the MySQL server...
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: centos.tt.co.kr
(snip)
Complete!
Starting the MySQL server...
MySQL データベースを初期化中:
(snip)
mysqld を起動中:  [  OK  ]


Done

4. MySQL設定変更
CloudStackのマニュアルに従い、my.cnfを編集。"# add for CloudStack 2011.09.21"以下の4行を追加。
$ vi /etc/my.cnf
[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

# add for CloudStack 2011.09.21
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=350
binlog_format = 'ROW'


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

5. SELinux無効化
マニュアルに従い、SELinuxを無効にする。

(1) とりあえず現在の設定を見る。
$ getenforce
Enforcing

(2) このセッションのSELinuxを無効にする。
$ setenforce permissive
$ getenforce
Permissive

(3) 再起動後もSELinuxが無効になるように設定変更。
$ vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=permissive
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

6. MySQLパスワード変更
MySQLのrootパスワードを変更。"set password = password('password')"のシングルクォート内に任意のパスワードを入れる。
$ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.52 Source distribution


Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password = password('password');
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

7. Management Serverインストール
いよいよCloudStackのManagement Serverをインストール
$ ./install.sh
Setting up the temporary repository...
Cleaning Yum cache...
Loaded plugins: fastestmirror
7 metadata files removed
Welcome to the Cloud.com CloudStack Installer.  What would you like to do?


M) Install the Management Server   
A) Install the Agent
B) Install BareMetal Agent
S) Install the Usage Monitor
E) Remove the MySQL server (will not remove the MySQL databases)
Q) Quit


> M
Installing the Management Server...
(snip)
Complete!
Done

8. DB作成
cloud-setup-databasesコマンドでDBを作成する。ハイパーバイザはxenserverとした。cloudユーザのパスワードは任意のパスワード。rootのパスワードは、さっき設定したやつ。
$ cloud-setup-databases cloud:password@localhost xenserver --deploy-as=root:password
Testing specified deployment credentials on server localhost:3306
Setting up user credentials in:
-> /etc/cloud/management/db.properties ... done.
Applying file /usr/share/cloud/setup/create-database.sql to the database on server localhost:3306
(snip)
Applying file /usr/share/cloud/setup/create-index-fk.sql to the database on server localhost:3306

9. Management Serverの初期化と起動
cloud-setup-managementコマンドでManagement Serverを初期化。
$ cloud-setup-management 
Starting to configure CloudStack Management Server:
Configure sudoers ...         [OK]
Configure Firewall ...        [OK]
Configure CloudStack Management Server ...[OK]
CloudStack Management Server setup is Done!

http://hostname:8080/client
にアクセスするとCloudStackの管理画面が表示される。

0 コメント:

コメントを投稿