1.安装cloudstack

1.1:配置本地yum

1)创建存放rpm包的目录

[root@cloudstack ~]# mkdir /soft/cloudstack/

2)将下载的包上传到对应的服务器目录中

下载路径:http://cloudstack.apt-get.eu/centos/6/4.9/

[root@cloudstack cloudstack]# pwd

/soft/cloudstack

[root@cloudstack cloudstack]# ls

cloudstack-agent-4.9.0-1.el6.x86_64.rpm            cloudstack-management-4.9.0-1.el6.x86_64.rpm

cloudstack-baremetal-agent-4.9.0-1.el6.x86_64.rpm  cloudstack-usage-4.9.0-1.el6.x86_64.rpm

cloudstack-cli-4.9.0-1.el6.x86_64.rpm

cloudstack-common-4.9.0-1.el6.x86_64.rpm

3)安装createrepo工具并创建repo

[root@cloudstack cloudstack]# yum -y install createrepo

[root@cloudstack cloudstack]# createrepo /soft/cloudstack/

Spawning worker 0 with 6 pkgs

Workers Finished

Gathering worker results

 

Saving Primary metadata

Saving file lists metadata

Saving other metadata

Generating sqlite DBs

Sqlite DBs complete

4)编辑.repo文件

[root@cloudstack cloudstack]# vim /etc/yum.repos.d/cloudstack.repo

[cloudstack]

name=cloudstack

baseurl=file:///soft/cloudstack/

enabled=1

gpgcheck=0

5)查看配置情况

[root@cloudstack cloudstack]# yum clean all

已加载插件:fastestmirror, security

Cleaning repos: base cloudstack extras mysql-connectors-community updates

清理一切

Cleaning up list of fastest mirrors

[root@cloudstack cloudstack]# yum repolist

[root@cloudstack cloudstack]# yum repolist

已加载插件:fastestmirror, security

Loading mirror speeds from cached hostfile

 * base: mirrors.tuna.tsinghua.edu.cn

 * extras: mirrors.tuna.tsinghua.edu.cn

 * updates: mirrors.tuna.tsinghua.edu.cn

仓库标识                   仓库名称       状态

base                       CentOS-6 - Bas 6,696

cloudstack                 cloudstack         6

extras                     CentOS-6 - Ext    62

mysql-connectors-community MySQL Communit    24

updates                    CentOS-6 - Upd   686

repolist: 7,474                                                                        

1.2:使用yum安装cloudstack

1)安装cloudstack-management

[root@cloudstack cloudstack]# yum -y install cloudstack-management

[root@cloudstack cloudstack]# yum -y install cloud-client

2.配置数据库(mysql)服务

2.1准备 mysql服务器

1)安装mysql服务

[root@cloudstack cloudstack]# yum -y install mysql-server

2)修改mysql配置文件

[root@cloudstack cloudstack]# vim /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

innodb_rollback_on_timeout=1

innodb_lock_wait_timeout=600

max_connections=350

log-bin=mysql-bin

binlog-format='ROW'

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

3)启动数据库

[root@cloudstack cloudstack]# service mysqld start

正在启动 mysqld:                                          [确定]

4)设置mysql root密码

[root@cloudstack cloudstack]# mysqladmin -uroot password 123456

5)设置root远程登录权限

[root@cloudstack cloudstack]# mysql -uroot -p123456 -e "GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY '123456'"

2.2创建cloudstack的初始化数据库文件

[root@cloudstack cloudstack]# cloudstack-setup-databases cloud:123456@localhost --deploy-as=root:123456 -e file -m 123456 -k 123456

Mysql user name:cloud                                                           [ OK ]

Mysql user password:******                                                      [ OK ]

Mysql server ip:localhost                                                       [ OK ]

Mysql server port:3306                                                          [ OK ]

Mysql root user name:root                                                       [ OK ]

Mysql root user password:******                                                 [ OK ]

Checking Cloud database files ...                                               [ OK ]

Checking local machine hostname ...                                             [ OK ]

Checking SELinux setup ...                                                      [ OK ]

Detected local IP address as 192.168.1.130, will use as cluster management server node IP[ OK ]

Preparing /etc/cloudstack/management/db.properties                              [ OK ]

Applying /usr/share/cloudstack-management/setup/create-database.sql             [ OK ]

Applying /usr/share/cloudstack-management/setup/create-schema.sql               [ OK ]

Applying /usr/share/cloudstack-management/setup/create-database-premium.sql     [ OK ]

Applying /usr/share/cloudstack-management/setup/create-schema-premium.sql       [ OK ]

Applying /usr/share/cloudstack-management/setup/server-setup.sql                [ OK ]

Applying /usr/share/cloudstack-management/setup/templates.sql                   [ OK ]

Processing encryption ...                                                       

 

[ OK ]

Finalizing setup ...                                                            [ OK ]

 

CloudStack has successfully initialized database, you can check your database configuration in /etc/cloudstack/management/db.properties