openstack 笔记 (二) 环境的搭建

1.系统的准备

  这里用 vm 软件虚拟了三台linux 服务器:系统版本是centos7 64位系统

    general node 01: 2核2g40gb   

    contorl node01:  1核1g40gb

    general node 02:  1核1g40gb

https://blog.csdn.net/bbwangj/article/details/79568821

系统版本:CentOS-7-x86_64-DVD-1511.iso 虚拟机配置:2C-4G-20G-NAT 系统安装注意事项:

  • 网卡名称:eth0
  • 时区:亚洲上海
  • 安全组策略(防火墙):关闭
  • 最小化安装

1.1 网卡名称修改

1.1.1 方法一

在安装时使用内核命令net.ifnames=0 biosdevname=0可将网卡名称改为传统ethx的命名规则

1.1.2 方法二

以下内容引自 RHEL7/centos7修改网卡名称为eth0

根据红帽官方文档介绍,设备重命名的过程如下:

A rule in /usr/lib/udev/rules.d/60-net.rules instructs the udev helper utility,/lib/udev/rename_device,to look into all /etc/sysconfig/networkscripts/ifcfg-suffix files.If it finds an ifcfg file with a HWADDR entry matching the MAC address of an interface it renames the interface to the name given in the ifcfg file by the DEVICE directive.

/usr/lib/udev/rules.d/60-net.rules文件中的规则会让udev帮助工具/lib/udev/renamedevice查看所有/etc/sysconfig/networkscripts/ifcfg-suffix文件。如果发现包含HWADDR条目的ifcfg文件与某个接口的MAC地址匹配,它会将该接口重命名为ifcfg文件中由DEVICE指令给出的名称。

根据以上介绍,进行网卡重命名:

1.ifconfig命令查看网卡配置

[root@test01 ~]# ifconfig 
enp0s9: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
inet 192.168.56.101  netmask 255.255.255.0  broadcast 192.168.56.255
inet6 fe80::a00:27ff:fea5:4fd  prefixlen 64  scopeid 0x20<link>
ether 08:00:27:a5:04:fd  txqueuelen 1000  (Ethernet)
RX packets 1213  bytes 131145 (128.0 KiB)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 771  bytes 86683 (84.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 0  (Local Loopback)
RX packets 1220  bytes 105112 (102.6 KiB)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 1220  bytes 105112 (102.6 KiB)
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
复制代码

由此可知,网卡MAC地址为:08:00:27:a5:04:fd

2.重命名网卡配置文件

# 如果没有网卡配置文件,可以使用以下命令添加(命令行工具NetworkManager)       
[root@test01 network-scripts]# nmcli connection add type ethernet ifname enp0s9 con-name enp0s9 autoconnect yes 
复制代码

[root@test01 network-scripts]# mv ifcfg-enp0s9 ifcfg-eth0

3.修改网卡配置文件

向配置文件中添加HWADDR,DEVICE,NAME参数。

4.拷贝配置文件60-net.rules并重启

[root@test01 network-scripts]# cp /usr/lib/udev/rules.d/60-net.rules /etc/udev/rules.d/
[root@test01 network-scripts]# shutdown -r 0
复制代码

1.2 手动分区

实际工作中无需boot和swap分区,只需一个分区即可。

 

分区

 

1.3 设置静态IP

在ifcfg-eth0网卡配置文件中加入GATEWAY,IPADDR,DNS1,NETMASK,依照VMware中的虚拟网络编辑器配置。

 

 

发现没有vim编辑器,参考https://www.jianshu.com/p/96dbc05d3df1装了

1.4 开启网卡IPV6功能

在/etc/sysctl.conf文件中增加如下参数

net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0
复制代码

生效:sysctl -p

2.安装基础软件源

安装基本软件

yum install -y wget yum-plugin-priorities

安装软件源

  • 备份和删除自带源
[root@controller ~]# mkdir -p /data/backup/repo
[root@controller ~]# mv /etc/yum.repos.d/* /data/backup/repo
复制代码
  • 安装阿里云yum源
wget -O CentOS-Base-ali.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
复制代码
  • 检查
yum repolist
yum clean all && yum makecache fast && yum update -y
yum install tree lrzsz vim telnet net-tools bash-completion yum-utils -y
复制代码
  • 禁止升级内核
# vim/etc/yum.conf
[main]
...
exclude=kernel*
exclude=centos-release*
复制代码

3.网络配置

关闭NetworkManager服务

systemctl stop NetworkManager
systemctl disable NetworkManager
复制代码

网卡配置修改

加入NM_CONTROLLED="no"禁止NM管理网络,加入IPV6设置

开启网卡混杂模式(让多种数据都能传输)

[root@controller network-scripts]# ifconfig eth0 promisc

将该命令设为开机自动运行

[root@controller network-scripts]# echo 'ifconfig eth0 promisc' >> /etc/profile

消息服务

systemctl start messagebus
systemctl enable messagebus
复制代码

防火墙

systemctl stop firewalld
systemctl disable firewalld
复制代码

selinux

vim /etc/selinux/config

将enforcing改为disabled

修改hosts

将主机名映射写入文件

4.OpenStack环境搭建

  • 软件源配置

修改OpenStack源地址为阿里云的地址

wget -O /etc/yum.repos.d/Ali-pike.repo http://elven.vip/ks/openstack/Ali-queens.repo

  • 检查
yum repolist
yum makecache fast
复制代码
  • 安装OpenStack客户端

[root@controller yum.repos.d]# yum install -y python-openstackclient openstack-selinux yum-plugin-priorities openstack-utils

  • 时间同步
yum install ntpdate
ntpdate -u time1.aliyun.com
复制代码

编辑自动运行脚本

crontab -e

添加内容:*/5 * * * * /usr/sbin/ntpdate -u time1.aliyun.com >> /dev/null 2>&1 &

  • 拍摄快照并基于快照创建计算节点computer

修改ip地址

修改主机名:hostnamectl set-hostname computer

  • 安装计算节点基本软件

yum install -y qemu-kvm libvirt bridge-utils

  • 将qemu连接到/ust/bin/qemu

ln -sv /usr/libexec/qemu-kvm /usr/bin/qemu



posted @ 2020-01-05 09:48  koala_dz  阅读(341)  评论(0编辑  收藏  举报