CPU | 4Core |
MEM | 4GB |
HDD1 | 20GB |
HDD2 | 100GB |
# sudo apt-get install open-vm-tools # sudo apt-get install open-vm-tools-desktop # sudo shutdown -r now
$ sudo apt-get install avahi-daemon avahi-utils $ sudo systemctl is-enabled avahi-daemon enabled
$ sudo -s # sudo fdisk -l Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 41940991 41938944 20G 83 Linux Disk /dev/sdb: 100 GiB, 107374182400 bytes, 209715200 sectors # fdisk /dev/sdb Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-209715199, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-209715199, default 209715199): Created a new partition 1 of type 'Linux' and of size 100 GiB. Command (m for help): w ← !w コマンド実行まで書き込まれない! root@nebula1:~# fdisk -l Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 41940991 41938944 20G 83 Linux Disk /dev/sdb: 100 GiB, 107374182400 bytes, 209715200 sectors Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 209715199 209713152 100G 83 Linux
# mkfs.ext4 /dev/sdb1
# mkdir /var/lib/one/datastores # blkid /dev/sdb1 /dev/sdb1: UUID="348b5156-0e1b-4d5a-b942-21eba13e2359" TYPE="ext4" PARTUUID="26e2b054-01"
UUID=481686bc-85c8-44d6-91f3-867748f44cda / ext4 errors=remount-ro 0 1
UUID=348b5156-0e1b-4d5a-b942-21eba13e2359 /var/lib/one ext4 defaults 0 0
/swapfile none swap sw 0 0
/etc/fstabの書き方
1 | デバイス名 | UUID=348b5156-0e1b-4d5a-b942-21eba13e2359 |
2 | マウントポイント | /var/lib/one |
3 | ファイルシステム | ext4 |
4 | マウントオプション | defaults |
5 | 異常時にダンプをするか | 0:必要なし 1:必要あり |
6 | 起動時に fsck チェックをするか | 0:しない 1:する(rootパーティション) 2:する(rootパーティション以外) |
$ df -h Filesystem Size Used Avail Use% Mounted on udev 963M 0 963M 0% /dev tmpfs 198M 7.0M 191M 4% /run /dev/sda1 20G 3.8G 15G 21% / tmpfs 989M 0 989M 0% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 989M 0 989M 0% /sys/fs/cgroup /dev/sdb1 98G 61M 93G 1% /var/lib/one tmpfs 198M 12K 198M 1% /run/user/1000 /dev/sr0 56M 56M 0 100% /media/nebula/VMware Toolsよか
$ sudo -s
# wget -q -O- https://downloads.opennebula.org/repo/repo.key | apt-key add - # echo "deb https://downloads.opennebula.org/repo/5.4/Ubuntu/17.04 stable opennebula" > /etc/apt/sources.list.d/opennebula.list17.10向けはなかったので17.04をインストール
# apt-get update && apt-get upgrade -y # apt-get install opennebula opennebula-sunstone opennebula-gate opennebula-flow
# /usr/share/one/install_gemsこのスクリプトは、足りないライブラリ (gcc とか) を勝手に apt-get で取ってきてくれる
# sudo apt-get install mysql-server mysql-client # systemctl is-enabled mysql enabledapt-get が自動起動するように設定するようだ
# mysql -u root -p mysql> GRANT ALL PRIVILEGES ON opennebula.* TO 'oneadmin' IDENTIFIED BY 'oneadmin'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; Query OK, 0 rows affected (0.00 sec) mysql> \q Byeデータベース(テーブル)は OpenNebula 初回起動時に作られる
# diff -u /etc/one/oned.conf.20171022 /etc/one/oned.conf --- /etc/one/oned.conf.20171022 2017-10-22 23:23:20.769969734 +0900 +++ /etc/one/oned.conf 2017-10-22 23:24:13.687223170 +0900 @@ -79,15 +79,15 @@ LISTEN_ADDRESS = "0.0.0.0" -DB = [ BACKEND = "sqlite" ] +# DB = [ BACKEND = "sqlite" ] # Sample configuration for MySQL -# DB = [ BACKEND = "mysql", -# SERVER = "localhost", -# PORT = 0, -# USER = "oneadmin", -# PASSWD = "oneadmin", -# DB_NAME = "opennebula" ] +DB = [ BACKEND = "mysql", + SERVER = "localhost", + PORT = 0, + USER = "oneadmin", + PASSWD = "oneadmin", + DB_NAME = "opennebula" ] VNC_PORTS = [ START = 5900
# systemctl start opennebula # systemctl start opennebula-sunstone
# oneuser show USER 0 INFORMATION ID : 0 NAME : oneadmin GROUP : oneadmin PASSWORD : cdc7f9ade5c4e3235c92d0e829b6e415f1472e08 AUTH_DRIVER : core ENABLED : Yes TOKENS USER TEMPLATE TOKEN_PASSWORD="7788bbd47f1562c85fdaee5b1ed175461b67b983" RESOURCE USAGE & QUOTASOKみたい
oneadmin:1WrobiphNoud
# systemctl enable opennebula # systemctl enable opennebula-sunstone
通常ユーザのパスワードは Sunstone (Web) で変更できるけど oneadmin だけはコマンドラインからの変更が必要
# oneuser show USER 0 INFORMATION ID : 0 NAME : oneadmin GROUP : oneadmin PASSWORD : cdc7f9ade5c4e3235c92d0e829b6e415f1472e08 AUTH_DRIVER : core ENABLED : Yes TOKENS USER TEMPLATE TOKEN_PASSWORD="7788bbd47f1562c85fdaee5b1ed175461b67b983" RESOURCE USAGE & QUOTAS # oneuser passwd 0 adminpassword
ID 0 (oneadmin) のユーザのパスワードの変更する
変更したパスワードを /var/lib/one/.one/one_auth の TOKEN_PASSWORD にも記入しておく。OpenNebula の管理コマンドがここのパスワードを見て OpenNebula サーバにアクセスするので
# apt-get install opennebula-node # systemctl status libvirtd # systemctl is-enabled libvirtd enabledKVM (libvirt) も依存ライブラリとしてインストールされる
# su oneadmin oneadmin@nebula1:/home/nebula$ ssh nebula1
$ ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 inet 127.0.0.1/8 scope host lo 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 inet 192.168.38.230/24 brd 192.168.38.255 scope global dynamic ens33 3: ens34: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 inet 192.168.10.12/24 brd 192.168.10.255 scope global dynamic ens34 4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000 inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000 link/ether 52:54:00:97:ff:77 brd ff:ff:ff:ff:ff:ff
# nmcli con add type bridge ifname br0 Connection 'bridge-br0' (bb8ff311-2fdc-432b-9c13-398a2266cd18) successfully added. # nmcli con modify bridge-br0 bridge.stp no # nmcli con modify bridge-br0 ipv4.method auto # nmcli con add type bridge-slave ifname ens34 master bridge-br0 Connection 'bridge-slave-ens34' (f4192512-5342-43fe-bd0a-7ab8d9a945f0) successfully added. # nmcli con add type bridge ifname br1 Connection 'bridge-br1' (4b2e6d07-a2f3-4ad4-88d1-7750df9fe705) successfully added. # nmcli con modify bridge-br1 bridge.stp no # nmcli con modify bridge-br1 ipv4.method auto # nmcli con add type bridge-slave ifname ens33 master bridge-br1 Connection 'bridge-slave-ens33' (c4fb184e-125b-4a39-8525-4186f8d9aa1d) successfully added. # reboot
$ ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 inet 127.0.0.1/8 scope host lo 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br1 state UP group default qlen 1000 link/ether 00:0c:29:a9:ec:8e brd ff:ff:ff:ff:ff:ff 3: ens34: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000 link/ether 00:0c:29:a9:ec:98 brd ff:ff:ff:ff:ff:ff 4: br1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 inet 192.168.38.230/24 brd 192.168.38.255 scope global dynamic br1 5: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 inet 192.168.10.12/24 brd 192.168.10.255 scope global dynamic br0 6: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000 inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 7: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000 link/ether 52:54:00:97:ff:77 brd ff:ff:ff:ff:ff:ff