CentOS安装OpenNebula(一)

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

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

主控端部署:

1、hosts文件做DNS解析。

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

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

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

2、关闭SELINUX:

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

3、防火墙配置:

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

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

4、软件源的配置:

[root@master yum.repos.d]# vim opennebula.repo

[root@master yum.repos.d]# cat opennebula.repo
[opennebula]
name=opennebula
baseurl=https://downloads.opennebula.org/repo/5.6/CentOS/7/x86_64
enabled=1
gpgkey=https://downloads.opennebula.org/repo/repo.key
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主控额外依赖和主程序:

先配置下国内源:

[root@master one]# gem sources -r https://rubygems.org/ -a https://gems.ruby-china.com/
https://gems.ruby-china.com/ added to sources
https://rubygems.org/ removed from sources


[root@master one]# gem install bundler --version '< 2'
Successfully installed bundler-1.17.3
Parsing documentation for bundler-1.17.3
1 gem installed
[root@master one]# /usr/share/one/install_gems
lsb_release command not found. If you are using a RedHat based
distribution install redhat-lsb

Select your distribution or press enter to continue without
installing dependencies.

0. Ubuntu/Debian
1. CentOS/RedHat/Scientific

1
Distribution "redhat" detected.
About to install these dependencies:
* gcc
* rubygem-rake
* libxml2-devel
* libxslt-devel
* patch
* gcc-c++
* sqlite-devel
* curl-devel
* mysql-devel
* openssl-devel
* ruby-devel
* make

Press enter to continue...

yum install gcc rubygem-rake libxml2-devel libxslt-devel patch gcc-c++ sqlite-devel curl-devel mysql-devel openssl-devel ruby-devel make
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * epel: mirror.01link.hk
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.ustc.edu.cn
Package gcc-4.8.5-44.el7.x86_64 already installed and latest version
Package rubygem-rake-0.9.6-39.el7_9.noarch already installed and latest version
Package libxml2-devel-2.9.1-6.el7_9.6.x86_64 already installed and latest version
Package libxslt-devel-1.1.28-6.el7.x86_64 already installed and latest version
Package patch-2.7.1-12.el7_7.x86_64 already installed and latest version
Package gcc-c++-4.8.5-44.el7.x86_64 already installed and latest version
Package sqlite-devel-3.7.17-8.el7_7.1.x86_64 already installed and latest version
Package libcurl-devel-7.29.0-59.el7_9.1.x86_64 already installed and latest version
Package 1:mariadb-devel-5.5.68-1.el7.x86_64 already installed and latest version
Package 1:openssl-devel-1.0.2k-26.el7_9.x86_64 already installed and latest version
Package ruby-devel-2.0.0.648-39.el7_9.x86_64 already installed and latest version
Package 1:make-3.82-24.el7.x86_64 already installed and latest version
Nothing to do
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as
root will break this application for all non-root users on this machine.
Fetching source index from https://rubygems.org/
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.
Fetching public_suffix 2.0.5
Installing public_suffix 2.0.5
Fetching addressable 2.5.2
Installing addressable 2.5.2
Fetching xml-simple 1.1.5
Installing xml-simple 1.1.5
Fetching amazon-ec2 0.9.17
Installing amazon-ec2 0.9.17
Fetching aws-sigv4 1.0.2
Installing aws-sigv4 1.0.2
Fetching jmespath 1.4.0
Installing jmespath 1.4.0
Fetching aws-sdk-core 2.11.39
Installing aws-sdk-core 2.11.39
Fetching aws-sdk-resources 2.11.39
Installing aws-sdk-resources 2.11.39
Fetching aws-sdk 2.11.39
Installing aws-sdk 2.11.39
Fetching multipart-post 2.0.0
Installing multipart-post 2.0.0
Fetching faraday 0.15.0
Installing faraday 0.15.0
Fetching faraday_middleware 0.12.2
Installing faraday_middleware 0.12.2
Fetching mini_portile2 2.1.0
Installing mini_portile2 2.1.0
Fetching nokogiri 1.6.8.1
Installing nokogiri 1.6.8.1 with native extensions
Fetching azure-core 0.1.14
Installing azure-core 0.1.14
Fetching mime-types-data 3.2016.0521
Installing mime-types-data 3.2016.0521
Fetching mime-types 3.1
Installing mime-types 3.1
Fetching systemu 2.6.5
Installing systemu 2.6.5
Fetching thor 0.20.0
Installing thor 0.20.0
Fetching azure 0.7.10
Installing azure 0.7.10
Fetching builder 3.2.3
Installing builder 3.2.3
Using bundler 1.17.3
Fetching configparser 0.1.7
Installing configparser 0.1.7
Fetching curb 0.9.4
Installing curb 0.9.4 with native extensions
Fetching daemons 1.2.6
Installing daemons 1.2.6
Fetching eventmachine 1.2.5
Installing eventmachine 1.2.5 with native extensions
Fetching hashie 3.5.7
Installing hashie 3.5.7
Fetching inflection 1.0.0
Installing inflection 1.0.0
Fetching memcache-client 1.8.5
Installing memcache-client 1.8.5
Fetching mysql2 0.5.1
Installing mysql2 0.5.1 with native extensions
Fetching net-ldap 0.16.1
Installing net-ldap 0.16.1
Fetching ox 2.9.2
Installing ox 2.9.2 with native extensions
Fetching parse-cron 0.1.4
Installing parse-cron 0.1.4
Fetching polyglot 0.3.5
Installing polyglot 0.3.5
Fetching rack 1.6.10
Installing rack 1.6.10
Fetching rack-protection 1.5.5
Installing rack-protection 1.5.5
Fetching scrub_rb 1.0.1
Installing scrub_rb 1.0.1
Fetching sequel 5.7.1
Installing sequel 5.7.1
Fetching tilt 2.0.8
Installing tilt 2.0.8
Fetching sinatra 1.4.8
Installing sinatra 1.4.8
Fetching sqlite3 1.3.13
Installing sqlite3 1.3.13 with native extensions
Fetching thin 1.7.2
Installing thin 1.7.2 with native extensions
Fetching treetop 1.6.10
Installing treetop 1.6.10
Fetching trollop 2.1.2
Installing trollop 2.1.2
Fetching uuidtools 2.1.5
Installing uuidtools 2.1.5
Fetching zendesk_api 1.16.0
Installing zendesk_api 1.16.0
Bundle complete! 23 Gemfile dependencies, 46 gems now installed.
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:

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

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

[root@master one]# systemctl status opennebula
● opennebula.service - OpenNebula Cloud Controller Daemon
   Loaded: loaded (/usr/lib/systemd/system/opennebula.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2023-10-01 09:45:30 CST; 2h 9min ago
 Main PID: 1695 (oned)
   CGroup: /system.slice/opennebula.service
           ├─1695 /usr/bin/oned -f
           ├─1699 ruby /usr/lib/one/mads/one_hm.rb
           ├─1734 ruby /usr/lib/one/mads/one_vmm_exec.rb -t 15 -r 0 kvm
           ├─1751 ruby /usr/lib/one/mads/one_vmm_exec.rb -l deploy,shutdown,reboot,cancel,save,r...
           ├─1768 /usr/lib/one/mads/collectd -p 4124 -f 5 -t 50 -i 60
           ├─1820 ruby /usr/lib/one/mads/one_im_exec.rb -r 3 -t 15 -w 90 kvm
           ├─1833 ruby /usr/lib/one/mads/one_im_exec.rb -l -c -t 15 -r 0 vcenter
           ├─1846 ruby /usr/lib/one/mads/one_tm.rb -t 15 -d dummy,lvm,shared,fs_lvm,qcow2,ssh,ce...
           ├─1866 ruby /usr/lib/one/mads/one_datastore.rb -t 15 -d dummy,fs,lvm,ceph,dev,iscsi_l...
           ├─1882 ruby /usr/lib/one/mads/one_market.rb -t 15 -m http,s3,one
           ├─1898 ruby /usr/lib/one/mads/one_ipam.rb -t 1 -i dummy
           └─1910 ruby /usr/lib/one/mads/one_auth_mad.rb --authn ssh,x509,ldap,server_cipher,ser...

Oct 01 09:45:27 master systemd[1]: Starting OpenNebula Cloud Controller Daemon...
Oct 01 09:45:30 master systemd[1]: Started OpenNebula Cloud Controller Daemon.



[root@master one]# systemctl status opennebula-sunstone
● opennebula-sunstone.service - OpenNebula Web UI Server
   Loaded: loaded (/usr/lib/systemd/system/opennebula-sunstone.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2023-10-01 11:51:14 CST; 9s ago
  Process: 48182 ExecStartPre=/usr/sbin/logrotate -f /etc/logrotate.d/opennebula-sunstone -s /var/lib/one/.logrotate.status (code=exited, status=0/SUCCESS)
 Main PID: 48183 (ruby)
   CGroup: /system.slice/opennebula-sunstone.service
           └─48183 /usr/bin/ruby /usr/lib/one/sunstone/sunstone-server.rb

Oct 01 11:51:14 master ruby[48183]: :keep_me_logged=>true,
Oct 01 11:51:14 master ruby[48183]: :lang=>"en_US",
Oct 01 11:51:14 master ruby[48183]: :table_order=>"desc",
Oct 01 11:51:14 master ruby[48183]: :mode=>"mixed",
Oct 01 11:51:14 master ruby[48183]: :marketplace_url=>"http://marketplace.opennebula.systems/",
Oct 01 11:51:14 master ruby[48183]: :oneflow_server=>"http://localhost:2474/",
Oct 01 11:51:14 master ruby[48183]: :routes=>["oneflow", "vcenter", "support"],
Oct 01 11:51:14 master ruby[48183]: :session_expire_time=>3600}
Oct 01 11:51:14 master ruby[48183]: --------------------------------------
Oct 01 11:51:15 master ruby[48183]: == Sinatra (v1.4.8) has taken the stage on 9869 for deve...Thin
Hint: Some lines were ellipsized, use -l to show in full.

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

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

CentOS安装OpenNebula(一)_第1张图片

使用oneadmin和密码进行登录:

CentOS安装OpenNebula(一)_第2张图片

你可能感兴趣的:(OpenNebula,OpenNebula)