Openstack-make-centos-image

简介:

煮酒品茶:OpenStack制作CentOS的镜像视频

1、建立虚拟机(硬盘镜像选对)

2、在虚拟机上做一些云的要求(有脚本)

3、上传镜像

4、测试




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# add the EPEL repo and update
rpm -Uvh http: //download .fedoraproject.org /pub/epel/6/x86_64/epel-release-6-8 .noarch.rpm
yum -y update
# install cloud-init
yum -y  install  cloud-init
yum -y  install  rsync
# add the ec2-user (default for cloud-init)
adduser ec2-user
mkdir  /home/ec2-user/ . ssh /
chown  -R ec2-user.ec2-user  /home/ec2-user/ . ssh
# patch up groups
sed  -i  '/^wheel:/ s/$/ec2-user/'  /etc/group
# fix up sudoers
sed  -i  '/Defaults    requiretty/d'  /etc/sudoers
sed  -i  '/## Same thing without a password/{n;d}'  /etc/sudoers
sed  -i '/ # Same thing without a password/a \
%wheel   ALL=(ALL)   NOPASSWD: ALL'  /etc/sudoers
# hack up sshd_config
sed  -i  's/PasswordAuthentication yes/PasswordAuthentication no/g'  /etc/ssh/sshd_config
# clean up the network interface stuff
rm  /etc/udev/rules .d /70-persistent-net .rules
sed  -i  '/HWADDR/d'  /etc/sysconfig/network-scripts/ifcfg-eth0
sed  -i  '/UUID/d'  /etc/sysconfig/network-scripts/ifcfg-eth0
# graft up grub
sed  -i  's/timeout=5/timeout=1/g'  /boot/grub/menu .lst
sed  -i ' /hiddenmenu/a  \
serial –unit=0 –speed=115200 \
terminal –timeout=10 console serial'  /boot/grub/menu .lst
sed  -i  '/^\skernel/ s/$/ console=tty0 console=ttyS0,115200n8/'  /boot/grub/menu .lst
# wipe the passwords
passwd  -l root
passwd  -l ec2-user
# say something cute in /etc/motd
echo  "CentOS image built using BlueChipTek's OpenStack guide."  >>  /etc/motd
echo  ""  >>  /etc/motd
echo  "More guides on OpenStack are at http://openstack.bluechiptek.com/"  >>  /etc/motd
echo  ""  >>  /etc/motd
echo  "@StackGeek"  >>  /etc/motd
# notify we're halting
echo  "Halting instance in 5 seconds!"
sleep  5
# halt the instance
halt




本文转自 煮酒品茶 51CTO博客,原文链接:http://blog.51cto.com/cwtea/1357349,如需转载请自行联系原作者
目录
相关文章
|
10月前
|
存储 缓存 Linux
Centos7 yum 方式安装 安装 Docker CE
系统要求 Docker CE 支持 64 位版本 CentOS 7,并且要求内核版本不低于 3.10。 CentOS 7 满足最低内核的要求,但由于内核版本比较低,部分功能(如 overlay2 存储层驱动)无法使用,并且部分功能可能不太稳定。 卸载旧版本 旧版本的 Docker 称为 docker 或者 docker-engine,使用以下命令卸载旧版本:
1079 1
|
11月前
|
Linux 虚拟化
使用RDO Packstack在CentOS 8上安装版本为Victoria的openstack
使用RDO Packstack在CentOS 8上安装版本为Victoria的openstack
|
Linux 网络安全 网络架构
使用RDO Packstack在CentOS 8上安装版本为Victoria的openstack(下)
使用RDO Packstack在CentOS 8上安装版本为Victoria的openstack
118 0
使用RDO Packstack在CentOS 8上安装版本为Victoria的openstack(下)
|
Linux Docker 容器
|
监控 关系型数据库 大数据
|
弹性计算 网络协议 Linux
How to Install and Configure Docker Swarm Mode on CentOS 7
In this tutorial, we will learn how to set up Docker Swarm on an Alibaba Cloud ECS CentOS 7 instance.
2124 0
How to Install and Configure Docker Swarm Mode on CentOS 7
|
安全 前端开发 关系型数据库
|
Linux 数据安全/隐私保护 Docker
为什么我们不允许非root用户在CentOS、Fedora和RHEL上直接运行Docker命令
本文讲的是为什么我们不允许非root用户在CentOS、Fedora和RHEL上直接运行Docker命令,【编者的话】容器技术最大的弱点是安全性不足,Docker也不例外。因此,如何加强Docker的安全性是每一个Docker用户必须慎重考虑的问题。
1579 0