OpenStack一键式安装

今天的内容延续昨天openstack环境准备
今天需要把真机,虚拟机1和虚拟机2全部准备完毕

1 案例1:配置yum仓库
1.1 问题

本案例要求把三个镜像配置yum源:
CentOS7-1708光盘内容作为仓库源
配置 RHEL7-extars内容加入仓库源
RHEL7OSP-10光盘中包含多个目录,每个目录都是仓库源(可以使用脚本生成)
1.2 步骤

实现此案例需要按照如下步骤进行。
步骤一:配置 yum仓库

警告:仅yum配置的第一个源(系统源)为gpgcheck=1需要导入公钥,其他的都是gpgcheck=0,否则安装会报错
[[email protected] ~]# mkdir /var/ftp/system
[[email protected] ~]# mkdir /var/ftp/extras
[[email protected] ~]# mkdir /var/ftp/HEL7OSP
[[email protected] ~]# vim /etc/fstab
/iso/RHEL7OSP-10.iso /var/ftp/HEL7OSP iso9660 defaults 0 0
/iso/CentOS7-1708.iso /var/ftp/system iso9660 defaults 0 0
/iso/RHEL7-extras.iso /var/ftp/extras iso9660 defaults 0 0
[[email protected] ~]# mount –a
mount: /dev/loop0 is write-protected, mounting read-only
mount: /dev/loop1 is write-protected, mounting read-only
mount: /dev/loop2 is write-protected, mounting read-only
[[email protected] ~]# vim /etc/yum.repos.d/local.repo
[local_repo]
name=CentOS-$releasever – Base
baseurl=”ftp://192.168.1.254/system”
enabled=1
gpgcheck=1
[local_extras]
name=extras
baseurl=”ftp://192.168.1.254/extras”
enabled=1
gpgcheck=0
[1local_devtools-rpms]
name=devtools-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-openstack-10-devtools-rpms”
enabled=1
gpgcheck=0
[2local_optools-rpms]
name=optools-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-openstack-10-optools-rpms”
enabled=1
gpgcheck=0
[3local_rpms]
name=rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-openstack-10-rpms”
enabled=1
gpgcheck=0
[4local_tools-rpms]
name=tools-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-openstack-10-tools-rpms”
enabled=1
gpgcheck=0
[5local_mon-rpms]
name=mon-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-rhceph-2-mon-rpms”
enabled=1
gpgcheck=0
[6local_osd-rpms]
name=osd-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-rhceph-2-osd-rpms”
enabled=1
gpgcheck=0
[7local_rhceph-2-tools-rpms]
name=rhceph-2-tools-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-rhceph-2-tools-rpms”
enabled=1
gpgcheck=0
[8local_agent-rpms]
name=agent-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-rhscon-2-agent-rpms”
enabled=1
gpgcheck=0
[9local_installer-rpms]
name=installer-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-rhscon-2-installer-rpms”
enabled=1
gpgcheck=0
[10local_rhscon-2-main-rpms]
name=rhscon-2-main-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-rhscon-2-main-rpms”
enabled=1
gpgcheck=0

代码如下
[[email protected] ~]# cat /etc/fstab
[[email protected] ~]# mkdir /var/ftp/system
[[email protected] ~]# mkdir /var/ftp/extras
[[email protected] ~]# mkdir /var/ftp/HEL7OSP
[[email protected] ~]# vim /etc/fstab

#
# /etc/fstab
# Created by anaconda on Thu Mar 8 09:45:35 2018
#
# Accessible filesystems, by reference, are maintained under ‘/dev/disk’
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=2c4538c2-7763-4c33-90c4-cfc0e20bb8c9 / ext4 defaults 1 1
UUID=42cf258f-160a-4054-a352-945929f3cc87 /var/lib/libvirt/images ext4 defaults 1 2
/var/lib/libvirt/images/iso/rhel-server-7.4-x86_64-dvd.iso /var/ftp/rhel7 iso9660 defaults 0 0
#/var/lib/libvirt/images/iso/CentOS-7-x86_64-Everything-1708.iso /var/ftp/centos iso9660 defaults 0 0
/var/lib/libvirt/images/iso/rhcs2.0-rhosp9-20161113-x86_64.iso /var/ftp/ceph iso9660 defaults 0 0
/var/lib/libvirt/images/iso/RHEL7OSP-10.iso /var/ftp/HEL7OSP iso9660 defaults 0 0
/var/lib/libvirt/images/iso/CentOS-7-x86_64-Everything-1708.iso /var/ftp/system iso9660 defaults 0 0
/var/lib/libvirt/images/iso/RHEL7-extras.iso /var/ftp/extras iso9660 defaults 0 0
(这里注意一下,我本身已经写过centos了,为了不和system冲突,所以还是还是把centos暂时注释掉)

[[email protected] ~]# mount -a
mount: /dev/loop0 写保护,将以只读方式挂载
mount: /dev/loop1 写保护,将以只读方式挂载
mount: /dev/loop2 写保护,将以只读方式挂载
mount: /dev/loop3 写保护,将以只读方式挂载
mount: /dev/loop4 写保护,将以只读方式挂载
[[email protected] ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda2 118G 47G 66G 42% /
devtmpfs 7.7G 0 7.7G 0% /dev
tmpfs 7.7G 21M 7.7G 1% /dev/shm
tmpfs 7.7G 10M 7.7G 1% /run
tmpfs 7.7G 0 7.7G 0% /sys/fs/cgroup
/dev/sda1 197G 77G 111G 41% /var/lib/libvirt/images
tmpfs 1.6G 56K 1.6G 1% /run/user/0
/dev/loop0 3.8G 3.8G 0 100% /var/ftp/rhel7
/dev/loop1 936M 936M 0 100% /var/ftp/ceph
/dev/loop2 3.0G 3.0G 0 100% /var/ftp/HEL7OSP
/dev/loop3 8.1G 8.1G 0 100% /var/ftp/system
/dev/loop4 169M 169M 0 100% /var/ftp/extras

编辑yum源,注意,只有第一个centos-everyting需要gpgcheck=1,其余都要为0,否则报错,同时真机要导入密钥
[[email protected] ~]# cat /etc/yum.repos.d/local.repo
[local_repo]
name=CentOS-$releasever – Base
baseurl=”ftp://192.168.1.254/system”
enabled=1
gpgcheck=1
[local_extras]
name=extras
baseurl=”ftp://192.168.1.254/extras”
enabled=1
gpgcheck=0
[1local_devtools-rpms]
name=devtools-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-openstack-10-devtools-rpms”
enabled=1
gpgcheck=0
[2local_optools-rpms]
name=optools-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-openstack-10-optools-rpms”
enabled=1
gpgcheck=0
[3local_rpms]
name=rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-openstack-10-rpms”
enabled=1
gpgcheck=0
[4local_tools-rpms]
name=tools-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-openstack-10-tools-rpms”
enabled=1
gpgcheck=0
[5local_mon-rpms]
name=mon-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-rhceph-2-mon-rpms”
enabled=1
gpgcheck=0
[6local_osd-rpms]
name=osd-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-rhceph-2-osd-rpms”
enabled=1
gpgcheck=0
[7local_rhceph-2-tools-rpms]
name=rhceph-2-tools-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-rhceph-2-tools-rpms”
enabled=1
gpgcheck=0
[8local_agent-rpms]
name=agent-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-rhscon-2-agent-rpms”
enabled=1
gpgcheck=0
[9local_installer-rpms]
name=installer-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-rhscon-2-installer-rpms”
enabled=1
gpgcheck=0
[10local_rhscon-2-main-rpms]
name=rhscon-2-main-rpms
baseurl=”ftp://192.168.1.254/HEL7OSP/rhel-7-server-rhscon-2-main-rpms”
enabled=1
gpgcheck=0

真机也要导入密钥,同时注释掉原来的centos源
[[email protected] ~]# cp /var/ftp/system/RPM-GPG-KEY-CentOS-7 ./
[[email protected] ~]# ll
-rw-r–r– 1 root root 1690 10月 15 16:13 RPM-GPG-KEY-CentOS-7

[[email protected] ~]# rpm –import RPM-GPG-KEY-CentOS-7

把原来写的dvd.repo删除掉
[[email protected] yum.repos.d]# ll
总用量 68
-rwxr-xr-x 1 root root 347 8月 12 17:17 cent7.repo
-rw-r–r– 1 root root 1664 8月 13 22:34 CentOS-Base.repo
-rw-r–r– 1 root root 1309 8月 13 22:34 CentOS-CR.repo
-rw-r–r– 1 root root 649 8月 13 22:34 CentOS-Debuginfo.repo
-rw-r–r– 1 root root 314 8月 13 22:34 CentOS-fasttrack.repo
-rw-r–r– 1 root root 630 8月 13 22:34 CentOS-Media.repo
-rw-r–r– 1 root root 1331 8月 13 22:34 CentOS-Sources.repo
-rw-r–r– 1 root root 4768 8月 13 22:34 CentOS-Vault.repo
-rw-r–r– 1 root root 270 10月 12 09:17 ceph.repo
-rw-r–r– 1 root root 71 10月 15 11:04 dvd.repo
-rwxr-xr-x 1 root root 951 8月 12 11:25 epel.repo
-rwxr-xr-x 1 root root 1050 8月 12 11:13 epel-testing.repo
-rw-r–r– 1 root root 1524 10月 15 16:10 local.repo
-r–r–r– 1 root root 114 7月 11 2017 packagekit-media.repo
-rw-r–r– 1 root root 229 8月 4 07:49 teamviewer.repo
-rwxr-xr-x 1 root root 229 8月 12 11:21 teamviewer.repo.rpmorig
[[email protected] yum.repos.d]# rm -rf dvd.repo
[[email protected] yum.repos.d]# ll
总用量 64
-rwxr-xr-x 1 root root 347 8月 12 17:17 cent7.repo
-rw-r–r– 1 root root 1664 8月 13 22:34 CentOS-Base.repo
-rw-r–r– 1 root root 1309 8月 13 22:34 CentOS-CR.repo
-rw-r–r– 1 root root 649 8月 13 22:34 CentOS-Debuginfo.repo
-rw-r–r– 1 root root 314 8月 13 22:34 CentOS-fasttrack.repo
-rw-r–r– 1 root root 630 8月 13 22:34 CentOS-Media.repo
-rw-r–r– 1 root root 1331 8月 13 22:34 CentOS-Sources.repo
-rw-r–r– 1 root root 4768 8月 13 22:34 CentOS-Vault.repo
-rw-r–r– 1 root root 270 10月 12 09:17 ceph.repo
-rwxr-xr-x 1 root root 951 8月 12 11:25 epel.repo
-rwxr-xr-x 1 root root 1050 8月 12 11:13 epel-testing.repo
-rw-r–r– 1 root root 1524 10月 15 16:10 local.repo
-r–r–r– 1 root root 114 7月 11 2017 packagekit-media.repo
-rw-r–r– 1 root root 229 8月 4 07:49 teamviewer.repo
-rwxr-xr-x 1 root root 229 8月 12 11:21 teamviewer.repo.rpmorig

创建yum缓存,正常情况下应该一切正常
[[email protected] yum.repos.d]# yum repolist
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
10local_rhscon-2-main-rpms | 2.9 kB 00:00:00
1local_devtools-rpms | 2.9 kB 00:00:00
2local_optools-rpms | 2.9 kB 00:00:00
3local_rpms | 2.9 kB 00:00:00
4local_tools-rpms | 2.9 kB 00:00:00
5local_mon-rpms | 2.9 kB 00:00:00
6local_osd-rpms | 2.9 kB 00:00:00
7local_rhceph-2-tools-rpms | 2.9 kB 00:00:00
8local_agent-rpms | 2.9 kB 00:00:00
9local_installer-rpms | 2.9 kB 00:00:00
local_extras | 2.9 kB 00:00:00
local_repo | 3.6 kB 00:00:00
(1/13): 1local_devtools-rpms/primary_db | 3.7 kB 00:00:00
(2/13): 5local_mon-rpms/primary_db | 37 kB 00:00:00
(3/13): 6local_osd-rpms/primary_db | 29 kB 00:00:00
(4/13): 10local_rhscon-2-main-rpms/primary_db | 21 kB 00:00:00
(5/13): 7local_rhceph-2-tools-rpms/primary_db | 30 kB 00:00:00
(6/13): 8local_agent-rpms/primary_db | 13 kB 00:00:00
(7/13): 9local_installer-rpms/primary_db | 44 kB 00:00:00
(8/13): local_extras/primary_db | 43 kB 00:00:00
(9/13): 2local_optools-rpms/primary_db | 41 kB 00:00:00
(10/13): 3local_rpms/primary_db | 318 kB 00:00:00
(11/13): local_repo/group_gz | 156 kB 00:00:00
(12/13): 4local_tools-rpms/primary_db | 35 kB 00:00:00
(13/13): local_repo/primary_db | 5.7 MB 00:00:00
源标识 源名称 状态
10local_rhscon-2-main-rpms rhscon-2-main-rpms 29
1local_devtools-rpms devtools-rpms 3
2local_optools-rpms optools-rpms 99
3local_rpms rpms 680
4local_tools-rpms tools-rpms 84
5local_mon-rpms mon-rpms 41
6local_osd-rpms osd-rpms 28
7local_rhceph-2-tools-rpms rhceph-2-tools-rpms 35
8local_agent-rpms agent-rpms 19
9local_installer-rpms installer-rpms 46
base/7/x86_64 CentOS-7 – Base 9,911
*epel/x86_64 Extra Packages for Enterprise Linux 7 – x86_64 12,731
extras/7/x86_64 CentOS-7 – Extras 432
librehat-shadowsocks/x86_64 Copr repo for shadowsocks owned by librehat 54
local_extras extras 76
local_repo CentOS-7 – Base 9,591
mon mon 41
osd osd 28
teamviewer/x86_64 TeamViewer – x86_64 18
tools tools 33
updates/7/x86_64 CentOS-7 – Updates 1,543
repolist: 35,522

2 案例2:配置DNS服务器:
2.1 问题

本案例要求掌握DNS服务器的配置:
允许DNS服务器为所有的客户端提供服务
解析域名openstack.tedu.cn
解析域名nova.tedu.cn
2.2 方案

此实验的整体方案需要三台机器,openstack作为主节点,nova作为额外节点,真机做为DNS和NTP的服务器(这里不再在表-1中体现,在真机上面直接配置即可),提供域名解析和时间同步服务,具体情况如表-1所示:
表-1

2.3 步骤

实现此案例需要按照如下步骤进行。
步骤一:配置DNS(真机操作)

[[email protected] ~]# yum -y install bind bind-chroot
[[email protected] ~]# vim /etc/named.conf
options {
listen-on port 53 { 192.168.1.3; }; //修改ip
allow-query { any; }; //允许所有
recursion yes;
forwarders { 172.40.1.10; }; //转发dns,真机的服务器地址
dnssec-enable no;
dnssec-validation no;
};
[[email protected] ~]# systemctl restart named

步骤一:两台虚拟机配置静态ip

注意:两台主机同样操作,改一下ip即可(以openstack.tedu.cn为例)
[[email protected] ~]# echo openstack.tedu.cn > /etc/hostname
[[email protected] ~]# hostname openstack.tedu.cn //另外一台主机改名为nova.tedu.cn
[[email protected] ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
# Generated by dracut initrd
DEVICE=”eth0″
ONBOOT=”yes”
IPV6INIT=”no”
IPV4_FAILURE_FATAL=”no”
NM_CONTROLLED=”no”
TYPE=”Ethernet”
BOOTPROTO=”static”
IPADDR=”192.168.1.1″
PREFIX=24
GATEWAY=192.168.1.254
[[email protected] ~]# systemctl restart network
步骤三:域名解析

[[email protected] ~]# vim /etc/hosts //在openstack.tedu.cn和nova.tedu.cn主机上面操作
192.168.1.1 openstack.tedu.cn
192.168.1.2 nova.tedu.cn

代码如下:
注意,我们不在真机上操作,去虚拟机上去操作,重新创建一台虚拟机,同时把IP改为192.168.1.3,内存给1G就可以了
传建前端盘node3.img
[[email protected] images]# qemu-img create -b node.qcow2 -f qcow2 node3.img
Formatting ‘node3.img’, fmt=qcow2 size=17179869184 backing_file=’node.qcow2′ encryption=off cluster_size=65536 lazy_refcounts=off
[[email protected] images]# qemu-img info node3.img
image: node3.img
file format: qcow2
virtual size: 16G (17179869184 bytes)
disk size: 196K
cluster_size: 65536
backing file: node.qcow2
Format specific information:
compat: 1.1
lazy refcounts: false
创建xml文件
[[email protected] images]# sed ‘s/node/node3/’ /etc/libvirt/qemu/node.xml > /etc/libvirt/qemunode3.xml
[[email protected] images]#
[[email protected] images]# vim /etc/libvirt/qemunode3.xml
[[email protected] images]# cat /etc/libvirt/qemunode3.xml
<!–
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh edit node3
or other application using the libvirt API.
–>

<domain type=’kvm’>
<name>node3</name>
<memory unit=’KiB’>1024000</memory>
<currentMemory unit=’KiB’>1024000</currentMemory>
<vcpu placement=’static’>2</vcpu>
<os>
<type arch=’x86_64′ machine=’pc-i440fx-rhel7.0.0′>hvm</type>
<boot dev=’hd’/>
</os>
<features>
<acpi/>
<apic/>
</features>
<cpu mode=’custom’ match=’exact’ check=’partial’>
<model fallback=’allow’>Skylake-Client-IBRS</model>
</cpu>
<clock offset=’utc’>
<timer name=’rtc’ tickpolicy=’catchup’/>
<timer name=’pit’ tickpolicy=’delay’/>
<timer name=’hpet’ present=’no’/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled=’no’/>
<suspend-to-disk enabled=’no’/>
</pm>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type=’file’ device=’disk’>
<driver name=’qemu’ type=’qcow2’/>
<source file=’/var/lib/libvirt/images/node3.img’/>
<target dev=’vda’ bus=’virtio’/>
<address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x07′ function=’0x0’/>
</disk>
<controller type=’usb’ index=’0′ model=’ich9-ehci1′>
<address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x05′ function=’0x7’/>
</controller>
<controller type=’usb’ index=’0′ model=’ich9-uhci1′>
<master startport=’0’/>
<address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x05′ function=’0x0′ multifunction=’on’/>
</controller>
<controller type=’usb’ index=’0′ model=’ich9-uhci2′>
<master startport=’2’/>
<address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x05′ function=’0x1’/>
</controller>
<controller type=’usb’ index=’0′ model=’ich9-uhci3′>
<master startport=’4’/>
<address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x05′ function=’0x2’/>
</controller>
<controller type=’pci’ index=’0′ model=’pci-root’/>
<controller type=’virtio-serial’ index=’0′>
<address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x06′ function=’0x0’/>
</controller>
<interface type=’network’>
<source network=’vbr’/>
<model type=’virtio’/>
<address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x03′ function=’0x0’/>
</interface>
<interface type=’bridge’>
<source bridge=’private1’/>
<model type=’virtio’/>
</interface>
<serial type=’pty’>
<target type=’isa-serial’ port=’0′>
<model name=’isa-serial’/>
</target>
</serial>
<console type=’pty’>
<target type=’serial’ port=’0’/>
</console>
<channel type=’unix’>
<target type=’virtio’ name=’org.qemu.guest_agent.0’/>
<address type=’virtio-serial’ controller=’0′ bus=’0′ port=’1’/>
</channel>
<channel type=’spicevmc’>
<target type=’virtio’ name=’com.redhat.spice.0’/>
<address type=’virtio-serial’ controller=’0′ bus=’0′ port=’2’/>
</channel>
<input type=’tablet’ bus=’usb’>
<address type=’usb’ bus=’0′ port=’1’/>
</input>
<input type=’mouse’ bus=’ps2’/>
<input type=’keyboard’ bus=’ps2’/>
<graphics type=’spice’ autoport=’yes’>
<listen type=’address’/>
<image compression=’off’/>
</graphics>
<sound model=’ich6′>
<address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x04′ function=’0x0’/>
</sound>
<video>
<model type=’qxl’ ram=’65536′ vram=’65536′ vgamem=’16384′ heads=’1′ primary=’yes’/>
<address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x02′ function=’0x0’/>
</video>
<redirdev bus=’usb’ type=’spicevmc’>
<address type=’usb’ bus=’0′ port=’2’/>
</redirdev>
<redirdev bus=’usb’ type=’spicevmc’>
<address type=’usb’ bus=’0′ port=’3’/>
</redirdev>
<memballoon model=’virtio’>
<address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x08′ function=’0x0’/>
</memballoon>
</devices>
</domain>

定义,并启动虚拟机
[[email protected] images]# virsh define /etc/libvirt/qemunode3.xml
定义域 node3(从 /etc/libvirt/qemunode3.xml)

[[email protected] images]# virsh start node3
域 node3 已开始

[[email protected] images]# virsh console node3
连接到域 node3
换码符为 ^]

[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu

更改YUM源、配置IP为192.168.1.3
[[email protected] ~]# cat /etc/yum.repos.d/dvd.repo
[dvd]
name=dvd
baseurl=ftp://192.168.1.254/system
enabled=1
gpgcheck=1
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Generated by dracut initrd
DEVICE=”eth0″
NAME=”eth0″
ONBOOT=yes
IPV6INIT=no
TYPE=Ethernet
IPADDR=”192.168.1.3″
PREFIX=”24″
GATEWAY=”192.168.1.254″
[[email protected] ~]# systemctl restart network
[[email protected] ~]# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.3 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::5054:ff:fe1b:6be9 prefixlen 64 scopeid 0x20<link>
ether 52:54:00:1b:6b:e9 txqueuelen 1000 (Ethernet)
RX packets 142 bytes 9882 (9.6 KiB)
RX errors 0 dropped 9 overruns 0 frame 0
TX packets 66 bytes 5746 (5.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[[email protected] ~]# yum repolist
Loaded plugins: fastestmirror
base | 3.6 kB 00:00
dvd | 3.6 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
(1/6): dvd/group_gz | 156 kB 00:00
(2/6): dvd/primary_db | 5.7 MB 00:00
(3/6): extras/7/x86_64/primary_db | 204 kB 00:00
(4/6): base/7/x86_64/group_gz | 166 kB 00:01
(5/6): updates/7/x86_64/primary_db | 6.0 MB 00:02
(6/6): base/7/x86_64/primary_db | 5.9 MB 00:02
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.163.com
* updates: mirrors.163.com
repo id repo name status
base/7/x86_64 CentOS-7 – Base 9,911
dvd dvd 9,591
extras/7/x86_64 CentOS-7 – Extras 432
updates/7/x86_64 CentOS-7 – Updates 1,543
repolist: 21,477

开始安装DNS
(注意,以下步骤都在真机上面去操作)

[[email protected] images]# cat /etc/named.conf
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// See the BIND Administrator’s Reference Manual (ARM) for details about the
// configuration located in /usr/share/doc/bind-{version}/Bv9ARM.html

options {
listen-on port 53 { 192.168.1.254; };
listen-on port 53 { 192.168.4.254; };
//listen-on-v6 port 53 { ::1; };
directory “/var/named”;
dump-file “/var/named/data/cache_dump.db”;
statistics-file “/var/named/data/named_stats.txt”;
memstatistics-file “/var/named/data/named_mem_stats.txt”;
allow-query { any; };

/*
– If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
– If you are building a RECURSIVE (caching) DNS server, you need to enable
recursion.
– If your recursive DNS server has a public IP address, you MUST enable access
control to limit queries to your legitimate users. Failing to do so will
cause your server to become part of large scale DNS amplification
attacks. Implementing BCP38 within your network would greatly
reduce such attack surface
*/
recursion yes;
forwarders { 176.202.0.227; };
dnssec-enable no;
dnssec-validation no;

/* Path to ISC DLV key */
bindkeys-file “/etc/named.iscdlv.key”;

managed-keys-directory “/var/named/dynamic”;

pid-file “/run/named/named.pid”;
session-keyfile “/run/named/session.key”;
};

logging {
channel default_debug {
file “data/named.run”;
severity dynamic;
};
};

zone “.” IN {
type hint;
file “named.ca”;
};

include “/etc/named.rfc1912.zones”;
include “/etc/named.root.key”;

[[email protected] images]# systemctl restart named

验证DNS,去3台虚拟机都去试一试,可以看到都可以了
虚拟机1
[[email protected] ~]# ping www.baidu.com
PING www.a.shifen.com (180.97.33.107) 56(84) bytes of data.
64 bytes from 180.97.33.107 (180.97.33.107): icmp_seq=1 ttl=53 time=39.0 ms
64 bytes from 180.97.33.107 (180.97.33.107): icmp_seq=2 ttl=53 time=39.1 ms
^C
— www.a.shifen.com ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 39.071/39.095/39.119/0.024 ms

虚拟机2
[[email protected] ~]# ping www.baidu.com
PING www.a.shifen.com (180.97.33.108) 56(84) bytes of data.
64 bytes from 180.97.33.108 (180.97.33.108): icmp_seq=1 ttl=53 time=35.6 ms
64 bytes from 180.97.33.108 (180.97.33.108): icmp_seq=2 ttl=53 time=63.1 ms
^C
— www.a.shifen.com ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 35.642/49.414/63.186/13.772 ms

虚拟机3
[[email protected] ~]# ping www.baidu.com
PING www.a.shifen.com (180.97.33.107) 56(84) bytes of data.
64 bytes from 180.97.33.107 (180.97.33.107): icmp_seq=1 ttl=53 time=39.6 ms
64 bytes from 180.97.33.107 (180.97.33.107): icmp_seq=2 ttl=53 time=40.9 ms
^C
— www.a.shifen.com ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 39.628/40.283/40.938/0.655 ms

第二步:两台虚拟机都配置静态IP和主机名,按照以下的要求
虚拟机1 openstack.tedu.cn 192.168.1.1
虚拟机2 nova.tedu.cn 192.168.1.2
已经配置好了,这里配置主机名
虚拟机1
[[email protected] ~]# hostnamectl set-hostname openstack.tedu.cn
[[email protected] ~]# exit
登出
Connection to 192.168.1.1 closed.
[[email protected] images]# ssh 192.168.1.1
[email protected]’s password:
Last login: Mon Oct 15 16:36:37 2018 from 192.168.1.254

虚拟机2
[[email protected] ~]# hostnamectl set-hostname nova.tedu.cn
[[email protected] ~]# exit
登出
Connection to 192.168.1.2 closed.
[[email protected] images]# ssh 192.168.1.2
[email protected]’s password:
Last login: Mon Oct 15 16:36:45 2018 from 192.168.1.254

第三步,修改本地HOSTS,添加域名解析
虚拟机1
[[email protected] ~]# vim /etc/hosts
[[email protected] ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.1 openstack.tedu.cn
192.168.1.2 nova.tedu.cn

虚拟机2
[[email protected] ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.1 openstack.tedu.cn
192.168.1.2 nova.tedu.cn

测试确认以下,可以相互PING通
[[email protected] ~]# ping nova.tedu.cn
PING nova.tedu.cn (192.168.1.2) 56(84) bytes of data.
64 bytes from nova.tedu.cn (192.168.1.2): icmp_seq=1 ttl=64 time=0.433 ms
64 bytes from nova.tedu.cn (192.168.1.2): icmp_seq=2 ttl=64 time=0.592 ms
^C
— nova.tedu.cn ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.433/0.512/0.592/0.082 ms
[[email protected] ~]#

[[email protected] ~]# ping openstack.tedu.cn
PING openstack.tedu.cn (192.168.1.1) 56(84) bytes of data.
64 bytes from openstack.tedu.cn (192.168.1.1): icmp_seq=1 ttl=64 time=0.428 ms
^C
— openstack.tedu.cn ping statistics —
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.428/0.428/0.428/0.000 ms

3 案例3:配置NTP服务器
3.1 问题

本案例要求配置NTP时间同步服务器:
将NTP服务与DNS服务部署在同一台主机上
确认NTP服务器的时区是东八区
确认NTP服务器的时间准确
计划安装openstack的服务器与NTP服务器进行时间校正
3.2 步骤

实现此案例需要按照如下步骤进行。
步骤一:配置NTP时间同步(真机操作)

[[email protected] ~]# yum -y install chrony
[[email protected] ~]# vim /etc/chrony.conf
server ntp1.aliyun.com iburst
bindacqaddress 0.0.0.0
allow 0/0 //允许所有人使用我的时间服务器
cmdallow 127.0.0.1 //控制指令
[[email protected] ~]# systemctl restart chronyd
[[email protected] ~]# netstat -antup | grep chronyd
udp 0 0 0.0.0.0:123 0.0.0.0:* 23036/chronyd
udp 0 0 127.0.0.1:323 0.0.0.0:* 23036/chronyd
[[email protected] ~]# chronyc sources -v //出现*号代表NTP时间可用
^* 120.25.115.20 2 6 17 62 -753us[-7003us] +/- 24ms

代码如下
安装软件包
[[email protected] images]# yum install -y chrony
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
软件包 chrony-3.2-2.el7.x86_64 已安装并且是最新版本
无须任何处理
配置配置文件,服务端
[[email protected] images]# vim /etc/chrony.conf
[[email protected] images]# grep -v “^#” /etc/chrony.conf | grep -v “^$”
server ntp1.aliyun.com iburst
bindacqaddress 0.0.0.0
allow 0/0
cmdallow 127.0.0.1
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
logdir /var/log/chrony

重启服务,并确认结果
[[email protected] images]# systemctl restart chronyd
[[email protected] images]# chronyc sources -v
210 Number of sources = 1

.– Source mode ‘^’ = server, ‘=’ = peer, ‘#’ = local clock.
/ .- Source state ‘*’ = current synced, ‘+’ = combined , ‘-‘ = not combined,
| / ‘?’ = unreachable, ‘x’ = time may be in error, ‘~’ = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) –. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 120.25.115.20 2 6 17 2 -468us[-2309us] +/- 19ms
[[email protected] images]#

虚拟机上操作
OPENSTACK节点
[[email protected] ~]# vim /etc/chrony.conf
[[email protected] ~]# grep -v “^#” /etc/chrony.conf | grep -v “^$”
server 192.168.1.254 iburst
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
logdir /var/log/chrony
[[email protected] ~]# systemctl restart chronyd
[[email protected] ~]# chronyc sources -v
210 Number of sources = 1

.– Source mode ‘^’ = server, ‘=’ = peer, ‘#’ = local clock.
/ .- Source state ‘*’ = current synced, ‘+’ = combined , ‘-‘ = not combined,
| / ‘?’ = unreachable, ‘x’ = time may be in error, ‘~’ = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) –. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* gateway 3 6 7 2 +904ns[-9579us] +/- 21ms

NOVA节点
[[email protected] ~]# vim /etc/chrony.conf
[[email protected] ~]# systemctl restart chronyd
[[email protected] ~]# chronyc sources -v
210 Number of sources = 1

.– Source mode ‘^’ = server, ‘=’ = peer, ‘#’ = local clock.
/ .- Source state ‘*’ = current synced, ‘+’ = combined , ‘-‘ = not combined,
| / ‘?’ = unreachable, ‘x’ = time may be in error, ‘~’ = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) –. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* gateway 3 6 7 1 -17us[ -258us] +/- 21ms

4 案例4:环境准备
4.1 问题

本案例要求准备基础环境,为安装openstack做准备:
准备openstack的基础环境
4.2 步骤

实现此案例需要按照如下步骤进行。
步骤一:准备基础环境

1)配置yum源
备注:只有系统源的gpgcheck=1,其他的都是gpgcheck=0)
[[email protected] ~]# scp /etc/yum.repos.d/local.repo \
192.168.1.1:/etc/yum.repos.d/ //拷贝给openstack.tedu.cn这台主机
[[email protected] ~]# scp /etc/yum.repos.d/local.repo \
192.168.1.2:/etc/yum.repos.d/ //拷贝给nova.tedu.cn这台主机
步骤二:配置ip

备注: 配置eth0为公共网络,网络地址192.168.1.0/24(已经配置过)
配置eth1为隧道接口,网络地址192.168.2.0/24
1)给openstack.tedu.cn主机添加eth1网卡
[[email protected] networks]# virsh -c qemu:///system attach-interface openstack bridge private2 –model virtio
Interface attached successfully //添加成功
[[email protected] ~]# cd /etc/sysconfig/network-scripts
[[email protected] network-scripts]# cp ifcfg-eth0 ifcfg-eth1
[[email protected] network-scripts]# vim ifcfg-eth1
# Generated by dracut initrd
DEVICE=”eth1″
ONBOOT=”yes”
IPV6INIT=”no”
IPV4_FAILURE_FATAL=”no”
NM_CONTROLLED=”no”
TYPE=”Ethernet”
BOOTPROTO=”static”
IPADDR=”192.168.2.1″
PREFIX=24
GATEWAY=192.168.1.254
[[email protected] network-scripts]# systemctl restart network
2)给nova.tedu.cn主机添加eth1网卡
[[email protected] networks]# virsh -c qemu:///system attach-interface nova bridge private2 –model virtio
Interface attached successfully //添加成功
[[email protected] ~]# cd /etc/sysconfig/network-scripts
[[email protected] network-scripts]# cp ifcfg-eth0 ifcfg-eth1
[[email protected] network-scripts]# vim ifcfg-eth1
# Generated by dracut initrd
DEVICE=”eth1″
ONBOOT=”yes”
IPV6INIT=”no”
IPV4_FAILURE_FATAL=”no”
NM_CONTROLLED=”no”
TYPE=”Ethernet”
BOOTPROTO=”static”
IPADDR=”192.168.2.2″
PREFIX=24
GATEWAY=192.168.1.254
[[email protected] network-scripts]# systemctl restart network
3)配置卷组(openstack主机上面操作)
[[email protected] images]# qemu-img create -f qcow2 disk.img 50G
Formatting ‘disk.img’, fmt=qcow2 size=53687091200 encryption=off cluster_size=65536 lazy_refcounts=off
[[email protected] networks]# virsh -c qemu:///system attach-disk openstack \
/var/lib/libvirt/images/disk.img vdb –subdriver qcow2 –sourcetype file
Disk attached successfully //添加成功
[[email protected] ~]# yum install lvm2
[[email protected] ~]# pvcreate /dev/vdb
[[email protected] ~]# vgcreate cinder-volumes /dev/vdb
4)安装openstack的依赖包(openstack.tedu.cn和nova.tedu.cn主机上面
[[email protected] ~]# yum install -y qemu-kvm libvirt-client libvirt-daemon libvirt-daemon-driver-qemu python-setuptools
[[email protected] ~]# yum install -y qemu-kvm libvirt-client libvirt-daemon libvirt-daemon-driver-qemu python-setuptools

代码如下:
1、配置YUM源,再说一遍,只有第一个system也就是那个centos的源需要gpgcheck=0
[[email protected] images]# scp /etc/yum.repos.d/local.repo 192.168.1.1:/etc/yum.repos.d/
[email protected]’s password:
local.repo 100% 1524 2.5MB/s 00:00
[[email protected] images]# scp /etc/yum.repos.d/local.repo 192.168.1.2:/etc/yum.repos.d/
[email protected]’s password:
local.repo 100% 1524 1.9MB/s 00:00
[[email protected] images]#

openstack节点确认
[[email protected] yum.repos.d]# yum repolist
已加载插件:fastestmirror
10local_rhscon-2-main-rpms | 2.9 kB 00:00:00
1local_devtools-rpms | 2.9 kB 00:00:00
2local_optools-rpms | 2.9 kB 00:00:00
3local_rpms | 2.9 kB 00:00:00
4local_tools-rpms | 2.9 kB 00:00:00
5local_mon-rpms | 2.9 kB 00:00:00
6local_osd-rpms | 2.9 kB 00:00:00
7local_rhceph-2-tools-rpms | 2.9 kB 00:00:00
8local_agent-rpms | 2.9 kB 00:00:00
9local_installer-rpms | 2.9 kB 00:00:00
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
local_extras | 2.9 kB 00:00:00
local_repo | 3.6 kB 00:00:00
http://mirrors.cqu.edu.cn/CentOS/7.5.1804/updates/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.cqu.edu.cn/CentOS/7.5.1804/updates/x86_64/repodata/repomd.xml: (28, ‘Connection timed out after 30001 milliseconds’)
正在尝试其它镜像。
updates | 3.4 kB 00:00:00
(1/17): 10local_rhscon-2-main-rpms/primary_db | 21 kB 00:00:00
(2/17): 1local_devtools-rpms/primary_db | 3.7 kB 00:00:00
(3/17): 5local_mon-rpms/primary_db | 37 kB 00:00:00
(4/17): 2local_optools-rpms/primary_db | 41 kB 00:00:00
(5/17): 6local_osd-rpms/primary_db | 29 kB 00:00:00
(6/17): 3local_rpms/primary_db | 318 kB 00:00:00
(7/17): 4local_tools-rpms/primary_db | 35 kB 00:00:00
(8/17): 8local_agent-rpms/primary_db | 13 kB 00:00:00
(9/17): 7local_rhceph-2-tools-rpms/primary_db | 30 kB 00:00:00
(10/17): local_extras/primary_db | 43 kB 00:00:00
(11/17): 9local_installer-rpms/primary_db | 44 kB 00:00:00
(12/17): local_repo/group_gz | 156 kB 00:00:00
(13/17): local_repo/primary_db | 5.7 MB 00:00:00
(14/17): extras/7/x86_64/primary_db | 204 kB 00:00:00
(15/17): base/7/x86_64/group_gz | 166 kB 00:00:01
(16/17): updates/7/x86_64/primary_db | 6.0 MB 00:00:01
(17/17): base/7/x86_64/primary_db | 5.9 MB 00:00:01
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
源标识 源名称 状态
10local_rhscon-2-main-rpms rhscon-2-main-rpms 29
1local_devtools-rpms devtools-rpms 3
2local_optools-rpms optools-rpms 99
3local_rpms rpms 680
4local_tools-rpms tools-rpms 84
5local_mon-rpms mon-rpms 41
6local_osd-rpms osd-rpms 28
7local_rhceph-2-tools-rpms rhceph-2-tools-rpms 35
8local_agent-rpms agent-rpms 19
9local_installer-rpms installer-rpms 46
base/7/x86_64 CentOS-7 – Base 9,911
extras/7/x86_64 CentOS-7 – Extras 432
local_extras extras 76
local_repo CentOS-7 – Base 9,591
updates/7/x86_64 CentOS-7 – Updates 1,543
repolist: 22,617

nova节点
[[email protected] ~]# ll /etc/yum.repos.d/
总用量 32
-rw-r–r–. 1 root root 1664 8月 30 2017 CentOS-Base.repo
-rw-r–r–. 1 root root 1309 8月 30 2017 CentOS-CR.repo
-rw-r–r–. 1 root root 649 8月 30 2017 CentOS-Debuginfo.repo
-rw-r–r–. 1 root root 314 8月 30 2017 CentOS-fasttrack.repo
-rw-r–r–. 1 root root 630 8月 30 2017 CentOS-Media.repo
-rw-r–r–. 1 root root 1331 8月 30 2017 CentOS-Sources.repo
-rw-r–r–. 1 root root 3830 8月 30 2017 CentOS-Vault.repo
-rw-r–r– 1 root root 1524 10月 15 17:13 local.repo
[[email protected] ~]# yum repolist
已加载插件:fastestmirror
10local_rhscon-2-main-rpms | 2.9 kB 00:00:00
1local_devtools-rpms | 2.9 kB 00:00:00
2local_optools-rpms | 2.9 kB 00:00:00
3local_rpms | 2.9 kB 00:00:00
4local_tools-rpms | 2.9 kB 00:00:00
5local_mon-rpms | 2.9 kB 00:00:00
6local_osd-rpms | 2.9 kB 00:00:00
7local_rhceph-2-tools-rpms | 2.9 kB 00:00:00
8local_agent-rpms | 2.9 kB 00:00:00
9local_installer-rpms | 2.9 kB 00:00:00
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
local_extras | 2.9 kB 00:00:00
local_repo | 3.6 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/17): 10local_rhscon-2-main-rpms/primary_db | 21 kB 00:00:00
(2/17): 2local_optools-rpms/primary_db | 41 kB 00:00:00
(3/17): 1local_devtools-rpms/primary_db | 3.7 kB 00:00:00
(4/17): 5local_mon-rpms/primary_db | 37 kB 00:00:00
(5/17): 6local_osd-rpms/primary_db | 29 kB 00:00:00
(6/17): 7local_rhceph-2-tools-rpms/primary_db | 30 kB 00:00:00
(7/17): 8local_agent-rpms/primary_db | 13 kB 00:00:00
(8/17): 4local_tools-rpms/primary_db | 35 kB 00:00:00
(9/17): 3local_rpms/primary_db | 318 kB 00:00:00
(10/17): 9local_installer-rpms/primary_db | 44 kB 00:00:00
(11/17): local_extras/primary_db | 43 kB 00:00:00
(12/17): local_repo/group_gz | 156 kB 00:00:00
(13/17): local_repo/primary_db | 5.7 MB 00:00:00
(14/17): extras/7/x86_64/primary_db | 204 kB 00:00:00
(15/17): base/7/x86_64/primary_db | 5.9 MB 00:00:01
(16/17): base/7/x86_64/group_gz | 166 kB 00:00:01
(17/17): updates/7/x86_64/primary_db | 6.0 MB 00:00:01
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
源标识 源名称 状态
10local_rhscon-2-main-rpms rhscon-2-main-rpms 29
1local_devtools-rpms devtools-rpms 3
2local_optools-rpms optools-rpms 99
3local_rpms rpms 680
4local_tools-rpms tools-rpms 84
5local_mon-rpms mon-rpms 41
6local_osd-rpms osd-rpms 28
7local_rhceph-2-tools-rpms rhceph-2-tools-rpms 35
8local_agent-rpms agent-rpms 19
9local_installer-rpms installer-rpms 46
base/7/x86_64 CentOS-7 – Base 9,911
extras/7/x86_64 CentOS-7 – Extras 432
local_extras extras 76
local_repo CentOS-7 – Base 9,591
updates/7/x86_64 CentOS-7 – Updates 1,543
repolist: 22,617

配置2台虚拟机的IP地址
[[email protected] network-scripts]# cp ifcfg-eth0 ifcfg-eth1
[[email protected] network-scripts]# vim ifcfg-eth1
[[email protected] network-scripts]# systemctl restart network

[[email protected] network-scripts]# cat ifcfg-eth1
# Generated by dracut initrd
DEVICE=”eth1″
NAME=”eth1″
ONBOOT=yes
IPV6INIT=no
TYPE=Ethernet
BOOTPROTO=”static”
IPADDR=”192.168.4.1″
PREFIX=”24″
GATEWAY=”192.168.4.254″
[[email protected] network-scripts]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::5054:ff:fe6e:9202 prefixlen 64 scopeid 0x20<link>
ether 52:54:00:6e:92:02 txqueuelen 1000 (Ethernet)
RX packets 16766 bytes 20783335 (19.8 MiB)
RX errors 0 dropped 3935 overruns 0 frame 0
TX packets 8759 bytes 763048 (745.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.4.1 netmask 255.255.255.0 broadcast 192.168.4.255
inet6 fe80::5054:ff:fe3b:717d prefixlen 64 scopeid 0x20<link>
ether 52:54:00:3b:71:7d txqueuelen 1000 (Ethernet)
RX packets 1649 bytes 86880 (84.8 KiB)
RX errors 0 dropped 1579 overruns 0 frame 0
TX packets 59 bytes 3750 (3.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 7 bytes 784 (784.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7 bytes 784 (784.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

NOVA节点
[[email protected] ~]# cd /etc/sysconfig/network-scripts/
[[email protected] network-scripts]# cp ifcfg-eth0 ifcfg-eth1
[[email protected] network-scripts]# vim ifcfg-eth1
[[email protected] network-scripts]# systemctl restart network
[[email protected] network-scripts]# cat ifcfg-eth1
# Generated by dracut initrd
DEVICE=”eth1″
NAME=”eth1″
ONBOOT=yes
IPV6INIT=no
TYPE=Ethernet
BOOTPROTO=”static”
IPADDR=”192.168.4.2″
PREFIX=”24″
GATEWAY=”192.168.1.254″
[[email protected] network-scripts]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::5054:ff:fe50:6852 prefixlen 64 scopeid 0x20<link>
ether 52:54:00:50:68:52 txqueuelen 1000 (Ethernet)
RX packets 15736 bytes 20715008 (19.7 MiB)
RX errors 0 dropped 3965 overruns 0 frame 0
TX packets 9061 bytes 782271 (763.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.4.2 netmask 255.255.255.0 broadcast 192.168.4.255
inet6 fe80::5054:ff:feb7:2a06 prefixlen 64 scopeid 0x20<link>
ether 52:54:00:b7:2a:06 txqueuelen 1000 (Ethernet)
RX packets 1589 bytes 83626 (81.6 KiB)
RX errors 0 dropped 1529 overruns 0 frame 0
TX packets 58 bytes 3820 (3.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 6 bytes 560 (560.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6 bytes 560 (560.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

测试一下,相互能够PING通
[[email protected] network-scripts]# ping 192.168.4.254
PING 192.168.4.254 (192.168.4.254) 56(84) bytes of data.
64 bytes from 192.168.4.254: icmp_seq=1 ttl=64 time=0.456 ms
^C
— 192.168.4.254 ping statistics —
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.456/0.456/0.456/0.000 ms
[[email protected] network-scripts]# ping 192.168.4.2
PING 192.168.4.2 (192.168.4.2) 56(84) bytes of data.
64 bytes from 192.168.4.2: icmp_seq=1 ttl=64 time=0.554 ms
64 bytes from 192.168.4.2: icmp_seq=2 ttl=64 time=0.522 ms
^C
— 192.168.4.2 ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.522/0.538/0.554/0.016 ms

[[email protected] network-scripts]# ping 192.168.4.254
PING 192.168.4.254 (192.168.4.254) 56(84) bytes of data.
64 bytes from 192.168.4.254: icmp_seq=1 ttl=64 time=0.345 ms
64 bytes from 192.168.4.254: icmp_seq=2 ttl=64 time=0.255 ms
^C
— 192.168.4.254 ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.255/0.300/0.345/0.045 ms
[[email protected] network-scripts]# ping 192.168.4.1
PING 192.168.4.1 (192.168.4.1) 56(84) bytes of data.
64 bytes from 192.168.4.1: icmp_seq=1 ttl=64 time=0.469 ms
64 bytes from 192.168.4.1: icmp_seq=2 ttl=64 time=0.646 ms
^C
— 192.168.4.1 ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.469/0.557/0.646/0.091 ms

配置卷组
OPENSTACK节点上创建cinder-volumes卷组
[[email protected] ~]# yum install -y lvm2
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
–> 正在检查事务
—> 软件包 lvm2.x86_64.7.2.02.177-4.el7 将被 安装
–> 正在处理依赖关系 lvm2-libs = 7:2.02.177-4.el7,它被软件包 7:lvm2-2.02.177-4.el7.x86_64 需要
–> 正在处理依赖关系 device-mapper-persistent-data >= 0.7.0-0.1.rc6,它被软件包 7:lvm2-2.02.177-4.el7.x86_64 需要
–> 正在处理依赖关系 liblvm2app.so.2.2(Base)(64bit),它被软件包 7:lvm2-2.02.177-4.el7.x86_64 需要
–> 正在处理依赖关系 libdevmapper.so.1.02(DM_1_02_141)(64bit),它被软件包 7:lvm2-2.02.177-4.el7.x86_64 需要
–> 正在处理依赖关系 libdevmapper-event.so.1.02(Base)(64bit),它被软件包 7:lvm2-2.02.177-4.el7.x86_64 需要
–> 正在处理依赖关系 liblvm2app.so.2.2()(64bit),它被软件包 7:lvm2-2.02.177-4.el7.x86_64 需要
–> 正在处理依赖关系 libdevmapper-event.so.1.02()(64bit),它被软件包 7:lvm2-2.02.177-4.el7.x86_64 需要
–> 正在检查事务
—> 软件包 device-mapper-event-libs.x86_64.7.1.02.146-4.el7 将被 安装
—> 软件包 device-mapper-libs.x86_64.7.1.02.140-8.el7 将被 升级
–> 正在处理依赖关系 device-mapper-libs = 7:1.02.140-8.el7,它被软件包 7:device-mapper-1.02.140-8.el7.x86_64 需要
—> 软件包 device-mapper-libs.x86_64.7.1.02.146-4.el7 将被 更新
—> 软件包 device-mapper-persistent-data.x86_64.0.0.7.3-3.el7 将被 安装
–> 正在处理依赖关系 libaio.so.1(LIBAIO_0.4)(64bit),它被软件包 device-mapper-persistent-data-0.7.3-3.el7.x86_64 需要
–> 正在处理依赖关系 libaio.so.1(LIBAIO_0.1)(64bit),它被软件包 device-mapper-persistent-data-0.7.3-3.el7.x86_64 需要
–> 正在处理依赖关系 libaio.so.1()(64bit),它被软件包 device-mapper-persistent-data-0.7.3-3.el7.x86_64 需要
—> 软件包 lvm2-libs.x86_64.7.2.02.177-4.el7 将被 安装
–> 正在处理依赖关系 device-mapper-event = 7:1.02.146-4.el7,它被软件包 7:lvm2-libs-2.02.177-4.el7.x86_64 需要
–> 正在检查事务
—> 软件包 device-mapper.x86_64.7.1.02.140-8.el7 将被 升级
—> 软件包 device-mapper.x86_64.7.1.02.146-4.el7 将被 更新
—> 软件包 device-mapper-event.x86_64.7.1.02.146-4.el7 将被 安装
—> 软件包 libaio.x86_64.0.0.3.109-13.el7 将被 安装
–> 解决依赖关系完成

依赖关系解决

===========================================================================================
Package 架构 版本 源 大小
===========================================================================================
正在安装:
lvm2 x86_64 7:2.02.177-4.el7 base 1.3 M
为依赖而安装:
device-mapper-event x86_64 7:1.02.146-4.el7 base 185 k
device-mapper-event-libs x86_64 7:1.02.146-4.el7 base 184 k
device-mapper-persistent-data x86_64 0.7.3-3.el7 base 405 k
libaio x86_64 0.3.109-13.el7 base 24 k
lvm2-libs x86_64 7:2.02.177-4.el7 base 1.0 M
为依赖而更新:
device-mapper x86_64 7:1.02.146-4.el7 base 289 k
device-mapper-libs x86_64 7:1.02.146-4.el7 base 316 k

事务概要
===========================================================================================
安装 1 软件包 (+5 依赖软件包)
升级 ( 2 依赖软件包)

总下载量:3.7 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/8): device-mapper-event-1.02.146-4.el7.x86_64.rpm | 185 kB 00:00:00
(2/8): device-mapper-event-libs-1.02.146-4.el7.x86_64.rpm | 184 kB 00:00:00
(3/8): device-mapper-1.02.146-4.el7.x86_64.rpm | 289 kB 00:00:00
(4/8): device-mapper-libs-1.02.146-4.el7.x86_64.rpm | 316 kB 00:00:00
(5/8): libaio-0.3.109-13.el7.x86_64.rpm | 24 kB 00:00:00
(6/8): device-mapper-persistent-data-0.7.3-3.el7.x86_64.rpm | 405 kB 00:00:00
(7/8): lvm2-2.02.177-4.el7.x86_64.rpm | 1.3 MB 00:00:00
(8/8): lvm2-libs-2.02.177-4.el7.x86_64.rpm | 1.0 MB 00:00:00
——————————————————————————————-
总计 3.3 MB/s | 3.7 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在更新 : 7:device-mapper-libs-1.02.146-4.el7.x86_64 1/10
正在更新 : 7:device-mapper-1.02.146-4.el7.x86_64 2/10
正在安装 : 7:device-mapper-event-libs-1.02.146-4.el7.x86_64 3/10
正在安装 : 7:device-mapper-event-1.02.146-4.el7.x86_64 4/10
正在安装 : 7:lvm2-libs-2.02.177-4.el7.x86_64 5/10
正在安装 : libaio-0.3.109-13.el7.x86_64 6/10
正在安装 : device-mapper-persistent-data-0.7.3-3.el7.x86_64 7/10
正在安装 : 7:lvm2-2.02.177-4.el7.x86_64 8/10
Created symlink from /etc/systemd/system/sysinit.target.wants/lvm2-lvmpolld.socket to /usr/lib/systemd/system/lvm2-lvmpolld.socket.
清理 : 7:device-mapper-libs-1.02.140-8.el7.x86_64 9/10
清理 : 7:device-mapper-1.02.140-8.el7.x86_64 10/10
验证中 : device-mapper-persistent-data-0.7.3-3.el7.x86_64 1/10
验证中 : libaio-0.3.109-13.el7.x86_64 2/10
验证中 : 7:device-mapper-1.02.146-4.el7.x86_64 3/10
验证中 : 7:device-mapper-event-1.02.146-4.el7.x86_64 4/10
验证中 : 7:device-mapper-event-libs-1.02.146-4.el7.x86_64 5/10
验证中 : 7:lvm2-libs-2.02.177-4.el7.x86_64 6/10
验证中 : 7:lvm2-2.02.177-4.el7.x86_64 7/10
验证中 : 7:device-mapper-libs-1.02.146-4.el7.x86_64 8/10
验证中 : 7:device-mapper-1.02.140-8.el7.x86_64 9/10
验证中 : 7:device-mapper-libs-1.02.140-8.el7.x86_64 10/10

已安装:
lvm2.x86_64 7:2.02.177-4.el7

作为依赖被安装:
device-mapper-event.x86_64 7:1.02.146-4.el7
device-mapper-event-libs.x86_64 7:1.02.146-4.el7
device-mapper-persistent-data.x86_64 0:0.7.3-3.el7
libaio.x86_64 0:0.3.109-13.el7
lvm2-libs.x86_64 7:2.02.177-4.el7

作为依赖被升级:
device-mapper.x86_64 7:1.02.146-4.el7 device-mapper-libs.x86_64 7:1.02.146-4.el7

完毕!
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# pvcreate /dev/vdb
Physical volume “/dev/vdb” successfully created.
[[email protected] ~]# vgcreate cinder-volumes /dev/vdb
Volume group “cinder-volumes” successfully created
[[email protected] ~]# vgs
VG #PV #LV #SN Attr VSize VFree
cinder-volumes 1 0 0 wz–n- <20.00g <20.00g

安装依赖包
openstak和nova上面都要安装依赖包
yum install -y qemu-kvm libvirt-client libvirt-daemon libvirt-daemon-driver-qemu python-setuptools

已安装:
libvirt-client.x86_64 0:3.9.0-14.el7_5.8
libvirt-daemon.x86_64 0:3.9.0-14.el7_5.8
libvirt-daemon-driver-qemu.x86_64 0:3.9.0-14.el7_5.8
python-setuptools.noarch 0:0.9.8-7.el7
qemu-kvm-rhev.x86_64 10:2.6.0-28.el7_3.6

作为依赖被安装:
autogen-libopts.x86_64 0:5.18-5.el7
avahi-libs.x86_64 0:0.6.31-19.el7
boost-iostreams.x86_64 0:1.53.0-27.el7
boost-random.x86_64 0:1.53.0-27.el7
boost-system.x86_64 0:1.53.0-27.el7
boost-thread.x86_64 0:1.53.0-27.el7
bzip2.x86_64 0:1.0.6-13.el7
celt051.x86_64 0:0.5.1.3-8.el7
cyrus-sasl.x86_64 0:2.1.26-23.el7
cyrus-sasl-gssapi.x86_64 0:2.1.26-23.el7
dnsmasq.x86_64 0:2.76-5.el7
flac-libs.x86_64 0:1.3.0-5.el7_1
glusterfs.x86_64 0:3.8.4-54.15.el7.centos
glusterfs-api.x86_64 0:3.8.4-54.15.el7.centos
glusterfs-client-xlators.x86_64 0:3.8.4-54.15.el7.centos
glusterfs-libs.x86_64 0:3.8.4-54.15.el7.centos
gnutls-dane.x86_64 0:3.3.26-9.el7
gnutls-utils.x86_64 0:3.3.26-9.el7
gperftools-libs.x86_64 0:2.6.1-1.el7
gsm.x86_64 0:1.0.13-11.el7
gssproxy.x86_64 0:0.7.0-17.el7
ipxe-roms-qemu.noarch 0:20170123-1.git4e85b27.el7_4.1
keyutils.x86_64 0:1.5.8-3.el7
libICE.x86_64 0:1.0.9-9.el7
libSM.x86_64 0:1.2.2-2.el7
libX11.x86_64 0:1.6.5-1.el7
libX11-common.noarch 0:1.6.5-1.el7
libXau.x86_64 0:1.0.8-2.1.el7
libXext.x86_64 0:1.3.3-3.el7
libXi.x86_64 0:1.7.9-1.el7
libXtst.x86_64 0:1.2.3-1.el7
libaio.x86_64 0:0.3.109-13.el7
libasyncns.x86_64 0:0.8-7.el7
libbasicobjects.x86_64 0:0.1.1-29.el7
libcacard.x86_64 40:2.5.2-2.el7
libcgroup.x86_64 0:0.41-15.el7
libcollection.x86_64 0:0.7.0-29.el7
libevent.x86_64 0:2.0.21-4.el7
libibverbs.x86_64 0:15-7.el7_5
libini_config.x86_64 0:1.3.1-29.el7
libiscsi.x86_64 0:1.9.0-7.el7
libjpeg-turbo.x86_64 0:1.2.90-5.el7
libnfsidmap.x86_64 0:0.25-19.el7
libogg.x86_64 2:1.3.0-7.el7
libpath_utils.x86_64 0:0.2.1-29.el7
libpcap.x86_64 14:1.5.3-11.el7
libpng.x86_64 2:1.5.13-7.el7_2
librados2.x86_64 1:10.2.3-17.el7cp
librbd1.x86_64 1:10.2.3-17.el7cp
librdmacm.x86_64 0:15-7.el7_5
libref_array.x86_64 0:0.1.5-29.el7
libsndfile.x86_64 0:1.0.25-10.el7
libtirpc.x86_64 0:0.2.4-0.10.el7
libusbx.x86_64 0:1.0.21-1.el7
libverto-libevent.x86_64 0:0.2.5-4.el7
libvirt-daemon-driver-network.x86_64 0:3.9.0-14.el7_5.8
libvirt-daemon-driver-storage-core.x86_64 0:3.9.0-14.el7_5.8
libvirt-libs.x86_64 0:3.9.0-14.el7_5.8
libvorbis.x86_64 1:1.3.3-8.el7.1
libxcb.x86_64 0:1.12-1.el7
lttng-ust.x86_64 0:2.4.1-1.el7cp
lz4.x86_64 0:1.7.5-2.el7
lzop.x86_64 0:1.03-10.el7
nfs-utils.x86_64 1:1.3.0-0.54.el7
nmap-ncat.x86_64 2:6.40-13.el7
numad.x86_64 0:0.5-18.20150602git.el7
opus.x86_64 0:1.0.2-6.el7
pciutils.x86_64 0:3.5.1-3.el7
pixman.x86_64 0:0.34.0-1.el7
pulseaudio-libs.x86_64 0:10.0-5.el7
python-backports.x86_64 0:1.0-8.el7
python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7
python-ipaddress.noarch 0:1.0.16-2.el7
qemu-img-rhev.x86_64 10:2.6.0-28.el7_3.6
qemu-kvm-common-rhev.x86_64 10:2.6.0-28.el7_3.6
quota.x86_64 1:4.01-17.el7
quota-nls.noarch 1:4.01-17.el7
radvd.x86_64 0:1.9.2-9.el7_5.4
rdma-core.x86_64 0:15-7.el7_5
rpcbind.x86_64 0:0.2.0-44.el7
seabios-bin.noarch 0:1.11.0-2.el7
seavgabios-bin.noarch 0:1.11.0-2.el7
sgabios-bin.noarch 1:0.20110622svn-4.el7
spice-server.x86_64 0:0.14.0-2.el7_5.5
tcp_wrappers.x86_64 0:7.6-77.el7
unbound-libs.x86_64 0:1.6.6-1.el7
usbredir.x86_64 0:0.7.1-3.el7
userspace-rcu.x86_64 0:0.7.9-2.el7rhgs
yajl.x86_64 0:2.0.4-4.el7

更新完毕:
selinux-policy.noarch 0:3.13.1-192.el7_5.6

作为依赖被升级:
cyrus-sasl-lib.x86_64 0:2.1.26-23.el7
dbus.x86_64 1:1.10.24-7.el7
dbus-libs.x86_64 1:1.10.24-7.el7
libselinux.x86_64 0:2.5-12.el7
libselinux-python.x86_64 0:2.5-12.el7
libselinux-utils.x86_64 0:2.5-12.el7
libsepol.x86_64 0:2.5-8.1.el7
pciutils-libs.x86_64 0:3.5.1-3.el7
policycoreutils.x86_64 0:2.5-22.el7
selinux-policy-targeted.noarch 0:3.13.1-192.el7_5.6

完毕!

安装packstack
已安装:
openstack-packstack.noarch 0:9.0.0-3.el7ost

作为依赖被安装:
PyYAML.x86_64 0:3.10-11.el7
augeas-libs.x86_64 0:1.4.0-5.el7_5.1
facter.x86_64 1:2.4.4-4.el7
hiera.noarch 0:1.3.4-1.el7
jbigkit-libs.x86_64 0:2.0-11.el7
libselinux-ruby.x86_64 0:2.5-12.el7
libtiff.x86_64 0:4.0.3-27.el7_3
libwebp.x86_64 0:0.3.0-7.el7
libyaml.x86_64 0:0.1.4-11.el7_0
openstack-packstack-puppet.noarch 0:9.0.0-3.el7ost
puppet.noarch 0:3.8.7-2.el7
puppet-aodh.noarch 0:9.5.0-1.el7ost
puppet-apache.noarch 0:1.10.0-2.05a0aacgit.el7ost
puppet-ceilometer.noarch 0:9.5.0-1.el7ost
puppet-certmonger.noarch 0:1.1.1-1.1157a7egit.el7ost
puppet-cinder.noarch 0:9.5.0-1.el7ost
puppet-concat.noarch 0:2.2.0-2.ba64361git.el7ost
puppet-corosync.noarch 0:5.0.0-1.f3ada25git.el7ost
puppet-firewall.noarch 0:1.8.1-2.e70157egit.el7ost
puppet-glance.noarch 0:9.5.0-2.el7ost
puppet-gnocchi.noarch 0:9.5.0-1.el7ost
puppet-heat.noarch 0:9.5.0-1.el7ost
puppet-horizon.noarch 0:9.5.0-1.el7ost
puppet-inifile.noarch 0:1.6.0-2.el7ost
puppet-ironic.noarch 0:9.5.0-1.el7ost
puppet-keystone.noarch 0:9.5.0-1.el7ost
puppet-manila.noarch 0:9.5.0-1.el7ost
puppet-memcached.noarch 0:2.8.1-1.bfa64e0git.el7ost
puppet-mongodb.noarch 0:0.16.0-1.el7ost
puppet-mysql.noarch 0:3.10.0-1.el7ost
puppet-neutron.noarch 0:9.5.0-1.el7ost
puppet-nova.noarch 0:9.5.0-2.el7ost
puppet-nssdb.noarch 0:1.0.1-1.el7ost
puppet-openstack_extras.noarch 0:9.5.0-1.el7ost
puppet-openstacklib.noarch 0:9.5.0-1.el7ost
puppet-oslo.noarch 0:9.5.0-1.el7ost
puppet-rabbitmq.noarch 0:5.6.0-1.057a013git.el7ost
puppet-redis.noarch 0:1.2.3-2.el7ost
puppet-remote.noarch 0:0.0.1-1.el7ost
puppet-rsync.noarch 0:0.4.0-1.8cc3c6fgit.el7ost
puppet-sahara.noarch 0:9.5.0-1.el7ost
puppet-ssh.noarch 0:2.9.1-1.el7ost
puppet-staging.noarch 0:1.0.4-1.b466d93git.el7ost
puppet-stdlib.noarch 0:4.13.1-3.f2492eegit.el7ost
puppet-swift.noarch 0:9.5.0-1.el7ost
puppet-sysctl.noarch 0:0.0.11-1.el7ost
puppet-tempest.noarch 0:9.4.0-1.el7ost
puppet-trove.noarch 0:9.5.0-1.el7ost
puppet-vcsrepo.noarch 0:1.4.0-2.cd6c3bcgit.el7ost
puppet-vswitch.noarch 0:5.4.0-1.el7ost
puppet-xinetd.noarch 0:2.0.0-2.f9d6e18git.el7ost
pyOpenSSL.noarch 0:0.15.1-1.el7ost
python-cffi.x86_64 0:1.6.0-5.el7
python-docutils.noarch 0:0.12-0.2.20140510svn7747.el7ost
python-enum34.noarch 0:1.0.4-1.el7
python-idna.noarch 0:2.4-1.el7
python-netaddr.noarch 0:0.7.18-1.el7ost
python-pbr.noarch 0:1.10.0-1.el7ost
python-pillow.x86_64 0:2.0.0-19.gitd1c6db8.el7
python-ply.noarch 0:3.4-11.el7
python-pycparser.noarch 0:2.14-1.el7
python-six.noarch 0:1.9.0-2.el7
python2-cryptography.x86_64 0:1.7.2-2.el7
python2-pyasn1.noarch 0:0.1.9-7.el7
ruby.x86_64 0:2.0.0.648-33.el7_4
ruby-augeas.x86_64 0:0.5.0-1.el7
ruby-irb.noarch 0:2.0.0.648-33.el7_4
ruby-libs.x86_64 0:2.0.0.648-33.el7_4
ruby-shadow.x86_64 0:1.4.1-22.el7
rubygem-bigdecimal.x86_64 0:1.2.0-33.el7_4
rubygem-io-console.x86_64 0:0.4.2-33.el7_4
rubygem-json.x86_64 0:1.7.7-33.el7_4
rubygem-psych.x86_64 0:2.0.0-33.el7_4
rubygem-rdoc.noarch 0:4.0.0-33.el7_4
rubygems.noarch 0:2.0.14.1-33.el7_4

完毕!

安装openstack
[[email protected] ~]# yum install -y openstack-packstack
[[email protected] ~]# packstack –gen-answer-file answer.ini
//answer.ini与answer.txt是一样的,只是用vim打开answer.ini文件有颜色
Packstack changed given value to required value /root/.ssh/id_rsa.pub
[[email protected] ~]# vim answer.ini
11 CONFIG_DEFAULT_PASSWORD=redhat //密码
42 CONFIG_SWIFT_INSTALL=n
75 CONFIG_NTP_SERVERS=192.168.1.3 //时间服务器的地址
554 CONFIG_CINDER_VOLUMES_CREATE=n //创建卷,已经手动创建过了
840 CONFIG_NEUTRON_ML2_TYPE_DRIVERS=flat,vxlan //驱动类型
876 CONFIG_NEUTRON_ML2_VXLAN_GROUP=239.1.1.5
//设置组播地址,最后一个随意不能为0和255,其他固定
910 CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=physnet1:br-ex //物理网桥的名称
921 CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:eth0
//br-ex桥的名称与eth0连接,管理eth0,网桥与哪个物理网卡连接
936 CONFIG_NEUTRON_OVS_TUNNEL_IF=eth1
1179 CONFIG_PROVISION_DEMO=n //DEMO是否测试
[[email protected] ~]# packstack –answer-file=answer.ini
**** Installation completed successfully ****** //出现这个为成功

[[email protected] ~]# packstack –answer-file=answer.ini
Welcome to the Packstack setup utility

The installation log file is available at: /var/tmp/packstack/20181015-184938-5g98kf/openstack-setup.log

Installing:
Clean Up [ DONE ]
Discovering ip protocol version [ DONE ]
Setting up ssh keys [ DONE ]
Preparing servers [ DONE ]
Pre installing Puppet and discovering hosts’ details [ DONE ]
Preparing pre-install entries [ DONE ]
Installing time synchronization via NTP [ DONE ]
Setting up CACERT [ DONE ]
Preparing AMQP entries [ DONE ]
Preparing MariaDB entries [ DONE ]
Fixing Keystone LDAP config parameters to be undef if empty[ DONE ]
Preparing Keystone entries [ DONE ]
Preparing Glance entries [ DONE ]
Checking if the Cinder server has a cinder-volumes vg[ DONE ]
Preparing Cinder entries [ DONE ]
Preparing Nova API entries [ DONE ]
Creating ssh keys for Nova migration [ DONE ]
Gathering ssh host keys for Nova migration [ DONE ]
Preparing Nova Compute entries [ DONE ]
Preparing Nova Scheduler entries [ DONE ]
Preparing Nova VNC Proxy entries [ DONE ]
Preparing OpenStack Network-related Nova entries [ DONE ]
Preparing Nova Common entries [ DONE ]
Preparing Neutron LBaaS Agent entries [ DONE ]
Preparing Neutron API entries [ DONE ]
Preparing Neutron L3 entries [ DONE ]
Preparing Neutron L2 Agent entries [ DONE ]
Preparing Neutron DHCP Agent entries [ DONE ]
Preparing Neutron Metering Agent entries [ DONE ]
Checking if NetworkManager is enabled and running [ DONE ]
Preparing OpenStack Client entries [ DONE ]
Preparing Horizon entries [ DONE ]
Preparing Gnocchi entries [ DONE ]
Preparing MongoDB entries [ DONE ]
Preparing Redis entries [ DONE ]
Preparing Ceilometer entries [ DONE ]
Preparing Aodh entries [ DONE ]
Preparing Puppet manifests [ DONE ]
Copying Puppet modules and manifests [ DONE ]
Applying 192.168.1.1_controller.pp
192.168.1.1_controller.pp: [ DONE ]
Applying 192.168.1.1_network.pp
192.168.1.1_network.pp: [ DONE ]
Applying 192.168.1.1_compute.pp
192.168.1.1_compute.pp: [ DONE ]
Applying Puppet manifests [ DONE ]
Finalizing [ DONE ]

**** Installation completed successfully ******

Additional information:
* File /root/keystonerc_admin has been created on OpenStack client host 192.168.1.1. To use the command line tools you need to source the file.
* To access the OpenStack Dashboard browse to http://192.168.1.1/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
* The installation log file is available at: /var/tmp/packstack/20181015-184938-5g98kf/openstack-setup.log
* The generated manifests are available at: /var/tmp/packstack/20181015-184938-5g98kf/manifests

6 案例6:网络管理
6.1 问题

本案例要求运用OVS完成以下配置:
查看外部OVS网桥及其端口
验证OVS配置
6.2 步骤

实现此案例需要按照如下步骤进行。
步骤一:查看外部OVS网桥

1)查看br-ex网桥配置(br-ex为OVS网桥设备)
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-br-ex
ONBOOT=”yes”
NM_CONTROLLED=”no”
IPADDR=”192.168.1.1″
PREFIX=24
GATEWAY=192.168.1.254
DEVICE=br-ex
NAME=br-ex
DEVICETYPE=ovs
OVSBOOTPROTO=”static”
TYPE=OVSBridge
2)查看eth0网卡配置(该网卡为OVS网桥的接口)
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
NAME=eth0
DEVICETYPE=ovs
TYPE=OVSPort
OVS_BRIDGE=br-ex
ONBOOT=yes
BOOTPROTO=none
3)验证OVS配置
[[email protected] ~]# ovs-vsctl show
Bridge br-ex
Controller “tcp:127.0.0.1:6633”
is_connected: true
fail_mode: secure
Port br-ex
Interface br-ex
type: internal
Port phy-br-ex
Interface phy-br-ex
type: patch
options: {peer=int-br-ex}
Port “eth0”
Interface “eth0”
ovs_version: “2.5.0”

查看是否多出来一个br-ex网桥,同时,eth0也发生了变化
[[email protected] ~]# ifconfig
br-ex: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::5c41:b0ff:fee4:9747 prefixlen 64 scopeid 0x20<link>
ether 5e:41:b0:e4:97:47 txqueuelen 1000 (Ethernet)
RX packets 13106 bytes 19703671 (18.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11124 bytes 920054 (898.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::5054:ff:fe6e:9202 prefixlen 64 scopeid 0x20<link>
ether 52:54:00:6e:92:02 txqueuelen 1000 (Ethernet)
RX packets 51163 bytes 202216431 (192.8 MiB)
RX errors 0 dropped 6677 overruns 0 frame 0
TX packets 36048 bytes 3566633 (3.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.4.1 netmask 255.255.255.0 broadcast 192.168.4.255
inet6 fe80::5054:ff:fe3b:717d prefixlen 64 scopeid 0x20<link>
ether 52:54:00:3b:71:7d txqueuelen 1000 (Ethernet)
RX packets 111913 bytes 169743598 (161.8 MiB)
RX errors 0 dropped 4324 overruns 0 frame 0
TX packets 87235 bytes 7099466 (6.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 94162 bytes 18139708 (17.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 94162 bytes 18139708 (17.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-br-ex
ONBOOT=yes
IPADDR=”192.168.1.1″
PREFIX=”24″
GATEWAY=”192.168.1.254″
DEVICE=br-ex
NAME=br-ex
DEVICETYPE=ovs
OVSBOOTPROTO=
TYPE=OVSBridge
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth
cat: /etc/sysconfig/network-scripts/ifcfg-eth: 没有那个文件或目录
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
NAME=eth0
DEVICETYPE=ovs
TYPE=OVSPort
OVS_BRIDGE=br-ex
ONBOOT=yes
BOOTPROTO=none

验证OVS配置
[[email protected] ~]# ovs-vsctl show
07aae1f6-4e1a-4567-aa77-5c878975055f
Manager “ptcp:6640:127.0.0.1”
is_connected: true
Bridge br-int
Controller “tcp:127.0.0.1:6633”
is_connected: true
fail_mode: secure
Port int-br-ex
Interface int-br-ex
type: patch
options: {peer=phy-br-ex}
Port br-int
Interface br-int
type: internal
Port patch-tun
Interface patch-tun
type: patch
options: {peer=patch-int}
Bridge br-ex
Controller “tcp:127.0.0.1:6633”
is_connected: true
fail_mode: secure
Port phy-br-ex
Interface phy-br-ex
type: patch
options: {peer=int-br-ex}
Port “eth0”
Interface “eth0”
Port br-ex
Interface br-ex
type: internal
Bridge br-tun
Controller “tcp:127.0.0.1:6633”
is_connected: true
fail_mode: secure
Port br-tun
Interface br-tun
type: internal
Port patch-int
Interface patch-int
type: patch
options: {peer=patch-tun}
ovs_version: “2.5.0”

7 案例7:管理项目
7.1 问题

本案例要求通过Horizon完成以下操作:
创建名为myproject的项目
查看项目信息
更新vcpu配额为30
删除myproject
7.2 步骤

实现此案例需要按照如下步骤进行。
步骤一:浏览器访问openstack

1)浏览器访问
[[email protected] conf.d]# firefox 192.168.1.1 //访问失败
2)需要改配置文件并重新加载
[[email protected] ~]# cd /etc/httpd/conf.d/
[[email protected] conf.d]# vi 15-horizon_vhost.conf
35 WSGIProcessGroup apache
36 WSGIApplicationGroup %{GLOBAL} //添加这一行
[[email protected] conf.d]# apachectl graceful //重新载入配置文件
3)浏览器访问,出现页面,如图-6所示:

代码如下
[[email protected] ~]# vim /etc/httpd/conf.d/15-horizon_vhost.conf
[[email protected] ~]#
[[email protected] ~]# apachectl graceful
[[email protected] ~]# cat /etc/httpd/conf.d/15-horizon_vhost.conf
# ************************************
# Vhost template in module puppetlabs-apache
# Managed by Puppet
# ************************************

<VirtualHost *:80>
ServerName openstack.tedu.cn

## Vhost docroot
DocumentRoot “/var/www/”
## Alias declarations for resources outside the DocumentRoot
Alias /dashboard/static “/usr/share/openstack-dashboard/static”

## Directories, there should at least be a declaration for /var/www/

<Directory “/var/www/”>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>

## Logging
ErrorLog “/var/log/httpd/horizon_error.log”
ServerSignature Off
CustomLog “/var/log/httpd/horizon_access.log” combined

## RedirectMatch rules
RedirectMatch permanent ^/$ /dashboard

## Server aliases
ServerAlias 192.168.1.1
ServerAlias openstack.tedu.cn
ServerAlias localhost
WSGIDaemonProcess apache group=apache processes=3 threads=10 user=apache
WSGIProcessGroup apache
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias /dashboard “/usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi”
</VirtualHost>

3)查看默认用户名和密码
[[email protected] conf.d]# cd
[[email protected] ~]# ls
answer.ini keystonerc_admin //keystonerc_admin生成的文件,里面有用户名和密码
[[email protected] ~]# cat keystonerc_admin
unset OS_SERVICE_TOKEN
export OS_USERNAME=admin //用户名
export OS_PASSWORD=1bb4c987345c45ba //密码
export OS_AUTH_URL=http://192.168.1.1:5000/v2.0
export PS1='[\[email protected]\h \W(keystone_admin)]\$ ‘
export OS_TENANT_NAME=admin
export OS_REGION_NAME=RegionOne

代码如下
[[email protected] ~]# ls
answer.ini keystonerc_admin RPM-GPG-KEY-CentOS-7
[[email protected] ~]# cat keystonerc_admin
unset OS_SERVICE_TOKEN
export OS_USERNAME=admin
export OS_PASSWORD=2e0f052c918943e3
export OS_AUTH_URL=http://192.168.1.1:5000/v2.0
export PS1='[\[email protected]\h \W(keystone_admin)]\$ ‘

export OS_TENANT_NAME=admin
export OS_REGION_NAME=RegionOne

4)在火狐浏览器中输入用户名和密码
具体自己去网页去看

命令行基本操作
1)创建名为myproject的项目
[[email protected] ~]# source ~/keystonerc_admin //初始化环境变量
[[email protected] ~(keystone_admin)]# openstack project create myproject
+————-+———————————-+
| Field | Value |
+————-+———————————-+
| description | None |
| enabled | True |
| id |f73949e2701346328faf5c1272414cd0|
| name | myproject |
+————-+———————————-+
2)查看项目信息
[[email protected] ~(keystone_admin)]# openstack project list
+———————————-+———–+
| ID | Name |
+———————————-+———–+
| 3fd5bffd734543d39cf742492273a47f | services |
| 7f0b43274a9f4e149357fc8393ff2c68 | admin |
| f73949e2701346328faf5c1272414cd0 | myproject |
+———————————-+———–+
3)更新vcpu配额为30
[[email protected] ~(keystone_admin)]# nova quota-update –cores 30 myproject
4)删除myproject
[[email protected] ~(keystone_admin)]# openstack project delete myproject

代码如下
[[email protected] ~]# source keystonerc_admin
[[email protected] ~(keystone_admin)]#
[[email protected] ~(keystone_admin)]# env | grep OS
HOSTNAME=openstack.tedu.cn
OS_REGION_NAME=RegionOne
OS_PASSWORD=2e0f052c918943e3
OS_AUTH_URL=http://192.168.1.1:5000/v2.0
OS_USERNAME=admin
OS_TENANT_NAME=admin
[[email protected] ~(keystone_admin)]#
[[email protected] ~(keystone_admin)]# openstack project create myproject
+————-+———————————-+
| Field | Value |
+————-+———————————-+
| description | None |
| enabled | True |
| id | a95a960b096e4cd89f0ae66a7525d53c |
| name | myproject |
+————-+———————————-+
[[email protected] ~(keystone_admin)]# openstack project list
+———————————-+———–+
| ID | Name |
+———————————-+———–+
| 2d04668f11324caab465496f3e1daef0 | admin |
| 315e051b85d14921a34f1f2643f32fd8 | services |
| a95a960b096e4cd89f0ae66a7525d53c | myproject |
+———————————-+———–+
[[email protected] ~(keystone_admin)]# nova quota-update –cores 30 myproject

(这个时候,刷新一下网页,可以看到多了一个项目myproject)

删除项目
[[email protected] ~(keystone_admin)]# openstack project delete myproject
(刷新网页试下,项目myproject已经删除)

今天的实验到此结束

此条目发表在OpenStack分类目录,贴了标签。将固定链接加入收藏夹。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注