Centos7.4安装openstack(queens)详细安装部署(一)---基础环境安装

一、安装环境准备

  1.1、硬件配置

    操作系统:http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1708.iso

    控制节点: cpu 1 ,内存 3G,网卡 2张,存储 30G

    计算节点: cpu 1 ,内存 1G,网卡 2张,存储 30G

  1.2、ip地址大家根据自己实际情况而定 
     控制节点第一张网卡:10.0.0.11 
     控制节点第二张网卡: 
     计算节点第一张网卡:10.0.0.31
     计算几点第二张网卡:

  1.3、 修改主机名,并添加hosts映射

    编辑文件/etc/hosts,删除原有内容,然后添加自己的主机名

hostnamectl set-hostname   controller
10.0.0.11 controller
10.0.0.31 computer1

  1.4、 关闭防火墙

systemctl disable firewalld
systemctl stop firewalld
禁用selinux,避免踩坑!编辑/etc/selinux/config,将enforcing修改为disabled。
SELINUX=disabled
selinux的设置需要重启节点才能生效。
setenforce 0 临时修改,马上生效

  1.5、准备yum本地源  

    上传如下文件至/root目录下,并解压onehost.tar.gz文件。

    

mkdir /opt/openstack
mount /root/openstack_queens.iso /mnt
cp /mnt/* /opt/openstack/
tar -xvf /root/onehost.tar.gz
cp -r /root/onehost/repodata /opt/openstack/
mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/* /etc/yum.repos.d/bak/
cp /root/onehost/local.repo /etc/yum.repos.d/

二、OpenStack基础环境安装  

  1.1、控制节点和计算节点都安装ntp服务

 yum install chrony -y

  1.2、编辑配置文件/etc/chrony.conf增加以下内容

    控制节点:

server ntp6.aliyun.com iburst 
allow
10.0.0.0/24 #这个根据自己子网情况

    计算节点:

server 10.0.0.11 iburst

    设置服务的开机启动,并启动服务:

systemctl enable chronyd
systemctl start chronyd

  1.3、(控制节点、计算节点)升级软件包,安装OpenStack客户端 

yum upgrade                                   升级软件包
yum install python-openstackclient -y 安装OpenStack客户端
yum install openstack-selinux -y 安装openstack-selinux

   1.4、(控制节点)sql数据库安装

 yum install mariadb mariadb-server python2-PyMySQL -y

  1.5、创建并编辑文件/etc/my.cnf.d/openstack.cnf增加如下内容

[mysqld]
bind-address = 10.0.0.11

default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

   1.7、设置数据库服务的开机启动,并启动服务

systemctl enable mariadb.service
systemctl start mariadb.service

   1.8、为数据库设置密码

[root@controller ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

  1.9、(控制节点)安装消息队列

yum install rabbitmq-server -y

  2.0、设置消息队列服务的开机自启,并启动服务

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

  添加openstack用户并设置openstack使用消息队列的权限

  注意:下面的ADMIN_PASS是我自己设置的openstack使用消息队列的密码,可以自行设置

# rabbitmqctl add_user openstack ADMIN_PASS
Creating user "openstack" ...

# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
Setting permissions for user "openstack" in vhost "/" ...

  2.1、(控制节点)安装memcached服务

yum install memcached python-memcached -y

  2.2、编辑/etc/sysconfig/memcached文件设置以下内容

OPTIONS="-l 127.0.0.1,::1,controller"

  2.3、设置服务开机自启动,并启动服务

systemctl enable memcached.service
systemctl start memcached.service

  2.4、(控制节点)安装etcd服务

yum install etcd -y

  2.5、编辑文件/etc/etcd/etcd.conf设置以下内容

#[Member]
#ETCD_CORS=""
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
#ETCD_WAL_DIR=""
ETCD_LISTEN_PEER_URLS="http://localhost:2380"
ETCD_LISTEN_CLIENT_URLS="http://localhost:2379"
#ETCD_MAX_SNAPSHOTS="5"
#ETCD_MAX_WALS="5"
ETCD_NAME="controller"
#ETCD_SNAPSHOT_COUNT="100000"
#ETCD_HEARTBEAT_INTERVAL="100"
#ETCD_ELECTION_TIMEOUT="1000"
#ETCD_QUOTA_BACKEND_BYTES="0"
#ETCD_MAX_REQUEST_BYTES="1572864"
#ETCD_GRPC_KEEPALIVE_MIN_TIME="5s"
#ETCD_GRPC_KEEPALIVE_INTERVAL="2h0m0s"
#ETCD_GRPC_KEEPALIVE_TIMEOUT="20s"
#
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://localhost:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379"
#ETCD_DISCOVERY=""
#ETCD_DISCOVERY_FALLBACK="proxy"
#ETCD_DISCOVERY_PROXY=""
#ETCD_DISCOVERY_SRV=""
ETCD_INITIAL_CLUSTER="controller=http://localhost:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new"
#ETCD_STRICT_RECONFIG_CHECK="true"
#ETCD_ENABLE_V2="true"
#
#[Proxy]
#ETCD_PROXY="off"
#ETCD_PROXY_FAILURE_WAIT="5000"
#ETCD_PROXY_REFRESH_INTERVAL="30000"
#ETCD_PROXY_DIAL_TIMEOUT="1000"
#ETCD_PROXY_WRITE_TIMEOUT="5000"
#ETCD_PROXY_READ_TIMEOUT="0"
#
#[Security]
#ETCD_CERT_FILE=""
#ETCD_KEY_FILE=""
#ETCD_CLIENT_CERT_AUTH="false"
#ETCD_TRUSTED_CA_FILE=""
#ETCD_AUTO_TLS="false"
#ETCD_PEER_CERT_FILE=""
#ETCD_PEER_KEY_FILE=""
#ETCD_PEER_CLIENT_CERT_AUTH="false"
#ETCD_PEER_TRUSTED_CA_FILE=""
#ETCD_PEER_AUTO_TLS="false"
#
#[Logging]
#ETCD_DEBUG="false"
#ETCD_LOG_PACKAGE_LEVELS=""
#ETCD_LOG_OUTPUT="default"
#
#[Unsafe]
#ETCD_FORCE_NEW_CLUSTER="false"
#
#[Version]
#ETCD_VERSION="false"
#ETCD_AUTO_COMPACTION_RETENTION="0"
#
#[Profiling]
#ETCD_ENABLE_PPROF="false"
#ETCD_METRICS="basic"
#
#[Auth]
#ETCD_AUTH_TOKEN="simple"

  2.6、设置开机服务自启动,并启动服务

systemctl enable etcd
systemctl start etcd
原文地址:https://www.cnblogs.com/aqicheng/p/13307073.html