Hello, I'm trying to do an unattended CentOS 5.3 install. For the most part it's working. As of right now i'm statically assigning the machine an IP which i believe will allow %post to resolve names? I also like knowing where the box will show up. I am however having a few issues and I'm probably thinking to complicated on them. My first one is the fact that updates aren't working from %post. Under the assumption name resolution is working, see above with the static configuration, the issue is then most likely importing of gpg keys. I've got these lines in %post: # GPG keys echo "Importing GPG keys ..." rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY* /usr/bin/yum -y update When they're uncommented the box hangs, i'd love to see output. My second issue is a cosmetic one. I want to set a standard prompt in /etc/bashrc. Out of the box the bashrc PS1 lines: if [ "$PS1" ]; then [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " I have to make changes to that second line so a sed substitution would probably be my best bet. I'm not sure how to grab the part i need and change it. Manually i change that line to: PS1='\u@\h:\w\$' I'd like to get %post to do that for me. Next, i'd like to alter /boot/grub/grub.conf. I want to set it up for serial terminal support, so i have to add a serial and terminal lines at the top of the file say after any comment blocks that might or might not be there plus add console=tty0 and/or console=ttyS0,9600n8 to the append lines to however many kernels are there. Again, i'm assuming sed but i'm not sure how to get the parts i need and edit. I want to do other things, mostly with security, increasing password complexity requirements and pam, but that should be easy once i figure out how to alter the right sections in files. Any help appreciated. Thanks. Dave.
On Wed, 2009-10-14 at 22:17 -0400, David Mehler wrote:> Hello, > I'm trying to do an unattended CentOS 5.3 install. For the most part > it's working. As of right now i'm statically assigning the machine an > IP which i believe will allow %post to resolve names? I also like > knowing where the box will show up. > I am however having a few issues and I'm probably thinking to > complicated on them. My first one is the fact that updates aren't > working from %post. Under the assumption name resolution is working, > see above with the static configuration, the issue is then most likely > importing of gpg keys. I've got these lines in %post: > > # GPG keys > echo "Importing GPG keys ..." > rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY* > /usr/bin/yum -y update > > When they're uncommented the box hangs, i'd love to see output.---- I would expect to see that in the error out console <Control><Alt><F4> (I think...maybe F3, or F5, I always forget). Generally, I will log everything that happens anyway so I would add to each of the 'custom lines something like '>> post-install.log 2&>1' instead ----> My second issue is a cosmetic one. I want to set a standard prompt in > /etc/bashrc. Out of the box the bashrc PS1 lines: > > if [ "$PS1" ]; then > [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " > > I have to make changes to that second line so a sed substitution > would probably be my best bet. I'm not sure how to grab the part i > need and change it. Manually i change that line to: > > PS1='\u@\h:\w\$'---- I find it's easier to just replace the whole file for this though you couuld use sed, I would probably just grab a copy of bashrc from an available web server and wget it it into place. ----> I'd like to get %post to do that for me. > Next, i'd like to alter /boot/grub/grub.conf. I want to set it up for > serial terminal support, so i have to add a serial and terminal lines > at the top of the file say after any comment blocks that might or > might not be there plus add console=tty0 and/or console=ttyS0,9600n8 > to the append lines to however many kernels are there. Again, i'm > assuming sed but i'm not sure how to get the parts i need and edit. > I want to do other things, mostly with security, increasing password > complexity requirements and pam, but that should be easy once i figure > out how to alter the right sections in files. Any help appreciated.---- sounds like you're too lazy to try sed to actually give us anything useful in terms of why it's not working. Google has millions of sed examples. Craig -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Am Donnerstag, den 15.10.2009, 04:17 +0200 schrieb David Mehler:> Hello, > I'm trying to do an unattended CentOS 5.3 install. For the most part > it's working. As of right now i'm statically assigning the machine an > IP which i believe will allow %post to resolve names? I also like > knowing where the box will show up. > I am however having a few issues and I'm probably thinking to > complicated on them. My first one is the fact that updates aren't > working from %post. Under the assumption name resolution is working, > see above with the static configuration, the issue is then most likely > importing of gpg keys. I've got these lines in %post: > > # GPG keys > echo "Importing GPG keys ..." > rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*Wich keys are that? You don't need that for the standard repos.> /usr/bin/yum -y updateThe yum is obsolete use the repo kickstart feature instead.> When they're uncommented the box hangs, i'd love to see output.Change to vt3, manually by using Alt+F3, automatic by using "chvt 3" as first line in %post> My second issue is a cosmetic one. I want to set a standard prompt in > /etc/bashrc. Out of the box the bashrc PS1 lines: > > if [ "$PS1" ]; then > [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " > > I have to make changes to that second line so a sed substitution > would probably be my best bet. I'm not sure how to grab the part i > need and change it. Manually i change that line to: > > PS1='\u@\h:\w\$' > > I'd like to get %post to do that for me.Well sed is a choice or patch or maybe replace the file all together.> Next, i'd like to alter /boot/grub/grub.conf. I want to set it up for > serial terminal support, so i have to add a serial and terminal lines > at the top of the file say after any comment blocks that might or > might not be there plus add console=tty0 and/or console=ttyS0,9600n8 > to the append lines to however many kernels are there. Again, i'm > assuming sed but i'm not sure how to get the parts i need and edit.If you use the serial console already at installation everything will be done for you. Appends will be automatically set and dealt with on kernel updates.> I want to do other things, mostly with security, increasing password > complexity requirements and pam, but that should be easy once i figure > out how to alter the right sections in files. Any help appreciated. > Thanks. > Dave. > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centosfinancial.com AG Munich head office/Hauptsitz M?nchen: Maria-Probst-Str. 19 | 80939 M?nchen | Germany Frankfurt branch office/Niederlassung Frankfurt: Messeturm | Friedrich-Ebert-Anlage 49 | 60327 Frankfurt | Germany Management board/Vorstand: Dr. Steffen Boehnert | Dr. Alexis Eisenhofer | Dr. Yann Samson | Matthias Wiederwach Supervisory board/Aufsichtsrat: Dr. Dr. Ernst zur Linden (chairman/Vorsitzender) Register court/Handelsregister: Munich ? HRB 128 972 | Sales tax ID number/St.Nr.: DE205 370 553
On 10/15/2009 04:17 AM, David Mehler wrote:> Hello, > I'm trying to do an unattended CentOS 5.3 install. For the most part > it's working. As of right now i'm statically assigning the machine an > IP which i believe will allow %post to resolve names? I also like > knowing where the box will show up.Start by enable logging of your %post section: %post --log /mnt/sysimage/root/post-install.log You can test if network is working by removing the yum update and add a: /usr/bin/nslookup www.someaddressthatshouldwork.com to your %post section and check the /root/post-install.log after installation. I use network commands during my %post section (NFS mounts to a named server) and it works. However, as others have pointed out, don't do "yum update", it is much faster to add the updates repo at the beginning, then you don't have to install the packages that have updates twice. I use: url --url http://ftp.crc.dk/centos/5/os/i386 repo --name=base --baseurl=http://ftp.crc.dk/centos/5/os/i386 repo --name=updates --baseurl=http://ftp.crc.dk/centos/5/updates/i386 Replace ftp.crc.dk with your favourite mirror. Mogens -- Mogens Kjaer, Carlsberg A/S, Computer Department Gamle Carlsberg Vej 10, DK-2500 Valby, Denmark Phone: +45 33 27 53 25, Mobile: +45 22 12 53 25 Email: mk at crc.dk Homepage: http://www.crc.dk