如何在Ubuntu上安装OpenneBula

OpenNebula是一个开源云计算平台,允许我们在完全虚拟化云中组合和管理VMware和KVM虚拟机

第1步:安装MariaDB数据库服务器

OpenNebula还需要一个数据库服务器来存储其内容。

安装MariaDB:

|-----|----------------------------------------------------------------------------|
| 1 2 | sudo apt update sudo apt ``install mariadb-server mariadb-client |

安装MariaDB后,下面的命令可用于停止,启动和启用MariaDB服务。

|-------|--------------------------------------------------------------------------------------------------------------------------------|
| 1 2 3 | sudo systemctl stop mariadb.service sudo systemctl start mariadb.service sudo systemctl ``enable mariadb.service |

之后,运行以下命令,通过创建root密码并禁止远程根访问来保护MariaDB服务器。

|---|------------------------------------|
| 1 | sudo mysql_secure_installation |

出现提示时,通过遵循教程,回答以下问题。

  • 输入root的当前密码(输入无):只需按Enter键
  • 设置root密码? [Y/N]:Y
  • 新密码:输入密码
  • 重新输入新密码:重复密码
  • 删除匿名用户? [Y/N]:Y
  • 远程禁止root登录? [Y/N]:Y
  • 删除测试数据库并访问它? [Y/N]:Y
  • 现在重新加载权限表? [Y/N]:Y

查看MariaDB服务状态。

|---|-----------------------------------|
| 1 | sudo systemctl status mariadb |

输出示例:

|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 2 3 4 5 6 7 8 9 10 11 | ● mariadb.service - MariaDB 10.1.44 database server Loaded: loaded (``/lib/systemd/system/mariadb``.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2016-04-08 17:08:17 CDT; 1min 54s ago Docs: ``man``:mysqld(8) https:``//mariadb``.com``/kb/en/library/systemd/ Main PID: 22363 (mysqld) Status: ``"Taking your SQL requests now. " Tasks: 27 (limit: 4666) CGroup: ``/system``.slice``/mariadb``.service └─22363 ``/usr/sbin/mysqld Apr 08 17:08:17 ubuntu1804 ``/etc/mysql/debian-start``[22396]: mysql |

第2步:创建OpenNebula数据库

登录MariaDB

|---|---------------------------|
| 1 | sudo mysql -u root -p |

创建一个空白数据库 opennebula

|---|-------------------------------|
| 1 | CREATE DATABASE opennebula; |

创建数据库用户 opennebulauser,密码为new_password_here

|---|-------------------------------------------------------------------------------------------|
| 1 | CREATE USER ``'opennebulauser'``@``'localhost' IDENTIFIED BY ``'new_password_here'``; |

授予用户 cakephpuser数据库完全访问权限。

|---|----------------------------------------------------------------------------------------|
| 1 | GRANT ALL ON opennebula.* TO ``'opennebulauser'``@``'localhost' WITH GRANT OPTION; |

最后,保存更改并退出。

|-----|-----------------------------|
| 1 2 | FLUSH PRIVILEGES; EXIT; |

第3步:安装Opennula

默认情况下,Ubuntu默认存储库使用没有OpenneBula。

我们必须从OpenneBula存储库安装。

将其存储库键添加到Ubuntu:

|---|---------------------------------------------------------------------------------------------|
| 1 | wget -q -O- https:``//downloads``.opennebula.org``/repo/repo``.key | ``sudo apt-key add |

添加其存储库文件。

|---|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 | echo "deb https://downloads.opennebula.org/repo/5.6/Ubuntu/18.04 stable opennebula" | ``sudo tee /etc/apt/sources``.list.d``/opennebula``.list |

安装OpenNebula。

|-----|-------------------------------------------------------------------------------------------------------------|
| 1 2 | sudo apt update sudo apt ``install opennebula opennebula-sunstone opennebula-gate opennebula-flow |

安装Ruby库和其他所需的软件包以支持Opennula。

|---|--------------------------------------|
| 1 | sudo /usr/share/one/install_gems |

下面的命令可用于启动和启用OpenNebula服务。

|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 2 3 4 | sudo systemctl start opennebula sudo systemctl ``enable opennebula sudo systemctl start opennebula-sunstone sudo systemctl ``enable opennebula-sunstone |

打开配置文件。

|---|--------------------------------------|
| 1 | sudo nano ``/etc/one/oned``.conf |

使用上面创建的数据库名称,用户和密码,填入配置文件中:

|-------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | SCRIPTS_REMOTE_DIR=``/var/tmp/one PORT = 2633 LISTEN_ADDRESS = ``"0.0.0.0" #DB = [ BACKEND = "sqlite" ] Sample configuration ``for MySQL DB = [ BACKEND = ``"mysql"``, SERVER = ``"localhost"``, PORT = 0, USER = ``"opennebulauser"``, PASSWD = ``"database_password_here"``, DB_NAME = ``"opennebula"``, CONNECTIONS = 50 ] VNC_PORTS = [ START = 5900 RESERVED = ``"6800, 6801, 6810:6820, 9869" |

默认情况下,其默认用户名和密码存储在下面的凭据中:

|---|------------------------------------------------|
| 1 | sudo nano ``/var/lib/one/``.one``/one_auth |

检查OpenNebula服务的状态:

|---|--------------------------------------|
| 1 | sudo systemctl status opennebula |

输出示例:

|-------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | ● opennebula.service - OpenNebula Cloud Controller Daemon Loaded: loaded (``/lib/systemd/system/opennebula``.service; enabled; vendor preset: enabled Active: active (running) since Sat 2016-04-11 18:35:40 CDT; 6min ago Main PID: 17544 (oned) Tasks: 105 (limit: 4666) CGroup: ``/system``.slice``/opennebula``.service ├─17544 ``/usr/bin/oned -f ├─17547 ruby ``/usr/lib/one/mads/one_hm``.rb ├─17582 ruby ``/usr/lib/one/mads/one_vmm_exec``.rb -t 15 -r 0 kvm ├─17599 ruby ``/usr/lib/one/mads/one_vmm_exec``.rb -l deploy,``shutdown``,reboot,cancel ├─17616 ``/usr/lib/one/mads/collectd -p 4124 -f 5 -t 50 -i 60 ├─17668 ruby ``/usr/lib/one/mads/one_im_exec``.rb -r 3 -t 15 -w 90 kvm ├─17681 ruby ``/usr/lib/one/mads/one_im_exec``.rb -l -c -t 15 -r 0 vcenter |

第4步:访问 OpenNebula门户

打开登录页面

http://localhost:9869

登录后将进入 Opennula仪表板。

设置KVM节点

添加KVM节点,只需运行我们要通过Opennula管理的节点下面的命令。

|---|---------------------------------------------------------------------------------------------|
| 1 | wget -q -O- https:``//downloads``.opennebula.org``/repo/repo``.key | ``sudo apt-key add |

然后添加其存储库

|---|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 | echo "deb https://downloads.opennebula.org/repo/5.6/Ubuntu/18.04 stable opennebula" | ``sudo tee /etc/apt/sources``.list.d``/opennebulakvmnode``.list |

最后,运行以下命令以安装节点包

|-----|------------------------------------------------------------------|
| 1 2 | sudo apt update sudo apt-get ``install opennebula-node |

打开其配置文件以允许OpenneBula管理它。

|---|----------------------------------------------|
| 1 | sudo nano ``/etc/libvirt/libvirtd``.conf |

然后编辑这些行并保存。

|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 2 3 4 5 | This is restricted to ``'root' by default. unix_sock_group = ``"oneadmin" If not using PolicyKit and setting group ownership ``for access control, ``then you may want to relax this too. unix_sock_rw_perms = ``"0777" |

重新启动客户端服务

|-----|----------------------------------------------------------------------------|
| 1 2 | sudo systemctl restart libvirtd sudo systemctl restart libvirt-bin |

设置无密码的SSH身份验证。

创建密码身份验证后,将服务器SSH密钥复制到客户端known_hosts文件中。

|---|---------------------------------------|
| 1 | /var/lib/one/``.``ssh``/known_hosts |

将有信任的所有密钥。

要管理KVM主机,请转到OpenneBula Web界面,开放式基础架构>>主机,然后单击+按钮。

添加新节点以进行管理。

相关推荐
方竞19 分钟前
Linux空口抓包方法
linux·空口抓包
sun0077001 小时前
ubuntu dpkg 删除安装包
运维·服务器·ubuntu
海岛日记1 小时前
centos一键卸载docker脚本
linux·docker·centos
AttackingLin2 小时前
2024强网杯--babyheap house of apple2解法
linux·开发语言·python
shuangrenlong3 小时前
slice介绍slice查看器
java·ubuntu
吃肉不能购3 小时前
Label-studio-ml-backend 和YOLOV8 YOLO11自动化标注,目标检测,实例分割,图像分类,关键点估计,视频跟踪
运维·yolo·自动化
学Linux的语莫3 小时前
Ansible使用简介和基础使用
linux·运维·服务器·nginx·云计算·ansible
踏雪Vernon3 小时前
[OpenHarmony5.0][Docker][环境]OpenHarmony5.0 Docker编译环境镜像下载以及使用方式
linux·docker·容器·harmonyos
学Linux的语莫4 小时前
搭建服务器VPN,Linux客户端连接WireGuard,Windows客户端连接WireGuard
linux·运维·服务器