{"id":6491,"date":"2017-02-21T11:24:28","date_gmt":"2017-02-21T03:24:28","guid":{"rendered":"http:\/\/rmohan.com\/?p=6491"},"modified":"2017-02-21T11:24:28","modified_gmt":"2017-02-21T03:24:28","slug":"kickstart-centos-7-making-iso-for-automated-installation","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6491","title":{"rendered":"Kickstart CentOS 7: Making ISO for automated installation"},"content":{"rendered":"<p>Kickstart\u201d is powerful tool for automated OS installation and configuration available in CentOS or RHEL. You can install CentOS without touching keyboard or mouse and even can automate post installation configuration process.<\/p>\n<p>I\u2019m recently building a Hadoop cluster for R&amp;D, which makes me repeatedly install and re-install CentOS on several virtual machines. This is boring task takes hours. So I googled for automation and the answer was the Kickstart.<\/p>\n<p>Basically a Kickstart is configuration file. CentOS load it at the beginning of installation process and apply it.<\/p>\n<p>There are some ways to load the configuration file, through network, file system, or include installation ISO. I took the ISO way.<\/p>\n<p>There is already good detail article about making kickstart-able ISO: <a href=\"http:\/\/smorgasbork.com\/component\/content\/article\/35-linux\/151-building-a-custom-centos-7-kickstart-disc-part-1\">\u201cBuilding a custom CentOS 7 kickstart disc, part 1\u201d<\/a>, I followed this article with some modified steps.<\/p>\n<h2>Prepare directory and copy files from CentOS installation disk<\/h2>\n<pre>$ mkdir ks_build\r\n$ mkdir ks_build\/isolinux\r\n$ mkdir ks_build\/isolinux\/images\r\n$ mkdir ks_build\/isolinux\/ks\r\n$ mkdir ks_build\/isolinux\/LiveOS\r\n$ mkdir ks_build\/isolinux\/Packages\r\n$ mkdir ks_build\/utils\r\n$ cp \/media\/cdrom\/CentOS7x86_64\/isolinux\/* ks_build\/isolinux\/\r\n$ cp -R \/media\/cdrom\/CentOS7x86_64\/images\/* ks_build\/isolinux\/images\/\r\n$ cp \/media\/cdrom\/CentOS7x86_64\/LiveOS\/* ks_build\/isolinux\/LiveOS\/\r\n$ cp -p \/media\/cdrom\/CentOS7x86_64\/Packages\/* ks_build\/isolinux\/Packages\/\r\n$ cp \/media\/cdrom\/CentOS7x86_64\/repodata\/0e6e90965f55146ba5025ea450f822d1bb0267d0299ef64dd4365825e6bad995-c7-x86_64-comps.xml.gz ks_build\/comps.xml.gz\r\n$ gunzip ks_build\/comps.xml.gz\r\n<\/pre>\n<h2>Create kickstart configuration file<\/h2>\n<p>I created two files. One for Hadoop master nodes and the other for slave nodes. The only difference is disk partition settings. I will only paste configuration for master nodes.<\/p>\n<p>Meaning of each options are described in <a href=\"https:\/\/access.redhat.com\/documentation\/en-US\/Red_Hat_Enterprise_Linux\/7\/html\/Installation_Guide\/sect-kickstart-syntax.html\">23.3. Kickstart Syntax Reference<\/a>, a Red Hat document. There is also an GUI tool named \u201csystem-config-kickstart\u201d for editing a configuration file.<\/p>\n<pre>$ vi ks_master.cfg\r\n<\/pre>\n<pre>#platform=x86, AMD64, or Intel EM64T\r\n#version=DEVEL\r\n\r\n# Install OS instead of upgrade\r\ninstall\r\n# Use CDROM installation media\r\ncdrom\r\n# System authorization information\r\nauth  --enableshadow  --passalgo=sha512\r\n# Run the Setup Agent on first boot\r\nfirstboot --enable\r\nignoredisk --only-use=vda\r\n# Keyboard layouts\r\nkeyboard --vckeymap=jp106 --xlayouts='jp','us'\r\n# System language\r\nlang en_US.UTF-8\r\n# Reboot after installation\r\nreboot\r\n# Root password\r\nrootpw  --iscrypted $6$P3w8ID5.Zn3KObRb$eYGfYprCnPzwDF6WVPCLgx.tDFFo4\/8prhovv.hEfdyfGRQ12MexcUwBESU3Hl2jS22KjA8si6.VdPChvnB4q1\r\n# System language\r\ntimezone Asia\/Tokyo --isUtc --nontp\r\n# Firewall configuration\r\nfirewall --disabled\r\n# Network information\r\nnetwork  --device=lo --hostname=localhost.localdomain\r\nnetwork --onboot=no --device=eth0 --bootproto=dhcp --noipv6\r\n# Use graphical install\r\ngraphical\r\n# SELinux configuration\r\nselinux --disabled\r\n# Do not configure the X Window System\r\nskipx\r\n# skip eula\r\neula --agreed\r\n\r\n# System bootloader configuration\r\nbootloader --location=mbr --driveorder=vda --append=\"crashkernel=auto rhgb quiet\"\r\n# Partition clearing information\r\nclearpart --all --initlabel\r\n# Disk partitioning information\r\npart \/boot --asprimary --fstype=\"ext4\" --size=500\r\npart swap --asprimary --fstype=\"swap\" --size=6144\r\npart \/ --asprimary --fstype=\"ext4\" --grow --size=1\r\n\r\n# Repository\r\nrepo --name=\"CentOS\"  --baseurl=cdrom:sr0 --cost=100\r\n%packages\r\n@core\r\n@base\r\n%end\r\n<\/pre>\n<pre>$ cp ks_master.cfg ks_build\/isolinux\/ks\/\r\n<\/pre>\n<p>Note, the \u201c\u2013onboot\u201d option is set to \u201cno\u201d. Because I haven\u2019t setup a DHCP server at this time. Without DHCP server, the instllation will stop at configuration screen.<\/p>\n<pre>network --onboot=no --device=eth0 --bootproto=dhcp --noipv6\r\n<\/pre>\n<h2>Create repository<\/h2>\n<pre>$ cd ~\/ks_build\/isolinux\r\n$ createrepo -g ~\/ks_build\/comps.xml . \r\n<\/pre>\n<h2>Build ISO<\/h2>\n<pre>$ cd ~\/ks_build\r\n$ chmod 664 isolinux\/isolinux.bin\r\n$ mkisofs -o custom.iso -b isolinux.bin -c boot.cat -no-emul-boot -V 'CentOS 7 x86_64' -boot-load-size 4 -boot-info-table -R -J -v -T isolinux\/\r\n<\/pre>\n<h2>Run kickstart<\/h2>\n<p>Boot from the ISO created by above command.<\/p>\n<p>Press \u201cESC\u201d at boot menu.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Type below command at boot prompt.<\/p>\n<pre>linux inst.ks=cdrom:\/dev\/cdrom:\/ks\/ks_master.cfg\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kickstart\u201d is powerful tool for automated OS installation and configuration available in CentOS or RHEL. You can install CentOS without touching keyboard or mouse and even can automate post installation configuration process.<\/p>\n<p>I\u2019m recently building a Hadoop cluster for R&amp;D, which makes me repeatedly install and re-install CentOS on several virtual machines. This is boring [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6491"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6491"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6491\/revisions"}],"predecessor-version":[{"id":6492,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6491\/revisions\/6492"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}