• 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.

  • Did you find what you needed?
    Show your support and gratitude by making a contribution!!
    Life always offers you a second chance ... Its called tomorrow !!!

    Sunday, May 21, 2017

    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"
    %end

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


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

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

    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/
    %end

    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.

    Follow the below links for more tutorials

    How to find the path of any command in Linux
    How to configure a Clustered Samba share using ctdb in Red Hat Cluster
    How to delete an iscsi-target from openfiler and Linux
    How to perform a local ssh port forwarding in Linux
    How to use yum locally without internet connection using cache?
    What is umask and how to change the default value permanently?
    Understanding Partition Scheme MBR vs GPT
    How does a successful or failed login process works in Linux
    How to find all the process accessing a file in Linux
    How to exclude multiple directories from du command in Linux
    How to configure autofs in Linux and what are its advantages?
    How to resize software raid partition in Linux
    How to configure Software RAID 1 mirroring in Linux
    How to prevent a command from getting stored in history in Linux

    0 comments:

    Post a Comment