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

两小时openstack环境搭建(keystone)

时间:2018-11-03 18:17:39      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:color   sql数据库   mysqld   apache2   sof   adb   source   amp   mysql数据库   

一、新建虚拟机4g内存2cpu,unbutu系统

安装并设置时间同步服务
apt update
apt install chrony

vim /etc/chrony/chrony.conf
技术分享图片

service chrony restart
compute上
apt update
apt install chrony
vim /etc/chrony/chrony.conf
技术分享图片
service chrony restart
chronyc sources
回到controller
chronyc sources
在两台虚拟机上
apt install software-properties-common
add-apt-repository cloud-archive:queens

apt update && apt dist-upgrade
apt install python-openstackclient

安装并配置mysql数据库(controller上)
apt install mariadb-server python-pymysql
vim /etc/mysql/mariadb.conf.d/99-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

service mysql restart
mysql_secure_installation 回车 更改一下root密码 一路回车即可

mysql
exit

apt install rabbitmq-server
创建openstack用户
rabbitmqctl add_user openstack 123456

rabbitmqctl set_permissions openstack "." "." ".*"
技术分享图片
apt install memcached python-memcache
vim /etc/memcached.conf
技术分享图片

service memcached restart
groupadd --system etcd
useradd --home-dir "/var/lib/etcd" \
--system \
--shell /bin/false \
-g etcd \
etcd

技术分享图片

mkdir -p /etc/etcd
chown etcd:etcd /etc/etcd
mkdir -p /var/lib/etcd
chown etcd:etcd /var/lib/etcd

.

ETCD_VER=v3.2.7
rm -rf /tmp/etcd && mkdir -p /tmp/etcd
curl -L \
https://github.com/coreos/etcd/releases/download/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz \
-o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz \
-C /tmp/etcd --strip-components=1
cp /tmp/etcd/etcd /usr/bin/etcd
cp /tmp/etcd/etcdctl /usr/bin/etcdctl

技术分享图片

vim /lib/systemd/system/etcd.service

[Unit]
After=network.target
Description=etcd - highly-available key value store

[Service]
LimitNOFILE=65536
Restart=on-failure
Type=notify
ExecStart=/usr/bin/etcd --config-file /etc/etcd/etcd.conf.yml
User=etcd

[Install]
WantedBy=multi-user.target

systemctl enable etcd
systemctl start etcd
systemctl status etcd
技术分享图片

安装并配置keyston服务

mysql
MariaDB [(none)]> CREATE DATABASE keystone;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone. TO ‘keystone‘@‘localhost‘ \
IDENTIFIED BY ‘KEYSTONE_DBPASS‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.
TO ‘keystone‘@‘%‘ \
IDENTIFIED BY ‘KEYSTONE_DBPASS‘;

技术分享图片

apt install keystone apache2 libapache2-mod-wsgi

ufw disable
技术分享图片
vim /etc/keystone/keystone.conf
修改下面两项
connection = mysql+pymysql://keystone:KEYSTONE_DBPASS@controller/keystone
provider = fernet

su -s /bin/sh -c "keystone-manage db_sync" keystone
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
keystone-manage credential_setup --keystone-user keystone --keystone-group keystone

keystone-manage bootstrap --bootstrap-password ADMIN_PASS --bootstrap-admin-url http://controller:5000/v3/ --bootstrap-internal-url http://controller:5000/v3/ --bootstrap-public-url http://controller:5000/v3/ --bootstrap-region-id RegionOne

技术分享图片

vim /etc/apache2/apache2.conf
ServerName controller

service apache2 restart
vim default-env

export OS_USERNAME=admin
export OS_PASSWORD=123456
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://controller:5000/v3
export OS_IDENTITY_API_VERSION=3

mv default-env /home/lxc/
chown lxc:lxc /home//lxc//default-env

两小时openstack环境搭建(keystone)

标签:color   sql数据库   mysqld   apache2   sof   adb   source   amp   mysql数据库   

原文地址:http://blog.51cto.com/13670314/2312516

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