• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • How to save %pre installation log file after installation in Red Hat 7

    We intend to write multiple scripts in the %pre and %post section of the kickstart files as per our requirement but since these scripts are executed in the background it is very important that we perform proper logging of individual section so that once the node is successfully installed those logs can be validated to make sure all the scripts were successfully executed and to debug further in case of failure.

    How to enable logging of %pre and %post scripts in kickstart?

    Below syntax can be used to enable the logging of individual %pre and %post section in a kickstart file
    %pre --log=/var/log/kickstart_pre1.log
    echo "Hello World"
    echo "This is first pre-installation script"

    %pre --log=/var/log/kickstart_pre2.log
    echo "Hello World"
    echo "This is second pre-installation script"

    %post --log=/var/log/kickstart_post1.log
    echo "Hello World"
    echo "This is first post-installation script"

    %post --log=/var/log/kickstart_post1.log
    echo "Hello World"
    echo "This is second post-installation script"

    How to store %pre section logs to be accessible after complete Red Hat Installation?

    Now this is the tricky part as all the logs stores for %post section would be accessible after a node is successfully installed but we have to take some extra steps to save the %pre script log files

    Since %post section is by default executed in chroot environment write an additional %post script as below to save both your %pre log files we used above

    %post --log=/var/log/kickstart_post_3.log --nochroot
    echo "Copying %pre installation script log files
    /bin/cp -rvf /var/log/kickstart_pre*.log /mnt/sysimage/var/log/

    So once your node is successfully installed check "/var/log" for your both the kickstart_pre*.log files and the %post section log files

    I hope the article was helpful.

    Deepak Prasad

    is a techie and an author who is still trying to survive in this IT generation with very little knowledge he has on Linux/Unix, VMware, SAN Storage, Automation, networking etc

    You can follow him on Facebook or Google+

    Do you also have something to share here?
    Join GoLinuxHub Team as an Author, Click here for more information
    How to save %pre installation log file after installation in Red Hat 7 How to save %pre installation log file after installation in Red Hat 7 Reviewed by Deepak Prasad on Friday, September 08, 2017 Rating: 5

    No comments:

    Powered by Blogger.