码迷,mamicode.com
首页 > 其他好文 > 详细

OpenStack-Rocky版单机部署

时间:2018-10-21 10:53:14      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:.sh   col   def   -o   log   创建   ntp   ade   name   

1.安装环境:

centos 7.5
192.168.254.10 openstack-server

2.系统配置:

[root@localhost ~]# hostname openstack-server.smoke.com
[root@openstack-server ~]# vim /etc/hostname
openstack-server.smoke.com
[root@openstack-server ~]# vim /etc/hosts
192.168.254.10  openstack-server openstack-server.smoke.com
[root@openstack-server ~]# ifconfig
enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.254.10  netmask 255.255.255.224  broadcast 192.168.254.31
        inet6 fe80::119a:26d0:b028:74d0  prefixlen 64  scopeid 0x20<link>
        ether 00:e0:4c:0f:ff:a9  txqueuelen 1000  (Ethernet)
        RX packets 42277  bytes 39441483 (37.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14912  bytes 1016294 (992.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 32  bytes 2792 (2.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 32  bytes 2792 (2.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

3.安装时间同步服务NTP:
[root@openstack-server ~]# yum install chrony

chrony时间服务器配置:

[root@openstack-server ~]# vim /etc/chrony.conf
allow 192.168.254.0/27

启动chrony服务:

[root@openstack-server ~]# systemctl enable chronyd.service
[root@openstack-server ~]# systemctl start chronyd.service

设置时区:
[root@openstack-server ~]# timedatectl set-timezone Asia/Shanghai

4.安装阿里的OpenStack源:

[root@openstack-server ~]# vim /etc/yum.repos.d/OpenStack-Rocky.repo
[openstack-rocky]
name=openstack-rocky
baseurl=https://mirrors.aliyun.com/centos/7.5.1804/cloud/x86_64/openstack-rocky/
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
repo_gpgcheck=0
enabled=1
[root@openstack-server ~]# yum clean all
[root@openstack-server ~]# yum makecache

升级软件包:
[root@openstack-server ~]# yum -y upgrade

安装OpenStack client:
[root@openstack-server ~]# yum -y install python-openstackclient

安装openstack-selinux:
[root@openstack-server ~]# yum -y install openstack-selinux

5.安装Mariadb:
[root@openstack-server ~]# yum -y install mariadb mariadb-server python2-PyMySQL

编辑Mariadb配置文件:

[root@openstack-server ~]# mv /etc/my.cnf /etc/my.cnf.bak
[root@openstack-server ~]# cp /usr/share/mariadb/my-large.cnf /etc/my.cnf
[root@openstack-server ~]# vim /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 192.168.254.10

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

启动Mariadb服务:

[root@openstack-server ~]# systemctl enable mariadb.service
[root@openstack-server ~]# systemctl start mariadb.service

初始化Mariadb:
[root@openstack-server ~]# mysql_secure_installation(按提示操作设置root密码)

6.安装rabbitmq-server:
[root@openstack-server ~]# yum install rabbitmq-server

启动rabbitmq-server服务:

[root@openstack-server ~]# vim /etc/rabbitmq/rabbitmq.config
[root@openstack-server ~]# systemctl start rabbitmq-server.service

添加openstack用户:

[root@openstack-server ~]# rabbitmqctl add_user openstack openstack
[root@openstack-server ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"

开启web管理插件:
[root@openstack-server ~]# rabbitmq-plugins enable rabbitmq_management

使用web访问rabbitmq-server(默认账号guest,密码guest):
技术分享图片

设置openstack用户Tags为administrator(点击Admin -- openstack):
技术分享图片

点击Update this user:
技术分享图片

查看设置:
技术分享图片

7.安装memcached:
[root@openstack-server ~]# yum -y install memcached python-memcached

配置memcached:

[root@openstack-server ~]# vim  /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 0.0.0.0,::1"

启动memcached服务:

[root@openstack-server ~]# systemctl enable memcached.service
[root@openstack-server ~]# systemctl start memcached.service

8.安装etcd服务:
[root@openstack-server ~]# yum -y install etcd

配置etcd服务:

[root@openstack-server ~]# vim  /etc/etcd/etcd.conf
#[Member]
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://192.168.254.10:2380"
ETCD_LISTEN_CLIENT_URLS="http://192.168.254.10:2379"
ETCD_NAME="openstack-server"
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.254.10:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.254.10:2379"
ETCD_INITIAL_CLUSTER="openstack=http://192.168.254.10:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new"

启动etcd服务:

[root@openstack-server ~]# systemctl enable etcd
[root@openstack-server ~]# systemctl start etcd

9.安装keystone:
在Mariadb创建keystone库和用户:

[root@openstack-server ~]# mysql -uroot -psmoke520 -e "CREATE DATABASE keystone;"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON keystone.* TO ‘keystone‘@‘localhost‘ IDENTIFIED BY ‘keystone‘;"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON keystone.* TO ‘keystone‘@‘%‘ IDENTIFIED BY ‘keystone‘;"

安装keystone:
[root@openstack-server ~]# yum -y install openstack-keystone httpd mod_wsgi

修改keystone配置文件:

[root@openstack-server ~]# vim /etc/keystone/keystone.conf
[database]
connection = mysql+pymysql://keystone:keystone@openstack-server/keystone
[token]
provider = fernet

同步数据库:
[root@openstack-server ~]# su -s /bin/sh -c "keystone-manage db_sync" keystone

初始化Fernet key仓库:

[root@openstack-server ~]# keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
[root@openstack-server ~]# keystone-manage credential_setup --keystone-user keystone --keystone-group keystone

引导身份服务:

[root@openstack-server ~]# keystone-manage bootstrap --bootstrap-password admin >   --bootstrap-admin-url http://openstack-server:5000/v3/ >   --bootstrap-internal-url http://openstack-server:5000/v3/ >   --bootstrap-public-url http://openstack-server:5000/v3/ >   --bootstrap-region-id RegionOne

配置httpd服务:

[root@openstack-server ~]# vim /etc/httpd/conf/httpd.conf
ServerName openstack-server

创建wsgi-keysone配置文件链接:
[root@openstack-server ~]# ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/

启动httpd服务:

[root@openstack-server ~]# systemctl enable httpd.service
[root@openstack-server ~]# systemctl start httpd.service
[root@openstack-server ~]# vim admin-openrc.sh
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://openstack-server:5000/v3
export OS_IDENTITY_API_VERSION=3

创建域,项目,用户,角色:

[root@openstack-server ~]# openstack domain create --description "An Example Domain" example
[root@openstack-server ~]# openstack project create --domain default >   --description "Service Project" service
[root@openstack-server ~]# openstack project create --domain default >   --description "Demo Project" myproject
[root@openstack-server ~]# openstack user create --domain default >   --password-prompt myuser
[root@openstack-server ~]# openstack role create myrole
[root@openstack-server ~]# openstack role add --project myproject --user myuser myrole

验证keystone是否安装成功:

[root@openstack-server ~]# unset OS_AUTH_URL OS_PASSWORD
[root@openstack-server ~]# openstack --os-auth-url http://openstack-server:5000/v3   --os-project-domain-name Default --os-user-domain-nam                           e Default   --os-project-name admin --os-username admin token issue

创建myuser环境变量:

[root@openstack-server ~]# vim myuser-openrc.sh
export OS_USERNAME=myuser
export OS_PASSWORD=myuser
export OS_PROJECT_NAME=myproject
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://openstack-server:5000/v3
export OS_IDENTITY_API_VERSION=3

使用myuser用户进行测试:

[root@openstack-server ~]#  openstack --os-auth-url http://openstack-server:5000/v3 >   --os-project-domain-name Default --os-user-domain-name Default >   --os-project-name myproject --os-username myuser token issue

修改用户环境变量脚本:

[root@openstack-server ~]# vim admin-openrc.sh
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://openstack-server:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
[root@openstack-server ~]# vim myuser-openrc.sh
export OS_USERNAME=myuser
export OS_PASSWORD=myuser
export OS_PROJECT_NAME=myproject
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://openstack-server:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2

使用脚本测试:

[root@openstack-server ~]# . admin-openrc.sh
[root@openstack-server ~]# openstack token issue

OpenStack-Rocky版单机部署

标签:.sh   col   def   -o   log   创建   ntp   ade   name   

原文地址:http://blog.51cto.com/smoke520/2306945

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!