• CentOS安装OpenNebula(一)


    OpenNebula是一个非常成熟的云平台,,十分简单,但是功能十分丰富。它提供了十分灵活的解决方案,让用户能建立并管理企业云和虚拟的数据中心。

    OpenNebula是专门为云计算打造的开源系统,用户可以使用Xen、KVM、VMware等虚拟化软件一起打造企业云。利用OpenNebula可以轻松构建私有云、混合云、公开云。

    主控端部署:

    1、hosts文件做DNS解析。

    1. [root@master ~]# cat /etc/hosts
    2. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
    3. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
    4. 192.168.17.107 server01 server01.lnmp.com
    5. 192.168.17.128 master
    6. 192.168.17.129 node1
    7. 192.168.17.130 store

    将所有的主机上hosts文件进行替换:

    1. [root@master ~]# scp /etc/hosts root@192.168.17.129:/etc/hosts
    2. The authenticity of host '192.168.17.129 (192.168.17.129)' can't be established.
    3. ECDSA key fingerprint is SHA256:4dogA08L5gdfaA69BGekE13kzSuIP2vcRp9rsqYnpn0.
    4. ECDSA key fingerprint is MD5:93:34:b9:61:03:cd:00:92:b9:91:3d:b6:6c:7a:84:95.
    5. Are you sure you want to continue connecting (yes/no)? yes
    6. Warning: Permanently added '192.168.17.129' (ECDSA) to the list of known hosts.
    7. root@192.168.17.129's password:
    8. hosts 100% 264 387.6KB/s 00:00
    9. [root@master ~]#
    10. [root@master ~]# scp /etc/hosts root@192.168.17.130:/etc/hosts
    11. The authenticity of host '192.168.17.130 (192.168.17.130)' can't be established.
    12. ECDSA key fingerprint is SHA256:4dogA08L5gdfaA69BGekE13kzSuIP2vcRp9rsqYnpn0.
    13. ECDSA key fingerprint is MD5:93:34:b9:61:03:cd:00:92:b9:91:3d:b6:6c:7a:84:95.
    14. Are you sure you want to continue connecting (yes/no)? yes
    15. Warning: Permanently added '192.168.17.130' (ECDSA) to the list of known hosts.
    16. root@192.168.17.130's password:
    17. hosts 100% 264 461.2KB/s 00:00
    18. [root@master ~]#

    2、关闭SELINUX:

    1. [root@master ~]# setenforce 0
    2. setenforce: SELinux is disabled
    3. [root@master ~]#
    4. [root@master ~]# sed -i '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config

    3、防火墙配置:

    为了能使OpenNebula正常工作,还必须配置系统防火墙开放相应的端口。目前采取的是关闭防火墙的做法。

    [root@master ~]# systemctl stop firewalld && systemctl disable firewalld
    

    4、软件源的配置:

    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

    5、安装epel源:epel源将提供一些额外的软件包。

    [root@master ~]# yum install -y epel-release
    

    6、安装依赖软件包。

    [root@master ~]# yum install -y gcc-c++ sqlite-devel curl-devel mysql-devel ruby-devel make
    

    7、安装OpenNebula主控依赖。

    [root@master ~]# yum -y install opennebula-server opennebula-sunstone opennebula-ruby opennebula-gate opennebula-flow

    8、安装OpenNebula主控额外依赖和主程序:

    先配置下国内源:

    1. [root@master one]# gem sources -r https://rubygems.org/ -a https://gems.ruby-china.com/
    2. https://gems.ruby-china.com/ added to sources
    3. https://rubygems.org/ removed from sources
    4. [root@master one]# gem install bundler --version '< 2'
    5. Successfully installed bundler-1.17.3
    6. Parsing documentation for bundler-1.17.3
    7. 1 gem installed
    8. [root@master one]# /usr/share/one/install_gems
    9. lsb_release command not found. If you are using a RedHat based
    10. distribution install redhat-lsb
    11. Select your distribution or press enter to continue without
    12. installing dependencies.
    13. 0. Ubuntu/Debian
    14. 1. CentOS/RedHat/Scientific
    15. 1
    16. Distribution "redhat" detected.
    17. About to install these dependencies:
    18. * gcc
    19. * rubygem-rake
    20. * libxml2-devel
    21. * libxslt-devel
    22. * patch
    23. * gcc-c++
    24. * sqlite-devel
    25. * curl-devel
    26. * mysql-devel
    27. * openssl-devel
    28. * ruby-devel
    29. * make
    30. Press enter to continue...
    31. yum install gcc rubygem-rake libxml2-devel libxslt-devel patch gcc-c++ sqlite-devel curl-devel mysql-devel openssl-devel ruby-devel make
    32. Loaded plugins: fastestmirror
    33. Loading mirror speeds from cached hostfile
    34. * base: mirrors.ustc.edu.cn
    35. * epel: mirror.01link.hk
    36. * extras: mirrors.huaweicloud.com
    37. * updates: mirrors.ustc.edu.cn
    38. Package gcc-4.8.5-44.el7.x86_64 already installed and latest version
    39. Package rubygem-rake-0.9.6-39.el7_9.noarch already installed and latest version
    40. Package libxml2-devel-2.9.1-6.el7_9.6.x86_64 already installed and latest version
    41. Package libxslt-devel-1.1.28-6.el7.x86_64 already installed and latest version
    42. Package patch-2.7.1-12.el7_7.x86_64 already installed and latest version
    43. Package gcc-c++-4.8.5-44.el7.x86_64 already installed and latest version
    44. Package sqlite-devel-3.7.17-8.el7_7.1.x86_64 already installed and latest version
    45. Package libcurl-devel-7.29.0-59.el7_9.1.x86_64 already installed and latest version
    46. Package 1:mariadb-devel-5.5.68-1.el7.x86_64 already installed and latest version
    47. Package 1:openssl-devel-1.0.2k-26.el7_9.x86_64 already installed and latest version
    48. Package ruby-devel-2.0.0.648-39.el7_9.x86_64 already installed and latest version
    49. Package 1:make-3.82-24.el7.x86_64 already installed and latest version
    50. Nothing to do
    51. Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as
    52. root will break this application for all non-root users on this machine.
    53. Fetching source index from https://rubygems.org/
    54. RubyGems 2.0.14.1 is not threadsafe, so your gems will be installed one at a time. Upgrade to RubyGems 2.1.0 or higher to enable parallel gem installation.
    55. Fetching public_suffix 2.0.5
    56. Installing public_suffix 2.0.5
    57. Fetching addressable 2.5.2
    58. Installing addressable 2.5.2
    59. Fetching xml-simple 1.1.5
    60. Installing xml-simple 1.1.5
    61. Fetching amazon-ec2 0.9.17
    62. Installing amazon-ec2 0.9.17
    63. Fetching aws-sigv4 1.0.2
    64. Installing aws-sigv4 1.0.2
    65. Fetching jmespath 1.4.0
    66. Installing jmespath 1.4.0
    67. Fetching aws-sdk-core 2.11.39
    68. Installing aws-sdk-core 2.11.39
    69. Fetching aws-sdk-resources 2.11.39
    70. Installing aws-sdk-resources 2.11.39
    71. Fetching aws-sdk 2.11.39
    72. Installing aws-sdk 2.11.39
    73. Fetching multipart-post 2.0.0
    74. Installing multipart-post 2.0.0
    75. Fetching faraday 0.15.0
    76. Installing faraday 0.15.0
    77. Fetching faraday_middleware 0.12.2
    78. Installing faraday_middleware 0.12.2
    79. Fetching mini_portile2 2.1.0
    80. Installing mini_portile2 2.1.0
    81. Fetching nokogiri 1.6.8.1
    82. Installing nokogiri 1.6.8.1 with native extensions
    83. Fetching azure-core 0.1.14
    84. Installing azure-core 0.1.14
    85. Fetching mime-types-data 3.2016.0521
    86. Installing mime-types-data 3.2016.0521
    87. Fetching mime-types 3.1
    88. Installing mime-types 3.1
    89. Fetching systemu 2.6.5
    90. Installing systemu 2.6.5
    91. Fetching thor 0.20.0
    92. Installing thor 0.20.0
    93. Fetching azure 0.7.10
    94. Installing azure 0.7.10
    95. Fetching builder 3.2.3
    96. Installing builder 3.2.3
    97. Using bundler 1.17.3
    98. Fetching configparser 0.1.7
    99. Installing configparser 0.1.7
    100. Fetching curb 0.9.4
    101. Installing curb 0.9.4 with native extensions
    102. Fetching daemons 1.2.6
    103. Installing daemons 1.2.6
    104. Fetching eventmachine 1.2.5
    105. Installing eventmachine 1.2.5 with native extensions
    106. Fetching hashie 3.5.7
    107. Installing hashie 3.5.7
    108. Fetching inflection 1.0.0
    109. Installing inflection 1.0.0
    110. Fetching memcache-client 1.8.5
    111. Installing memcache-client 1.8.5
    112. Fetching mysql2 0.5.1
    113. Installing mysql2 0.5.1 with native extensions
    114. Fetching net-ldap 0.16.1
    115. Installing net-ldap 0.16.1
    116. Fetching ox 2.9.2
    117. Installing ox 2.9.2 with native extensions
    118. Fetching parse-cron 0.1.4
    119. Installing parse-cron 0.1.4
    120. Fetching polyglot 0.3.5
    121. Installing polyglot 0.3.5
    122. Fetching rack 1.6.10
    123. Installing rack 1.6.10
    124. Fetching rack-protection 1.5.5
    125. Installing rack-protection 1.5.5
    126. Fetching scrub_rb 1.0.1
    127. Installing scrub_rb 1.0.1
    128. Fetching sequel 5.7.1
    129. Installing sequel 5.7.1
    130. Fetching tilt 2.0.8
    131. Installing tilt 2.0.8
    132. Fetching sinatra 1.4.8
    133. Installing sinatra 1.4.8
    134. Fetching sqlite3 1.3.13
    135. Installing sqlite3 1.3.13 with native extensions
    136. Fetching thin 1.7.2
    137. Installing thin 1.7.2 with native extensions
    138. Fetching treetop 1.6.10
    139. Installing treetop 1.6.10
    140. Fetching trollop 2.1.2
    141. Installing trollop 2.1.2
    142. Fetching uuidtools 2.1.5
    143. Installing uuidtools 2.1.5
    144. Fetching zendesk_api 1.16.0
    145. Installing zendesk_api 1.16.0
    146. Bundle complete! 23 Gemfile dependencies, 46 gems now installed.
    147. Use `bundle info [gemname]` to see where a bundled gem is installed.

    这个地方要有耐心等待,时间稍长。在获取程序和安装程序的过程中不要中断进程。

    9、修改默认的oneadmin密码(这个账号密码用于登录OpenNebula的控制面板):

    [root@master ~]# echo "oneadmin:910zxq" > /var/lib/one/.one/one_auth
    

    10、启动OpenNebula:

    1. [root@master ~]# systemctl start opennebula
    2. [root@master ~]# systemctl start opennebula-sunstone

    检查两个程序的运行状态:

    1. [root@master one]# systemctl status opennebula
    2. ● opennebula.service - OpenNebula Cloud Controller Daemon
    3. Loaded: loaded (/usr/lib/systemd/system/opennebula.service; enabled; vendor preset: disabled)
    4. Active: active (running) since Sun 2023-10-01 09:45:30 CST; 2h 9min ago
    5. Main PID: 1695 (oned)
    6. CGroup: /system.slice/opennebula.service
    7. ├─1695 /usr/bin/oned -f
    8. ├─1699 ruby /usr/lib/one/mads/one_hm.rb
    9. ├─1734 ruby /usr/lib/one/mads/one_vmm_exec.rb -t 15 -r 0 kvm
    10. ├─1751 ruby /usr/lib/one/mads/one_vmm_exec.rb -l deploy,shutdown,reboot,cancel,save,r...
    11. ├─1768 /usr/lib/one/mads/collectd -p 4124 -f 5 -t 50 -i 60
    12. ├─1820 ruby /usr/lib/one/mads/one_im_exec.rb -r 3 -t 15 -w 90 kvm
    13. ├─1833 ruby /usr/lib/one/mads/one_im_exec.rb -l -c -t 15 -r 0 vcenter
    14. ├─1846 ruby /usr/lib/one/mads/one_tm.rb -t 15 -d dummy,lvm,shared,fs_lvm,qcow2,ssh,ce...
    15. ├─1866 ruby /usr/lib/one/mads/one_datastore.rb -t 15 -d dummy,fs,lvm,ceph,dev,iscsi_l...
    16. ├─1882 ruby /usr/lib/one/mads/one_market.rb -t 15 -m http,s3,one
    17. ├─1898 ruby /usr/lib/one/mads/one_ipam.rb -t 1 -i dummy
    18. └─1910 ruby /usr/lib/one/mads/one_auth_mad.rb --authn ssh,x509,ldap,server_cipher,ser...
    19. Oct 01 09:45:27 master systemd[1]: Starting OpenNebula Cloud Controller Daemon...
    20. Oct 01 09:45:30 master systemd[1]: Started OpenNebula Cloud Controller Daemon.
    21. [root@master one]# systemctl status opennebula-sunstone
    22. ● opennebula-sunstone.service - OpenNebula Web UI Server
    23. Loaded: loaded (/usr/lib/systemd/system/opennebula-sunstone.service; enabled; vendor preset: disabled)
    24. Active: active (running) since Sun 2023-10-01 11:51:14 CST; 9s ago
    25. Process: 48182 ExecStartPre=/usr/sbin/logrotate -f /etc/logrotate.d/opennebula-sunstone -s /var/lib/one/.logrotate.status (code=exited, status=0/SUCCESS)
    26. Main PID: 48183 (ruby)
    27. CGroup: /system.slice/opennebula-sunstone.service
    28. └─48183 /usr/bin/ruby /usr/lib/one/sunstone/sunstone-server.rb
    29. Oct 01 11:51:14 master ruby[48183]: :keep_me_logged=>true,
    30. Oct 01 11:51:14 master ruby[48183]: :lang=>"en_US",
    31. Oct 01 11:51:14 master ruby[48183]: :table_order=>"desc",
    32. Oct 01 11:51:14 master ruby[48183]: :mode=>"mixed",
    33. Oct 01 11:51:14 master ruby[48183]: :marketplace_url=>"http://marketplace.opennebula.systems/",
    34. Oct 01 11:51:14 master ruby[48183]: :oneflow_server=>"http://localhost:2474/",
    35. Oct 01 11:51:14 master ruby[48183]: :routes=>["oneflow", "vcenter", "support"],
    36. Oct 01 11:51:14 master ruby[48183]: :session_expire_time=>3600}
    37. Oct 01 11:51:14 master ruby[48183]: --------------------------------------
    38. Oct 01 11:51:15 master ruby[48183]: == Sinatra (v1.4.8) has taken the stage on 9869 for deve...Thin
    39. Hint: Some lines were ellipsized, use -l to show in full.

    看到两个程序都运行正常。

    11、浏览器打开:http://192.168.17.128:9869:

    使用oneadmin和密码进行登录:

  • 相关阅读:
    pandas:jupyter notebook笔记(更新中)
    numpy中计算相关系数的np.corrcoef
    mybatis实战:四、insert 用法(普通插入、返回主键自增的值)
    MFC Windows 程序设计[224]之双列表拾取器(附源码)
    多线程---锁策略与CAS
    LeetCode 1334. 阈值距离内邻居最少的城市:多次运用单源最短路的迪杰斯特拉算法
    Java Websocket 02: 原生模式通过 Websocket 传输文件
    无ansible-core安装ansible
    数据结构-----红黑树的删除操作
    “Node.js 包已不值得信任”
  • 原文地址:https://blog.csdn.net/chang_chunhua/article/details/133455720