配置yum倉庫:配置三臺虛擬機 2CPU,6G 內存,50G 硬盤 2CPU,4.5G 內存,100G 硬盤 配置靜態IP ifcfg-eth0

本案例要求配置基本環境:

配置三臺虛擬機
2CPU,6G 內存,50G 硬盤
2CPU,4.5G 內存,100G 硬盤
配置靜態IP ifcfg-eth0
openstack : 192.168.1.10
nova: 192.168.1.11, 192.168.1.12
配置主機名 /etc/hosts,能夠相互 ping 通
配置 dns 服務器 /etc/resolv.conf

1.2 方案

此實驗的整體方案需要三臺機器,openstack作爲主節點,nova01 和 nova02作爲額外節點,真機做爲DNS轉發和NTP的服務器(這裏不再在表-1中體現),提供域名解析和時間同步服務,具體情況如表-1所示:
在這裏插入圖片描述

表-1
1.3 步驟

實現此案例需要按照如下步驟進行。

步驟一:準備三臺虛擬機

[student@room9pc01 images]$base-vm openstack nova01 nova02
[student@room9pc01 images]$virsh start openstack
[student@room9pc01 images]$virsh start nova01
[student@room9pc01 images]$virsh start nova02

2)opensatck主機擴容爲50G

[student@room9pc01 images]$ virsh blockresize --path /var/lib/libvirt/images/openstack.img --size 100G openstack
[student@room9pc01 images]$ virsh console openstack
[root@localhost ~]# /usr/bin/growpart /dev/vda 1
[root@localhost ~]# /usr/sbin/xfs_growfs /
[root@localhost ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        50G  914M   50G   2% /

3)nova01 和 nova02 主機擴容爲100G(以nova01爲例)

[student@room9pc01 images]$ virsh blockresize --path /var/lib/libvirt/images/nova01.img --size 50G nova01
重新定義 '/var/lib/libvirt/images/nova01.img' 塊設備大小
[root@localhost ~]# /usr/bin/growpart /dev/vda 1
[root@localhost ~]# /usr/sbin/xfs_growfs  /
[root@localhost ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       100G  917M  100G   1% /

4)三臺主機配置靜態ip(以一臺爲例)

openstack:192.168.1.10

nova01: 192.168.1.11

nova02: 192.168.1.12

[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# vim ifcfg-eth0
# Generated by dracut initrd
DEVICE="eth0"
ONBOOT="yes"
NM_CONTROLLED="no"
TYPE="Ethernet"
BOOTPROTO="static"
PERSISTENT_DHCLIENT="yes"
IPADDR=192.168.1.10
NEMASK=255.255.255.0
GATEWAY=192.168.1.254

5)三臺主機修改主機名,配置/etc/hosts,和/etc/resolv.conf文件(以一臺爲例)

[root@localhost ~]# hostname openstack
[root@localhost ~]# echo openstack > /etc/hostname 
[root@localhost ~]# vim /etc/hosts
192.168.1.10 openstack
192.168.1.11 nova01
192.168.1.12 nova02
[root@localhost ~]# vim /etc/resolv.conf  //去掉search開頭的行
; generated by /usr/sbin/dhclient-script
nameserver 192.168.1.254

6)修改三臺主機的內存(openstack6G,nova01 和nova02 4G)

[student@room9pc01 ~]$ virsh edit openstack
... 
 <memory unit='KiB'>6588282</memory>
  <currentMemory unit='KiB'>6588282</currentMemory>
...
[student@room9pc01 ~]$ virsh edit nova01
...
  <memory unit='KiB'>4588282</memory>
  <currentMemory unit='KiB'>4588282</currentMemory>
...
[student@room9pc01 ~]$ virsh start  openstack
域 openstack 已開始
[student@room9pc01 ~]$ virsh start  nova01
域 nova01 已開始
[student@room9pc01 ~]$ virsh start  nova02
域 nova02 已開始
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章