• CentOS安装OpenNebula(二)


    被控端部署:

    先要配置好yum源

    1. [root@master yum.repos.d]# vim opennebula.repo
    2. [root@master yum.repos.d]# cat opennebula.repo
    3. [opennebula]
    4. name=opennebula
    5. baseurl=https://downloads.opennebula.org/repo/5.6/CentOS/7/x86_64
    6. enabled=1
    7. gpgkey=https://downloads.opennebula.org/repo/repo.key
    8. gpgcheck=1

    安装支持opennebula的kvm包:

    1. [root@node1 yum.repos.d]# yum install -y opennebula-node-kvm
    2. [root@store yum.repos.d]# yum install -y opennebula-node-kvm

    完成后启动libvirted:

    1. [root@node1 ~]# systemctl start libvirtd
    2. [root@node1 ~]# systemctl enable libvirtd
    3. [root@node1 ~]#
    4. [root@node1 ~]# systemctl status libvirtd
    5. ● libvirtd.service - Virtualization daemon
    6. Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
    7. Active: active (running) since Sun 2023-10-01 12:11:28 CST; 44s ago
    8. Docs: man:libvirtd(8)
    9. https://libvirt.org
    10. Main PID: 16376 (libvirtd)
    11. CGroup: /system.slice/libvirtd.service
    12. ├─16376 /usr/sbin/libvirtd
    1. [root@store ~]# systemctl start libvirtd
    2. [root@store ~]# systemctl enable libvirtd
    3. [root@store ~]#
    4. [root@store ~]# systemctl status libvirtd
    5. ● libvirtd.service - Virtualization daemon
    6. Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
    7. Active: active (running) since Sun 2023-10-01 12:11:48 CST; 14s ago
    8. Docs: man:libvirtd(8)
    9. https://libvirt.org
    10. Main PID: 16362 (libvirtd)
    11. CGroup: /system.slice/libvirtd.service
    12. ├─16362 /usr/sbin/libvirtd
    13. ├─16459 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefi...
    14. └─16460 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefi...

    启动后,我们会发现多了一个桥接网卡:

    配置SSH公钥免密码登录:免密登录。

     在控制端和被控端在安装opennebula包组的时候所有的主机默认都已经创建了一个用户:oneadmin。

    切换到对应的用户(同样的用户)

    生成公钥和私钥,

    以下命令需要按3次Enter键。

    1. [root@master etc]# su - oneadmin
    2. Last login: Sun Oct 1 18:44:28 CST 2023 on pts/0
    3. [oneadmin@master ~]$ ssh-keygen -t rsa
    4. Generating public/private rsa key pair.
    5. Enter file in which to save the key (/var/lib/one/.ssh/id_rsa):
    6. /var/lib/one/.ssh/id_rsa already exists.
    7. Overwrite (y/n)? y
    8. Enter passphrase (empty for no passphrase):
    9. Enter same passphrase again:
    10. Your identification has been saved in /var/lib/one/.ssh/id_rsa.
    11. Your public key has been saved in /var/lib/one/.ssh/id_rsa.pub.
    12. The key fingerprint is:
    13. SHA256:3puWpubvvQG6R4bLceWpc+JGC34NcZAlSxBM3Xox/Ng oneadmin@master
    14. The key's randomart image is:
    15. +---[RSA 2048]----+
    16. | o++o=. |
    17. | ..+o= |
    18. | .o * |
    19. | o = E |
    20. | S..* . |
    21. | .+o*.o |
    22. | ooO.*. |
    23. | =.%+o. |
    24. | o+@*+o. |
    25. +----[SHA256]-----+

    将公钥写到授权密钥文件中。

    cat /var/lib/one/.ssh/id_rsa.pub >>  /var/lib/one/.ssh/authorized_keys

    修改生成文件的权限:权限不能太大,太大会报错。

    1. [oneadmin@master root]$ chmod 644 /var/lib/one/.ssh/authorized_keys
    2. [oneadmin@master root]$ chmod 755 /var/lib/one/.ssh/

    用scp将授权密钥文件拷贝到对应的主机上。

    scp /var/lib/one/.ssh/*  root@node1:/var/lib/one/.ssh/

    说明:对应主机上没有.ssh目录,我使用了mkdir .ssh创建了目录。

    在oneadmin用户下,使用ssh node1或者store,不需要密码验证。

    1. [oneadmin@master root]$ ssh node1
    2. [oneadmin@node1 ~]$ exit
    3. logout
    4. Connection to node1 closed.
    5. [oneadmin@master root]$
    6. [oneadmin@master root]$ ssh store
    7. [oneadmin@store ~]$
    8. [oneadmin@store ~]$ exit
    9. logout
    10. Connection to store closed.

  • 相关阅读:
    105AspectRatio调整宽高比组件_flutter
    Pytorch实战[使用VGG16实现图片分类]
    [附源码]SSM计算机毕业设计高校创新创业服务平台JAVA
    IDEA的使用(三)Debug(断点调试)(IntelliJ IDEA 2022.1.3版本)
    Linux下的进程控制
    计算机操作系统 第五章 虚拟存储器(3)
    带头双向循环链表的增删查改(C语言实现)
    ImageViewer技术实现细节
    .Net MinimalApis响应返回值
    基于ABP实现DDD--实体创建和更新
  • 原文地址:https://blog.csdn.net/chang_chunhua/article/details/133461060