LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 04-12-2010, 05:10 AM   #1
xiutuo
Member
 
Registered: Mar 2008
Posts: 52

Rep: Reputation: 15
centos kickstart problem


when i use kickstart to install centos from cdrom (i make it myself in my way),i got a %post script problem with the kickstart file.
1.%post script used to copy my own software from cdrom to hard disk.
then make install automaitlly with bash script.

the %post script like :
%post
mkdir -p /myownsoftware
cp -r /mnt/myownsoftware/* /myownsoftware
cd /myownsoftware
……
after installtion.i check /myownsoftware dir there is nothing!
my question is:
when install from cdrom .where is the mount point of the cdrom?
is it /mnt/ or /media or some dir else?

thx your for your reply

Last edited by xiutuo; 04-12-2010 at 05:12 AM.
 
Old 04-12-2010, 06:33 AM   #2
bakdong
Member
 
Registered: Apr 2009
Posts: 214

Rep: Reputation: 44
I've not tested this, but I suspect /mnt/source
 
Old 04-12-2010, 09:55 PM   #3
xiutuo
Member
 
Registered: Mar 2008
Posts: 52

Original Poster
Rep: Reputation: 15
thx , I will try ,waiting for my message..


I have been test it.
it looks like after installtion,cdrom is already umounted.
%post
mkdir -p /custom_software
cp /mnt/source/myownsoftware /custom_software
……
copy nothing...confuse.....

Last edited by xiutuo; 04-12-2010 at 10:26 PM.
 
Old 04-13-2010, 03:07 AM   #4
bakdong
Member
 
Registered: Apr 2009
Posts: 214

Rep: Reputation: 44
It seems that the disk is being unmounted before the %post command section is started.

I found this by Googling:

Code:
%post --nochroot

mkdir -p /mnt/cdrom
mount -t iso9660 /tmp/cdrom /mnt/cdrom

mkdir /mnt/sysimage/boot/INSTALL
cp -a /mnt/cdrom/isolinux/* /mnt/sysimage/boot/INSTALL
cp -a /mnt/cdrom/custom/ks-reinstall.cfg /mnt/sysimage/boot/INSTALL/ks-reinstall.cfg
cp -a /mnt/cdrom/custom/install.pl /mnt/sysimage/boot/INSTALL/install.pl
So the install mounts the installed root system at /mnt/sysimage and then chroots to it for the %post section.

You may be able to mount the cd/dvd in the chroot and access it from there:

Code:
%post

mkdir -p /mnt/cdrom
mount -t iso9660 /tmp/cdrom /mnt/cdrom
but then again, I don't think so.


Have another look at the kickstart manual, perhaps?
 
Old 04-13-2010, 11:43 PM   #5
xiutuo
Member
 
Registered: Mar 2008
Posts: 52

Original Poster
Rep: Reputation: 15
mycentos iso dir

+ Centos
--* system rpms
+ custom_rpms
--* all my own softwares
+


------------

#%pre
%post
mkdir -p /custom_rpms /mnt/cdrom
mount -t iso9660 /tmp/cdrom /mnt/cdrom
cp -a /mnt/cdrom/custom_software/* /custom_rpms/
-------------
don't work either...
confuse..............
 
Old 04-13-2010, 11:59 PM   #6
bakdong
Member
 
Registered: Apr 2009
Posts: 214

Rep: Reputation: 44
Ok. When the kickstart instal gets to the ordinary %post commands it drops the session into a changed root environment, so all you see is the new installation as / (as you would when working normally)

If you have a separate section '%post --nochroot' it doesn't do that and you get to view the real situation (which has the installation at /mnt/sysimage/

So, what I think will work for you is this:

Code:
%post --nochroot
mkdir -p /mnt/sysimage/custom_rpms /mnt/cdrom
mount -t iso9660 /tmp/cdrom /mnt/cdrom
cp -r /mnt/cdrom/custom_software /mnt/sysimage/custom_rpms
 
Old 04-14-2010, 02:57 AM   #7
xiutuo
Member
 
Registered: Mar 2008
Posts: 52

Original Poster
Rep: Reputation: 15
I found the document file for newest version 5.4 at redhat.com
https://www.redhat.com/docs/en-US/Re...allconfig.html

-------------
Note
The pre-installation script section of kickstart cannot manage multiple install trees or source media. This information must be included for each created ks.cfg file, as the pre-installation script occurs during the second stage of the installation process.
Note
If you configured the network with static IP information, including a nameserver, you can access the network and resolve IP addresses in the %post section. If you configured the network for DHCP, the /etc/resolv.conf file has not been completed when the installation executes the %post section. You can access the network, but you can not resolve IP addresses. Thus, if you are using DHCP, you must specify IP addresses in the %post section.
Note
The post-install script is run in a chroot environment; therefore, performing tasks such as copying scripts or RPMs from the installation media do not work.



and very userful url,tell u about the media cdrom mount point or location during installation:
http://256.com/gray/docs/rh_boot/

Anaconda umount's the cdrom that is on /tmp/cdrom
so
mkdir -p /mnt/source
mount -t iso9660 /tmp/cdrom /mnt/source
make the ks.cfg work in %post --nochroot

the solution: if u want to copy file from media cdrom,you have to choose nochroot environment!!!!

%post --noroot
%post --nochroot
mkdir -p /mnt/cdrom
mount -t iso9660 /tmp/cdrom /mnt/cdrom
#mkdir -p /mnt/sysimage/boot/INSTALL
mkdir -p /mnt/sysimage/soft
cp -a /mnt/cdrom/custom_software/epel-release-5-3.noarch.rpm /mnt/sysimage/soft/epel-release-5-3.noarch.rpm
cp -a /mnt/cdrom/custom_software/nginx-0.8.20.tar.gz /mnt/sysimage/soft/nginx-0.8.20.tar.gz
#--and auto install shell---
tar -zxvf /mnt/sysimage/nginx-0.8.20.tar.gz
cd /mnt/sysimage/soft/nginx-0.82
configure --prefix=/mnt/sysimage/
make
make install
rpm --root /mnt/sysimage/ -ivh /mnt/sysimage/soft/epel-release-5-3.noarch.rpm
----

it works ,,but rpm --root comand got error(only if it has depes other software...),because chroot enviroment...

Last edited by xiutuo; 04-14-2010 at 02:58 AM.
 
Old 04-14-2010, 03:57 AM   #8
bakdong
Member
 
Registered: Apr 2009
Posts: 214

Rep: Reputation: 44
You didn't say you were installing custom RPMs! Can't you just add them as packages in a new group? That would be much cleaner than trying to fiddle with the %post script:

http://linuxdevcenter.com/pub/a/linu...owcontent=text
 
Old 04-14-2010, 11:05 PM   #9
xiutuo
Member
 
Registered: Mar 2008
Posts: 52

Original Poster
Rep: Reputation: 15
thx very much,,

i will test it...
 
Old 04-14-2010, 11:59 PM   #10
bakdong
Member
 
Registered: Apr 2009
Posts: 214

Rep: Reputation: 44
An alternative, if available, would be to mount a volume containing the rpms from somewhere else, an NFS share or http or FTP perhaps, and use them from there in the %post script.
 
Old 05-12-2010, 02:07 AM   #11
xiutuo
Member
 
Registered: Mar 2008
Posts: 52

Original Poster
Rep: Reputation: 15
custom install rpm.
1.create the comps.xml file
comps.xml format :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE newcomps PUBLIC "-//CentOS//DTD Comps info//EN" "comps.dtd">
<comps>
<group>
<id>myownrpms</id>
<name>myownrpms</name>
<name xml:lang="en_GB">myownrpms</name>
<name xml:lang="zh_CN">自定义rpm软件包</name>
<description>my own rpms</description>
<description xml:lang="en_GB">myownrpms</description>
<description xml:lang="zh_CN">myownrpms</description>
<default>false</default>
<uservisible>true</uservisible>
<packagelist>
<packagereq type="default">first rpm</packagereq>

<packagereq type="default">last rpm</packagereq>
</packagelist>
</group>
<category>
<id>myownrpms</id>
<name>myownrpms</name>
<name xml:lang="en_GB">my own rpms</name>
<name xml:lang="zh_CN">自定义软件rpm包</name>
<description>my own rpms</description>
<description xml:lang="en_GB">myownrpms</description>
<description xml:lang="zh_CN">myownrpms</description>
<display_order>96</display_order>
<grouplist>
<groupid>myownrpms</groupid>
</grouplist>
</category>

2.create the yum repodata with createrepo command,before do it,you should use rpm --test --dbpath to deal with the dependency between rpms

3.install myown rpms in ks.cf
%packages
@myownrpms

4.creat os iso file with mkisofs command

5.kickstart install use cdrom


----------------have fun...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can't kickstart CentOs on VirtualBox VM geek.ksa Linux - Virtualization and Cloud 3 08-29-2010 10:35 AM
CentOS/Redhat kickstart packages cdestiny Linux - Server 4 12-02-2008 05:46 AM
Minimal centos via kickstart not working abcdefg Red Hat 5 11-01-2008 01:11 PM
Kickstart installation problems with CentOS 5.2 triley Linux - General 3 10-21-2008 01:37 PM
CentOS kickstart installation with nodefaults shubb Linux - Distributions 3 10-13-2008 02:13 PM


All times are GMT -5. The time now is 08:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration