1.修改系统登录前显示信息:
修改方法:
编辑/etc/issue文件:
[root@CentOS ~]# vi /etc/issue
CentOS release 6.4 (Final)
Kernel on an m
内容可以自定义修改如:
[root@CentOS ~]# vi /etc/issue
Myiaas OS release 3.0
Please login as admin
d
显示效果:
相关参数说明:
b 插入当前行的波特率
d 插入当前日期
s 插入操作系统的名称
l 插入当前tty的名称
m 插入计算机的体系结构id,如x86_64
n 插入计算机的节点名,即hostname
o 插入计算机的域名
r 插入内核的版本
t 插入当前时间
u 插入当前登陆的用户数
U 插入1 user 或者 N users,N是当前登陆的用户数
v 插入当前操作系统的版本
参考配置脚本:
#!/bin/bash
echo -n "" > /etc/issue
cat >> /etc/issue << EOF
Myiaas OS release 3.0
Please login as admin
d
EOF
2.修改开机启动时候CentOS字样:
修改方法:
(1).编辑/etc/redhat-release
[root@CentOS ~]# vi /etc/redhat-release
CentOS release 6.4 (Final)
将内容修改为Myiaas OS release 3.0:
[root@CentOS ~]# cat /etc/redhat-release
Myiaas OS release 3.0
参考配置脚本:
#!/bin/bash
echo -n "" > /etc/system-release
cat >> /etc/system-release << EOF
Myiaas OS release 3.0
EOF
(2).编辑/etc/rc.d/rc.sysinit
大约在106行左右:
elif [[ "$system_release" =~ "CentOS" ]]; then
[ "$BOOTUP" = "color" ] && echo -en "\033[0;36m"
echo -en "CentOS"
[ "$BOOTUP" = "color" ] && echo -en "\033[0;39m"
PRODUCT=$(sed "s/CentOS (.*) ?release.*/1/" /etc/system-release)
echo " $PRODUCT"
将"CentOS"字样全部替换为"Myiaas":
elif [[ "$system_release" =~ "Myiaas" ]]; then
[ "$BOOTUP" = "color" ] && echo -en "\033[0;36m"
echo -en "Myiaas"
[ "$BOOTUP" = "color" ] && echo -en "\033[0;39m"
PRODUCT=$(sed "s/Myiaas (.*) ?release.*/1/" /etc/system-release)
echo " $PRODUCT"
保存退出;
参考配置脚本:
sed -i "s/CentOS/Myiaas/" /etc/rc.d/rc.sysinit
显示效果:
3.修改CentOS安装选项的背景图片:
修改方法:
替换镜像中的isolinux/splash.jpg图片文件即可。
4.修改CentOS安装过程中的CentOS文字显示:
修改方法:
(1).安装xz用于解压initrd.img镜像:
# yum -y install xz
(2).创建initrddir文件夹,将镜像目录的isolinux/initrd.img文件拷贝到initrddir文件夹中:
# mkdir initrddir
# cp -av /data/OS/isolinux/initrd.img ~/initrddir/
# cd ~/initrddir
# ls
initrd.img
(3).解压initrd.img文件
# xz -dc initrd.img | cpio -id
(4).修改.buildstamp文件
# vi .buildstamp
201303020151.x86_64
CentOS
6.4
FINAL=YES
http://bug.centos.org/
将内容改为:
201303020151.x86_64
Myiaas
3.0
FINAL=YES
http://www.chensh.net/
保存退出;
(5).initrd.img打包压缩
cd到initrddir文件夹执行如下操作:
# find . | cpio -c -o | xz -6 --format=lzma > ../initrd.img
(6).将镜像目录下的isolinux/initrd.img替换成新打包的initrd.img文件
# cd ~/
# cp -av initrd.img /data/OS/isolinux/
5.修改CentOS安装过程中的背景图片:
(1).安装squashfs-tools工具:
# yum -y install squashfs-tools
(2).创建installold文件夹,将镜像目录的images/install.img文件拷贝到installold文件夹中:
# mkdir installold
# cp -av /data/OS/image/install.img ~/installold/
# cd ~/installold
# ls
install.img
(3).打开install.img文件:
# mkdir /mnt/install
# mount -o loop -t squashfs ~/installold/install.img /mnt/install
# ls /mnt/install/
etc firmware lib lib64 modules proc usr var
# cp -av /mnt/install ~/installnew
(4).替换图形安装过程中的背景图片
# cd installnew/usr/share/anaconda/pixmaps/
# ls
about-to-install.png gnome-lock.png partscheme-freespace.png splash.png
anaconda_header.png gnome-mouse.png partscheme-replace.png syslinux-splash.png
checkMark.png install.png partscheme-shrink.png upgrade.png
config-language.png network.png progress_first-lowres.png
done.png partscheme-all.png progress_first.png
filter-menu.png partscheme-custom.png root-password.png
(5).install.img打包压缩
# cd ~/
# mksquashfs installnew install.img
(6).将镜像目录下的image/install.img替换成新打包的install.img文件
# cp -av install.img /data/OS/image/
6.修改isolinux.cfg 内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | default vesamenu.c32 #prompt 1 timeout 600 display boot.msg menu background splash.jpg menu title Welcome to Myiaas 3.0 ! menu color border 0 #ffffffff #00000000 menu color sel 7 #ffffffff #ff000000 menu color title 0 #ffffffff #00000000 menu color tabmsg 0 #ffffffff #00000000 menu color unsel 0 #ffffffff #00000000 menu color hotsel 0 #ff000000 #ffffffff menu color hotkey 7 #ffffffff #ff000000 menu color scrollbar 0 #ffffffff #00000000 label local menu label ^[A] Boot from local drive localboot 0xffff label Myiaas OS 3.0 menu label ^[B] Install Myiaas OS 3.0 system kernel vmlinuz append test ks=cdrom: /isolinux/myiaas/ks/myiaas .cfg initrd=initrd.img |
7.系统登录后增加监控显示:
(1).修改.bashrc文件,增加两行红色字体内容:
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
[ -z "$PS1" ] && return
. ~/.monitor
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
(2).在家目录下创建.monitor文件,内容如下:
|
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | ########################################################################## # # kickstart install script by chensh # Email myiaas@126.com # www.chensh.net # Platform=x86, AMD64, or Intel EM64T # ########################################################################## # version=DEVEL # Install OS instead of upgrade install # Local installation Use CDROM installation media cdrom # System language lang en_US.UTF-8 # System keyboard keyboard us # Use text mode install text # Network information network --onboot no --bootproto dhcp -- hostname =Myiaas --noipv6 #Root password rootpw chensh # Firewall configuration firewall --disabled # System authorization information authconfig --enableshadow --passalgo=sha512 # do not configure X Windows skipx # SELinux configuration selinux --disabled # System timezone timezone --utc Asia /Shanghai # System bootloader configuration bootloader --location=mbr # Partition clearing information #clearpart --all --initlabel # Disk partitioning information part /boot --fstype=ext4 --size=100 part / --fstype=ext4 --size=10240 part swap --size=2048 part /srv --fstype=ext4 --grow --size=200 repo --name= "CentOS" --baseurl= file : ///mnt/source --cost=100 reboot %pre /usr/sbin/parted -s ` fdisk -l | grep -w "Disk /dev" | awk '{print $2}' | awk 'NR==1' | sed 's#:##g' ` mklabel gpt # This packages is for Myiaas OS %packages --nobase @core kvm libvirt ruby %post --nochroot # mkdir -p /mnt/sysimage/tmp/ >> /tmp/ins.log 2>&1 cp -av /mnt/source/isolinux/ezcloud/scripts/myiaas .sh /mnt/sysimage/tmp/ >> /tmp/ins .log 2>&1 %post chmod 755 /tmp/myiaas .sh >> /tmp/ins .log 2>&1 sh /tmp/myiaas .sh >> /tmp/ins .log 2>&1 #-------------Closed virbr0 interface----------------------- virsh net-destroy default >> /tmp/ins .log 2>&1 virsh net-undefine default >> /tmp/ins .log 2>&1 %end |
关于anaconda具有很高学习价值的两篇文章:
http://blog.csdn.net/woods2001/article/details/7297195
http://blog.csdn.net/woods2001/article/details/7297197