**感谢朋友支持本博客,欢迎共同探讨交流。因为能力和时间有限。错误之处在所难免,欢迎指正。
假设转载,请保留作者信息。
博客地址:http://blog.csdn.net/qq_21398167**
**原博文地址:http://blog.csdn.net/qq_21398167/article/details/46389799**
1.基础配置
操作系统使用CentOS-7.0-x86_64-*.iso,安装过程省略,本文採用yum源安装。
(1).导入第三方安装源
[root@node ~]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
[root@node ~]# rpm -Uvhhttp://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
[root@node ~]# yum installhttp://repos.fedorapeople.org/repos/openstack/openstack-havana/rdo-release-havana-9.noarch.rpm
(2).配置/etc/hosts文件
[root@node ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6localhost6.localdomain6
192.168.1.2 openstack
192.168.1.3 node
(3).配置网络
[root@node ~]# vi/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="E4:1F:13:45:AB:C1"
ONBOOT="yes"
IPADDR=192.168.1.3
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
TYPE="Ethernet"
[root@openstack~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE="eth1"
BOOTPROTO="none"
HWADDR="E4:1F:13:45:AB:C3"
ONBOOT="yes"
TYPE="Ethernet"
(4).关闭selinux:
[root@node ~]# more/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 - SELinux is fully disabled.
SELINUX=disabled
#SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
[root@node~]# setenforce 0
(5).改动/etc/sysctl.conf參数:
[root@node ~]# vi/etc/sysctl.conf
……………………
net.ipv4.ip_forward= 1
……………………
[root@node ~]#sysctl -p #使sysctl.conf配置生效
2.安装配置NTPclient
(1).安装NTPclient服务:
[root@node ~]# yum -y installntpdate
(2).设置时间同步:
[root@node ~]#ntpdate192.168.1.2
31 Mar 16:17:03ntpdate[5848]: the NTP socket is in use, exiting
(3).设置计划任务:
[root@node ~]# crontab-e
插入下行内容:
*/5 * * * * ntpdate 192.168.1.2>> /var/log/ntpdate.log
3.环境变量设置
改动.bash_profile文件,加入下面參数:
[root@node ~]# vi.bash_profile
………………
exportOS_USERNAME=admin
exportOS_TENANT_NAME=admin
exportOS_PASSWORD=password
exportOS_AUTH_URL=http://192.168.1.2:5000/v2.0
exportSERVICE_ENDPOINT=http://192.168.1.2:35357/v2.0
exportSERVICE_TOKEN=12dd70ede7c9d9d3ed3c
………………
运行以下的命令使变量即时生效:
[root@node ~]# source.bash_profile
4.安装配置libvirt服务
(1).安装libvirt服务:
[root@node ~]#yum -y install qemu-kvm libvirt
(2)启动libvirt服务:
[root@node ~]# servicelibvirtd start
(3)查看net-list,发现default:
[root@node ~]# virshnet-list
Name State Autostart Persistent
--------------------------------------------------
default active yes yes
(4)删除default。即virbr0:
[root@node ~]# virshnet-destroy default
Networkdefault destroyed
[root@node ~]# virshnet-undefine default
Networkdefault has been undefined
(5)重新启动libvirtd服务,设置开机自启动:
[root@node ~]# servicelibvirtd restart
[root@node ~]# chkconfiglibvirtd on
5.安装MySQLclient
(1).安装mysqlclient
[root@node ~]#yum -y install maridb
(2).检查mysql数据库连通性
[root@node ~]# mysql -h192.168.1.2 -unova -pnova
Welcome to the MySQLmonitor. ………………
mysql> quit;
Bye
6.安装配置Nova服务
(1)安装nova-compute、nova-network、nova-scheduler
[root@node ~]#yum -y install openstack-nova-computeopenstack-nova-network openstack-nova-scheduler
(2).改动nova配置文件
[root@node ~]#vi /etc/nova/nova.conf
[DEFAULT]
my_ip = 192.168.1.3
auth_strategy = keystone
state_path =/letv/openstack/lib/nova
verbose=True
allow_resize_to_same_host= true
rpc_backend =nova.openstack.common.rpc.impl_qpid
qpid_hostname = 192.168.1.2
libvirt_type = kvm
glance_api_servers = 192.168.1.2:9292
novncproxy_base_url =http://192.168.1.2:6080/vnc_auto.html
vncserver_listen = 192.168.1.3
vncserver_proxyclient_address= 192.168.1.3
vnc_enabled = true
vnc_keymap = en-us
network_manager =nova.network.manager.FlatDHCPManager
firewall_driver =nova.virt.firewall.NoopFirewallDriver
multi_host = True
flat_interface = eth1
flat_network_bridge = br1
public_interface = eth0
instance_usage_audit =True
instance_usage_audit_period= hour
notify_on_state_change =vm_and_task_state
notification_driver =nova.openstack.common.notifier.rpc_notifier
compute_scheduler_driver=nova.scheduler.simple.SimpleScheduler
[hyperv]
[zookeeper]
[osapi_v3]
[conductor]
[keymgr]
[cells]
[database]
sql_connection=mysql://nova:nova@192.168.1.2/nova
[image_file_url]
[baremetal]
[rpc_notifier2]
[matchmaker_redis]
[ssl]
[trusted_computing]
[upgrade_levels]
[matchmaker_ring]
[vmware]
[spice]
[keystone_authtoken]
auth_host = 192.168.1.2
auth_port = 35357
auth_protocol = http
admin_user = nova
admin_tenant_name =service
admin_password = service
因上管理节点nova.conf配置文件里改动了instances实例存放的位置。还须要作一下操作:
改动路径,设置文件夹权限:
[root@node ~]# cp-r /var/lib/nova/ /openstack/lib/
[root@node ~]# chown-R nova:nova /openstack/lib/nova/
(3).启动nova相关服务。设置开机自启动
[root@node ~]# servicemessagebus start
[root@node ~]# chkconfigmessagebus on
[root@node ~]# serviceopenstack-nova-compute start
[root@node ~]# serviceopenstack-nova-network start
[root@node ~]# chkconfigopenstack-nova-compute on
[root@node ~]# chkconfigopenstack-nova-network on
*******************************************************************************************
OpenStack其它经常使用命令:
1.listnova服务,包括管理节点和计算节点
[root@openstack~]# nova service-list
+------------------+-------------+----------+---------+-------+----------------------------+-----------------+
| Binary | Host | Zone |Status | State | Updated_at | Disabled Reason |
+------------------+-------------+----------+---------+-------+----------------------------+-----------------+
| nova-cert | openstack | internal | enabled | up |2014-03-31T08:59:50.000000 | - |
| nova-consoleauth |openstack | internal | enabled | up | 2014-03-31T08:59:54.000000| - |
| nova-scheduler | openstack | internal | enabled | up |2014-03-31T08:59:48.000000 | - |
| nova-conductor | openstack | internal | enabled | up |2014-03-31T08:59:52.000000 | - |
| nova-compute | openstack | nova | enabled | up |2014-03-31T08:59:56.000000 | - |
| nova-compute | node | nova | enabled | up | 2014-03-31T08:59:53.000000 | - |
| nova-network | openstack | internal | enabled | up |2014-03-31T08:59:50.000000 | - |
| nova-network | node | internal | enabled | up |2014-03-31T08:59:56.000000 | - |
| nova-scheduler | node | internal | enabled | up | 2014-03-31T08:59:52.000000| - |
2.查看计算节点:
[root@node ~]# novahypervisor-list
+----+---------------------+
| ID | Hypervisorhostname |
+----+---------------------+
| 1 | openstack |
| 2 |node |
+----+---------------------+
3.查看虚拟机模板配置:
[root@node ~]# novaflavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor |Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True |
| 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True |
| 3 | m1.medium |4096 | 40 | 0 | | 2 | 1.0 | True |
| 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True |
| 5 | m1.xlarge |16384 | 160 | 0 | | 8 | 1.0 | True |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
vim /etc/nova/api-paste.ini
admin_tenant_name=admin
admin_user=admin
admin_password=password
手机扫一扫
移动阅读更方便
你可能感兴趣的文章