SLES 9由DVD创建安装源的问题。
[
|
2008/10/15 00:17]
|
2008/10/15 00:17]
由于是从SLES9 SP3的DVD光盘拷贝到安装源的创建目录内,发现报错如下:
cp: will not create hard link './SP3/CD1/i386/update/SUSE-CORE/9/rpm/i586' to directory './SP3/CD1/suse/i586'
cp: will not create hard link './SP3/CD1/i386/update/SUSE-CORE/9/rpm/noarch' to directory './SP3/CD1/suse/noarch'
cp: will not create hard link './SP3/CD2/i386/update/SUSE-CORE/9/rpm/i586' to directory './SP3/CD2/suse/i586'
cp: will not create hard link './SP3/CD2/i386/update/SUSE-CORE/9/rpm/i686' to directory './SP3/CD2/suse/i686'
cp: will not create hard link './SP3/CD2/i386/update/SUSE-CORE/9/rpm/noarch' to directory './SP3/CD2/suse/noarch'
cp: will not create hard link './SP3/CD2/i386/update/SUSE-CORE/9/rpm/nosrc' to directory './SP3/CD2/suse/nosrc'
cp: will not create hard link './SP3/CD2/i386/update/SUSE-CORE/9/rpm/src' to directory './SP3/CD2/suse/src'
如果你置之不理,在后期的PXE网络安装中,客户端安装系统的时候会提示你找不到所要安装的rpm包。
其实道理很简单,在光盘的镜像结构里面,目录是可以做硬链接的。但是当你将光盘里面的内容拷贝到系统环境下,在目前的linux下的任何文件系统内也是无法为目录来创建硬链接的。
所以解决的方法就是:
1:手工创建软链接。(后经过测试,nfs分享后,无法找到路径)
2:直接从源路径复制目录到链接位置。(学乖了,就这招吧。)
3:用于源的分享的时候,直接将光盘挂载到那个目录下面。(这里有一个疑问,为什么这个时候是好用的。其实在使用ftp分享的时候,也许不让跳转目录。但是应该都属于同一个/下面,理论是可以的。)
最保险的做法是2,1和3也许都会多多少少面临这些问题。不过可以深入研究一下为什么不可以。
后记:用NFS还是效率最高的。
引用
cp: will not create hard link './SP3/CD1/i386/update/SUSE-CORE/9/rpm/i586' to directory './SP3/CD1/suse/i586'
cp: will not create hard link './SP3/CD1/i386/update/SUSE-CORE/9/rpm/noarch' to directory './SP3/CD1/suse/noarch'
cp: will not create hard link './SP3/CD2/i386/update/SUSE-CORE/9/rpm/i586' to directory './SP3/CD2/suse/i586'
cp: will not create hard link './SP3/CD2/i386/update/SUSE-CORE/9/rpm/i686' to directory './SP3/CD2/suse/i686'
cp: will not create hard link './SP3/CD2/i386/update/SUSE-CORE/9/rpm/noarch' to directory './SP3/CD2/suse/noarch'
cp: will not create hard link './SP3/CD2/i386/update/SUSE-CORE/9/rpm/nosrc' to directory './SP3/CD2/suse/nosrc'
cp: will not create hard link './SP3/CD2/i386/update/SUSE-CORE/9/rpm/src' to directory './SP3/CD2/suse/src'
如果你置之不理,在后期的PXE网络安装中,客户端安装系统的时候会提示你找不到所要安装的rpm包。
其实道理很简单,在光盘的镜像结构里面,目录是可以做硬链接的。但是当你将光盘里面的内容拷贝到系统环境下,在目前的linux下的任何文件系统内也是无法为目录来创建硬链接的。
所以解决的方法就是:
1:手工创建软链接。(后经过测试,nfs分享后,无法找到路径)
2:直接从源路径复制目录到链接位置。(学乖了,就这招吧。)
3:用于源的分享的时候,直接将光盘挂载到那个目录下面。(这里有一个疑问,为什么这个时候是好用的。其实在使用ftp分享的时候,也许不让跳转目录。但是应该都属于同一个/下面,理论是可以的。)
最保险的做法是2,1和3也许都会多多少少面临这些问题。不过可以深入研究一下为什么不可以。
后记:用NFS还是效率最高的。
SuSE Enterprise网络安装(三)
[
|
2008/10/09 23:13]
|
2008/10/09 23:13]
过完十一有些累,研究了一下节前剩下的尾巴。找到了问题的解决方案。那就是在autoyast里面执行一个脚本。下面是关于几个阶段执行的脚本。选择chroot-scripts这个时候进行网卡模块的安装。这样在第一次系统启动前完成驱动的加载。从而进入系统配置环节,完成系统的安装。
参考URL:http://www.suse.com/~ug/autoyast_doc/createprofile.scripts.html
pre-scripts (very early, before anything else really happened)
chroot-scripts (after the package installation, before the first boot)
post-scripts (during the first boot of the installed system, no services running)
init-scripts (during the first boot of the installed system, all servies up and running)
......
</runlevel>
<scripts>
<chroot-scripts config:type="list">
<script>
<filename>instBCM.sh</filename>
<debug config:type="boolean">true</debug>
<location></location>
<interpreter>shell</interpreter>
<source><![CDATA[
#!/bin/bash
#
# After installation, the logfile from this script can be found in
# /var/adm/autoinstall/logs
#
echo "========================================="
echo "... Starting AutoYAST included script ..."
echo "========================================="
rpm -ivh --root=/mnt http://192.168.65.100/brcm-bnx2-kmp-default-1.7.1c_2.6.16.46_0.12-0.i586.rpm
]]>
</source>
</script>
</chroot-scripts>
</scripts>
......
后来客户又有了新的要求,需要添加用户。故而又添加了一个初始化脚本,用于用户的创建。
<scripts>
<chroot-scripts config:type="list">
<script>
<filename>instBCM.sh</filename>
<debug config:type="boolean">true</debug>
<location></location>
<interpreter>shell</interpreter>
<source><![CDATA[
#!/bin/bash
#
# After installation, the logfile from this script can be found in
# /var/adm/autoinstall/logs
#
echo "========================================="
echo "... Starting AutoYAST included script ..."
echo "========================================="
rpm -ivh --root=/mnt http://192.168.65.100/brcm-bnx2-kmp-default-1.7.1c_2.6.16.46_0.12-0.i586.rpm
]]>
</source>
</script>
</chroot-scripts>
<init-scripts config:type="list">
<script>
<filename>initUser.sh</filename>
<debug config:type="boolean">true</debug>
<location></location>
<interpreter>shell</interpreter>
<source><![CDATA[
#!/bin/bash
#
# After installation, the logfile from this script can be found in
# /var/adm/autoinstall/logs
#
echo "========================================="
echo "... Starting AutoYAST included script ..."
echo "========================================="
groupadd -g 1000 admin
groupadd -g 2000 sybase
groupadd -g 2010 oracle
groupadd -g 2020 weblogic
groupadd -g 2030 postfix
groupadd -g 2040 vsftpd
useradd -m -g 2000 -u 2000 sybase
useradd -m -g 2010 -u 2010 oracle
useradd -m -g 2020 -u 2020 weblogic
useradd -m -g 2030 -u 2030 postfix
useradd -m -g 2040 -u 2040 vsftpd
for i in $(seq 1 30)
do
echo $[999+$i] $(printf %.2d $i)
useradd -m -g 1000 -u $[999+$i] kook$(printf %.2d $i)
done
]]>
</source>
</script>
</init-scripts>
</scripts>
参考URL:http://www.suse.com/~ug/autoyast_doc/createprofile.scripts.html
pre-scripts (very early, before anything else really happened)
chroot-scripts (after the package installation, before the first boot)
post-scripts (during the first boot of the installed system, no services running)
init-scripts (during the first boot of the installed system, all servies up and running)
......
</runlevel>
<scripts>
<chroot-scripts config:type="list">
<script>
<filename>instBCM.sh</filename>
<debug config:type="boolean">true</debug>
<location></location>
<interpreter>shell</interpreter>
<source><![CDATA[
#!/bin/bash
#
# After installation, the logfile from this script can be found in
# /var/adm/autoinstall/logs
#
echo "========================================="
echo "... Starting AutoYAST included script ..."
echo "========================================="
rpm -ivh --root=/mnt http://192.168.65.100/brcm-bnx2-kmp-default-1.7.1c_2.6.16.46_0.12-0.i586.rpm
]]>
</source>
</script>
</chroot-scripts>
</scripts>
......
后来客户又有了新的要求,需要添加用户。故而又添加了一个初始化脚本,用于用户的创建。
<scripts>
<chroot-scripts config:type="list">
<script>
<filename>instBCM.sh</filename>
<debug config:type="boolean">true</debug>
<location></location>
<interpreter>shell</interpreter>
<source><![CDATA[
#!/bin/bash
#
# After installation, the logfile from this script can be found in
# /var/adm/autoinstall/logs
#
echo "========================================="
echo "... Starting AutoYAST included script ..."
echo "========================================="
rpm -ivh --root=/mnt http://192.168.65.100/brcm-bnx2-kmp-default-1.7.1c_2.6.16.46_0.12-0.i586.rpm
]]>
</source>
</script>
</chroot-scripts>
<init-scripts config:type="list">
<script>
<filename>initUser.sh</filename>
<debug config:type="boolean">true</debug>
<location></location>
<interpreter>shell</interpreter>
<source><![CDATA[
#!/bin/bash
#
# After installation, the logfile from this script can be found in
# /var/adm/autoinstall/logs
#
echo "========================================="
echo "... Starting AutoYAST included script ..."
echo "========================================="
groupadd -g 1000 admin
groupadd -g 2000 sybase
groupadd -g 2010 oracle
groupadd -g 2020 weblogic
groupadd -g 2030 postfix
groupadd -g 2040 vsftpd
useradd -m -g 2000 -u 2000 sybase
useradd -m -g 2010 -u 2010 oracle
useradd -m -g 2020 -u 2020 weblogic
useradd -m -g 2030 -u 2030 postfix
useradd -m -g 2040 -u 2040 vsftpd
for i in $(seq 1 30)
do
echo $[999+$i] $(printf %.2d $i)
useradd -m -g 1000 -u $[999+$i] kook$(printf %.2d $i)
done
]]>
</source>
</script>
</init-scripts>
</scripts>
SuSE Enterprise网络安装(二)--引导initrd的修改
[
|
2008/09/28 08:38]
|
2008/09/28 08:38]
硬件环境:X3755
软件环境:SLES 9 SP3 And SLES 10 SP1
参考文档:
How to create custom initrd for SUSE Linux Enterprise Server 9 and 10 - IBM System x
修改过程非常简单,我不再进行更多描述,只是标注一下注意事项。
Affected configurations
This tip is not machine specific.
This tip is not option specific.
The system is configured with at least one of the following:
SuSE Linux Enterprise Server 10, any Service Pack
SuSE Linux Enterprise Server 10 for AMD64/EM64T, any Service Pack
SuSE Linux Enterprise Server 9, any Service Pack
SuSE Linux Enterprise Server for AMD64/EM64T, any Service Pack
SuSE Linux SLED 10, any Service Pack
SuSE Linux SLED 10 for AMD64/EM64T, any Service Pack
Note: This does not imply that the network operating system will work under all combinations of hardware and software.
Additional information
The following are SLES9/10 custom initrd instructions for the purpose of enabling network installs and an example to update the SLES9 SP3 base initrd with an updated bnx2 driver (1.6.6b).
Getting the network driver for the installation kernel:
Select brcm _dd_nic_bnx2-1.6.6b_sles9_32-64.tgz from the following URL:
Broadcom (bnx2) NetXtreme II driver v1.7.6b for SUSE Linux Enterprise Server 9
Broadcom (bnx2) NetXtreme II driver v1.7.6b for SUSE Linux Enterprise Server 10
Copy brcm _dd_nic_bnx2-1.6.6b_sles9_32-64.tgz to your install server and then from the directory where you copied it, untar it with:
mkdir /tmp/tmp_nic ;
cd /tmp/tmp_nic ;
tar xzf ../brcm_dd_nic_bnx2-1.6.6b_sles9_32-64.tgz
Extract the installer kernel (default) network module:
rpm2cpio sles9/ i386|x86_64 /update/SUSE-SLES/9/rpm/brcm-bnx2-default-1.6.6b_2.6.5_7.244-0. i585|x86_64 .rpm | cpio -id "*bnx2.ko"
Note: The user now has the bnx2.ko module for the installer kernel under:
/tmp/tmp_nic/lib/modules/2.6.5-7.44-default/updates/bnx2.ko
Creating your custom initrd:
Go to the directory where your initrd used during network installs is located (i.e., /tftpboot/SUSE/sles9sp3-32bit/initrd).
Unzip the original initrd : gunzip < initrd > initrd_unzipped.
SLES9: Mount the unzipped initrd image:
mkdir ./initrd_staging ;
mount -o loop ./initrd_unzipped ./initrd_staging
SLES10: Extract the initrd:
mkdir ./initrd_staging ;
cd ./initrd_staging ;
cpio -id < ../initrd_unzipped ;
cd
Copy the updated driver into the loop mounted initrd:
cp /tmp/tmp_nic/lib/modules/2.6.5-7.244-default/updates/bnx2.ko ./initrd_staging/lib/modules/2.6.5-override-default/initrd/
注意:网络安装时引导的内核一定是xxx-default什么的。而不是系统安装完成时的内核。
SLES9: Unmount the initrd:
umount ./initrd_staging ;
rmdir ./initrd_staging
SLES10: Repack the initrd:
cd ./initrd_staging ;
find . | cpio -o --format=newc > ../new_initrd_unzipped
SLES9: Rezip the unzipped initrd:
gzip -9 < ./initrd_unzipped > new_initrd
SLES10: Rezip the unzipped initrd:
cd .. ;
gzip -9 < ./new_initrd_unzipped > new_initrd
Note: The 'new_initrd' file now contains an updated bnx2 driver which can be used to perform a network install for any machine needing the updated version of the bnx2 driver.
软件环境:SLES 9 SP3 And SLES 10 SP1
参考文档:
How to create custom initrd for SUSE Linux Enterprise Server 9 and 10 - IBM System x
修改过程非常简单,我不再进行更多描述,只是标注一下注意事项。
引用
Affected configurations
This tip is not machine specific.
This tip is not option specific.
The system is configured with at least one of the following:
SuSE Linux Enterprise Server 10, any Service Pack
SuSE Linux Enterprise Server 10 for AMD64/EM64T, any Service Pack
SuSE Linux Enterprise Server 9, any Service Pack
SuSE Linux Enterprise Server for AMD64/EM64T, any Service Pack
SuSE Linux SLED 10, any Service Pack
SuSE Linux SLED 10 for AMD64/EM64T, any Service Pack
Note: This does not imply that the network operating system will work under all combinations of hardware and software.
Additional information
The following are SLES9/10 custom initrd instructions for the purpose of enabling network installs and an example to update the SLES9 SP3 base initrd with an updated bnx2 driver (1.6.6b).
Getting the network driver for the installation kernel:
Select brcm _dd_nic_bnx2-1.6.6b_sles9_32-64.tgz from the following URL:
Broadcom (bnx2) NetXtreme II driver v1.7.6b for SUSE Linux Enterprise Server 9
Broadcom (bnx2) NetXtreme II driver v1.7.6b for SUSE Linux Enterprise Server 10
Copy brcm _dd_nic_bnx2-1.6.6b_sles9_32-64.tgz to your install server and then from the directory where you copied it, untar it with:
mkdir /tmp/tmp_nic ;
cd /tmp/tmp_nic ;
tar xzf ../brcm_dd_nic_bnx2-1.6.6b_sles9_32-64.tgz
Extract the installer kernel (default) network module:
rpm2cpio sles9/ i386|x86_64 /update/SUSE-SLES/9/rpm/brcm-bnx2-default-1.6.6b_2.6.5_7.244-0. i585|x86_64 .rpm | cpio -id "*bnx2.ko"
Note: The user now has the bnx2.ko module for the installer kernel under:
/tmp/tmp_nic/lib/modules/2.6.5-7.44-default/updates/bnx2.ko
Creating your custom initrd:
Go to the directory where your initrd used during network installs is located (i.e., /tftpboot/SUSE/sles9sp3-32bit/initrd).
Unzip the original initrd : gunzip < initrd > initrd_unzipped.
SLES9: Mount the unzipped initrd image:
mkdir ./initrd_staging ;
mount -o loop ./initrd_unzipped ./initrd_staging
SLES10: Extract the initrd:
mkdir ./initrd_staging ;
cd ./initrd_staging ;
cpio -id < ../initrd_unzipped ;
cd
Copy the updated driver into the loop mounted initrd:
cp /tmp/tmp_nic/lib/modules/2.6.5-7.244-default/updates/bnx2.ko ./initrd_staging/lib/modules/2.6.5-override-default/initrd/
注意:网络安装时引导的内核一定是xxx-default什么的。而不是系统安装完成时的内核。
SLES9: Unmount the initrd:
umount ./initrd_staging ;
rmdir ./initrd_staging
SLES10: Repack the initrd:
cd ./initrd_staging ;
find . | cpio -o --format=newc > ../new_initrd_unzipped
SLES9: Rezip the unzipped initrd:
gzip -9 < ./initrd_unzipped > new_initrd
SLES10: Rezip the unzipped initrd:
cd .. ;
gzip -9 < ./new_initrd_unzipped > new_initrd
Note: The 'new_initrd' file now contains an updated bnx2 driver which can be used to perform a network install for any machine needing the updated version of the bnx2 driver.
SuSE Enterprise的自动安装(dhcpd,tftpd,PXE)
[
|
2008/09/25 20:18]
|
2008/09/25 20:18]
补充在前面:
我这是给客户做的一个方案,本来这个文档在本地测试完全OK,但是到了客户那里就不好用了。想想为什么?保证你以后可以节省很多时间。那就是-------------------------------硬件结构的不同。最重要的是网卡的支持的问题。这个支持是在启动的initird.img这个初始化镜像结构里面没有包含驱动。
结论:如果想真正实施方案,记住,你需要修改initrd镜像文件。添加相应网卡驱动。这部分,我会另外写一个文档进行说明。
再补充:这次死的真惨,去了三次都没有搞定这么一个简单玩意。这次补充一下原理描述,这样就清楚为什么要那么做。由于是网络安装,所以整个环境下,必须有网卡的支持。也就是说在光盘环境下安装,可以在操作系统完成后再处理网卡,而我们由于启用了网络安装,所以在这个安装全程中,要清楚哪几部分需要网卡的支持。本来以为在那个initrd修改后,就可以了。没有想到SLES,在软件安装完成后,重新启动做基础配置的时候(此时真正系统接管,原来修改initrd,模块仍旧无效了。),还需要链接到服务器的安装源,简直气死我了。这样的话,就需要再次修改。
关于服务器端那部分的原理就不描述了。
客户端安装过程描述:
1:客户端开启网卡的PXE模式,通过服务器端的DHCP获取网卡地址。(这是在网卡硬件底层PXE的ROM实现的,跟系统没有关系。)得到地址后,服务器端指向TFTP的服务器,获取服务器端的pxelinux.0的引导文件,同时读取/tftpboot/pxelinux.cfg/default文件,通过这个定义的菜单,引导进入安装引导系统(这个是微系统)。
2:安装引导系统(通常都在安装光盘的boot里面,提供一个内核和镜像),我们通过添加客户端的网卡模块,以便网络环境的支持。进而进入安装环境。详见:http://www.52zhe.cn/read.php/199.htm
3:(这正是我没有想到的),在2的(引导用的微系统)系统安装完软件后,重新启动,由真正的系统接管,从而继续操作系统的安装,用于配置,这个过程竟然也是需要链接的服务器的。这点真是让人郁闷。我们必须想办法,让在2的过程中添加网卡的正确驱动模块,以应对这个过程的顺利进行。这部分也已经实现。详见:http://www.52zhe.cn/read.php/200.htm
原理相信大家都清楚,有Dhcpd,Tftpd,PXE服务支持,再加上安装源的创建,以httpd,ftpd,nfs其中的一种服务进行支持。就可以实现SuSE的完全无人自动安装。用于多台主机的安装,是一个非常好的方法。再利用auto yast来创建好,安装所需的配置文件。就相当于RedHat的kickstart一样。只不过SUSE的XML文件描述定义太长。看得累得慌,不如RedHat的修改起来方便。
下面详细描述一下具体的操作步骤.
Server:
1:配置dhcpd,tftpd,PXE这样的环境,这其实也是基本原理的逐步处理过程。
2:配置安装源
3:创建autoinst.xml文件
Client:
查看一下效果就可以了。
Sever端的操作:
1:安装所有软件
zypper in dhcp-server atftp
2: 配置dhcp。
kook:~ # cat /etc/dhcpd.conf
option domain-name "skybility.com";
option domain-name-servers 192.168.65.100;
option routers 192.168.65.100;
default-lease-time 14400;
ddns-update-style none;
########### 提供TFTP服务器地址和启动文件#####################
next-server 192.168.65.100;
filename "pxelinux.0";
#############################################################
subnet 192.168.65.0 netmask 255.255.255.0 {
default-lease-time 14400;
max-lease-time 172800;
}
########## 为客户端分配指定IP ###############################
host liujia {
hardware ethernet 00:0C:29:E5:C5:28;
fixed-address 192.168.65.200;
}
#############################################################
修改配置文件/etc/sysconfig/dhcpd里面依赖的端口,设定一下。如:eth0
3:配置TFTP部分。
kook:~ # useradd -s /sbin/nologin tftp
kook:~ # grep -v ^# /etc/sysconfig/atftpd
ATFTPD_OPTIONS="--daemon --user tftp -v"
ATFTPD_USE_INETD="no"
ATFTPD_DIRECTORY="/tftpboot"
ATFTPD_BIND_ADDRESSES=""
4:配置PXE所需,注意目录的配置结构。看看文件都是从哪里来的。
kook:~ # ls -alR /tftpboot/
/tftpboot/:
总计 21
drwxr-xr-x 5 root root 184 2008-09-25 09:59 .
drwxr-xr-x 25 root root 784 2008-09-25 15:24 ..
-rw-r--r-- 1 root root 523 2008-09-25 09:59 message ----from SuSE DVD //source/suse101/boot/i386/loader/message
-rw-r--r-- 1 root root 13148 2008-09-24 22:44 pxelinux.0 ----from /usr/share/syslinux/pxelinux.0
drwxr-xr-x 2 root root 72 2008-09-25 07:16 pxelinux.cfg ----mkdir
drwxr-xr-x 2 root root 96 2008-09-24 22:41 sles10 ----mkdir
drwxr-xr-x 2 root root 96 2008-09-24 23:06 sles9 ----mkdir
/tftpboot/pxelinux.cfg:
总计 4
drwxr-xr-x 2 root root 72 2008-09-25 07:16 .
drwxr-xr-x 5 root root 184 2008-09-25 09:59 ..
-rw-r--r-- 1 root root 870 2008-09-25 07:12 default ----from SuSE DVD //source/suse101/boot/i386/loader/isolinux.cfg
/tftpboot/sles10:
总计 9537
drwxr-xr-x 2 root root 96 2008-09-24 22:41 .
drwxr-xr-x 5 root root 184 2008-09-25 09:59 ..
-r--r--r-- 1 root root 8494631 2008-09-24 22:41 initrd ----from SuSE10 DVD //source/suse101/boot/i386/loader/
-r--r--r-- 1 root root 1258892 2008-09-24 22:41 linux ----from SuSE10 DVD //source/suse101/boot/i386/loader/
/tftpboot/sles9:
总计 7491
drwxr-xr-x 2 root root 96 2008-09-24 23:06 .
drwxr-xr-x 5 root root 184 2008-09-25 09:59 ..
-r--r--r-- 1 root root 6112326 2008-09-24 23:06 initrd ----from SuSE9 DVD //source/suse101/boot/i386/loader/
/tftpboot/config:
总计 36
drwxr-xr-x 2 root root 80 2008-09-25 13:51 .
drwxr-xr-x 6 root root 208 2008-09-25 13:50 ..
-rw-r--r-- 1 root root 33188 2008-09-25 13:51 autoinst.xml ---from command "yast2 autoyast" or edit root/autoinst.xml
############################################ 破烂的分割线 ############################################################
kook:/tftpboot # cat message (这个将是客户端的显示界面)
Welcome to SUSE Linux Enterprise Server 9 SP3 and Server 10 SP1 !!!!
0fTo start the installation enter 'sles10' and press <return>.07
Available boot options:
sles10 - Installation SuSE 10 SP1
sles9 - Installation SuSE 9 SP3
noacpi - Installation - ACPI Disabled
nolapic - Installation - nolapic
failsafe - Installation - Safe Settings
rescue - Rescue System
memtest - Memory Test
'noacpi' or 'failsafe' may be necessary on some tricky hardware.
Have a lot of fun...
############################################ 破烂的分割线 ############################################################
kook:/tftpboot # cat pxelinux.cfg/default
default sles10
display message
# sles10
label sles10
kernel /sles10/linux
append initrd=/sles10/initrd install=nfs://192.168.65.100/source/suse101 splash=silent showopts
# sles9
label sles9
kernel /sles9/linux
append initrd=/sles9/initrd install=nfs://192.168.65.100/source/suse903 splash=silent showopts
# noacpi
label noacpi
kernel linux
append initrd=initrd splash=silent showopts acpi=off
# nolapic
label nolapic
kernel linux
append initrd=initrd splash=silent showopts nolapic
# failsafe
label failsafe
kernel linux
append initrd=initrd splash=silent showopts apm=off acpi=off mce=off barrier=off ide=nodma idewait=50 i8042.nomux psmouse.proto=bare irqpoll pci=nommconf
# rescue
label rescue
kernel linux
append initrd=initrd splash=silent rescue=1 showopts
# memory test
label memtest
kernel memtest
prompt 1
timeout 600
implicit 0
############################################ 破烂的分割线 ############################################################
补充一下关于append里面的一些补充:
autoyast=http://192.168.65.100/install/autoinst.xml
autoyast=tftp://192.168.65.100/config/host-xxx.xml
一些其他的参数如下:
netdevice、hostip、netmask、gateway、nameserver、autoyast、install
vnc、vncpassword、usessh、sshpassword
也许你需要在客户端的
boot: (这里输入上面的相关参数,以让每台主机有单独的配置文件。和一些其他的高级应用。)
从这一点来说。确实没有实现完全自动安装。因为还是需要在客户端运行命令。
在这里给主机一个问题吧: 如何让客户端直接获取属于自己的配置文件从而安装呢?
这样的才是真正意义上的全自动,无人值守的安装。服务器启动后。客户端只要开机,并且网卡是PXE模式,就可以完成所有的安装了。
############################################ 破烂的分割线 ############################################################
5: 配置安装源,安装相应的服务。
kook:/ # ls -al /source/
总计 5
drwxr-xr-x 4 root root 96 2008-09-25 14:05 .
drwxr-xr-x 25 root root 784 2008-09-25 15:24 ..
dr-xr-xr-x 9 root root 4096 2007-05-23 23:56 suse101 ----coyp from SuSE10 DVD //*
drwxr-xr-x 2 root root 48 2008-09-25 14:05 suse903 ----coyp from SuSE9 DVD //*
至于用什么服务,用nfs吧。文件传输效率高一点。喜欢的话,可以把所有的服务都配了。
编辑/etc/exports
ha01:/ # cat /etc/exports
/source/suse101 *(fsid=0,ro,sync,root_squash)
/source/suse903 *(fsid=0,ro,sync,root_squash)
启动服务:
/etc/init.d/nfsserver start
那些基本服务都chkconfig一下。别忘记了。
客户端:
启动后看到如下界面:

在图示的下面输入如下:
boot: sles10 autoyast=tftp://192.168.65.100/config/host-01.xml
这样就可以实现自动安装。但是这不是我认为的理想状态。
我一直认为可以做到,依据这个配置的IP,可以获取到相应的配置文件,进而客户端无需任何动作,既可以完成客户端的安装。
目前已经可以了,但是没有为每台主机创建一个独立的配置文件,现在用了一个通用的配置文件了。
后记:
虽然使用了通用的配置文件,但是可以通过autoyast来执行定制脚本来实现不同主机的定义。包括主机名,ip设定等等定制动作。
我这是给客户做的一个方案,本来这个文档在本地测试完全OK,但是到了客户那里就不好用了。想想为什么?保证你以后可以节省很多时间。那就是-------------------------------硬件结构的不同。最重要的是网卡的支持的问题。这个支持是在启动的initird.img这个初始化镜像结构里面没有包含驱动。
结论:如果想真正实施方案,记住,你需要修改initrd镜像文件。添加相应网卡驱动。这部分,我会另外写一个文档进行说明。
再补充:这次死的真惨,去了三次都没有搞定这么一个简单玩意。这次补充一下原理描述,这样就清楚为什么要那么做。由于是网络安装,所以整个环境下,必须有网卡的支持。也就是说在光盘环境下安装,可以在操作系统完成后再处理网卡,而我们由于启用了网络安装,所以在这个安装全程中,要清楚哪几部分需要网卡的支持。本来以为在那个initrd修改后,就可以了。没有想到SLES,在软件安装完成后,重新启动做基础配置的时候(此时真正系统接管,原来修改initrd,模块仍旧无效了。),还需要链接到服务器的安装源,简直气死我了。这样的话,就需要再次修改。
关于服务器端那部分的原理就不描述了。
客户端安装过程描述:
1:客户端开启网卡的PXE模式,通过服务器端的DHCP获取网卡地址。(这是在网卡硬件底层PXE的ROM实现的,跟系统没有关系。)得到地址后,服务器端指向TFTP的服务器,获取服务器端的pxelinux.0的引导文件,同时读取/tftpboot/pxelinux.cfg/default文件,通过这个定义的菜单,引导进入安装引导系统(这个是微系统)。
2:安装引导系统(通常都在安装光盘的boot里面,提供一个内核和镜像),我们通过添加客户端的网卡模块,以便网络环境的支持。进而进入安装环境。详见:http://www.52zhe.cn/read.php/199.htm
3:(这正是我没有想到的),在2的(引导用的微系统)系统安装完软件后,重新启动,由真正的系统接管,从而继续操作系统的安装,用于配置,这个过程竟然也是需要链接的服务器的。这点真是让人郁闷。我们必须想办法,让在2的过程中添加网卡的正确驱动模块,以应对这个过程的顺利进行。这部分也已经实现。详见:http://www.52zhe.cn/read.php/200.htm
原理相信大家都清楚,有Dhcpd,Tftpd,PXE服务支持,再加上安装源的创建,以httpd,ftpd,nfs其中的一种服务进行支持。就可以实现SuSE的完全无人自动安装。用于多台主机的安装,是一个非常好的方法。再利用auto yast来创建好,安装所需的配置文件。就相当于RedHat的kickstart一样。只不过SUSE的XML文件描述定义太长。看得累得慌,不如RedHat的修改起来方便。
下面详细描述一下具体的操作步骤.
Server:
1:配置dhcpd,tftpd,PXE这样的环境,这其实也是基本原理的逐步处理过程。
2:配置安装源
3:创建autoinst.xml文件
Client:
查看一下效果就可以了。
Sever端的操作:
1:安装所有软件
zypper in dhcp-server atftp
2: 配置dhcp。
kook:~ # cat /etc/dhcpd.conf
option domain-name "skybility.com";
option domain-name-servers 192.168.65.100;
option routers 192.168.65.100;
default-lease-time 14400;
ddns-update-style none;
########### 提供TFTP服务器地址和启动文件#####################
next-server 192.168.65.100;
filename "pxelinux.0";
#############################################################
subnet 192.168.65.0 netmask 255.255.255.0 {
default-lease-time 14400;
max-lease-time 172800;
}
########## 为客户端分配指定IP ###############################
host liujia {
hardware ethernet 00:0C:29:E5:C5:28;
fixed-address 192.168.65.200;
}
#############################################################
修改配置文件/etc/sysconfig/dhcpd里面依赖的端口,设定一下。如:eth0
3:配置TFTP部分。
kook:~ # useradd -s /sbin/nologin tftp
kook:~ # grep -v ^# /etc/sysconfig/atftpd
ATFTPD_OPTIONS="--daemon --user tftp -v"
ATFTPD_USE_INETD="no"
ATFTPD_DIRECTORY="/tftpboot"
ATFTPD_BIND_ADDRESSES=""
4:配置PXE所需,注意目录的配置结构。看看文件都是从哪里来的。
kook:~ # ls -alR /tftpboot/
/tftpboot/:
总计 21
drwxr-xr-x 5 root root 184 2008-09-25 09:59 .
drwxr-xr-x 25 root root 784 2008-09-25 15:24 ..
-rw-r--r-- 1 root root 523 2008-09-25 09:59 message ----from SuSE DVD //source/suse101/boot/i386/loader/message
-rw-r--r-- 1 root root 13148 2008-09-24 22:44 pxelinux.0 ----from /usr/share/syslinux/pxelinux.0
drwxr-xr-x 2 root root 72 2008-09-25 07:16 pxelinux.cfg ----mkdir
drwxr-xr-x 2 root root 96 2008-09-24 22:41 sles10 ----mkdir
drwxr-xr-x 2 root root 96 2008-09-24 23:06 sles9 ----mkdir
/tftpboot/pxelinux.cfg:
总计 4
drwxr-xr-x 2 root root 72 2008-09-25 07:16 .
drwxr-xr-x 5 root root 184 2008-09-25 09:59 ..
-rw-r--r-- 1 root root 870 2008-09-25 07:12 default ----from SuSE DVD //source/suse101/boot/i386/loader/isolinux.cfg
/tftpboot/sles10:
总计 9537
drwxr-xr-x 2 root root 96 2008-09-24 22:41 .
drwxr-xr-x 5 root root 184 2008-09-25 09:59 ..
-r--r--r-- 1 root root 8494631 2008-09-24 22:41 initrd ----from SuSE10 DVD //source/suse101/boot/i386/loader/
-r--r--r-- 1 root root 1258892 2008-09-24 22:41 linux ----from SuSE10 DVD //source/suse101/boot/i386/loader/
/tftpboot/sles9:
总计 7491
drwxr-xr-x 2 root root 96 2008-09-24 23:06 .
drwxr-xr-x 5 root root 184 2008-09-25 09:59 ..
-r--r--r-- 1 root root 6112326 2008-09-24 23:06 initrd ----from SuSE9 DVD //source/suse101/boot/i386/loader/
/tftpboot/config:
总计 36
drwxr-xr-x 2 root root 80 2008-09-25 13:51 .
drwxr-xr-x 6 root root 208 2008-09-25 13:50 ..
-rw-r--r-- 1 root root 33188 2008-09-25 13:51 autoinst.xml ---from command "yast2 autoyast" or edit root/autoinst.xml
############################################ 破烂的分割线 ############################################################
kook:/tftpboot # cat message (这个将是客户端的显示界面)
Welcome to SUSE Linux Enterprise Server 9 SP3 and Server 10 SP1 !!!!
0fTo start the installation enter 'sles10' and press <return>.07
Available boot options:
sles10 - Installation SuSE 10 SP1
sles9 - Installation SuSE 9 SP3
noacpi - Installation - ACPI Disabled
nolapic - Installation - nolapic
failsafe - Installation - Safe Settings
rescue - Rescue System
memtest - Memory Test
'noacpi' or 'failsafe' may be necessary on some tricky hardware.
Have a lot of fun...
############################################ 破烂的分割线 ############################################################
kook:/tftpboot # cat pxelinux.cfg/default
default sles10
display message
# sles10
label sles10
kernel /sles10/linux
append initrd=/sles10/initrd install=nfs://192.168.65.100/source/suse101 splash=silent showopts
# sles9
label sles9
kernel /sles9/linux
append initrd=/sles9/initrd install=nfs://192.168.65.100/source/suse903 splash=silent showopts
# noacpi
label noacpi
kernel linux
append initrd=initrd splash=silent showopts acpi=off
# nolapic
label nolapic
kernel linux
append initrd=initrd splash=silent showopts nolapic
# failsafe
label failsafe
kernel linux
append initrd=initrd splash=silent showopts apm=off acpi=off mce=off barrier=off ide=nodma idewait=50 i8042.nomux psmouse.proto=bare irqpoll pci=nommconf
# rescue
label rescue
kernel linux
append initrd=initrd splash=silent rescue=1 showopts
# memory test
label memtest
kernel memtest
prompt 1
timeout 600
implicit 0
############################################ 破烂的分割线 ############################################################
补充一下关于append里面的一些补充:
autoyast=http://192.168.65.100/install/autoinst.xml
autoyast=tftp://192.168.65.100/config/host-xxx.xml
一些其他的参数如下:
netdevice、hostip、netmask、gateway、nameserver、autoyast、install
vnc、vncpassword、usessh、sshpassword
也许你需要在客户端的
boot: (这里输入上面的相关参数,以让每台主机有单独的配置文件。和一些其他的高级应用。)
从这一点来说。确实没有实现完全自动安装。因为还是需要在客户端运行命令。
在这里给主机一个问题吧: 如何让客户端直接获取属于自己的配置文件从而安装呢?
这样的才是真正意义上的全自动,无人值守的安装。服务器启动后。客户端只要开机,并且网卡是PXE模式,就可以完成所有的安装了。
############################################ 破烂的分割线 ############################################################
5: 配置安装源,安装相应的服务。
kook:/ # ls -al /source/
总计 5
drwxr-xr-x 4 root root 96 2008-09-25 14:05 .
drwxr-xr-x 25 root root 784 2008-09-25 15:24 ..
dr-xr-xr-x 9 root root 4096 2007-05-23 23:56 suse101 ----coyp from SuSE10 DVD //*
drwxr-xr-x 2 root root 48 2008-09-25 14:05 suse903 ----coyp from SuSE9 DVD //*
至于用什么服务,用nfs吧。文件传输效率高一点。喜欢的话,可以把所有的服务都配了。
编辑/etc/exports
ha01:/ # cat /etc/exports
/source/suse101 *(fsid=0,ro,sync,root_squash)
/source/suse903 *(fsid=0,ro,sync,root_squash)
启动服务:
/etc/init.d/nfsserver start
那些基本服务都chkconfig一下。别忘记了。
客户端:
启动后看到如下界面:

在图示的下面输入如下:
boot: sles10 autoyast=tftp://192.168.65.100/config/host-01.xml
这样就可以实现自动安装。但是这不是我认为的理想状态。
我一直认为可以做到,依据这个配置的IP,可以获取到相应的配置文件,进而客户端无需任何动作,既可以完成客户端的安装。
目前已经可以了,但是没有为每台主机创建一个独立的配置文件,现在用了一个通用的配置文件了。
后记:
虽然使用了通用的配置文件,但是可以通过autoyast来执行定制脚本来实现不同主机的定义。包括主机名,ip设定等等定制动作。
IBM X系列主板更换,SuSE 10无法启动。
[
|
2008/09/25 20:11]
|
2008/09/25 20:11]
客户的机器,系统无法启动。主机环境X3755,硬盘做的RAID 5,客户说是无法启动。
于是过去一趟,发现grub正常,这证明主板更换后,数据没有问题。RAID都是正常的。
在加载分区的时候就死掉了。重新看了一下grub菜单。发现如下:
/dev/disk/by-id/scsi-SServeRA_Driver_1_005C020200-part1
这样的字样。于是便明白了。grub.conf和fstab都是系统安装时创建的问题。
而设备识别是通过ID设备名的方式,而服务器更换主板后这个文件发生变化。
后经挂载(我当时手上恰好有个ubuntu 8.04 desktop版本)后,发现产生的设备名为
/dev/disk/by-id/scsi-SServeRA_Drvier_1_5054020200-part1
进入系统后发现这个名字链接到../../sda1,也就是/dev/sda1
相信你也知道如何处理了。通过rescue模式,进行menu.lst和fstab这两个文件的修改。
再开机启动,一切正常。
回想一下这个标准错误,就觉得好笑。竟然真的碰到,佩服啊!
于是过去一趟,发现grub正常,这证明主板更换后,数据没有问题。RAID都是正常的。
在加载分区的时候就死掉了。重新看了一下grub菜单。发现如下:
/dev/disk/by-id/scsi-SServeRA_Driver_1_005C020200-part1
这样的字样。于是便明白了。grub.conf和fstab都是系统安装时创建的问题。
而设备识别是通过ID设备名的方式,而服务器更换主板后这个文件发生变化。
后经挂载(我当时手上恰好有个ubuntu 8.04 desktop版本)后,发现产生的设备名为
/dev/disk/by-id/scsi-SServeRA_Drvier_1_5054020200-part1
进入系统后发现这个名字链接到../../sda1,也就是/dev/sda1
相信你也知道如何处理了。通过rescue模式,进行menu.lst和fstab这两个文件的修改。
再开机启动,一切正常。
回想一下这个标准错误,就觉得好笑。竟然真的碰到,佩服啊!





