跳转至

3. 安装openstack基础服务

0. 官方文档

# https://docs.openstack.org/mitaka/zh_CN/install-guide-rdo/

1. 设置openstack的yum源

  1. 载光盘
# 配置本地yum源,还需要光盘的一个yum源
# 挂载本地光盘
mount /dev/cdrom /mnt
  1. 上传repo压缩包
# 从老师的资料中找到yum源压缩包 openstack_rpm.tar.gz
cd /opt
openstack_rpm.tar.gz
tar -zxvf openstack_rpm.tar.gz
  1. 生成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
  1. 生成缓存
yum makecache
  1. 设置光盘开机自动挂载
echo 'mount /dev/cdrom /mnt' >>/etc/rc.local
  1. 添加可执行权限
chmod +x /etc/rc.d/rc.local

2. 安装时间同步chrony

#controller
vim /etc/chrony.conf
#修改第26行
allow 192.168.178.0/24
#重启服务
systemctl restart chronyd
date

#compute1
vim /etc/chrony.conf
#修改第3行
server 192.168.178.11 iburst
#重启服务
systemctl restart chronyd
date
 [root@controller opt]# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1153/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      1153/sshd
udp        0      0 127.0.0.1:323           0.0.0.0:*                           609/chronyd
udp6       0      0 ::1:323                 :::*                                609/chronyd
[root@controller opt]#
[root@controller opt]# vim /etc/chrony.conf
...
 25 # Allow NTP client access from local network.
 26 #allow 192.168.0.0/16
 27 allow 192.168.178.0/24
 28
...
[root@controller opt]#
[root@controller opt]# systemctl restart chronyd.service

3. 安装openstack客户端和selinux

#所有节点
yum install python-openstackclient openstack-selinux -y

4. 安装配置mariadb

1. 安装

#controller
yum install mariadb mariadb-server python2-PyMySQL -y

2. 修改配置文件

echo '[mysqld]
bind-address = 192.168.178.11
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8'  >/etc/my.cnf.d/openstack.cnf

3. 启动并设置开机自启

systemctl start mariadb
systemctl enable mariadb

netstat -tunlp|grep mysqld

4. 配置安全规则

mysql_secure_installation
# root初始密码为空(不输入,直接回车)
# 不设置root密码
# 去除anoymous
# 不允许root登录
# 移除test数据库
# 重载数据库

# 在宿主机直接输入mysql即可登录

5. 安装rabbitmq消息队列并创建用户

1. 安装

#controller
yum install rabbitmq-server -y

2. 启动并开机自启

systemctl start rabbitmq-server.service 
systemctl enable rabbitmq-server.service

3. 添加用户并设置权限

rabbitmqctl add_user openstack RABBIT_PASS
#设置openstack用户有最高权限
rabbitmqctl set_permissions openstack ".*" ".*" ".*"

4. 开启消息队列

rabbitmq-plugins enable rabbitmq_management

5. 查看端口

netstat -tunlp|grep beam
[root@controller ~]# netstat -tunlp|grep beam
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      4815/beam
tcp6       0      0 :::5672                 :::*                    LISTEN      4815/beam
[root@controller ~]# rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
  mochiweb
  webmachine
  rabbitmq_web_dispatch
  amqp_client
  rabbitmq_management_agent
  rabbitmq_management

Applying plugin configuration to rabbit@controller... started 6 plugins.
[root@controller ~]#
[root@controller ~]# netstat -tunlp|grep beam
tcp        0      0 0.0.0.0:15672           0.0.0.0:*               LISTEN      4815/beam
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      4815/beam
tcp6       0      0 :::5672                 :::*                    LISTEN      4815/beam

6. 浏览器访问

# ip+端口 访问,默认初始用户名和密码:guest:guest
192.168.178.11:15672

img.png

#进入后如下图

img_1.png

6. 安装memcache

1. 安装

#controller
yum install memcached python-memcached -y

2. 修改配置文件

sed -i 's#127.0.0.1#192.168.178.11#g' /etc/sysconfig/memcached

3. 开启并设置开机自启

systemctl restart memcached.service
systemctl enable memcached.service

4. 查看端口

#netstat -tunlp|grep memcache
[root@controller ~]# netstat -tunlp| grep memcached
tcp        0      0 192.168.178.11:11211    0.0.0.0:*               LISTEN      8304/memcached
tcp6       0      0 ::1:11211               :::*                    LISTEN      8304/memcached
udp        0      0 192.168.178.11:11211    0.0.0.0:*                           8304/memcached
udp6       0      0 ::1:11211               :::*                                8304/memcached

至此,基础服务安装完毕!


最后更新: 2022-02-20 04:00:12