packstack一键安装openstack的方法,其中节点的硬件架构为x86_64(必须是64位,32位不可以)、操作系统为centos7。官方的安装文档地址为https://openstack.redhat.com/Quickstart。



1 安装软件库

更新安装的软件包,命令如下:

sudo yum update -y

建立RDO库,命令如下:

sudo yum install -y https://rdo.fedorapeople.org/rdo-release.rpm

上面的RDO库安装的openstack版本为Juno,如果想要安装openstack之前的版本,访问http://rdo.fedorapeople.org/找到对应的rpm文件安装即可。.



2 安装Packstack 

安装packstack,命令如下:

sudo yum install -y openstack-packstack



3 安装openstack

在单节点安装openstack的命令如下所示:

packstack --allinone

如果在安装过程中遇到问题,请在https://openstack.redhat.com/Workarounds中查看是否有类似问题的解决方式。



4 卸载openstack

RDO官方网站给出的卸载方法为https://openstack.redhat.com/Uninstalling_RDO。

如果节点上只有openstack,没有其他服务,则用下面的完全卸载方式,将下面的节本复制到一个文件中,修改文件为可执行,执行该文件即可完成卸载程序。卸载节本如下所示:

# Warning! Dangerous step! Destroys VMs
for x in $(virsh list --all | grep instance- | awk '{print $2}') ; do
    virsh destroy $x ;
    virsh undefine $x ;
done ;
 
# Warning! Dangerous step! Removes lots of packages, including many
# which may be unrelated to RDO.
yum remove -y nrpe "*nagios*" puppet ntp ntp-perl ntpdate "*openstack*" \
"*nova*" "*keystone*" "*glance*" "*cinder*" "*swift*" \
mysql mysql-server httpd "*memcache*" scsi-target-utils \
iscsi-initiator-utils perl-DBI perl-DBD-MySQL ;
 
ps -ef | grep -i repli | grep swift | awk '{print $2}' | xargs kill ;
 
# Warning! Dangerous step! Deletes local application data
rm -rf /etc/nagios /etc/yum.repos.d/packstack_* /root/.my.cnf \
/var/lib/mysql/ /var/lib/glance /var/lib/nova /etc/nova /etc/swift \
/srv/node/device*/* /var/lib/cinder/ /etc/rsync.d/frag* \
/var/cache/swift /var/log/keystone ;
 
umount /srv/node/device* ;
killall -9 dnsmasq tgtd httpd ;
setenforce 1 ;
vgremove -f cinder-volumes ;
losetup -a | sed -e 's/:.*//g' | xargs losetup -d ;
find /etc/pki/tls -name "ssl_ps*" | xargs rm -rf ;
for x in $(df | grep "/lib/" | sed -e 's/.* //g') ; do
    umount $x ;
done
如果节点上还有其他服务运行,则用下面的保守卸载方式,将下面的节本复制到一个文件中,修改文件为可执行,执行该文件即可完成卸载程序。卸载节本如下所示:
for x in $(virsh list --all | grep instance- | awk '{print $2}') ; do
    virsh destroy $x ;
    virsh undefine $x ;
done ;
 
yum remove -y "*openstack*" "*nova*" "*keystone*" "*glance*" "*cinder*" "*swift*" "*rdo-release*";
 
# Optional - makes database cleanup cleaner.
# If you do this bit, the database cleanup stuff below is superfluous.
# yum remove -y "*mysql*"
 
ps -ef | grep -i repli | grep swift | awk '{print $2}' | xargs kill ;
 
rm -rf  /etc/yum.repos.d/packstack_* /var/lib/glance /var/lib/nova /etc/nova /etc/swift \
/srv/node/device*/* /var/lib/cinder/ /etc/rsync.d/frag* \
/var/cache/swift /var/log/keystone /tmp/keystone-signing-nova ;
 
# Ensure there is a root user and that we know the password
service mysql stop
cat > /tmp/set_mysql_root_pwd << EOF
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
EOF
 
# mysql cleanup
/usr/bin/mysqld_safe --init-file=/tmp/set_mysql_root_pwd &
rm /tmp/set_mysql_root_pwd
mysql -uroot -pMyNewPass -e "drop database nova; drop database cinder; drop database keystone; drop database glance;"
 
umount /srv/node/device* ;
vgremove -f cinder-volumes ;
losetup -a | sed -e 's/:.*//g' | xargs losetup -d ;
find /etc/pki/tls -name "ssl_ps*" | xargs rm -rf ;
for x in $(df | grep "/lib/" | sed -e 's/.* //g') ; do
    umount $x ;
done