{"id":64,"date":"2010-02-26T12:04:31","date_gmt":"2010-02-26T17:04:31","guid":{"rendered":"http:\/\/blogs.wp.stage.cpanel.net\/2010\/02\/creating_a_cpanel_auto-installer_iso\/"},"modified":"2010-02-26T12:04:31","modified_gmt":"2010-02-26T17:04:31","slug":"creating_a_cpanel_auto-installer_iso","status":"publish","type":"post","link":"https:\/\/devel.www.cpanel.net\/blog\/products\/creating_a_cpanel_auto-installer_iso\/","title":{"rendered":"Creating a cPanel auto-installer ISO"},"content":{"rendered":"

Over the past few weeks I have been working on a custom spin of the CentOS installation image that automatically installs cPanel. \u00a0This ISO also performs some pre-installation configuration and installs updated packages as well as installing cpanel. \u00a0I think this information is handy for anyone who wants to create a CentOS installation image, whether for cPanel or for something else. \u00a0To create the installation image, we will modify the CentOS installation DVD; adding in a kickstart file, removing unneeded packages, and updating the remaining packages.<\/p>\n

What you need<\/strong>
\nFor creating this image you will need a few things:<\/p>\n

    \n
  1. A cPanel server running the target OS on the target architecture. I recommend using a fresh installation.<\/li>\n
  2. The yum-utils and createrepo packages installed from yum:
    \nyum install -y yum-utils createrepo<\/code><\/li>\n
  3. A copy of the CentOS installation DVD ISO<\/li>\n
  4. 10+ gB of free disk space<\/li>\n<\/ol>\n

    Creating the package list<\/strong>
    \nYou will need to grab a list of packages from the cPanel server. \u00a0These are used at several points of the process to let the installer know what it needs to install, \u00a0while letting yumdownloader know what it needs to download. \u00a0Unfortunately, there isn\u2019t an easy way to grab a list of packages that can be used directly. \u00a0Also, cPanel provides some packages that are not available within yum. \u00a0You should never install these manually. \u00a0We will need to filter these packages out. \u00a0You can accomplish this using the following (silly) shell command:
    \nrpm -qa | egrep -v \"(nsd|bandmin|proftpd|pure-ftpd|frontpage|gpg-pubkey|MySQL|exim|courier|dovecot)\" | perl -lane '$F[0] =~ s\/-[0-9].+$\/\/; print $F[0];' | sort | uniq > ~\/rpmlist<\/code><\/p>\n

    This command generates a file that contains the names of the packages on the system excluding the cPanel-installed packages and a couple of other packages.<\/p>\n

    Copying the ISO<\/strong>
    \nCopying the installer ISO is a relatively simple task. \u00a0You simply need to copy it to the system in question, mount it, then copy it to your home directory. \u00a0There are a couple of dot files that need to be copied as well.
    \nwget http:\/\/url\/to\/some\/iso
    \nmkdir \/mnt\/iso
    \nmount -o loop some_iso \/mnt\/iso
    \ncp -pr \/mnt\/iso ~
    \ncp -pr \/mnt\/iso\/.discinfo ~\/iso\/
    \ncp -pr \/mnt\/iso\/.treeinfo ~\/iso\/
    \n<\/code><\/p>\n

    Creating an populating the repository<\/strong>
    \nCreating your repository is a very important step to this process. \u00a0Using the packages provided with the DVD will result in an out-of-date installation. \u00a0While this is fine for some uses, you will likely prefer that the installation process installs updated packages. This results in faster installation times.<\/p>\n

    The first step is to clear out the current repository:
    \nchdir ~\/iso\/CentOS\/
    \nrm -f *<\/code><\/p>\n

    After the repo has been cleared, we need to repopulate the repo with the updated packages. \u00a0To do so, we will use the yumdownloader utility available within the yum-utils rpm.
    \ncd ~\/iso\/CentOS\/<\/em>
    \nyumdownloader --resolve `cat ~\/rpmlist | tr \u2018n\u2019 \u2018 \u2018`<\/em><\/code><\/p>\n

    This will download the latest version of the packages in question from yum and place them in the current directory.<\/p>\n

    Note: \u00a0This process can take awhile depending on your Internet connection and the speed of the mirror in question.<\/p>\n

    Once this has been done, we have to populate the repodata files with the correct information. \u00a0This is handled via the createrepo utility:
    \ncd ~\/iso\/
    \ncreaterepo -g repodata\/comps.xml .<\/code><\/p>\n

    Placing the kickstart file<\/strong>
    \nYou also need to create and place a kickstart file in the appropriate location. \u00a0You can find an example of this file at http:\/\/httpupdate.cpanel.net\/cpanel-ks.cfg. \u00a0This file can be used for setting defaults, fully automating the installation process, and pre-configuring cPanel. \u00a0In a later post I\u2019ll talk about what can be done with kickstart files for provisioning cPanel servers (documentation can be viewed at http:\/\/www.centos.org\/docs\/5\/html\/Installation_Guide-en-US\/s1-kickstart2-options.html). \u00a0At this point, the only thing you need to know is that you should copy the contents of \/root\/rpmlist and paste them between %packages and %post inside of cpanel-ks.cfg. \u00a0Once this has been done, you should place it in the user\u2019s home directory.
    \ncd ~\/iso\/
    \nwget http:\/\/httpupdate.cpanel.net\/cpanel-ks.cfg
    \n<\/code><\/p>\n

    Configuring the Installer to use the kickstart file<\/strong>
    \nThe bootloader will have to be told to use the kickstart file. \u00a0You can accomplish this by editting ~\/iso\/isolinux\/isolinux.cfg.<\/p>\n

    This file it should currently contain something similar to:
    \n label linux
    \n\u00a0\u00a0kernel vmlinuz
    \n\u00a0\u00a0append initrd=initrd.img
    \n label text
    \n\u00a0\u00a0kernel vmlinuz
    \n\u00a0\u00a0append initrd=initrd.img text<\/code><\/p>\n

    On both of these, ks=cpanel-ks.cfg should be added to the end of the append line. \u00a0This will tell the installer to automatically load the kickstart file.<\/p>\n

    Creating the ISO<\/strong>
    \nOnce this has been done the \u2018mkisofs\u2019 utility can be used to create the ISO:
    \nmkisofs -o $output_file -b isolinux\/isolinux.bin -c isolinux\/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T .<\/code><\/p>\n

    At this point you can burn the ISO to a disc and begin provisioning your server.<\/p>\n","protected":false},"excerpt":{"rendered":"

    Over the past few weeks I have been working on a custom spin of the CentOS installation image that automatically installs cPanel. \u00a0This ISO also performs some pre-installation configuration and installs updated packages as well as installing cpanel. \u00a0I think this information is handy for anyone who wants to create a CentOS installation image, whether […]<\/p>\n","protected":false},"author":77,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[49],"tags":[],"class_list":["post-64","post","type-post","status-publish","format-standard","hentry","category-products"],"acf":[],"yoast_head":"\nCreating a cPanel auto-installer ISO | cPanel<\/title>\n <!-- Mirrored from cpanel.net/wp-json/wp/v2/posts/64/ by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 06 Sep 2024 09:40:56 GMT --> <meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=_-1461.html \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating a cPanel auto-installer ISO | cPanel\" \/>\n<meta property=\"og:description\" content=\"Over the past few weeks I have been working on a custom spin of the CentOS installation image that automatically installs cPanel. \u00a0This ISO also performs some pre-installation configuration and installs updated packages as well as installing cpanel. \u00a0I think this information is handy for anyone who wants to create a CentOS installation image, whether […]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/devel.www.cpanel.net\/blog\/products\/creating_a_cpanel_auto-installer_iso\/\" \/>\n<meta property=\"og:site_name\" content=\"cPanel\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cpanel\/\" \/>\n<meta property=\"article:published_time\" content=\"2010-02-26T17:04:31+00:00\" \/>\n<meta name=\"author\" content=\"cPanel Community\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@cPanel\" \/>\n<meta name=\"twitter:site\" content=\"@cPanel\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"cPanel Community\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/devel.www.cpanel.net\/blog\/products\/creating_a_cpanel_auto-installer_iso\/\",\"url\":\"https:\/\/devel.www.cpanel.net\/blog\/products\/creating_a_cpanel_auto-installer_iso\/\",\"name\":\"Creating a cPanel auto-installer ISO | cPanel\",\"isPartOf\":{\"@id\":\"https:\/\/devel.www.cpanel.net\/#website\"},\"datePublished\":\"2010-02-26T17:04:31+00:00\",\"dateModified\":\"2010-02-26T17:04:31+00:00\",\"author\":{\"@id\":\"https:\/\/devel.www.cpanel.net\/#\/schema\/person\/8cf97408aad4fb70cf55d11a1d4f57f8\"},\"breadcrumb\":{\"@id\":\"https:\/\/devel.www.cpanel.net\/blog\/products\/creating_a_cpanel_auto-installer_iso\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/devel.www.cpanel.net\/blog\/products\/creating_a_cpanel_auto-installer_iso\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/devel.www.cpanel.net\/blog\/products\/creating_a_cpanel_auto-installer_iso\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/devel.www.cpanel.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating a cPanel auto-installer ISO\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/devel.www.cpanel.net\/#website\",\"url\":\"https:\/\/devel.www.cpanel.net\/\",\"name\":\"cPanel\",\"description\":\"Hosting Platform of Choices\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/devel.www.cpanel.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/devel.www.cpanel.net\/#\/schema\/person\/8cf97408aad4fb70cf55d11a1d4f57f8\",\"name\":\"cPanel Community\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/devel.www.cpanel.net\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e1949945083b5526bb95711bd3d616b3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e1949945083b5526bb95711bd3d616b3?s=96&d=mm&r=g\",\"caption\":\"cPanel Community\"},\"description\":\"The web hosting industry's most reliable management solution since 1997. With our first-class support and rich feature set, it's easy to see why our customers and partners make cPanel & WHM their hosting platform of choice. For more information, visit cPanel.net.\",\"sameAs\":[\"https:\/\/cpanel.net\"],\"url\":\"https:\/\/devel.www.cpanel.net\/blog\/author\/cpadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Creating a cPanel auto-installer ISO | cPanel","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/devel.www.cpanel.net\/blog\/products\/creating_a_cpanel_auto-installer_iso\/","og_locale":"en_US","og_type":"article","og_title":"Creating a cPanel auto-installer ISO | cPanel","og_description":"Over the past few weeks I have been working on a custom spin of the CentOS installation image that automatically installs cPanel. \u00a0This ISO also performs some pre-installation configuration and installs updated packages as well as installing cpanel. \u00a0I think this information is handy for anyone who wants to create a CentOS installation image, whether […]","og_url":"https:\/\/devel.www.cpanel.net\/blog\/products\/creating_a_cpanel_auto-installer_iso\/","og_site_name":"cPanel","article_publisher":"https:\/\/www.facebook.com\/cpanel\/","article_published_time":"2010-02-26T17:04:31+00:00","author":"cPanel Community","twitter_card":"summary_large_image","twitter_creator":"@cPanel","twitter_site":"@cPanel","twitter_misc":{"Written by":"cPanel Community","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/devel.www.cpanel.net\/blog\/products\/creating_a_cpanel_auto-installer_iso\/","url":"https:\/\/devel.www.cpanel.net\/blog\/products\/creating_a_cpanel_auto-installer_iso\/","name":"Creating a cPanel auto-installer ISO | cPanel","isPartOf":{"@id":"https:\/\/devel.www.cpanel.net\/#website"},"datePublished":"2010-02-26T17:04:31+00:00","dateModified":"2010-02-26T17:04:31+00:00","author":{"@id":"https:\/\/devel.www.cpanel.net\/#\/schema\/person\/8cf97408aad4fb70cf55d11a1d4f57f8"},"breadcrumb":{"@id":"https:\/\/devel.www.cpanel.net\/blog\/products\/creating_a_cpanel_auto-installer_iso\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/devel.www.cpanel.net\/blog\/products\/creating_a_cpanel_auto-installer_iso\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/devel.www.cpanel.net\/blog\/products\/creating_a_cpanel_auto-installer_iso\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/devel.www.cpanel.net\/"},{"@type":"ListItem","position":2,"name":"Creating a cPanel auto-installer ISO"}]},{"@type":"WebSite","@id":"https:\/\/devel.www.cpanel.net\/#website","url":"https:\/\/devel.www.cpanel.net\/","name":"cPanel","description":"Hosting Platform of Choices","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/devel.www.cpanel.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/devel.www.cpanel.net\/#\/schema\/person\/8cf97408aad4fb70cf55d11a1d4f57f8","name":"cPanel Community","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/devel.www.cpanel.net\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e1949945083b5526bb95711bd3d616b3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e1949945083b5526bb95711bd3d616b3?s=96&d=mm&r=g","caption":"cPanel Community"},"description":"The web hosting industry's most reliable management solution since 1997. With our first-class support and rich feature set, it's easy to see why our customers and partners make cPanel & WHM their hosting platform of choice. For more information, visit cPanel.net.","sameAs":["https:\/\/cpanel.net"],"url":"https:\/\/devel.www.cpanel.net\/blog\/author\/cpadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/posts\/64"}],"collection":[{"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/users\/77"}],"replies":[{"embeddable":true,"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/comments?post=64"}],"version-history":[{"count":0,"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/posts\/64\/revisions"}],"wp:attachment":[{"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/media?parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/categories?post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/tags?post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}