独辟蹊径网络安装Debian/Ubuntu(3)

上述事例中的anaconda-ks.cfg文件中没有使用%post部分脚本,故此在安装完成的系统上出IP地址信息设置完成,任何服务器上的配置都需要一步一步的操作完成,这个方式对于一个群集站点的部署来说是很不理想的。通过使用%post安装后的脚本,可以通过默认的shell脚本语法实现文件的下载、软件包的编译等工作,从而是安装后的主机可以直接投入到使用中,减少准备时间。以下是一个%post脚本事例,通过此段代码可以完成在PXE安装阶段安装heartbeat-2.1.4,当然也可以从ftp上将heartbeat-2.1.4需要的配置文件下载到指定的目录下,以节省配置时间。只要有了脚本可以完成很多想象的的事情!至于能够作什么只有管理员们自己在工作中慢慢体会了。

%post
cd                        /usr/src/
wget                        ftp://172.16.1.19/libnet.tar.gz
wget                        ftp://172.16.1.19/heartbeat-2.1.4.tar.gz
tar                        -xvf libnet.tar.gz
cd                        libnet
./configure;make;make                        install;cd ..
tar                        -xvf heartbeat-2.1.4.tar.gz
cd                        heartbeat-2.1.4
./ConfigureMe                        configure;make;make install;

安装过程究竟要安装那些软件包合适,不能完全通过已安装系统的anaconda-ks.cfg文件获得,RedHat&CentOS提供的system-config-kickstart配置工具提供了一个便捷的选择选择方式,不过限于Redhat目前的商业的授权问题,可以通过Centos对应的版本进行软件包的选择,具体如下图所示:

独辟蹊径网络安装Debian/Ubuntu

图:system-config-kickstart加载

独辟蹊径网络安装Debian/Ubuntu

图:system-config-kickstart配置软件包

以下是一个RHEL5.3&Centos5.2的可用的软件包组的清单,可以工具自己的需要选择。其中蓝色部分为当前版本能够提供的全部的软件包组名称。
#platform=x86,                        AMD64, or Intel EM64T
#                        System authorization information
auth                         --useshadow  --enablemd5
#                        System bootloader configuration
bootloader                        --location=mbr
#                        Partition clearing information
clearpart                        --none
#                        Use graphical install
graphical
#                        Firewall configuration
firewall                        --enabled
#                        Run the Setup Agent on first boot
firstboot                        --disable
#                        System keyboard
keyboard                        us
#                        System language
lang                        en_US
#                        Installation logging level
logging                        --level=info
#                        Use CDROM installation media
cdrom
#                        SELinux configuration
selinux                        --enforcing
#                        System timezone
timezone                         America/New_York
#                        Install OS instead of upgrade
install
# X                        Window System configuration information
xconfig                         --defaultdesktop=GNOME --depth=8 --resolution=640x480
%packages
@server-cfg
@base-x
@gnome-desktop
@ftp-server
@legacy-software-development
@development-libs
@base
@x-software-development
@sound-and-video
@mail-server
@network-server
@gnome-software-development
@admin-tools
@kde-software-development
@printing
@web-server
@mysql
@openfabrics-enterprise-distribution
@development-tools
@chinese-support
@Java-development
@legacy-network-server
@system-tools
@kde-desktop
@legacy-software-support
@sql-server
@virtualization
@graphical-internet
@cluster-storage
@text-internet
@ruby
@office
@games
@dialup
@smb-server
@authoring-and-publishing
@graphics
@clustering
@emacs
@java
@dns-server
@engineering-and-scientific
@editors
@news-server

当然这个system-config-kickstart配置工具并不局限于软件包的选择,可以设置一个Kickstart文件的命令、软件包选择、脚本等全部的信息。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/28731.html