您的位置:首页 > 其它

CloudStack之一:管理服务器安装

2017-02-28 13:46 387 查看
cloudstack管理服务器(版本4.9)

1. 主机规划 OS:CentOS6.5
cloudstack 192.168.10.185 (primary)

nfs 192.168.10.180 (secondary)
node01 192.168.10.190 (kvm)

###IP配置
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.10.185
NETMASK=255.255.255.0
GATEWAY=192.168.10.1

2. 修改主机名
在hosts中增加
# vi /etc/hosts
192.168.10.185 cloudstack.abc.com
# vi /etc/sysconfig/network
HOSTNAME=cloudstack.abc.com
# hostname --fqdn
#

3. 关闭SELINUX设置
# vi /etc/selinux/config
SELINUX=disabled
需要重启生效,直接生效配置。
# setenforce 0
# getenforce
disabled

4. 关闭防火墙
service iptables stop
chkconfig iptables off

5. 配置NTP时间服务同步互联网时间服务器
# crontab -e
*/10 * * * * /usr/sbin/ntpdate time.windows.com >/dev/null 2>&1

6. 配置系统YUM源
添加cloudstack软件包的官方源(Cloudstack版本4.9)

# vi /etc/yum.repos.d/cloudstack.repo
[cloudstack]
name=cloudstack
baseurl=http://cloudstack.apt-get.eu/centos/6/4.9/
enabled=1
gpgcheck=0

7. 安装Management Server
安装如下rpm包
iptables-services ipmitool wget ws-commons-util mysql-connector-python mysql mysql-connector-java jpackage-utils nfs-utils mkisofs
tomcat >= 7.0 java >= 1.7.0

# yum -y install cloudstack-management
备注:需要安装一些依赖包,切换到系统自带yum源,可以安装这些包

8. 安装mysql并配置数据库
1)安装mysql-server
# yum -y install mysql-server
2)修改mysql配置并加入以下几行
# vi /etc/my.cnf
datadir=/var/lib/mysql
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=350
log-bin=mysql-bin
binlog-format = 'ROW'
3)重启mysql,并加入开机自启动
# service mysqld start
# chkconfig mysqld on
更改mysql密码
/usr/bin/mysqladmin -u root password 'password'

###安装MySQL connector Installation
#vi /etc/yum.repos.d/mysql.repo
[mysql-connectors-community]
name=MySQL Community connectors
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/$releasever/$basearch/
enabled=1
gpgcheck=1
Import GPG public key from MySQL:

#rpm --import http://repo.mysql.com/RPM-GPG-KEY-mysql #Install mysql-connector
#yum install mysql-connector-python
或#rpm -ivh mysql-connector-python-2.0.5-1.el7.noarch.rpm

4)执行mysql的安全配置,设置密码等过程,如需要简单可直接全选Y.
# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
... skipping.
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!

5)安装cloudstack数据库
# cloudstack-setup-databases cloud:cloud@localhost --deploy-as=root:password
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.10.185, 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 ]
Applying /usr/share/cloudstack-bridge/setup/cloudbridge_db.sql [ OK ]
Applying /usr/share/cloudstack-bridge/setup/cloudbridge_schema.sql [ OK ]
Applying /usr/share/cloudstack-bridge/setup/cloudbridge_multipart.sql [ OK ]
Applying /usr/share/cloudstack-bridge/setup/cloudbridge_index.sql [ OK ]
Applying /usr/share/cloudstack-bridge/setup/cloudbridge_multipart_alter.sql [ OK ]
Applying /usr/share/cloudstack-bridge/setup/cloudbridge_bucketpolicy.sql [ OK ]
Applying /usr/share/cloudstack-bridge/setup/cloudbridge_policy_alter.sql [ OK ]
Applying /usr/share/cloudstack-bridge/setup/cloudbridge_offering.sql [ OK ]
Applying /usr/share/cloudstack-bridge/setup/cloudbridge_offering_alter.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
#GRANT ALL PRIVILEGES ON *.* TO 'root'@'cs.abc.com' IDENTIFIED BY 'password' WITH GRANT OPTION;

9. 初始化cloudstack管理节点
# cloudstack-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!

10. 启动cloudstack-management
# service cloudstack-management start

11. 配置NFS存储,该内容可以独立配置。
配置说明: 安装是主存储采用NFS进行测试,NFS可以由其它服务器单独提供,这里供测试,根据如下要求,在另一服务器及管理机上配置NFS服务。
NFS(辅助存储): 192.168.10.180
NFS(主存储) : 192.168.10.185
备注:二台都要配置nfs
#yum -y install nfs-utils

1)配置域名(主要配合NFS配置使用)
# vi /etc/idmapd.conf
Domain = abc.com
2) 准备NFS目录
# mkdir -p /data/{primary,secondary}
3) 修改nfs服务参数
# vi /etc/sysconfig/nfs
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
RQUOTAD_PORT=875
MOUNTD_PORT=892
STATD_PORT=662
STATD_OUTGOING_PORT=2020
RPCNFSDARGS="-N 4"

4)配置文件
# vi /etc/exports
/data/primary *(rw,fsid=1,async,no_root_squash,no_subtree_check)
/data/secondary *(rw,fsid=1,async,no_root_squash,no_subtree_check)

5) 配置nfs服务启动
service rpcbind start
service nfs start
chkconfig rpcbind on
chkconfig nfs on
showmount -e 127.0.0.1

6) 挂载测试,测试完毕后卸载掉,不需要手动挂载(在192.168.10.185上执行)
mount -t nfs 192.168.10.185:/data/primary /mnt/1/
mount -t nfs 192.168.10.180:/data/secondary /mnt/2/
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_cloudstack-lv_root 36G 5.1G 29G 16% /
tmpfs 1.9G 68K 1.9G 1% /dev/shm
/dev/sda1 485M 39M 421M 9% /boot
192.168.10.185:/data/primary 36G 5.1G 29G 16% /mnt/1
192.168.10.180:/data/secondary 36G 6.1G 28G 19% /mnt/2

12. 导入系统虚拟机模板
说明: 系统虚拟机模板按要求要存放在辅助存储上的,我们可以先手动挂载nfs辅助存储, 然后把290M KVM虚拟化模板先下载到辅助存储目录下,然后再导入。本例采用KVM虚拟化,下载导入KVM虚拟机模板。
# mount -t nfs 192.168.10.180:/data/secondary /mnt/2/
# cd /mnt/2/
#/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt \
-m /export/secondary \
-u http://cloudstack.apt-get.eu/systemvm/4.6/systemvm64template-4.6.0-kvm.qcow2.bz2 \
-h kvm -F

问题:如果添加模板大小的地方没显示,提示Connection refused
搜索secstorage关键字,找到一个叫做“secstorage.allowed.internal.sites”的配置参数,设置为192.168.10.0/24,敲回车确认即可。这个参数是说,Web服务器的网段在192.168.10.0;然后到管理节点的命令行重启服务: # service cloud-management restart
重新登陆界面,在此添加ISO模版,就不会出现“connection refused”的错误。

cloudstack4.9 系统虚拟机默认用户名密码:root/password

13. 安装完成, 访问http://192.168.10.185:8080/client



默认用户名和密码为admin, password
点击“我以前使用过CloudStack,跳过此指南”进入配置界面。

安装完毕。

参考:http://koumm.blog.51cto.com/703525/1558660


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  cloudstack