102 lines
2.4 KiB
Markdown
102 lines
2.4 KiB
Markdown
---
|
||
title: "Ovirt 笔记"
|
||
date: 2019-10-30T13:04:51+08:00
|
||
lastmod: 2019-10-30T13:04:51+08:00
|
||
tags: ["ovirt"]
|
||
categories: ["kvm"]
|
||
---
|
||
|
||
# 封装 CentOS6/7 虚拟机
|
||
- 标识 “重新配置”
|
||
```bash
|
||
touch /.unconfigured
|
||
```
|
||
- 删除 ssh 主机密钥
|
||
```bash
|
||
rm -rf /etc/ssh/ssh_host_*
|
||
```
|
||
- 恢复原始主机名 ”localhost“
|
||
```bash
|
||
#CentOS6
|
||
sed -i '/^HOSTNAME/cHOSTNAME=localhost.localdomain' /etc/sysconfig/network
|
||
#CentOS7
|
||
sed -i '/^HOSTNAME/cHOSTNAME=localhost.localdomain' /etc/hostname
|
||
```
|
||
- 清理 udev
|
||
```bash
|
||
rm -rf /etc/udev/rules.d/70-*
|
||
```
|
||
- 删除网卡硬件标识
|
||
```bash
|
||
sed -i -e '/HWADDR/d' -e '/UUID/d' /etc/sysconfig/network-scripts/ifcfg-{eth,enp}*
|
||
```
|
||
- 清空日志
|
||
```bash
|
||
rm -rf /var/log/*
|
||
```
|
||
- 关闭虚拟机
|
||
```bash
|
||
poweroff
|
||
```
|
||
|
||
# 解锁 admin 用户
|
||
- 查看状态
|
||
```bash
|
||
ovirt-aaa-jdbc-tool user show admin
|
||
```
|
||
- 解锁
|
||
```bash
|
||
ovirt-aaa-jdbc-tool user unlock admin
|
||
```
|
||
|
||
# 创建本地 yum 源
|
||
- 安装工具
|
||
```bash
|
||
yum install yum-utils createrepo
|
||
```
|
||
- 解压 rpm 包(无用,仅作记录)
|
||
```bash
|
||
rpm2cpio {filename}.rpm | cpio -ivd
|
||
```
|
||
- 下载 ovirt.repo,保存到本地服务器的 /etc/yum.repos.d/ 下
|
||
- 下载 RPM-GPG-ovirt-4.1,保存到本地服务器的 /etc/pki/rpm-gpg/ 下
|
||
- 在该服务器上,执行以下命令:
|
||
```bash
|
||
yum clean all
|
||
yum makecache fast
|
||
yum repolist #此时能看到新增加的 ovirt.repo 文件中的 yum 源
|
||
```
|
||
- 同步 yum repo 到本地
|
||
```bash
|
||
mkdir /DATA/yum && cd /DATA/yum
|
||
reposync -nld \
|
||
--repoid=ovirt-4.1 \
|
||
--repoid=ovirt-4.1-epel \
|
||
--repoid=ovirt-centos7 \
|
||
--repoid=centos-opstools-release \
|
||
--repoid=patternfly-patternfly1
|
||
```
|
||
- 创建本地 yum repo
|
||
```bash
|
||
createrepo --update ovirt-4.1
|
||
createrepo --update ovirt-4.1-epel
|
||
createrepo --update ovirt-centos7
|
||
createrepo --update centos-opstools-release
|
||
createrepo --update patternfly-patternfly1
|
||
```
|
||
- nginx.conf 配置
|
||
```nginx
|
||
server {
|
||
listen 1080 default_server;
|
||
listen [::]:1080 default_server;
|
||
server_name _;
|
||
root /DATA/yum;
|
||
location / {
|
||
autoindex on;
|
||
autoindex_exact_size off;
|
||
autoindex_localtime on;
|
||
}
|
||
}
|
||
```
|
||
|