How-to: An unattended installation of Ubuntu 16.04 on a disk with existing OS

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
-1
down vote

favorite












I had a task of deploying Ubuntu Desktop 16.04 on multiple machines with Windows 10 on them. Of course, to accomplish the task efficiently, I needed to find a way to install automatically.



I asked Google, found various manuals, tried all of them... And that's where I stuck. No matter what I did, I always had the Choose installation type question. As a bonus, I learned that the official documentation is terribly outdated, that there are several types of syntax and all of them don't work at all...



In the end, I saw the light at the end of the tunnel. So as to let others to not have the same struggle as I had, here's the how-to. It's guaranteed to work, given the prerequisites are satisfied.



So:



A question:



How do I make a completely automatic installation of Ubuntu 16.04, if I have a computer or computers with an already installed system (Microsoft Windows, for example)? And how to make it install programms I need after the new system is ready?










share|improve this question























  • Maybe helpful: Ubuntu 16.04 Unattended-Install for UEFI using preseed · github Other useful resources are Performing an automated Ubuntu install using preseeding and https://help.ubuntu.com.
    – dessert
    Feb 7 at 10:34











  • Thanks, but all of them are for an installing to a disk without OS.
    – Mexanizator
    Feb 7 at 12:10










  • I don't understand, partitioning is treated in the help.ubuntu.com example-preseed.txt as well as in the github one, what difference does it make and what else do you need? Please edit and clarify your question!
    – dessert
    Feb 7 at 12:39











  • @dessert Hello, I remade the post. What do I do to make it available to the others?
    – Mexanizator
    Feb 22 at 12:40











  • @dessert Like that?
    – Mexanizator
    Feb 22 at 13:11














up vote
-1
down vote

favorite












I had a task of deploying Ubuntu Desktop 16.04 on multiple machines with Windows 10 on them. Of course, to accomplish the task efficiently, I needed to find a way to install automatically.



I asked Google, found various manuals, tried all of them... And that's where I stuck. No matter what I did, I always had the Choose installation type question. As a bonus, I learned that the official documentation is terribly outdated, that there are several types of syntax and all of them don't work at all...



In the end, I saw the light at the end of the tunnel. So as to let others to not have the same struggle as I had, here's the how-to. It's guaranteed to work, given the prerequisites are satisfied.



So:



A question:



How do I make a completely automatic installation of Ubuntu 16.04, if I have a computer or computers with an already installed system (Microsoft Windows, for example)? And how to make it install programms I need after the new system is ready?










share|improve this question























  • Maybe helpful: Ubuntu 16.04 Unattended-Install for UEFI using preseed · github Other useful resources are Performing an automated Ubuntu install using preseeding and https://help.ubuntu.com.
    – dessert
    Feb 7 at 10:34











  • Thanks, but all of them are for an installing to a disk without OS.
    – Mexanizator
    Feb 7 at 12:10










  • I don't understand, partitioning is treated in the help.ubuntu.com example-preseed.txt as well as in the github one, what difference does it make and what else do you need? Please edit and clarify your question!
    – dessert
    Feb 7 at 12:39











  • @dessert Hello, I remade the post. What do I do to make it available to the others?
    – Mexanizator
    Feb 22 at 12:40











  • @dessert Like that?
    – Mexanizator
    Feb 22 at 13:11












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I had a task of deploying Ubuntu Desktop 16.04 on multiple machines with Windows 10 on them. Of course, to accomplish the task efficiently, I needed to find a way to install automatically.



I asked Google, found various manuals, tried all of them... And that's where I stuck. No matter what I did, I always had the Choose installation type question. As a bonus, I learned that the official documentation is terribly outdated, that there are several types of syntax and all of them don't work at all...



In the end, I saw the light at the end of the tunnel. So as to let others to not have the same struggle as I had, here's the how-to. It's guaranteed to work, given the prerequisites are satisfied.



So:



A question:



How do I make a completely automatic installation of Ubuntu 16.04, if I have a computer or computers with an already installed system (Microsoft Windows, for example)? And how to make it install programms I need after the new system is ready?










share|improve this question















I had a task of deploying Ubuntu Desktop 16.04 on multiple machines with Windows 10 on them. Of course, to accomplish the task efficiently, I needed to find a way to install automatically.



I asked Google, found various manuals, tried all of them... And that's where I stuck. No matter what I did, I always had the Choose installation type question. As a bonus, I learned that the official documentation is terribly outdated, that there are several types of syntax and all of them don't work at all...



In the end, I saw the light at the end of the tunnel. So as to let others to not have the same struggle as I had, here's the how-to. It's guaranteed to work, given the prerequisites are satisfied.



So:



A question:



How do I make a completely automatic installation of Ubuntu 16.04, if I have a computer or computers with an already installed system (Microsoft Windows, for example)? And how to make it install programms I need after the new system is ready?







16.04 system-installation automation ubiquity






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 22 at 14:54

























asked Feb 1 at 10:30









Mexanizator

2618




2618











  • Maybe helpful: Ubuntu 16.04 Unattended-Install for UEFI using preseed · github Other useful resources are Performing an automated Ubuntu install using preseeding and https://help.ubuntu.com.
    – dessert
    Feb 7 at 10:34











  • Thanks, but all of them are for an installing to a disk without OS.
    – Mexanizator
    Feb 7 at 12:10










  • I don't understand, partitioning is treated in the help.ubuntu.com example-preseed.txt as well as in the github one, what difference does it make and what else do you need? Please edit and clarify your question!
    – dessert
    Feb 7 at 12:39











  • @dessert Hello, I remade the post. What do I do to make it available to the others?
    – Mexanizator
    Feb 22 at 12:40











  • @dessert Like that?
    – Mexanizator
    Feb 22 at 13:11
















  • Maybe helpful: Ubuntu 16.04 Unattended-Install for UEFI using preseed · github Other useful resources are Performing an automated Ubuntu install using preseeding and https://help.ubuntu.com.
    – dessert
    Feb 7 at 10:34











  • Thanks, but all of them are for an installing to a disk without OS.
    – Mexanizator
    Feb 7 at 12:10










  • I don't understand, partitioning is treated in the help.ubuntu.com example-preseed.txt as well as in the github one, what difference does it make and what else do you need? Please edit and clarify your question!
    – dessert
    Feb 7 at 12:39











  • @dessert Hello, I remade the post. What do I do to make it available to the others?
    – Mexanizator
    Feb 22 at 12:40











  • @dessert Like that?
    – Mexanizator
    Feb 22 at 13:11















Maybe helpful: Ubuntu 16.04 Unattended-Install for UEFI using preseed · github Other useful resources are Performing an automated Ubuntu install using preseeding and https://help.ubuntu.com.
– dessert
Feb 7 at 10:34





Maybe helpful: Ubuntu 16.04 Unattended-Install for UEFI using preseed · github Other useful resources are Performing an automated Ubuntu install using preseeding and https://help.ubuntu.com.
– dessert
Feb 7 at 10:34













Thanks, but all of them are for an installing to a disk without OS.
– Mexanizator
Feb 7 at 12:10




Thanks, but all of them are for an installing to a disk without OS.
– Mexanizator
Feb 7 at 12:10












I don't understand, partitioning is treated in the help.ubuntu.com example-preseed.txt as well as in the github one, what difference does it make and what else do you need? Please edit and clarify your question!
– dessert
Feb 7 at 12:39





I don't understand, partitioning is treated in the help.ubuntu.com example-preseed.txt as well as in the github one, what difference does it make and what else do you need? Please edit and clarify your question!
– dessert
Feb 7 at 12:39













@dessert Hello, I remade the post. What do I do to make it available to the others?
– Mexanizator
Feb 22 at 12:40





@dessert Hello, I remade the post. What do I do to make it available to the others?
– Mexanizator
Feb 22 at 12:40













@dessert Like that?
– Mexanizator
Feb 22 at 13:11




@dessert Like that?
– Mexanizator
Feb 22 at 13:11










1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted












Firstly, you need to satisfy the next conditions, otherwise there's no guarantee it'll work, if, say, you have a computer with two disks or will choose MBR mode:



  • Ubuntu 16.04;

  • The machine has only one disk;

  • You don't need the contents on it as all the data is going to be erased;

  • UEFI mode is choosed;

  • The machine is connected to the Internet by a wire. If not, it would install, but without drivers and updates.

Then:




  1. Download the image:



    wget http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso



  2. Extract it:



    cd folder
    xorriso -osirrox on -indev ubuntu-16.04.3-desktop-amd64.iso -extract / custom-iso



  3. Edit the config of GRUB, e.g. with nano:



    sudo nano boot/grub/grub.cfg


    and add the following:



    if loadfont /boot/grub/font.pf2 ; then 
    set gfxmode=auto
    insmod efi_gop
    insmod efi_uga
    insmod gfxterm
    terminal_output gfxterm
    fi

    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    set default=0
    set timeout=1

    menuentry "Install Ubuntu"
    set gfxpayload=keep
    linux /casper/vmlinuz.efi file=/cdrom/preseed/ks.seed auto=true priority=critical debian-installer/locale=ru_Ru keyboard-configuration/layoutcode=us ubiquity/reboot=true languagechooser/language-name=Russian countrychooser/shortlist=RU localechooser/supported-locales=ru_RU.UTF-8 boot=casper automatic-ubiquity initrd=/casper/initrd.lz quiet splash noprompt noshell ---
    initrd /casper/initrd.lz



    Pay attention to such parameters as locale, layoutcode, languagechooser and etc. and edit correspondingly.




  4. Create the config for the Ubuntu installer, e.g. with nano:



    sudo nano preseed/ks.seed


    and add the following:



    ubiquity partman-auto/disk string /dev/sda 
    ubiquity partman-auto/method string regular
    ubiquity partman-lvm/device_remove_lvm boolean true
    ubiquity partman-md/device_remove_md boolean true
    ubiquity partman-auto/choose_recipe select atomic

    d-i partman-partitioning/confirm_write_new_label boolean true
    d-i partman/choose_partition select finish
    d-i partman/confirm boolean true
    d-i partman/confirm_nooverwrite boolean true
    d-i partman-md/confirm_nooverwrite boolean true
    d-i partman-lvm/confirm_nooverwrite boolean true
    d-i partman-efi/non_efi_system boolean true

    d-i debian-installer/locale string ru_RU
    d-i console-setup/ask_detect boolean false
    d-i console-setup/layoutcode string us

    d-i netcfg/get_hostname string unassigned-hostname
    d-i netcfg/get_domain string unassigned-domain
    d-i netcfg/choose_interface select auto

    d-i clock-setup/utc-auto boolean true
    d-i clock-setup/utc boolean true
    d-i time/zone string Europe/Moscow
    d-i clock-setup/ntp boolean true

    d-i mirror/country string RU
    d-i apt-setup/multiverse boolean true
    d-i apt-setup/restricted boolean true
    d-i apt-setup/universe boolean true

    d-i passwd/user-fullname string User
    d-i passwd/username string user
    d-i passwd/user-password-crypted password sOlSUKAdMoT5M
    d-i passwd/user-default-groups string adm audio cdrom dip lpadmin sudo plugdev sambashare video

    d-i grub-installer/grub2_instead_of_grub_legacy boolean true
    d-i grub-installer/only_debian boolean true
    d-i finish-install/reboot_in_progress note

    ubiquity ubiquity/success_command
    string echo "auto enp0s3" >> /etc/network/interfaces;
    echo "iface enp0s3 inet dhcp" >> /etc/network/interfaces;
    ifup enp0s3;
    apt-get update -y;
    in-target apt-get install -y openssh-server;


    By the way, pay attention to an unsaid feauture of Ubiquity. Just right before launching the success_command section it shutdowns the interfaces (amusing, right?), so to install something from the Internet you have to configure an interface first.



    And forgot to mention, the password to User here is 'qwerty123'. I strongly recommend to change it afterwards.




  5. Finally, compile a new image:



    sudo mkisofs -D -r -V "UNATTENDED_UBUNTU" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ~/ubuntu/custom-http.iso ~/ubuntu/custom-iso/


    And you're good to go.



That's all. I hope that walkthrough would help to someone. Special thanks to Just_a_fake_account and the others from Linux Mint forum, who helped to solve the puzzle.






share|improve this answer






















  • But I've already done that. See, how indented the text in the answer is?
    – Mexanizator
    Feb 22 at 15:19










  • @dessert Thanks to you guys too! :) By the way, isn't the code area supposed to be somehow outlined comparing to the text? You know, like a text when it's quoted.
    – Mexanizator
    Feb 22 at 15:39











  • You may want to format the code in Step 5 as a one long string rather than three lines. This makes it easier to copy and paste.
    – user68186
    Feb 22 at 18:02










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1002043%2fhow-to-an-unattended-installation-of-ubuntu-16-04-on-a-disk-with-existing-os%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted












Firstly, you need to satisfy the next conditions, otherwise there's no guarantee it'll work, if, say, you have a computer with two disks or will choose MBR mode:



  • Ubuntu 16.04;

  • The machine has only one disk;

  • You don't need the contents on it as all the data is going to be erased;

  • UEFI mode is choosed;

  • The machine is connected to the Internet by a wire. If not, it would install, but without drivers and updates.

Then:




  1. Download the image:



    wget http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso



  2. Extract it:



    cd folder
    xorriso -osirrox on -indev ubuntu-16.04.3-desktop-amd64.iso -extract / custom-iso



  3. Edit the config of GRUB, e.g. with nano:



    sudo nano boot/grub/grub.cfg


    and add the following:



    if loadfont /boot/grub/font.pf2 ; then 
    set gfxmode=auto
    insmod efi_gop
    insmod efi_uga
    insmod gfxterm
    terminal_output gfxterm
    fi

    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    set default=0
    set timeout=1

    menuentry "Install Ubuntu"
    set gfxpayload=keep
    linux /casper/vmlinuz.efi file=/cdrom/preseed/ks.seed auto=true priority=critical debian-installer/locale=ru_Ru keyboard-configuration/layoutcode=us ubiquity/reboot=true languagechooser/language-name=Russian countrychooser/shortlist=RU localechooser/supported-locales=ru_RU.UTF-8 boot=casper automatic-ubiquity initrd=/casper/initrd.lz quiet splash noprompt noshell ---
    initrd /casper/initrd.lz



    Pay attention to such parameters as locale, layoutcode, languagechooser and etc. and edit correspondingly.




  4. Create the config for the Ubuntu installer, e.g. with nano:



    sudo nano preseed/ks.seed


    and add the following:



    ubiquity partman-auto/disk string /dev/sda 
    ubiquity partman-auto/method string regular
    ubiquity partman-lvm/device_remove_lvm boolean true
    ubiquity partman-md/device_remove_md boolean true
    ubiquity partman-auto/choose_recipe select atomic

    d-i partman-partitioning/confirm_write_new_label boolean true
    d-i partman/choose_partition select finish
    d-i partman/confirm boolean true
    d-i partman/confirm_nooverwrite boolean true
    d-i partman-md/confirm_nooverwrite boolean true
    d-i partman-lvm/confirm_nooverwrite boolean true
    d-i partman-efi/non_efi_system boolean true

    d-i debian-installer/locale string ru_RU
    d-i console-setup/ask_detect boolean false
    d-i console-setup/layoutcode string us

    d-i netcfg/get_hostname string unassigned-hostname
    d-i netcfg/get_domain string unassigned-domain
    d-i netcfg/choose_interface select auto

    d-i clock-setup/utc-auto boolean true
    d-i clock-setup/utc boolean true
    d-i time/zone string Europe/Moscow
    d-i clock-setup/ntp boolean true

    d-i mirror/country string RU
    d-i apt-setup/multiverse boolean true
    d-i apt-setup/restricted boolean true
    d-i apt-setup/universe boolean true

    d-i passwd/user-fullname string User
    d-i passwd/username string user
    d-i passwd/user-password-crypted password sOlSUKAdMoT5M
    d-i passwd/user-default-groups string adm audio cdrom dip lpadmin sudo plugdev sambashare video

    d-i grub-installer/grub2_instead_of_grub_legacy boolean true
    d-i grub-installer/only_debian boolean true
    d-i finish-install/reboot_in_progress note

    ubiquity ubiquity/success_command
    string echo "auto enp0s3" >> /etc/network/interfaces;
    echo "iface enp0s3 inet dhcp" >> /etc/network/interfaces;
    ifup enp0s3;
    apt-get update -y;
    in-target apt-get install -y openssh-server;


    By the way, pay attention to an unsaid feauture of Ubiquity. Just right before launching the success_command section it shutdowns the interfaces (amusing, right?), so to install something from the Internet you have to configure an interface first.



    And forgot to mention, the password to User here is 'qwerty123'. I strongly recommend to change it afterwards.




  5. Finally, compile a new image:



    sudo mkisofs -D -r -V "UNATTENDED_UBUNTU" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ~/ubuntu/custom-http.iso ~/ubuntu/custom-iso/


    And you're good to go.



That's all. I hope that walkthrough would help to someone. Special thanks to Just_a_fake_account and the others from Linux Mint forum, who helped to solve the puzzle.






share|improve this answer






















  • But I've already done that. See, how indented the text in the answer is?
    – Mexanizator
    Feb 22 at 15:19










  • @dessert Thanks to you guys too! :) By the way, isn't the code area supposed to be somehow outlined comparing to the text? You know, like a text when it's quoted.
    – Mexanizator
    Feb 22 at 15:39











  • You may want to format the code in Step 5 as a one long string rather than three lines. This makes it easier to copy and paste.
    – user68186
    Feb 22 at 18:02














up vote
1
down vote



accepted












Firstly, you need to satisfy the next conditions, otherwise there's no guarantee it'll work, if, say, you have a computer with two disks or will choose MBR mode:



  • Ubuntu 16.04;

  • The machine has only one disk;

  • You don't need the contents on it as all the data is going to be erased;

  • UEFI mode is choosed;

  • The machine is connected to the Internet by a wire. If not, it would install, but without drivers and updates.

Then:




  1. Download the image:



    wget http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso



  2. Extract it:



    cd folder
    xorriso -osirrox on -indev ubuntu-16.04.3-desktop-amd64.iso -extract / custom-iso



  3. Edit the config of GRUB, e.g. with nano:



    sudo nano boot/grub/grub.cfg


    and add the following:



    if loadfont /boot/grub/font.pf2 ; then 
    set gfxmode=auto
    insmod efi_gop
    insmod efi_uga
    insmod gfxterm
    terminal_output gfxterm
    fi

    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    set default=0
    set timeout=1

    menuentry "Install Ubuntu"
    set gfxpayload=keep
    linux /casper/vmlinuz.efi file=/cdrom/preseed/ks.seed auto=true priority=critical debian-installer/locale=ru_Ru keyboard-configuration/layoutcode=us ubiquity/reboot=true languagechooser/language-name=Russian countrychooser/shortlist=RU localechooser/supported-locales=ru_RU.UTF-8 boot=casper automatic-ubiquity initrd=/casper/initrd.lz quiet splash noprompt noshell ---
    initrd /casper/initrd.lz



    Pay attention to such parameters as locale, layoutcode, languagechooser and etc. and edit correspondingly.




  4. Create the config for the Ubuntu installer, e.g. with nano:



    sudo nano preseed/ks.seed


    and add the following:



    ubiquity partman-auto/disk string /dev/sda 
    ubiquity partman-auto/method string regular
    ubiquity partman-lvm/device_remove_lvm boolean true
    ubiquity partman-md/device_remove_md boolean true
    ubiquity partman-auto/choose_recipe select atomic

    d-i partman-partitioning/confirm_write_new_label boolean true
    d-i partman/choose_partition select finish
    d-i partman/confirm boolean true
    d-i partman/confirm_nooverwrite boolean true
    d-i partman-md/confirm_nooverwrite boolean true
    d-i partman-lvm/confirm_nooverwrite boolean true
    d-i partman-efi/non_efi_system boolean true

    d-i debian-installer/locale string ru_RU
    d-i console-setup/ask_detect boolean false
    d-i console-setup/layoutcode string us

    d-i netcfg/get_hostname string unassigned-hostname
    d-i netcfg/get_domain string unassigned-domain
    d-i netcfg/choose_interface select auto

    d-i clock-setup/utc-auto boolean true
    d-i clock-setup/utc boolean true
    d-i time/zone string Europe/Moscow
    d-i clock-setup/ntp boolean true

    d-i mirror/country string RU
    d-i apt-setup/multiverse boolean true
    d-i apt-setup/restricted boolean true
    d-i apt-setup/universe boolean true

    d-i passwd/user-fullname string User
    d-i passwd/username string user
    d-i passwd/user-password-crypted password sOlSUKAdMoT5M
    d-i passwd/user-default-groups string adm audio cdrom dip lpadmin sudo plugdev sambashare video

    d-i grub-installer/grub2_instead_of_grub_legacy boolean true
    d-i grub-installer/only_debian boolean true
    d-i finish-install/reboot_in_progress note

    ubiquity ubiquity/success_command
    string echo "auto enp0s3" >> /etc/network/interfaces;
    echo "iface enp0s3 inet dhcp" >> /etc/network/interfaces;
    ifup enp0s3;
    apt-get update -y;
    in-target apt-get install -y openssh-server;


    By the way, pay attention to an unsaid feauture of Ubiquity. Just right before launching the success_command section it shutdowns the interfaces (amusing, right?), so to install something from the Internet you have to configure an interface first.



    And forgot to mention, the password to User here is 'qwerty123'. I strongly recommend to change it afterwards.




  5. Finally, compile a new image:



    sudo mkisofs -D -r -V "UNATTENDED_UBUNTU" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ~/ubuntu/custom-http.iso ~/ubuntu/custom-iso/


    And you're good to go.



That's all. I hope that walkthrough would help to someone. Special thanks to Just_a_fake_account and the others from Linux Mint forum, who helped to solve the puzzle.






share|improve this answer






















  • But I've already done that. See, how indented the text in the answer is?
    – Mexanizator
    Feb 22 at 15:19










  • @dessert Thanks to you guys too! :) By the way, isn't the code area supposed to be somehow outlined comparing to the text? You know, like a text when it's quoted.
    – Mexanizator
    Feb 22 at 15:39











  • You may want to format the code in Step 5 as a one long string rather than three lines. This makes it easier to copy and paste.
    – user68186
    Feb 22 at 18:02












up vote
1
down vote



accepted







up vote
1
down vote



accepted








Firstly, you need to satisfy the next conditions, otherwise there's no guarantee it'll work, if, say, you have a computer with two disks or will choose MBR mode:



  • Ubuntu 16.04;

  • The machine has only one disk;

  • You don't need the contents on it as all the data is going to be erased;

  • UEFI mode is choosed;

  • The machine is connected to the Internet by a wire. If not, it would install, but without drivers and updates.

Then:




  1. Download the image:



    wget http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso



  2. Extract it:



    cd folder
    xorriso -osirrox on -indev ubuntu-16.04.3-desktop-amd64.iso -extract / custom-iso



  3. Edit the config of GRUB, e.g. with nano:



    sudo nano boot/grub/grub.cfg


    and add the following:



    if loadfont /boot/grub/font.pf2 ; then 
    set gfxmode=auto
    insmod efi_gop
    insmod efi_uga
    insmod gfxterm
    terminal_output gfxterm
    fi

    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    set default=0
    set timeout=1

    menuentry "Install Ubuntu"
    set gfxpayload=keep
    linux /casper/vmlinuz.efi file=/cdrom/preseed/ks.seed auto=true priority=critical debian-installer/locale=ru_Ru keyboard-configuration/layoutcode=us ubiquity/reboot=true languagechooser/language-name=Russian countrychooser/shortlist=RU localechooser/supported-locales=ru_RU.UTF-8 boot=casper automatic-ubiquity initrd=/casper/initrd.lz quiet splash noprompt noshell ---
    initrd /casper/initrd.lz



    Pay attention to such parameters as locale, layoutcode, languagechooser and etc. and edit correspondingly.




  4. Create the config for the Ubuntu installer, e.g. with nano:



    sudo nano preseed/ks.seed


    and add the following:



    ubiquity partman-auto/disk string /dev/sda 
    ubiquity partman-auto/method string regular
    ubiquity partman-lvm/device_remove_lvm boolean true
    ubiquity partman-md/device_remove_md boolean true
    ubiquity partman-auto/choose_recipe select atomic

    d-i partman-partitioning/confirm_write_new_label boolean true
    d-i partman/choose_partition select finish
    d-i partman/confirm boolean true
    d-i partman/confirm_nooverwrite boolean true
    d-i partman-md/confirm_nooverwrite boolean true
    d-i partman-lvm/confirm_nooverwrite boolean true
    d-i partman-efi/non_efi_system boolean true

    d-i debian-installer/locale string ru_RU
    d-i console-setup/ask_detect boolean false
    d-i console-setup/layoutcode string us

    d-i netcfg/get_hostname string unassigned-hostname
    d-i netcfg/get_domain string unassigned-domain
    d-i netcfg/choose_interface select auto

    d-i clock-setup/utc-auto boolean true
    d-i clock-setup/utc boolean true
    d-i time/zone string Europe/Moscow
    d-i clock-setup/ntp boolean true

    d-i mirror/country string RU
    d-i apt-setup/multiverse boolean true
    d-i apt-setup/restricted boolean true
    d-i apt-setup/universe boolean true

    d-i passwd/user-fullname string User
    d-i passwd/username string user
    d-i passwd/user-password-crypted password sOlSUKAdMoT5M
    d-i passwd/user-default-groups string adm audio cdrom dip lpadmin sudo plugdev sambashare video

    d-i grub-installer/grub2_instead_of_grub_legacy boolean true
    d-i grub-installer/only_debian boolean true
    d-i finish-install/reboot_in_progress note

    ubiquity ubiquity/success_command
    string echo "auto enp0s3" >> /etc/network/interfaces;
    echo "iface enp0s3 inet dhcp" >> /etc/network/interfaces;
    ifup enp0s3;
    apt-get update -y;
    in-target apt-get install -y openssh-server;


    By the way, pay attention to an unsaid feauture of Ubiquity. Just right before launching the success_command section it shutdowns the interfaces (amusing, right?), so to install something from the Internet you have to configure an interface first.



    And forgot to mention, the password to User here is 'qwerty123'. I strongly recommend to change it afterwards.




  5. Finally, compile a new image:



    sudo mkisofs -D -r -V "UNATTENDED_UBUNTU" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ~/ubuntu/custom-http.iso ~/ubuntu/custom-iso/


    And you're good to go.



That's all. I hope that walkthrough would help to someone. Special thanks to Just_a_fake_account and the others from Linux Mint forum, who helped to solve the puzzle.






share|improve this answer
















Firstly, you need to satisfy the next conditions, otherwise there's no guarantee it'll work, if, say, you have a computer with two disks or will choose MBR mode:



  • Ubuntu 16.04;

  • The machine has only one disk;

  • You don't need the contents on it as all the data is going to be erased;

  • UEFI mode is choosed;

  • The machine is connected to the Internet by a wire. If not, it would install, but without drivers and updates.

Then:




  1. Download the image:



    wget http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso



  2. Extract it:



    cd folder
    xorriso -osirrox on -indev ubuntu-16.04.3-desktop-amd64.iso -extract / custom-iso



  3. Edit the config of GRUB, e.g. with nano:



    sudo nano boot/grub/grub.cfg


    and add the following:



    if loadfont /boot/grub/font.pf2 ; then 
    set gfxmode=auto
    insmod efi_gop
    insmod efi_uga
    insmod gfxterm
    terminal_output gfxterm
    fi

    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    set default=0
    set timeout=1

    menuentry "Install Ubuntu"
    set gfxpayload=keep
    linux /casper/vmlinuz.efi file=/cdrom/preseed/ks.seed auto=true priority=critical debian-installer/locale=ru_Ru keyboard-configuration/layoutcode=us ubiquity/reboot=true languagechooser/language-name=Russian countrychooser/shortlist=RU localechooser/supported-locales=ru_RU.UTF-8 boot=casper automatic-ubiquity initrd=/casper/initrd.lz quiet splash noprompt noshell ---
    initrd /casper/initrd.lz



    Pay attention to such parameters as locale, layoutcode, languagechooser and etc. and edit correspondingly.




  4. Create the config for the Ubuntu installer, e.g. with nano:



    sudo nano preseed/ks.seed


    and add the following:



    ubiquity partman-auto/disk string /dev/sda 
    ubiquity partman-auto/method string regular
    ubiquity partman-lvm/device_remove_lvm boolean true
    ubiquity partman-md/device_remove_md boolean true
    ubiquity partman-auto/choose_recipe select atomic

    d-i partman-partitioning/confirm_write_new_label boolean true
    d-i partman/choose_partition select finish
    d-i partman/confirm boolean true
    d-i partman/confirm_nooverwrite boolean true
    d-i partman-md/confirm_nooverwrite boolean true
    d-i partman-lvm/confirm_nooverwrite boolean true
    d-i partman-efi/non_efi_system boolean true

    d-i debian-installer/locale string ru_RU
    d-i console-setup/ask_detect boolean false
    d-i console-setup/layoutcode string us

    d-i netcfg/get_hostname string unassigned-hostname
    d-i netcfg/get_domain string unassigned-domain
    d-i netcfg/choose_interface select auto

    d-i clock-setup/utc-auto boolean true
    d-i clock-setup/utc boolean true
    d-i time/zone string Europe/Moscow
    d-i clock-setup/ntp boolean true

    d-i mirror/country string RU
    d-i apt-setup/multiverse boolean true
    d-i apt-setup/restricted boolean true
    d-i apt-setup/universe boolean true

    d-i passwd/user-fullname string User
    d-i passwd/username string user
    d-i passwd/user-password-crypted password sOlSUKAdMoT5M
    d-i passwd/user-default-groups string adm audio cdrom dip lpadmin sudo plugdev sambashare video

    d-i grub-installer/grub2_instead_of_grub_legacy boolean true
    d-i grub-installer/only_debian boolean true
    d-i finish-install/reboot_in_progress note

    ubiquity ubiquity/success_command
    string echo "auto enp0s3" >> /etc/network/interfaces;
    echo "iface enp0s3 inet dhcp" >> /etc/network/interfaces;
    ifup enp0s3;
    apt-get update -y;
    in-target apt-get install -y openssh-server;


    By the way, pay attention to an unsaid feauture of Ubiquity. Just right before launching the success_command section it shutdowns the interfaces (amusing, right?), so to install something from the Internet you have to configure an interface first.



    And forgot to mention, the password to User here is 'qwerty123'. I strongly recommend to change it afterwards.




  5. Finally, compile a new image:



    sudo mkisofs -D -r -V "UNATTENDED_UBUNTU" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ~/ubuntu/custom-http.iso ~/ubuntu/custom-iso/


    And you're good to go.



That's all. I hope that walkthrough would help to someone. Special thanks to Just_a_fake_account and the others from Linux Mint forum, who helped to solve the puzzle.







share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 22 at 18:27









dessert

20k55795




20k55795










answered Feb 22 at 14:54









Mexanizator

2618




2618











  • But I've already done that. See, how indented the text in the answer is?
    – Mexanizator
    Feb 22 at 15:19










  • @dessert Thanks to you guys too! :) By the way, isn't the code area supposed to be somehow outlined comparing to the text? You know, like a text when it's quoted.
    – Mexanizator
    Feb 22 at 15:39











  • You may want to format the code in Step 5 as a one long string rather than three lines. This makes it easier to copy and paste.
    – user68186
    Feb 22 at 18:02
















  • But I've already done that. See, how indented the text in the answer is?
    – Mexanizator
    Feb 22 at 15:19










  • @dessert Thanks to you guys too! :) By the way, isn't the code area supposed to be somehow outlined comparing to the text? You know, like a text when it's quoted.
    – Mexanizator
    Feb 22 at 15:39











  • You may want to format the code in Step 5 as a one long string rather than three lines. This makes it easier to copy and paste.
    – user68186
    Feb 22 at 18:02















But I've already done that. See, how indented the text in the answer is?
– Mexanizator
Feb 22 at 15:19




But I've already done that. See, how indented the text in the answer is?
– Mexanizator
Feb 22 at 15:19












@dessert Thanks to you guys too! :) By the way, isn't the code area supposed to be somehow outlined comparing to the text? You know, like a text when it's quoted.
– Mexanizator
Feb 22 at 15:39





@dessert Thanks to you guys too! :) By the way, isn't the code area supposed to be somehow outlined comparing to the text? You know, like a text when it's quoted.
– Mexanizator
Feb 22 at 15:39













You may want to format the code in Step 5 as a one long string rather than three lines. This makes it easier to copy and paste.
– user68186
Feb 22 at 18:02




You may want to format the code in Step 5 as a one long string rather than three lines. This makes it easier to copy and paste.
– user68186
Feb 22 at 18:02

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1002043%2fhow-to-an-unattended-installation-of-ubuntu-16-04-on-a-disk-with-existing-os%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

pylint3 and pip3 broken

Missing snmpget and snmpwalk

How to enroll fingerprints to Ubuntu 17.10 with VFS491