OpenNebulaを簡単にインストールする

#はじめに
手軽なAPIで操作できるクラウド環境を整備したかった。
OpenNebulaかOpenStackどちらかで構築しようと考えたが、前者の方が楽そうなので試してみた。
インストール中、ぐぐるとOpenstackでも楽そうなのかもしれない。( https://docs.openstack.org/devstack/latest/guides/single-machine.html )
まぁとりあえず、ネビュラを使ってみましょうか。

#環境
CentOS7
Linode(1GB)

#インストール
OpenNebulaは簡単なコマンドでインストールできる（お試し的な用途だとは思うが）
##スクリプトのダウンロード
リンクが切れてないか、確認されたい。

```
wget https://raw.githubusercontent.com/OpenNebula/minione/master/minione
```

スクリプトを実行してあげるだけだ。

```
sudo bash minione --verbose
```

途中1回だけ同意を求められるので、yes　と同意できる場合は入力する。


```shell-session:ログ
[root@てすてす ~]# sudo bash minione --verbose

### Checks & detection
Checking distribution and version [CentOS 7 5.8]  OK
Checking if OpenNebula repository exists  OK
Checking cpu virtualization capabilities  SKIP QEMU will be used
Checking free disk space  OK
Checking local interface [eth0]  OK
Checking directories from previous installation  OK
Checking user from previous installation  OK
Checking sshd service is running  OK
Checking bridge-utils are installed  SKIP will try to install
Checking minionebr interface is not present  OK
Checking virtual network ほにゃらら/24 is not routed  OK
Checking SELinux  SKIP will try to disable
Checking for present ssh key  SKIP
Generating ssh keypair in /root/.ssh/id_rsa  OK
Checking presence of the market app: "CentOS 7 - KVM"  OK

### Main deployment steps:
Disable SELinux
Install bridge-utils
Disable_firewalld
Configure bridge minionebr with IP ほにゃらら/24
Enable NAT over eth0
Using ssh public key /root/.ssh/id_rsa.pub
Install OpenNebula version 5.8

Do you agree? [yes/no]:
yes

### Installation
Disabling SELinux  OK
Install bridge-utils  OK
Creating bridge interface minionebr  OK
Restarting network  OK
Disabling firewalld  OK
Enabling ipv4 forward  OK
Configuring nat using iptables  OK
Verify bridge by ping from it  OK
Saving iptables changes  OK
Installing DNSMasq  OK
Starting DNSMasq  OK
Configuring repositories  OK
Installing epel  OK
Installing OpenNebula packages  OK
Installing ruby gems  OK
Installing OpenNebula node packages  OK

### Configuration
Switching onegate endpoint in oned.conf  OK
Switching scheduler interval to 10sec  OK
Switching to QEMU emulation  OK
Setting initial password for current user and oneadmin  OK
Changing WebUI to listen on port 80  OK
Starting opennebula services  OK
Checking OpenNebula is working  OK
Disabling ssh from virtual network  OK
Adding localhost ssh key to known_hosts  OK
Testing ssh connection to localhost  OK
Add ssh key to oneadmin user  OK
Updating datastores, TM_MAD=qcow2, SHARED=yes  OK
Creating kvm host  OK
Creating virtual network  OK
Exporting [CentOS 7 - KVM] from marketplace to local datastore  OK
Updating template  OK

### Report
OpenNebula 5.8 was installed
Sunstone (the webui) is runninng on:
  http://ほにゃほにゃ/
Use following to login:
  user: ほじ
  password: ぱすわど
[root@li1889-102 ~]# 


```

あっさりインストールできた。

##こんな感じ
![image.png](https://qiita-image-store.s3.amazonaws.com/0/245977/83e15e49-6390-8f01-f11f-f1a03df1d093.png)


##注意 Ubuntu18.04
Ubuntu18.04でやってみると下記のようなエラーが出た。

```
### Main deployment steps:
Install bridge-utils
Configure bridge minionebr with IP なんとか/24
Enable NAT over eth0
Using ssh public key /root/.ssh/id_rsa.pub
Install OpenNebula version 5.6
Modify AppArmor

Do you agree? [yes/no]:
yes

### Installation
Updating apt cache  OK
Install bridge-utils  OK
Creating bridge interface minionebr  OK
Restarting network  FAILED
```
直るかなぁ。netplanの不足か？

```shell
apt install netplan
```

netplanと相性が悪い。スクリプトにnetplanはちゃんと対応できるような記述がなされていたので、悪いのは俺のせいだろう。でも、Ubuntuに拘る理由もないので、今回はCentOS7でやった。


#Ref
https://opennebula.org/minione-install-opennebula-with-a-single-command/
https://github.com/OpenNebula/minione/