CentOS7.0+OpenStack+kvm云平台部署—基础配置

2019-06-11 17:52:42 浏览数 (1)

一.主机分配:

主机名 IP(Static) 系统配置 角色

openstack 192.168.1.2 CentOS-7.0-x86_64-desktop 4CPU,16G RAM,300G DISK,2网卡 管理节点/计算节点

node 192.168.1.3 CentOS-7.0-x86_64-desktop 4CPU,16G RAM,300G DISK,2网卡 计算节点

(首先确定本机是否已经设定支持虚拟化)

1、进入BIOS。开机时按F2或F12或DEL或ESC等键(各电脑有所不同)。

2、进入BIOS后,找到Configuration选项,选择Intel Virtual Technology并回车,将光标移至Enabled,然后再回车,最后按F10保存并退出。

如果找不到Configuration选项,可以试试下面的方法:

(1)某些HP(惠普)电脑进入BIOS后,需要选择SystemConfiguration(系统配置)菜单,

然后选择Device Configuration(设备配置),找到Virtualization Technology,设置为Enabled。

(2)某些联想Thinkpad电脑进入BIOS后,需要选择Security菜单,然后选择Virtualization,设置为Enabled。

(3)某些DELL(戴尔)电脑进入BIOS后,需要选择Processor Settings菜单,然后选择VirtualizationTechnology,设置为Enabled。 二、管理节点安装(OpenStack)

1.基础配置

操作系统使用CentOS-7.0-x86_64.iso,安装过程省略,本文采用yum源安装。

(1).导入第三方安装源

[root@openstack ~]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

[root@openstack ~]# rpm -Uvhhttp://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

[root@openstack ~]# yum install http://repos.fedorapeople.org/repos/openstack/openstack-havana/rdo-release-havana-9.noarch.rpm (下载这个的时候 如果出现有pid 阻止,就用kill杀了)

把附带的压缩包源解压放到/etc/yum.repo.d/目录下面

修改rdo-release.repo配置文件。将gpgcheck=1修改为=0

(如果后期yum安装的时候出现无法找到源,尝试用附带的CentOS-Base.repo代替原来的)

(2).配置/etc/hosts文件

[root@openstack ~]# vi /etc/hosts

127.0.0.1 localhostlocalhost.localdomain localhost4 localhost4.localdomain4

::1 localhost localhost.localdomainlocalhost6 localhost6.localdomain6

192.168.1.2 openstack

192.168.1.3 node

(3).配置网络

如果你已经安装完了,希望改成eth0这样的名称,那么需要:

修改grub2启动参数

vi /etc/sysconfig/grub

GRUB_CMDLINE_LINUX=”rd.lvm.lv=vg0/swapvconsole.keymap=us crashkernel=auto vconsole.font=latarcyrheb-sun16net.ifnames=0 biosdevname=0 rd.lvm.lv=vg0/usr rhgb quiet”

grub2-mkconfig -o /boot/grub2/grub.cfg

重新对文件进行命名:

/etc/sysconfig/network-scripts/ifcfg-*

然后执行:

# grub2-mkconfig -o /boot/grub2/grub.cfg

重新启动电脑 就能看见名字已经改过来了

[root@openstack ~]# vi/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"

BOOTPROTO="static"

HWADDR="E4:1F:13:45:AB:C8"

ONBOOT="yes"

IPADDR=192.168.1.2(根据自己的IP而定)

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:CA"

ONBOOT="yes"

TYPE="Ethernet"

(4).关闭selinux:

[root@openstack ~]# more/etc/selinux/config

# This file controls the state of SELinuxon the system.

# SELINUX= can take one of these threevalues:

# enforcing - SELinuxsecurity policy is enforced.

# permissive - SELinuxprints warnings instead of enforcing.

# disabled - SELinuxis fully disabled.

SELINUX=disabled

# SELINUXTYPE= type of policy in use.Possible values are:

# targeted - Onlytargeted network daemons are protected.

# strict - FullSELinux protection.

SELINUXTYPE=targeted

[root@openstack ~]# setenforce 0

(5).修改/etc/sysctl.conf参数:

[root@openstack ~]# vi/etc/sysctl.conf

……………………

net.ipv4.ip_forward = 1

…………………… [root@openstack ~]#sysctl -p #使sysctl.conf配置生效

2.安装配置NTP服务

(1).安装NTP服务:

[root@openstack ~]# yum -y install ntp

如果报错 HTTP Error 404 –Not Fount

修改配置文件 /etc/yum.repos.d/foreman.repo

改为:baseurl=http://yum.theforeman.org/releases/1.5/el6/x86_64

(把原来的el7改为el6)

(2).配置NTP服务:

[root@openstack ~]# vi /etc/ntp.conf

driftfile /var/lib/ntp/drift

restrict default ignore

restrict 127.0.0.1

restrict 192.168.1.0 mask255.255.255.0 nomodify notrap

server ntp.api.bz

server 127.127.1.0 #local clock

fudge 127.127.1.0 stratum 10

keys /etc/ntp/keys

(3).启动NTP服务,设置开机自启动:

[root@openstack ~]# service ntpd start

[root@openstack ~]# chkconfig ntpd on

3.配置安装MySQL:

(1).安装MySQL服务:

[root@openstack ~]# yum -yinstall mariadb mariadb-galera-server MySQL-python

(2).启动MqSQL服务,设置开机自启动:

[root@openstack ~]# service mysqld start

[root@openstack ~]# chkconfig mysqld on

(3).修改MySQL密码为passwd:

[root@openstack ~]# mysqladmin –uroot–p password passwd

后面的passwd是要设置的密码,回车后出现Enter password 输入就密码,如果没有,直接回车

4.安装配置qpid服务

(1).安装qpid服务:

[root@openstack~]# yum -y install qpid-cpp-server memcached

(2).修改/etc/qpidd.conf配置文件,将auth设置为no:

[root@openstack ~]# vi /etc/qpid/qpidd.conf

……………………

auth=no

(3).启动qpid服务,设置开机启动:

[root@openstack ~]# service qpidd start

[root@openstack ~]# chkconfig qpidd on

(4).安装OpenStack工具包:

[root@openstack ~]# yum install-y openstack-utils

0 人点赞