首页 > 代码库 > 58 Openstack基础、openstack之glance、openstack之keystone

58 Openstack基础、openstack之glance、openstack之keystone

03 openstack之keystone


配置环境

Controller CentOS release 6.7 controller

eth0:仅主机 192.168.28.121

eth1:桥接 192.168.1.121

node2 192.168.1.122 CentOS release 6.7 compute1

eth0:仅主机,eth1:VMnet2 不会直接与外部网络通信

node3 192.168.1.123 CentOS release 6.7 networking

eth0:仅主机,eth1:VMnet2,eth2:桥接

[root@Controller ~]# vim /etc/hosts

添加

192.168.28.121      controller.magedu.com controller

192.168.28.122      compute1.magedu.com compute1

192.168.28.123      network1.magedu.com network1



#配置安装Mariadb

[root@Controller ~]# yum -y groupinstall "Development tools" "Desktop Platform Development" -y

[root@Controller ~]# yum -y install cmake

[root@Controller ~]# groupadd -r -g 306 mysql

[root@Controller ~]# useradd -r -g 306 -u 306 mysql

[root@Controller ~]# mkdir -p /mydata/data

[root@Controller ~]# chown  mysql.mysql /mydata/data/

[root@Controller ~]# tar xf mariadb-5.5.53.tar.gz 

[root@Controller ~]# cd mariadb-5.5.53

[root@Controller mariadb-5.5.53]#cmake  \

-DCMAKE_INSTALL_PREFIX=/usr/local/mariadb-5.5.53 \

 -DMYSQL_DATADIR=/mydata/data \

 -DSYSCONFDIR=/etc \

 -DWITH_INNOBASE_STORAGE_ENGINE=1 \

 -DWITH_ARCHIVE_STORAGE_ENGINE=1 \

 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

 -DWITH_READLINE=1 \

 -DWITH_SSL=system \

 -DWITH_ZLIB=system \

 -DWITH_LIBWRAP=0 \

 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \

 -DDEFAULT_CHARSET=utf8 \

 -DDEFAULT_COLLATION=utf8_general_ci

[root@Controller mariadb-5.5.53]# make && make install

[root@Controller mariadb-5.5.53]# cd /usr/local/mariadb-5.5.53/

[root@Controller mariadb-5.5.53]# chown -R root.mysql ./*

[root@Controller mariadb-5.5.53]# cd ..

[root@Controller local]# ln -s mariadb-5.5.53/ mysql

[root@Controller local]# cd mysql

[root@Controller mysql]# scripts/mysql_install_db --user=mysql --datadir=/mydata/data/

[root@Controller mysql]# mkdir /etc/mysql

[root@Controller mysql]# cp support-files/my-large.cnf /etc/mysql/my.cnf

[root@Controller mysql]# vim /etc/mysql/my.cnf 

添加

datadir = /mydata/data

innodb_file_per_table = ON

skip_name_resolv = ON  

[root@Controller mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld

[root@Controller mysql]# chmod +x /etc/rc.d/init.d/mysqld 

[root@Controller mysql]# chkconfig --add mysqld

[root@Controller ~]# vim /etc/profile.d/mysql.sh

export PATH=/usr/local/mysql/bin:$PATH

[root@Controller ~]# . /etc/profile.d/mysql.sh


#配置openstack-controller

[root@Controller ~]# cd /etc/sysconfig/netwok-scripts 

[root@Controller network-scripts]# cp ifcfg-eth{0,1}

[root@Controller network-scripts]# vim ifcfg-eth1

替换所有的eth0为eth1

删除UUID、MAC、MM_CONTROLLED行

其它保持不变

[root@Controller network-scripts]# vim ifcfg-eth0

删除UUID、MAC、MM_CONTROLLED、网关、DNS

修改IP地址为192.168.28.121

[root@Controller network-scripts]# service NetworkManager stop

[root@Controller network-scripts]# chkconfig NetworkManager off

[root@Controller network-scripts]# service network restart

[root@Controller network-scripts]# ifconfig

eth0      Link encap:Ethernet  HWaddr 00:0C:29:AF:63:D0  

 inet addr:192.168.28.121  Bcast:192.168.28.255  Mask:255.255.255.0

 inet6 addr: fe80::20c:29ff:feaf:63d0/64 Scope:Link

 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

 RX packets:25 errors:0 dropped:0 overruns:0 frame:0

 TX packets:47 errors:0 dropped:0 overruns:0 carrier:0

 collisions:0 txqueuelen:1000 

 RX bytes:1962 (1.9 KiB)  TX bytes:3146 (3.0 KiB)


eth1      Link encap:Ethernet  HWaddr 00:0C:29:AF:63:DA  

 inet addr:192.168.1.121  Bcast:192.168.1.255  Mask:255.255.255.0

 inet6 addr: fe80::20c:29ff:feaf:63da/64 Scope:Link

 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

 RX packets:1745 errors:0 dropped:0 overruns:0 frame:0

 TX packets:115 errors:0 dropped:0 overruns:0 carrier:0

 collisions:0 txqueuelen:1000 

 RX bytes:316460 (309.0 KiB)  TX bytes:13880 (13.5 KiB)

 

#同步服务器时间  

[root@Controller network-scripts]# crontab -l

*/3 * * * * /usr/sbin/ntpdate 192.168.1.1 &> /dev/null


#配置openstack-Compute1

[root@Compute1 ~]# cd /etc/sysconfig/netwok-scripts 

[root@Compute1 network-scripts]# cp ifcfg-eth{0,1}

[root@Compute1 network-scripts]# vim ifcfg-eth1

替换所有的eth0为eth1

删除UUID、MAC、MM_CONTROLLED、DNS、网关、网关、掩码行

其它保持不变

[root@Compute1 network-scripts]# vim ifcfg-eth0

删除UUID、MAC、MM_CONTROLLED

修改IP地址为192.168.28.122

修改网关为192.168.28.121

[root@Compute1 network-scripts]# service NetworkManager stop

[root@Compute1 network-scripts]# chkconfig NetworkManager off

[root@Compute1 network-scripts]# service network restart

[root@Compute1 network-scripts]#route add default gw 192.168.28.121


#同步服务器时间

[root@Compute1 ~]# crontab -l

*/3 * * * * /usr/sbin/ntpdate 192.168.1.1 &> /dev/null

[root@Controller ~]# scp /etc/hosts compute1:/etc/

[root@Controller ~]# iptables -t nat -A POSTROUTING -s 192.168.28.0/24 -j SNAT --to-source 192.168.1.121

[root@Controller ~]# service iptables save

[root@Controller ~]# vim /etc/sysctl.conf 

修改

net.ipv4.ip_forward = 0

net.ipv4.ip_forward = 1


[root@Controller ~]# cd /etc/yum.repos.d/

[root@Controller yum.repos.d]# vim openstack.repo

[openstack]

name=openstack-icehouse

baseurl=http://192.168.56.2/openstack

enabled=1

gpgcheck=0

[root@Controller yum.repos.d]# yum install openstack-keystone python-keystoneclient #没有安装成功

[root@Controller yum.repos.d]# yum install -y openstack-utils

[root@Controller yum.repos.d]# openstack-db --init --service keystone --pass keystone

[root@Controller yum.repos.d]# cd

[root@Controller ~]# mysql

mysql> GRANT ALL ON keystone.* to ‘keystone‘@‘%‘ IDENTIFIED BY ‘keystone‘;

mysql> FLUSH PRIVILEGES;

mysql> \q

[root@Controller ~]# su -s /bin/sh -c ‘keystone-manage db_sync‘ keystone

[root@Controller ~]# service mysqld stop

[root@Controller ~]# yum install mariadb-galera-server

[root@Controller ~]# rm -f /etc/profile.d/mysql.sh


截止 93:0(84558)

由于openstack-keystone无法安装成功,本视频无法继续进行


04 openstack之glance


截止 11:33(10512)

由于openstack-keystone无法安装成功,本视频无法继续进行


本文出自 “追梦” 博客,请务必保留此出处http://sihua.blog.51cto.com/377227/1892009

58 Openstack基础、openstack之glance、openstack之keystone