CentOS 7 安装私有平台OpenNebula

目录

一、配置yum源

二、配置数据库MySQL

2.1 安装MySQL

2.2 修改MySQL密码

2.3 创建项目用户和库

三、安装配置前端包

四、设置oneadmin账号密码

五、验证安装

5.1 命令行验证安装

5.2 数据存放位置

5.3 端口介绍

5.4 命令介绍

六、访问

6.1 设置语言

6.2 创建主机

七、创建网络模板及网络

八、创建镜像

九、创建虚拟机模板

十、创建虚拟机

十一、克隆虚拟机

十二、添加其他主机


关闭防火墙、selinux

一、配置yum源

将以下内容添加到/etc/yum.repos.d/opennebula.repo文件中。

[root@kvm ~]# cat << "EOT" > /etc/yum.repos.d/opennebula.repo
[opennebula]
name=OpenNebula Community Edition
baseurl=https://downloads.opennebula.io/repo/6.0/CentOS/7/$basearch
enabled=1
gpgkey=https://downloads.opennebula.io/repo/repo.key
gpgcheck=1
repo_gpgcheck=1
EOT
​
[root@kvm ~]# yum clean all
[root@kvm ~]# yum makecache fast

二、配置数据库MySQL

2.1 安装MySQL

[root@kvm ~]# yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-11.noarch.rpm
[root@kvm ~]# vim /etc/yum.repos.d/mysql-community.repo

添加以下MySQL源配置信息:

[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
​
[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
​
[mysql-tools-community]
name=MySQL Tools Community
baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

2.2 修改MySQL密码

[root@kvm ~]# grep -o 'root@localhost.*' /var/log/mysqld.log | awk 'END{print $NF}'
YoHi(8Fk0m?4
[root@kvm ~]# mysqladmin -uroot -p'YoHi(8Fk0m?4' password 'xiangyu'

2.3 创建项目用户和库

mysql> CREATE DATABASE 'opennebula' default charset 'utf8';
mysql> CREATE USER 'oneadmin' IDENTIFIED BY '123456';
mysql> GRANT ALL PRIVILEGES ON opennebula.* TO 'oneadmin';
mysql> flush privileges;
mysql> SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; # 设置事务隔离级别

三、安装配置前端包

[root@kvm ~]# yum -y install epel-release
[root@kvm ~]# yum -y install centos-release-scl-rh
​
# 修改MySQL 下载包
[root@kvm ~]# yum -y install opennebula opennebula-sunstone opennebula-fireedge opennebula-gate opennebula-flow opennebula-provisionls opennebula-node-kvm
​
# 配置前端使用mysql数据库
[root@kvm ~]# vim /etc/one/oned.conf
DB = [ BACKEND = "mysql",
       SERVER  = "localhost",
       PORT    = 0,
       USER    = "oneadmin",
       PASSWD  = "QianFeng@123",
       DB_NAME = "opennebula",
       CONNECTIONS = 25,
       COMPARE_BINARY = "no" ]

四、设置oneadmin账号密码

[root@kvm ~]# sudo -u oneadmin /bin/sh
sh-4.2$ echo 'oneadmin:changeme123' > /var/lib/one/.one/one_auth
sh-4.2$ exit
​
# 修改如下配置
[root@kvm ~]# vim /etc/one/sunstone-server.conf
:public_fireedge_endpoint: http://one.example.com:2616 # one.example.com为当前主机地址
​
[root@kvm ~]# vim /etc/one/onegate-server.conf
:host: 0.0.0.0
​
[root@kvm ~]# vim /etc/one/oned.conf
ONEGATE_ENDPOINT="http://one.example.com:5030"
​
[root@kvm ~]# vim /etc/one/oneflow-server.conf
:host: 0.0.0.0
[root@kvm ~]# systemctl start opennebula opennebula-sunstone opennebula-fireedge opennebula-gate opennebula-flow
[root@kvm ~]# systemctl enable opennebula opennebula-sunstone opennebula-fireedge opennebula-gate opennebula-flow

五、验证安装

5.1 命令行验证安装

[root@kvm ~]# su - oneadmin -c "oneuser show"
USER 0 INFORMATION                                                              
ID              : 0                   
NAME            : oneadmin            
GROUP           : oneadmin            
PASSWORD        : 494a715f7e9b4071aca61bac42ca858a309524e5864f0920030862a4ae7589be
AUTH_DRIVER     : core                
ENABLED         : Yes                 
TOKENS                                                                          
     ID EGID  EGROUP     EXPIRATION          
ca78b8d *0    oneadmin   2023-12-27 10:00:26
USER TEMPLATE                                                                   
FIREEDGE=[
  DISABLEANIMATIONS="YES",
  LANG="zh_CN",
  SCHEME="system" ]
SUNSTONE=[
  LANG="zh_CN" ]
TOKEN_PASSWORD="a3bb2bb7b53ad6025b9e5650d12d76ff4a30be4ba7bd091c96db1df5e1e69825"
VMS USAGE & QUOTAS            
                                                  
​

5.2 数据存放位置

路径 描述
/etc/one/ 配置文件
/var/log/one/ 日志文件,例如 、 和oned.log``sched.log``sunstone.log``.log
/var/lib/one/ oneadmin主目录
/var/lib/one/datastores// 数据存储的存储
/var/lib/one/vms// VM 的操作文件(部署文件、传输管理器脚本等)
/var/lib/one/.one/one_auth oneadmin凭据
/var/lib/one/remotes/ 将同步到主机的探测器和脚本
/var/lib/one/remotes/etc 探测器和脚本的配置文件
/var/lib/one/remotes/hooks/ 钩子脚本
/var/lib/one/remotes/vmm/ Virtual Machine Manager 驱动程序脚本
/var/lib/one/remotes/auth/ 身份验证驱动程序脚本
/var/lib/one/remotes/im/ 信息管理器(监视)驱动程序脚本
/var/lib/one/remotes/market/ MarketPlace 驱动程序脚本
/var/lib/one/remotes/datastore/ 数据存储驱动程序脚本
/var/lib/one/remotes/vnm/ 网络驱动程序脚本
/var/lib/one/remotes/tm/ Transfer Manager 驱动程序脚本

5.3 端口介绍

端口 描述
22 前端主机 SSH 服务器
2474 OneFlow 服务器
2616 下一代 GUI 服务器 FireEdge
2633 主 OpenNebula Daemon (oned), XML-RPC API 端点
4124 监视守护程序(TCP/UDP)
5030 OneGate 服务器
9869 GUI服务器 Sunstone
29876 noVNC 代理服务器

5.4 命令介绍

使用以下命令停止所有 OpenNebula 服务:
[root@kvm ~]# 使用以下命令停止所有 OpenNebula 服务:
systemctl stop opennebula opennebula-scheduler opennebula-hem \
    opennebula-sunstone opennebula-fireedge opennebula-gate opennebula-flow \
    opennebula-guacd opennebula-novnc opennebula-showback.timer \
    opennebula-ssh-agent opennebula-ssh-socks-cleaner.timer
    
使用以下命令重新启动所有已在运行的 OpenNebula 服务:
[root@kvm ~]# 使用以下命令停止所有 OpenNebula 服务:
systemctl try-restart opennebula opennebula-scheduler opennebula-hem \
    opennebula-sunstone opennebula-fireedge opennebula-gate opennebula-flow \
    opennebula-guacd opennebula-novnc opennebula-ssh-agent

六、访问

账号密码查看 /var/lib/one/.one/one_auth oneadmin:changeme123

CentOS 7 安装私有平台OpenNebula_第1张图片

6.1 设置语言

CentOS 7 安装私有平台OpenNebula_第2张图片

6.2 创建主机

CentOS 7 安装私有平台OpenNebula_第3张图片

CentOS 7 安装私有平台OpenNebula_第4张图片

七、创建网络模板及网络

请为虚拟机网络单独准备一块网卡

CentOS 7 安装私有平台OpenNebula_第5张图片

CentOS 7 安装私有平台OpenNebula_第6张图片

网络模板
CLUSTER_IDS = "0"
DNS = "8.8.8.8"
GATEWAY = "192.168.33.1"
NETWORK_ADDRESS = "192.168.33.0"
NETWORK_MASK = "255.255.255.0"
PHYDEV = "ens35"
SECURITY_GROUPS = "0"
VN_MAD = "bridge"

八、创建镜像

保存后会自动上传

CentOS 7 安装私有平台OpenNebula_第7张图片

九、创建虚拟机模板

CentOS 7 安装私有平台OpenNebula_第8张图片

CentOS 7 安装私有平台OpenNebula_第9张图片

虚拟机模板
CONTEXT = [
  NETWORK = "YES",
  SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" ]
CPU = "1"
DISK = [
  IMAGE = "centos7",
  IMAGE_UNAME = "oneadmin" ]
DISK = [
  IMAGE = "template",
  IMAGE_UNAME = "oneadmin" ]
DISK = [
  FORMAT = "qcow2",
  FS = "xfs",
  SIZE = "10240",
  TYPE = "fs" ]
GRAPHICS = [
  LISTEN = "0.0.0.0",
  TYPE = "VNC" ]
HOT_RESIZE = [
  CPU_HOT_ADD_ENABLED = "NO",
  MEMORY_HOT_ADD_ENABLED = "NO" ]
HYPERVISOR = "kvm"
INPUTS_ORDER = ""
LOGO = "images/logos/centos.png"
MEMORY = "2048"
MEMORY_UNIT_COST = "MB"
NIC = [
  NETWORK = "vv",
  NETWORK_UNAME = "oneadmin",
  SECURITY_GROUPS = "0",
  SSH = "YES" ]
OS = [
  ARCH = "x86_64",
  BOOT = "disk0",
  MACHINE = "pc-i440fx-rhel7.0.0" ]
VCPU = "1"
VMGROUP = [
  ROLE = "centos",
  VMGROUP_ID = "0" ]

十、创建虚拟机

十一、克隆虚拟机

首先,先进行一台虚拟机的安装,并在创建时持久化该虚拟机,使其成为一个模板,待安装完成后,给系统盘另存为镜像模板。

CentOS 7 安装私有平台OpenNebula_第10张图片

十二、添加其他主机

添加主机方式,将所有node节点配置ssh免密登录,用户为oneadmin,ssh密码自己设置,秘钥位置为/var/lib/one/.ssh/id_rsa.pub

你可能感兴趣的:(adb)