Centos7.4安裝openstack(queens)詳細安裝部署(一)---基礎環境安裝


一、安裝環境准備

  1.1、硬件配置

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

    官網安裝:https://docs.openstack.org/queens/install/

    控制節點: 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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM