Opennebula 云平台
原创
©著作权归作者所有:来自51CTO博客作者AchoYu的原创作品,请联系作者获取转载授权,否则将追究法律责任
1、安装步骤
- 1、关闭SE
- 2、配置epel源地和opennebula源
cat << "EOT" > /etc/yum.repos.d/opennebula.repo
[opennebula]
name=opennebula
baseurl=https://downloads.opennebula.org/repo/5.10/CentOS/7/$basearch
enabled=1
gpgkey=https://downloads.opennebula.org/repo/repo.key
gpgcheck=1
repo_gpgcheck=1
EOT
cat << "EOT" > /etc/yum.repos.d/opennebula.repo
[opennebula]
name=opennebula
baseurl=https://downloads.opennebula.org/repo/5.10/CentOS/8/$basearch
enabled=1
gpgkey=https://downloads.opennebula.org/repo/repo.key
gpgcheck=1
repo_gpgcheck=1
EOT
- 3、安装相关主控相关依赖包
yum install opennebula-server opennebula-sunstone opennebula-ruby opennebula-gate opennebula-flow -y
- 4、Ruby 运行环境安装(V5.10版本之后可选)
查看:
ls -lad /usr/share/one/gems*
lrwxrwxrwx 1 root root 9 Aug 13 11:41 /usr/share/one/gems -> gems-dist
drwxr-xr-x 9 root root 4096 Aug 13 11:41 /usr/share/one/gems-dist
自动修复:
test -L /usr/share/one/gems && unlink /usr/share/one/gems
/usr/share/one/install_gems
手动修复:
sqlite3 development library
mysql client development library
curl development library
libxml2 and libxslt development libraries
ruby development library
gcc and g++
make
以上安装包
- 5、mysql数据库配置
1、创建用户
GRANT ALL PRIVILEGES ON opennebula.* TO 'oneadmin' IDENTIFIED BY '<thepassword>';
2、配置事务隔离级别
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
3、配置oned.configuration
# Sample configuration for MySQL
DB = [ backend = "mysql",
server = "localhost",
port = 0,
user = "oneadmin",
passwd = "<thepassword>",
db_name = "opennebula" ]
4、定期清理索引
alter table vm_pool drop index ftidx;
alter table vm_pool add fulltext index ftidx (search_token);
5、虚拟机自定义配置
- 6、启动OpenNebula
1、使用 oneadmin 用户
su oneadmin
2、修改默认密码
echo "oneadmin:mypassword" > ~/.one/one_auth
3、启动
systemctl start opennebula
systemctl start opennebula-sunstone
4、出错验证Ruby环境是否有问题
- 7、验证安装
1、命令:oneuser show
输出:
USER 0 INFORMATION
ID : 0
NAME : oneadmin
GROUP : oneadmin
PASSWORD : 3bc15c8aae3e4124dd409035f32ea2fd6835efc9
AUTH_DRIVER : core
ENABLED : Yes
USER TEMPLATE
TOKEN_PASSWORD="ec21d27e2fe4f9ed08a396cbd47b08b8e0a4ca3c"
RESOURCE USAGE & QUOTAS
2、网页
http://<frontend_address>:9869
3、错误日志
/var/log/one/sunstone.log
/var/log/one/sunstone.error
4、程序说明
Path Description
/etc/one/ Configuration Files
/var/log/one/ Log files, notably: oned.log, sched.log, sunstone.log and <vmid>.log
/var/lib/one/ oneadmin home directory
/var/lib/one/datastores/<dsid>/ Storage for the datastores
/var/lib/one/vms/<vmid>/ Action files for VMs (deployment file, transfer manager scripts, etc…)
/var/lib/one/.one/one_auth oneadmin credentials
/var/lib/one/remotes/ Probes and scripts that will be synced to the Hosts
/var/lib/one/remotes/hooks/ Hook scripts
/var/lib/one/remotes/vmm/ Virtual Machine Manager Driver scripts
/var/lib/one/remotes/auth/ Authentication Driver scripts
/var/lib/one/remotes/im/ Information Manager (monitoring) Driver scripts
/var/lib/one/remotes/market/ MarketPlace Driver scripts
/var/lib/one/remotes/datastore/ Datastore Driver scripts
/var/lib/one/remotes/vnm/ Networking Driver scripts
/var/lib/one/remotes/tm/ Transfer Manager Driver scripts
5、端口说明
Port Description
9869 Sunstone server.
29876 VNC proxy port, used for translating and redirecting VNC connections to the hypervisors.
2633 OpenNebula daemon, main XML-RPC API endpoint.
2474 OneFlow server. This port only needs to be opened if OneFlow server is used.
5030 OneGate server. This port only needs to be opened if OneGate server is used.
端口都可以自定义配置,或者代理。
- 8、后续步骤
1、重置密码
oneuser passwd 0 <PASSWORD>
echo 'oneadmin:PASSWORD' > /var/lib/one/.one/one_auth
2、Opennedula 扩展应用
- OneFlow
用于将多个虚拟机应用程序定义和管理为单个实体。OneFlow还让您为应用程序组件定义依赖关系和自动扩展策略。
################################################ #############################
服务器配置
################## ################################################ #############
#OpenNebula 守护程序联系信息#
:one_xmlrpc : http:// localhost:2633 / RPC2
#生命周期管理器步骤之间的时间(以秒为单位)
#
:lcm_interval : 30
#OneFlow服务器将运行的主机和端口
:host : 127.0.0.1
:port : 2474
################################################ #############################
默认值
################### ################################################ ############
#缩放操作后的默认冷却时间,以秒为单位
:default_cooldown : 300
#默认关闭操作。值:'shutdown','shutdown-hard'
:shutdown_action : 'shutdown'
#默认oneflow动作选项当只有一个被提供
:action_number : 1
:action_period : 60
#oneflow创建的虚拟机的默认名称。您可以使用
以下
#个
占位符中的任意一个:#$ SERVICE_ID #$ SERVICE_NAME
#$ ROLE_NAME
#$ VM_NUMBER
:vm_name_template : '$ ROLE_NAME_ $ VM_NUMBER_(service_ $ SERVICE_ID)'
################################################ ###########
Auth
#################################### ########################
#与OpenNebula核心进行通信的身份验证驱动程序
#-密码,用于令牌的对称密码加密
#-x509,用于令牌的x509证书加密
:core_auth : 密码
################################################ #############################
日志
################## ################################################ ############
#日志调试级别
#0 =错误,1 =警告,2 =信息,3 =调试
#
:debug_level : 2
启动:
service opennebula-flow start
日志:
/var/log/one/oneflow.error
/var/log/one/oneflow.log
3、Opennedula node节点安装
- 1、要添加OpenNebula存储库,请以root用户身份执行以下操作:
cat << “ EOT” > /etc/yum.repos.d/opennebula.repo
[ opennebula ]
名称= opennebula
baseurl = https://downloads.opennebula.org/repo/5.10/CentOS/7/ $ basearch
enabled = 1
gpgkey = https://downloads.opennebula.org/repo/repo.key
gpgcheck = 1
repo_gpgcheck = 1
EOT
- 2、安装软件
sudo yum install opennebula-node-kvm
sudo systemctl restart libvirtd
qemu-kvm安装sudo yum install centos-release-qemu-ev
sudo yum install qemu-kvm-ev
- 3、禁用SElinux
vim /etc/selinux/config
SELINUX=disabled
- 4、配置无密码的SSH
- 1、前端服务器以前端服务器,节点服务器为参数,生成known_hosts文件
ssh-keyscan <frontend> <node1> <node2> <node3> ... >> /var/lib/one/.ssh/known_hosts
scp -rp /var/lib/one/.ssh <node1>:/var/lib/one/
scp -rp /var/lib/one/.ssh <node2>:/var/lib/one/
scp -rp /var/lib/one/.ssh <node3>:/var/lib/one/
### FAQ选择导入虚拟机后,会修改默认的/etc/libvirt/qemu.conf
还原为
user = "qemu"
group = "qemu"
就可以继续使用命令行启动