Loading... ![OpenStack.jpg](/usr/uploads/2020/09/3823210610.jpg) # CentOS 7 安装OpenStack教程 本次实验安装的是OpenStack的Queens版。OpenStack的安装是一个难题,组件众多,非常麻烦。RDO是红帽Red Hat Enterprise Linux OpenStack Platform的社区版,类似RHEL和Fedora,RHEV和oVirt这样的关系。如果手工部署OpenStack,可能需要好几天,使用RDO,就是几个命令,当然也牺牲了灵活性。所以我们这里使用RDO仓库来安装OpenStack的Queens版。 * 准备:VMware虚拟机安装至少需要准备2核6GB内存,硬盘建议分配至少40GB。虚拟机网卡可以只配置一个,使用桥接模式和宿主机连接。使用root用户登录进系统。 ## 环境准备 安装CentOS 7 的时候选择最小安装,并设置好固定IP地址,将yum源替换为阿里云源 ```bash curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo ``` ### 第一步 更新系统软件和内核 本次实验使用DNF新一代的RPM软件包管理器来对系统组件进行更新。 * DNF 并未默认安装在 RHEL 或 CentOS 7系统中。为了安装 DNF ,必须先安装并启用 epel-release 依赖 ```bash yum install -y epel-release curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo ``` * 安装dnf ```bash yum install -y dnf ``` * 之后使用dnf update更新系统软件和内核 ```bash dnf update -y ``` 稍等片刻后就安装完成了,完成之后最好是reboot一下,这是一个好习惯。 ### 第二步 配置前置安装条件 OpenStack不建议使用firewalld和networkManager,因为它使用的是iptables,它与firewalld冲突。NetworkManager对OpenStack可能不知道的网络适配器动态地执行操作,因此可能会导致严重的网络问题。因此,推荐/最佳实践是您使用基本的网络实用程序。 * 停止并禁用NetworkManager ```bash systemctl stop NetworkManager systemctl disable NetworkManager ``` * 停止并禁用firewalld ```bash systemctl stop firewalld systemctl disable firewalld ``` * 重新启动网络服务 ```bash systemctl restart network ``` * 禁用SELinux ```bash setenforce 0 ``` * 或者永久禁用SELinux(建议) ```bash vi /etc/selinux/config ``` 将 SELINUX=enforcing 更改为 SELINUX=disabled ### 第三步 安装OpenStack仓库 * 安装RDO仓库和yum仓库管理器 ```bash yum install -y https://rdoproject.org/repos/rdo-release.rpm yum install -y yum-utils ``` * 启用OpenStack-Queens仓库 ```bash yum-config-manager --enable openstack-queens ``` 之后重启一下系统 ```bash sync;reboot ``` ### 第四步 安装OpenStack Packstack Packstack是一个OpenStack设置实用程序 ```bash yum install -y openstack-packstack ``` ### 第五步 使用Packstack部署和运行OpenStack ```bash packstack --allinone ``` * 此步骤执行需要较长时间,请耐心等待 * 输出内容 ``` Welcome to the Packstack setup utility The installation log file is available at: /var/tmp/packstack/20200921-085713-IQc12l/openstack-setup.log Packstack changed given value to required value /root/.ssh/id_rsa.pub Installing: Clean Up [ DONE ] Discovering ip protocol version [ DONE ] Setting up ssh keys [ DONE ] Preparing servers [ DONE ] Pre installing Puppet and discovering hosts' details [ DONE ] Preparing pre-install entries [ DONE ] Setting up CACERT [ DONE ] Preparing AMQP entries [ DONE ] Preparing MariaDB entries [ DONE ] Fixing Keystone LDAP config parameters to be undef if empty[ DONE ] Preparing Keystone entries [ DONE ] Preparing Glance entries [ DONE ] Checking if the Cinder server has a cinder-volumes vg[ DONE ] Preparing Cinder entries [ DONE ] Preparing Nova API entries [ DONE ] Creating ssh keys for Nova migration [ DONE ] Gathering ssh host keys for Nova migration [ DONE ] Preparing Nova Compute entries [ DONE ] Preparing Nova Scheduler entries [ DONE ] Preparing Nova VNC Proxy entries [ DONE ] Preparing OpenStack Network-related Nova entries [ DONE ] Preparing Nova Common entries [ DONE ] Preparing Neutron API entries [ DONE ] Preparing Neutron L3 entries [ DONE ] Preparing Neutron L2 Agent entries [ DONE ] Preparing Neutron DHCP Agent entries [ DONE ] Preparing Neutron Metering Agent entries [ DONE ] Checking if NetworkManager is enabled and running [ DONE ] Preparing OpenStack Client entries [ DONE ] Preparing Horizon entries [ DONE ] Preparing Swift builder entries [ DONE ] Preparing Swift proxy entries [ DONE ] Preparing Swift storage entries [ DONE ] Preparing Gnocchi entries [ DONE ] Preparing Redis entries [ DONE ] Preparing Ceilometer entries [ DONE ] Preparing Aodh entries [ DONE ] Preparing Puppet manifests [ DONE ] Copying Puppet modules and manifests [ DONE ] Applying 虚拟机的IP地址_controller.pp 虚拟机的IP地址_controller.pp: [ DONE ] Applying 虚拟机的IP地址_network.pp 虚拟机的IP地址_network.pp: [ DONE ] Applying 虚拟机的IP地址_compute.pp 虚拟机的IP地址_compute.pp: [ DONE ] Applying Puppet manifests [ DONE ] Finalizing [ DONE ] **** Installation completed successfully ****** Additional information: * Parameter CONFIG_NEUTRON_L2_AGENT: You have chosen OVN Neutron backend. Note that this backend does not support the VPNaaS or FWaaS services. Geneve will be used as the encapsulation method for tenant networks * A new answerfile was created in: /root/packstack-answers-20200000-000000.txt * Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components. * File /root/keystonerc_admin has been created on OpenStack client host 虚拟机的IP地址. To use the command line tools you need to source the file. * To access the OpenStack Dashboard browse to http://虚拟机的IP地址/dashboard . Please, find your login credentials stored in the keystonerc_admin in your home directory. * The installation log file is available at: /var/tmp/packstack/20200000-000000-IQc12l/openstack-setup.log * The generated manifests are available at: /var/tmp/packstack/20200000-000000-IQc12l/manifests ``` (如果执行了上述命令,则不需要此操作)如果您不想立即运行packstack –allinone,因为它会安装所有内容(可能需要更多内容)。您可以使用配置文件指定要配置的内容。首先生成配置文件。 ```bash packstack --gen-answer-file=answer.txt ``` ### 第六步 验证OpenStack是否安装成功 登录到仪表板(Horizon)进行验证。在上述命令的执行输出(packstack -allinone)的末尾是仪表盘的登录地址。 ![OpenStack登录界面.png](/usr/uploads/2020/09/2841874175.png) * 用浏览器访问http://虚拟机的IP地址/dashboard * 默认用户名是admin,您可以从keystonerc_admin获取密码(如果未在answers.txt文件中设置密码),可以在/root目录中找到它(Keystone是身份验证服务/组件的密码) ```bash cat keystonerc_admin ``` 输出内容 ``` unset OS_SERVICE_TOKEN export OS_USERNAME=admin export OS_PASSWORD='这里是密码' export OS_REGION_NAME=RegionOne export OS_AUTH_URL=http://虚拟机IP地址:5000/v3 export PS1='[\u@\h \W(keystone_admin)]\$ ' export OS_PROJECT_NAME=admin export OS_USER_DOMAIN_NAME=Default export OS_PROJECT_DOMAIN_NAME=Default export OS_IDENTITY_API_VERSION=3 ``` 整个安装过程大约需要半小时到一小时不等 ![OpenStack管理界面.png](/usr/uploads/2020/09/263862580.png) Last modification:November 6, 2024 © Allow specification reprint Support Appreciate the author AliPayWeChat Like If you think my article is useful to you, please feel free to appreciate