Cloudstack 制作Centos 模板
也是在系统之上的操作;
选择ISO创建实例;进去系统之后做一些基本设置;关闭SELinux 和敌对网络的设置;如果是自动获取的网络便可以如此设置网卡参数;
1、网络设置
对于初始的设置可以先保证网络正常,基于个人的实验平台我这样设置;
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=dhcp
[root@test35 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=dhcp
2、设置SELINUX=disabled
[root@test35 ~]# vi/etc/selinux/config
3、然后进行安装一些服务 ntp acpid ntpdate wget expect
expect是一个简单的工具语言,如要工作就是进行自动化的人机交互。Expect 自动交互式脚本命令 类似 Linux 的 bash shell;
主机能够连接网络的时候可以直接yum 安装这些;
[root@test35 ~]#yum install ntp acpid wget expect -y
启动服务正常而后chkconfig 设置开机启动;
4、下载随机密码脚本;
[root@test35 ~]# wget http://download.cloud.com/templates/4.2/bindir/cloud-set-guest-password.in
wget http://download.cloud.com/templates/4.2/bindir/cloud-set-guest-password.in
5、移动脚本自/etc/init.d/ (重命名了)
[root@test35 ~]# mv cloud-set-guest-password.in /etc/init.d/cloud-set-guest-password
赋予可执行的权限
[root@test35 ~]# chmod +x /etc/init.d/cloud-set-guest-password
6、然后删除MAC与网卡绑定;这个系统启动的时候可以自动删除;
[root@test35 ~]# rm -f /etc/udev/rules.d/70-persistent-net.rules
7、清除指令记录
history -c
关闭实例然后查看卷直接创建为模板就可以了
(实际应该还有很多的日志文件需要删除 和更改 是系统做到优化极致)