iaas私有云搭建

配置网络,主机名

修改和添加/etc/sysconfig/network-scripts/ifcfg-enp*(具体的网口)文件。

controller节点:

[root@localhost ~]#
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enoxxxxxx(网卡1BOOTPROTO=static  //修改IP为静态
ONBOOT=yes  //开机自启
IPADDR=192.168.1.10  	//添加IP地址
PREFIX=24					//添加子网掩码
GATEWAY=192.168.1.1    	//添加网关
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enoxxxxxx(网卡2BOOTPROTO=static  //修改IP自动获取(dhcp)为静态
ONBOOT=yes  //开机不自启改为自启
IPADDR=192.168.2.10  	//添加IP地址
PREFIX=24					//添加子网掩码
[root@localhos t~]# hostnamectl set-hostname controller //名字命名
[root@localhos t~]# reboot						//重启
[root@controller ~]#

compute节点:

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enoxxxxxx(网卡1BOOTPROTO=static  //修改IP为静态
ONBOOT=yes  //开机自启
IPADDR=192.168.1.20  	//添加IP地址
PREFIX=24					//添加子网掩码
GATEWAY=192.168.1.1    	//添加网关
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enoxxxxxx(网卡2BOOTPROTO=static  //修改IP为静态
ONBOOT=yes  //开机自启
IPADDR=192.168.2.20  	//添加IP地址
PREFIX=24					//添加子网掩码
[root@localhos t~]# hostnamectl set-hostname compute //名字命名
[root@localhos t~]#  reboot                    //重新登陆
[root@compute ~]#

永久关闭防火墙和selinux

controller节点:

[root@controller ~]# systemctl stop firewalld
[root@controller ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.

[root@controller ~]# setenforce 0
[root@controller ~]# vi /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 - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

compute节点

[root@compute ~]# systemctl stop firewalld
[root@compute ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.

[root@compute ~]# setenforce 0
[root@compute ~]# vi /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 - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

主机名映射

[root@controller ~]# vi /etc/hosts       //进入配置页面后添加为
192.168.1.10 controller
192.168.1.20 compute
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@compute ~]# vi /etc/hosts		 //进入配置页面后添加为
192.168.1.10 controller
192.168.1.20 compute
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

yum源配置

controller节点

[root@controller ~]# cd /etc/yum.repos.d
[root@controller yum.repos.d]# ll
total 28
-rw-r--r--. 1 root root 1664 Dec  9  2015 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Dec  9  2015 CentOS-CR.repo
-rw-r--r--. 1 root root  649 Dec  9  2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  290 Dec  9  2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 Dec  9  2015 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Dec  9  2015 CentOS-Sources.repo
-rw-r--r--. 1 root root 1952 Dec  9  2015 CentOS-Vault.repo
[root@controller yum.repos.d]# rm -rf *
[root@controller yum.repos.d]# ll
total 0
[root@controller yum.repos.d]# vi local.repo
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0			
enabled=1
[iaas]
name=iaas
baseurl=file:///opt/iaas/iaas-repo
gpgcheck=0
enabled=1

compute节点

[root@controller ~]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# ll
total 28
-rw-r--r--. 1 root root 1664 Dec  9  2015 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Dec  9  2015 CentOS-CR.repo
-rw-r--r--. 1 root root  649 Dec  9  2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  290 Dec  9  2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 Dec  9  2015 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Dec  9  2015 CentOS-Sources.repo
-rw-r--r--. 1 root root 1952 Dec  9  2015 CentOS-Vault.repo
[root@controller yum.repos.d]# rm -rf *
[root@controller yum.repos.d]# ll
total 0
[root@controller yum.repos.d]# vi local.repo
[centos]
name=centos
baseurl=ftp://controller/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=ftp://controller/iaas/iaas-repo
gpgcheck=0
enabled=1

镜像挂载

第一种:临时挂载,不清理缓存就和永久挂载一样

[root@controller ~]# ll
total 7012772  -rw-------. 1 root root       1204 Oct  3 05:26 anaconda-ks.cfg
-rw-r--r--. 1 root root 4329570304 Oct  3 22:16 CentOS-7-x86_64-DVD-1511.iso
-rw-r--r--. 1 root root 2851502080 Oct  3 22:16 XianDian-IaaS-v2.2.iso
[root@controller ~]# mount -o loop CentOS-7-x86_64-DVD-1511.iso  /mnt/
[root@controller ~]# mkdir /opt/centos
[root@controller ~]# cp -rvf /mnt/*   /opt/centos/
[root@controller ~]# umount  /mnt/
[root@controller ~]# mount -o loop XianDian-IaaS-v2.0-1228.iso  /mnt/
[root@controller ~]# cp -rvf /mnt/* /opt/iaas/
[root@controller ~]# umount  /mnt/

第二种:永久挂载

[root@controller ~]# ll
total 7012772
-rw-------. 1 root root       1204 Oct  3 05:26 anaconda-ks.cfg
-rw-r--r--. 1 root root 4329570304 Oct  3 22:16 CentOS-7-x86_64-DVD-1511.iso
-rw-r--r--. 1 root root 2851502080 Oct  3 22:16 XianDian-IaaS-v2.2.iso
root@controller ~]# mkdir /opt/centos
[root@controller ~]#  mkdir /opt/iaas

 [root@controller ~]# cat /etc/fstab 
 
#
# /etc/fstab
# Created by anaconda on Sat Oct  3 16:57:52 2020
#
# 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=08c6356f-240a-4912-99a8-ac4709bb0c84 /                       xfs     defaults        0 0
UUID=fd16eec6-ad7d-418c-9d98-b99497246286 /boot                   xfs     defaults        0 0
UUID=158246bd-ebb9-426e-98bd-bdb95d6ca473 swap                    swap    defaults        0 0
/root/CentOS-7-x86_64-DVD-1511.iso        /opt/centos	          iso9660	defaults 0 0
/root/XianDian-IaaS-v2.2.iso              /opt/iaas	          iso9660	defaults 0 0

[root@controller ~]# mount -a
mount: /dev/loop0 is write-protected, mounting read-only
mount: /dev/loop1 is write-protected, mounting read-only

[root@controller ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        98G  7.6G   90G   8% /
devtmpfs        904M     0  904M   0% /dev
tmpfs           913M     0  913M   0% /dev/shm
tmpfs           913M  8.5M  904M   1% /run
tmpfs           913M     0  913M   0% /sys/fs/cgroup
/dev/sda1       497M  118M  380M  24% /boot
tmpfs           183M     0  183M   0% /run/user/0
/dev/loop0      4.1G  4.1G     0 100% /opt/centos
/dev/loop1      2.7G  2.7G     0 100% /opt/iaas

搭建ftp服务,并开启自启

[root@controller ~]# yum install  –y vsftpd
[root@controller ~]# vi /etc/vsftpd/vsftpd.conf
添加anon_root=/opt/
保存退出

[root@controller ~]# systemctl restart vsftpd
[root@controller ~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.

安装iaas相关软件包

[root@controller ~]# yum install -y iaas-xiandian
[root@compute ~]# yum install -y iaas-xiandian

划分磁盘

[root@compute ~]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0001763e
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048     5220351     2097152   82  Linux swap / Solaris
/dev/sda3         5220352    41943039    18361344   83  Linux
Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@compute ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x33e90955.
Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1):  
First sector (2048-209715199, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): +30G
Partition 1 of type Linux and of size 30 GiB is set
Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (2-4, default 2): 
First sector (62916608-209715199, default 62916608): 
Using default value 62916608
Last sector, +sectors or +size{K,M,G} (62916608-209715199, default 209715199): +30G
Partition 2 of type Linux and of size 30 GiB is set
Command (m for help): W
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

[root@compute ~]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0001763e
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048     5220351     2097152   82  Linux swap / Solaris
/dev/sda3         5220352    41943039    18361344   83  Linux

Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x33e90955

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    62916607    31457280   83  Linux
/dev/sdb2        62916608   125831167    31457280   83  Linux
[root@compute ~]# mkfs.xfs /dev/sdb1
meta-data=/dev/sdb1              isize=256    agcount=4, agsize=1966080 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=7864320, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=3840, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@compute ~]# mkfs.xfs /dev/sdb2
meta-data=/dev/sdb2              isize=256    agcount=4, agsize=1966080 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=7864320, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=3840, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@compute ~]# 

环境变量修改

[root@controller ~]# vi /etc/xiandian/openrc.sh				//vi是编辑  cat是查看
cat /etc/xiandian/openrc.sh
##--------------------system Config--------------------##
##Controller Server Manager IP. example:x.x.x.x
HOST_IP=192.168.1.10

##Controller Server hostname. example:controller
HOST_NAME=controller

##Compute Node Manager IP. example:x.x.x.x
HOST_IP_NODE=192.168.1.20

##Compute Node hostname. example:compute
HOST_NAME_NODE=compute

##--------------------Rabbit Config ------------------##
##user for rabbit. example:openstack
RABBIT_USER=openstack

##Password for rabbit user .example:000000
RABBIT_PASS=a(设置的密码)

##--------------------MySQL Config---------------------##
##Password for MySQL root user . exmaple:000000
DB_PASS=a

##--------------------Keystone Config------------------##
##Password for Keystore admin user. exmaple:000000
DOMAIN_NAME=wsw(自定义)
ADMIN_PASS=a
DEMO_PASS=a

##Password for Mysql keystore user. exmaple:000000
KEYSTONE_DBPASS=a

##--------------------Glance Config--------------------##
##Password for Mysql glance user. exmaple:000000
GLANCE_DBPASS=a

##Password for Keystore glance user. exmaple:000000
GLANCE_PASS=a

##--------------------Nova Config----------------------##
##Password for Mysql nova user. exmaple:000000
NOVA_DBPASS=a

##Password for Keystore nova user. exmaple:000000
NOVA_PASS=a

##--------------------Neturon Config-------------------##
##Password for Mysql neutron user. exmaple:000000
NEUTRON_DBPASS=a

##Password for Keystore neutron user. exmaple:000000
NEUTRON_PASS=a

##metadata secret for neutron. exmaple:000000
METADATA_SECRET=a

##External Network Interface. example:eth1
INTERFACE_NAME=eno(网卡二)

##First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
#minvlan=

##Last Vlan ID in VLAN RANGE for VLAN Network. example:200
#maxvlan=

##--------------------Cinder Config--------------------##
##Password for Mysql cinder user. exmaple:000000
CINDER_DBPASS=a

##Password for Keystore cinder user. exmaple:000000
CINDER_PASS=a

##Cinder Block Disk. example:md126p3
BLOCK_DISK=/dev/sdb1(划分的磁盘)

##--------------------Trove Config--------------------##
##Password for Mysql Trove User. exmaple:000000
TROVE_DBPASS=a

##Password for Keystore Trove User. exmaple:000000
TROVE_PASS=a

##--------------------Swift Config---------------------##
##Password for Keystore swift user. exmaple:000000
SWIFT_PASS=a

##The NODE Object Disk for Swift. example:md126p4.
OBJECT_DISK=/dev/sdb2

##The NODE IP for Swift Storage Network. example:x.x.x.x.
STORAGE_LOCAL_NET_IP=192.168.1.20

##--------------------Heat Config----------------------##
##Password for Mysql heat user. exmaple:000000
HEAT_DBPASS=a

##Password for Keystore heat user. exmaple:000000
HEAT_PASS=a

##--------------------Ceilometer Config----------------##
##Password for Mysql ceilometer user. exmaple:000000
CEILOMETER_DBPASS=a

##Password for Keystore ceilometer user. exmaple:000000
CEILOMETER_PASS=a

##--------------------AODH Config----------------##
##Password for Mysql AODH user. exmaple:000000
AODH_DBPASS=a

##Password for Keystore AODH user. exmaple:000000
AODH_PASS=a

[root@compute ~]# scp 192.168.1.10:/etc/xiandian/openrc.sh /etc/xiandian/    
  //将环境变量从controller复制到compute上

配置NTP服务

安装ntp服务(时间同步)1)配置controller节点
[root@controller ~]# yum -y install ntp
[root@controller ~]# vim /etc/ntp.conf
添加以下内容(删除默认sever规则)
server 127.127.1.0
fudge 127.127.1.0   stratum 10

[root@controller ~]# systemctl restart ntpd
[root@controller ~]# systemctl enable ntpd
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.2)配置compute节点
[root@compute ~]# yum install -y ntp
[root@compute ~]# ntpdate controller			//配置时间同步
 1 Oct 08:36:16 ntpdate[2255]: adjust time server 192.168.1.10 offset -0.229334 sec
[root@compute ~]# systemctl enable ntpd
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.

脚本安装

顺序不可改变。请提前备份!

控制节点
iaas-pre-host.sh
reboot
iaas-install-mysql.sh
iaas-install-keystone.sh
iaas-install-glance.sh
iaas-install-nova-controller.sh
iaas-install-neutron-controller.sh
iaas-install-neutron-controller-gre.sh
iaas-install-dashboard.sh

计算节点
iaas-pre-host.sh
reboot
iaas-install-nova-compute.sh
iaas-install-neutron-compute.sh
iaas-install-neutron-compute-gre.sh

检验

http://192.168.1.10/dashboard

看成品

在这里插入图片描述在这里插入图片描述

最后加油吧!

  • 6
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值