openstack-M版,学习笔记一

笔记为根据老男孩视频+官方文档学习,并记录,如有错漏,心情好的可以指出一下。 

前言 

环境准备

机器规划

Controller012C4GIP192.168.137.11
compute2C4GIP192.168.137.33

修改主机名

(针对主机的功能进行配置名字)

hostnamectl set-hostname controller01

IP地址网关

ONBOOT=yes
IPADDR=192.168.137.11
NETMASK=255.255.255.0
GATEWAY=192.168.137.1
DNS1=114.114.114.114
DNS2=8.8.8.8

host解析

(all)注①

192.168.137.11 controller01
192.168.137.33 computer

配置完毕后,在对应的机器上ping主机名,看看是否能通畅

测试ping百度

确认是否能上网

配置源

配置本地光盘源

因为有时候,有一些包是可以从光盘上进行安装的,所以讲光盘挂载上,并配置本地源

mount /dev/cdrom /mnt

[root@controller01 ~]# mount /dev/cdrom /mnt
mount: /dev/sr0 is write-protected, mounting read-only
[root@controller01 ~]# ls -lhtr /mnt
total 654K
-rw-r--r-- 1 root root 1.7K Dec  9  2015 RPM-GPG-KEY-CentOS-Testing-7
-rw-r--r-- 1 root root 1.7K Dec  9  2015 RPM-GPG-KEY-CentOS-7
-rw-r--r-- 1 root root  18K Dec  9  2015 GPL
-rw-r--r-- 1 root root  215 Dec  9  2015 EULA
-rw-r--r-- 1 root root   14 Dec  5  2016 CentOS_BuildTag
drwxr-xr-x 2 root root 2.0K Dec  5  2016 LiveOS
drwxr-xr-x 2 root root 2.0K Dec  5  2016 isolinux
drwxr-xr-x 3 root root 2.0K Dec  5  2016 EFI
drwxrwxr-x 2 root root 616K Dec  5  2016 Packages
drwxrwxr-x 2 root root 4.0K Dec  5  2016 repodata
drwxr-xr-x 3 root root 2.0K Dec  5  2016 images
-r--r--r-- 1 root root 2.9K Dec  5  2016 TRANS.TBL

#如果mnt下有内容,就表示已经挂载成功

为了让下次打开虚拟机,本地光盘能自动加载,配置一下开机启动

[root@controller01 yum.repos.d]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
mount /dev/cdrom /mnt    #这一段为添加到文件中的内容

同时给文件添加可执行权限

chmod +x /etc/rc.d/rc.local

[root@controller01 yum.repos.d]# ls -lhtr /etc/rc.d/rc.local
-rwxr-xr-x. 1 root root 495 Sep 16 23:54 /etc/rc.d/rc.local

配置openstack官方源

(控制节点和计算节点都需要配置)

  1. 配置网络源,因为部署openstack的M版,官方包括centos官方都已经下架,只能通过其他地方获取
[root@controller01 yum.repos.d]# cat /etc/yum.repos.d/openstack-mitaka.repo
[openstack]
name=openstack
baseurl=http://vault.centos.org/7.2.1511/cloud/x86_64/openstack-mitaka
enabled=1
gpgcheck=0
  1. 使用视频提供的rpm包制作成本地源
[root@controller01 yum.repos.d]# ls /opt/
openstack_rpm.tar.gz  repo

[root@controller01 yum.repos.d]# cat /etc/yum.repos.d/local.repo
[local]
name=local
baseurl=file:///mnt
gpgcheck=0

[openstack-mitaka]
name=openstack-mitaka
baseurl=file:///opt/repo
gpgcheck=0

配置完毕后,检查源是否可用

[root@computer01 opt]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: ftp.iij.ad.jp
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id                    repo name                                                 status
base/7/x86_64              CentOS-7 - Base                                           10,072
epel/x86_64                Extra Packages for Enterprise Linux 7 - x86_64            13,665
extras/7/x86_64            CentOS-7 - Extras                                            500
local                      local                                                      3,831
openstack                  openstack                                                  1,582
openstack-mitaka           openstack-mitaka                                             598    #由此可见,已经加装成功并成功生成缓存
updates/7/x86_64           CentOS-7 - Updates                                         2,750
repolist: 32,998

ps:我担心后续安装的时候提示包不完整,所以,两个方法都用了。、

PS:
a. 安装openstack centos里面的源
默认在CentOS-Base.repo源中就有openstack的源

[root@controller01 ~]# yum list |grep openstack
centos-release-openstack-queens.noarch      1-2.el7.centos             extras   
centos-release-openstack-rocky.noarch       1-1.el7.centos             extras   
centos-release-openstack-stein.noarch       1-1.el7.centos             extras   
centos-release-openstack-train.noarch       1-1.el7.centos             extras

b. 安装官方的源
通过安装centos-release-openstack-train.noarch,就会默认安装上对应的源文件

[root@controller01 yum.repos.d]# yum install centos-release-openstack-train.noarch
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                | 5.0 kB  00:00:00     
* base: mirrors.cn99.com
* epel: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base                                                                | 3.6 kB  00:00:00     
epel                                                                | 4.7 kB  00:00:00     
extras                                                              | 2.9 kB  00:00:00     
local                                                               | 3.6 kB  00:00:00     
openstack                                                           | 2.9 kB  00:00:00     
openstack-mitaka                                                    | 2.9 kB  00:00:00     
updates                                                             | 2.9 kB  00:00:00     
(1/2): epel/x86_64/primary_db                                       | 7.0 MB  00:00:01     
(2/2): epel/x86_64/updateinfo                                       | 1.0 MB  00:00:03     
Resolving Dependencies
--> Running transaction check
---> Package centos-release-openstack-train.noarch 0:1-1.el7.centos will be installed
--> Processing Dependency: centos-release-qemu-ev for package: centos-release-openstack-train-1-1.el7.centos.noarch
--> Processing Dependency: centos-release-ceph-nautilus for package: centos-release-openstack-train-1-1.el7.centos.noarch
--> Running transaction check
---> Package centos-release-ceph-nautilus.noarch 0:1.2-2.el7.centos will be installed
--> Processing Dependency: centos-release-storage-common for package: centos-release-ceph-nautilus-1.2-2.el7.centos.noarch
--> Processing Dependency: centos-release-nfs-ganesha28 for package: centos-release-ceph-nautilus-1.2-2.el7.centos.noarch
---> Package centos-release-qemu-ev.noarch 0:1.0-4.el7.centos will be installed
--> Processing Dependency: centos-release-virt-common for package: centos-release-qemu-ev-1.0-4.el7.centos.noarch
--> Running transaction check
---> Package centos-release-nfs-ganesha28.noarch 0:1.0-3.el7.centos will be installed
---> Package centos-release-storage-common.noarch 0:2-2.el7.centos will be installed
---> Package centos-release-virt-common.noarch 0:1-1.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================
Package                             Arch        Version                 Repository   Size
===========================================================================================
Installing:
centos-release-openstack-train      noarch      1-1.el7.centos          extras      5.3 k
Installing for dependencies:
centos-release-ceph-nautilus        noarch      1.2-2.el7.centos        extras      5.1 k
centos-release-nfs-ganesha28        noarch      1.0-3.el7.centos        extras      4.3 k
centos-release-qemu-ev              noarch      1.0-4.el7.centos        extras       11 k
centos-release-storage-common       noarch      2-2.el7.centos          extras      5.1 k
centos-release-virt-common          noarch      1-1.el7.centos          extras      4.5 k
Transaction Summary
===========================================================================================
Install  1 Package (+5 Dependent packages)
Total download size: 35 k
Installed size: 25 k
Is this ok [y/d/N]:

#以上为安装官方源的办法。如果缺少了这个步骤,直接使用yum命令安装是找不到对应的源包的

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值