🗂

プライベートクラウド(OpenStack)を構築してみた

2022/05/23に公開

興味本位でOpenStackをWindows11のVMware上のCentOS7.9で構築してみました。
ディスクサイズやメモリなどギリギリでただ構築しただけになります。
もっとまともな機器で構築すればかなり有用なサービスとなることは間違いないです。

注意事項

色々な記事を参照するとメモリ8GB無いとpackstackインストールで失敗するそうです。
ホストマシンには最低でも8GBのメモリを設定することを覚えておきましょう。

事前準備

不都合なサービスを停止する

systemctl disable firewalld
systemctl stop firewalld
systemctl disable NetworkManager
systemctl stop NetworkManager
systemctl enable network
systemctl start network

Selinuxをdisabledにする

[root@localhost ~]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

yumアップデートの実行

yum update -y

OpenStackのインストール

yum install -y centos-release-openstack-stein

もっかいyum update

yum update -y

All-In-Oneでインストールできるツールのインストール

yum install -y openstack-packstack

$db_sync timeoutの値を0にする

既存の設定を確認する

修正前
[root@openstack ~]# cd /usr/share/
[root@openstack share]# grep -Ri "timeout = 30" | grep "openstack*"
openstack-puppet/modules/rsync/templates/header.erb:timeout = 300
openstack-puppet/modules/nova/manifests/db/online_data_migrations.pp:  $db_sync_timeout = 300,
openstack-puppet/modules/nova/manifests/db/sync.pp:  $db_sync_timeout = 300,
openstack-puppet/modules/nova/manifests/db/sync_api.pp:  $db_sync_timeout = 300,
openstack-puppet/modules/neutron/manifests/db/sync.pp:  $db_sync_timeout = 300,
[root@openstack share]#

下4つを下記のとおり編集します。

修正後
[root@openstack share]# grep -Ri "timeout = 0" | grep "openstack*"
openstack-puppet/modules/openstacklib/lib/puppet/provider/openstack.rb:      self.request_timeout = 0
openstack-puppet/modules/nova/manifests/db/online_data_migrations.pp:  $db_sync_timeout = 0,
openstack-puppet/modules/nova/manifests/db/sync.pp:  $db_sync_timeout = 0,
openstack-puppet/modules/nova/manifests/db/sync_api.pp:  $db_sync_timeout = 0,
openstack-puppet/modules/neutron/manifests/db/sync.pp:  $db_sync_timeout = 0,

Answerファイルの作成

packstack --gen-answer-file=answer.txt

実行結果
赤字のinformationが出るのはOKです。

[root@localhost ~]# packstack --gen-answer-file=answer.txt
Packstack changed given value  to required value /root/.ssh/id_rsa.pub
Additional information:
 * Parameter CONFIG_NEUTRON_L2_AGENT: You have choosen OVN neutron backend. Note that this backend does not support LBaaS, VPNaaS or FWaaS services. Geneve will be used as encapsulation method for tenant networks

パスワードの設定

[root@localhost ~]# cat answer.txt | grep "CONFIG_KEYSTONE_ADMIN_PW"
CONFIG_KEYSTONE_ADMIN_PW=hoge12345

packstackでOpenStackをインストールする

[root@localhost ~]# packstack --answer-file=answer.txt --timeout=0 --debug
Welcome to the Packstack setup utility

The installation log file is available at: /var/tmp/packstack/20220523-094708-HSQxu2/openstack-setup.log

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 LBaaS Agent 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 192.168.250.58_controller.pp
192.168.250.58_controller.pp:                        [ DONE ]
Applying 192.168.250.58_network.pp
192.168.250.58_network.pp:                           [ DONE ]
Applying 192.168.250.58_compute.pp
192.168.250.58_compute.pp:                           [ DONE ]
Applying Puppet manifests                            [ DONE ]
Finalizing                                           [ DONE ]

 **** Installation completed successfully ******

Additional information:
 * Parameter CONFIG_NEUTRON_L2_AGENT: You have choosen OVN neutron backend. Note that this backend does not support LBaaS, VPNaaS or FWaaS services. Geneve will be used as encapsulation method for tenant networks
 * 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 192.168.250.58. To use the command line tools you need to source the file.
 * To access the OpenStack Dashboard browse to http://192.168.250.58/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
 * Because of the kernel update the host 192.168.250.58 requires reboot.
 * The installation log file is available at: /var/tmp/packstack/20220523-094708-HSQxu2/openstack-setup.log
 * The generated manifests are available at: /var/tmp/packstack/20220523-094708-HSQxu2/manifests
 * Note temporary directory /var/tmp/packstack/4de1bb030a09497c8dc758ca53210d8d on host 192.168.250.58 was not deleted for debugging purposes.

問題なくインストールできましたらログに記載があるとおりブラウザでアクセスしてみましょう。
To access the OpenStack Dashboard browse to http://192.168.250.58/dashboard

無事アクセスできました。
次回はOpenStack上にゲストOSを立ててみたいと思います。

Discussion