Packstackを使ってOpenStackを構築する


背景

OpenStackを出来るだけ簡単に構築してPrivate Cloud環境を手に入れたい。

概要

  • Mac上でVagrantでCentOS7のVMを用意し、そのVMにPackstackを使ってOpenStackをinstallする方法まとめ。

参考

手順

VagrantでVMを用意する。(CentOS7, CPU:2, Memory:8G)

bash
### Vagrantfileを置く作業フォルダを作成
iguchi@igc-mbp:~/my-vagrant$ mkdir openstack-study && ce openstack-study
iguchi@igc-mbp:~/my-vagrant/openstack-study$ vagrant init centos/7

### Vagrantfileを書き換える。CPUを2個、メモリを8G、80を8080にport forwardする
iguchi@igc-mbp:~/my-vagrant/openstack-study (master *)$ git diff
diff --git a/Vagrantfile b/Vagrantfile
index 8378ce3..cd53e9e 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -23,7 +23,7 @@ Vagrant.configure("2") do |config|
   # within the machine from a port on the host machine. In the example below,
   # accessing "localhost:8080" will access port 80 on the guest machine.
   # NOTE: This will enable public access to the opened port
-  # config.vm.network "forwarded_port", guest: 80, host: 8080
+  config.vm.network "forwarded_port", guest: 80, host: 8080

   # Create a forwarded port mapping which allows access to a specific port
   # within the machine from a port on the host machine and only allow access
@@ -49,13 +49,14 @@ Vagrant.configure("2") do |config|
   # backing providers for Vagrant. These expose provider-specific options.
   # Example for VirtualBox:
   #
-  # config.vm.provider "virtualbox" do |vb|
+  config.vm.provider "virtualbox" do |vb|
   #   # Display the VirtualBox GUI when booting the machine
   #   vb.gui = true
   #
   #   # Customize the amount of memory on the VM:
-  #   vb.memory = "1024"
-  # end
+    vb.cpus = 2
+    vb.memory = "8192"
+  end
   #
   # View the documentation for the provider you are using for more
   # information on available options.
iguchi@igc-mbp:~/my-vagrant/openstack-study (master *)$

### VMを起動
iguchi@igc-mbp:~/my-vagrant/openstack-study (master *)$ vagrant up

### VMにsshでloginする
iguchi@igc-mbp:~/my-vagrant/openstack-study (master *)$ vagrant ssh

作ったVMにPackstackをinstallして、環境を整えると共に、OpenStackをinstallする

bash
### localeの設定
### If you are using non-English locale make sure your /etc/environment is populated:
[vagrant@localhost ~]$ cat /etc/environment
LANG=en_US.utf-8
LC_ALL=en_US.utf-8

### network関係の設定
### If you plan on having external network access to the server and instances, this is a good moment to properly configure your network settings. A static IP address to your network card, and disabling NetworkManager are good ideas.
[vagrant@localhost ~]$ sudo systemctl disable firewalld
[vagrant@localhost ~]$ sudo systemctl stop firewalld
[vagrant@localhost ~]$ sudo systemctl disable NetworkManager
[vagrant@localhost ~]$ sudo systemctl stop NetworkManager
[vagrant@localhost ~]$ sudo systemctl enable network
[vagrant@localhost ~]$ sudo systemctl start network

### Step 1: Software repositories
### On RHEL, download and install the RDO repository RPM to set up the OpenStack repository:
[vagrant@localhost ~]$ sudo yum install -y https://rdoproject.org/repos/rdo-release.rpm

### On CentOS, the Extras repository provides the RPM that enables the OpenStack repository. Extras is enabled by default on CentOS 7, so you can simply install the RPM to set up the OpenStack repository.
[vagrant@localhost ~]$ sudo yum install -y centos-release-openstack-stein

### Make sure the repository is enabled:
[vagrant@localhost ~]$ sudo yum-config-manager --enable openstack-stein

### Update your current packages:
[vagrant@localhost ~]$ sudo yum update -y

### Step 2: Install Packstack Installer
[vagrant@localhost ~]$ sudo yum install -y openstack-packstack

### Step 3: Run Packstack to install OpenStack
[vagrant@localhost ~]$ sudo packstack --allinone

Web UIにアクセスしてloginする

login後の画面