2. 虚拟机安装openstack
1. 启动2台虚拟机¶
# 用户名和密码:root:123456
2. 修改IP¶
# 修改IP地址,与自己vmware的网络虚拟器一致!我的是:192.168.178.0网段!
vim /etc/sysconfig/network-scripts/ifcfg-eth0
systemctl restart network
ping baidu.com
# 没问题后,使用ssh远程登录!
#controller节点
[root@oldboy ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=none
NAME=eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.178.11 #controller修改IP为这个
NETMASK=255.255.255.0
GATEWAY=192.168.178.254 #网关与自己的设置一致!
DNS1=223.5.5.5
[root@oldboy ~]# systemctl restart network
[root@oldboy ~]#
#compute1节点
[root@oldboy ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=none
NAME=eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.178.31 #controller修改IP为这个
NETMASK=255.255.255.0
GATEWAY=192.168.178.254 #网关与自己的设置一致!
DNS1=223.5.5.5
[root@oldboy ~]# systemctl restart network
[root@oldboy ~]#
3. 修改主机名¶
hostnamectl set-hostname controller
hostnamectl set-hostname compute1
#1.
[root@oldboy ~]# hostnamectl set-hostname controller
[root@oldboy ~]#
[root@oldboy ~]# bash
[root@controller ~]#
#2.
[root@oldboy ~]# hostnamectl set-hostname compute1
[root@oldboy ~]#
[root@oldboy ~]# bash
[root@compute1 ~]#
4. 修改host解析¶
vim /etc/hosts
192.168.178.11 controller
192.168.178.31 compute1
5. 挂载光盘¶
# 配置本地yum源,还需要光盘的一个yum源
# 挂载本地光盘
mount /dev/cdrom /mnt
6. 上传repo压缩包¶
# 从老师的资料中找到yum源压缩包 openstack_rpm.tar.gz
cd /opt
openstack_rpm.tar.gz
tar -zxvf openstack_rpm.tar.gz
7. 生成repo配置文件¶
echo '[local]
name=local
baseurl=file:///mnt
gpgcheck=0
[openstack]
name=openstack
baseurl=file:///opt/repo
gpgcheck=0' >/etc/yum.repos.d/local.repo
8. 生成缓存¶
yum makecache
[root@controller opt]# yum makecache
Loaded plugins: fastestmirror
file:///mnt/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mnt/repodata/repomd.xml"
Trying other mirror.
openstack | 2.9 kB 00:00:00
(1/3): openstack/filelists_db | 465 kB 00:00:00
(2/3): openstack/other_db | 211 kB 00:00:00
(3/3): openstack/primary_db | 398 kB 00:00:00
Determining fastest mirrors
Metadata Cache Created
9. 设置开机挂载¶
echo 'mount /dev/cdrom /mnt' >>/etc/rc.local
10. 添加可执行权限¶
chmod +x /etc/rc.d/rc.local
最后更新:
2022-02-20 04:00:12