1

I have set up a PXE server that does a fully automated installation of both Ubuntu 18.04 server and Centos 7.6.

My issue is that after installation, the Ubuntu systems have my PXE server IP in their sources.list file, and I want them to point to the internet repos.

The Centos systems have the internet network repos, so it has to be possible to do this.

Both installers use a url directive for the pointer to local installation files. The Centos installation uses a kickstart file, and the ubuntu one is a hybrid kickstart/preseed file.

I only have the specific files I need for the base servers, so I need them to be updated after they are deployed.

My current workaround is to do a post install copy of a local sources.list file to replace the one Ubuntu creates automatically during installation, but this feels like a hack.

I have found no way to do this correctly using preseeds, and I also have found no automated way to make this change after the installation completes.

I would think that, for example, if you did your initial installation in the US, but moved to Japan, you would want an automated way to change your sources.list file from ...us.archive... to ...jp.archive...

So, my request is for either

an example PXE preseed file that uses a local repo for installation and then sets up the internet repos for your location when the os installation is finished,

or

a Ubuntu executable that can be run to automatically update your sources.list file if your geographic location changes.

1

When using a preseed file for ubuntu server install, you may also insert late commands - commands that will run as soon as the the installation ends. You may want to run an apt-mirror-updater command, or any other command that suites you.

Example:

d-i preseed/late_command string in-target apt-mirror-updater ["your params here"] 

Another example::

d-i preseed/late_command string in-target add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ Bionic universe multiverse"

Further reading: apt-mirror-updater: Automated Debian/Ubuntu mirror selection Appendix B. Automating the installation using preseeding

4
  • I am currently doing late commands to copy my systems sources.list to the PXE client. No extra 'stuff' to install, like using apt-mirror-updater would require. And apt-add-repository just adds new entries. I still need to know what the are. I am trying to understand how to use a local url for install, and automatically set up the installed system for the local time zone repos in the preseed files. This works correctly for ftp and cd installs. There has to be a way to do it for a network install. – Ned Tonge Feb 14 '20 at 23:37
  • And thanks for the apt-mirror-updater tip. I need to test that for the after deployment part of my question. – Ned Tonge Feb 14 '20 at 23:40
  • In the preseed file you can specify the mirror you would like to use, and all the host server directories. The mirror can either be a name that will be resolved by dns (local or external), or an ip adress. Depending on your network topology, the requested server can be local or remote on the internet. Time zones may also be changed manually, or requested by ntp. If no specific mirror was requested in the preseed, the installer would simply choose the relevant according to the selected country and language (if the debconf priority kernel parameter was set to lower than high). – Pizza Feb 15 '20 at 12:55
  • Here is an official preseed example by Debian, with many parameters explained. Surely it'll help you find an answer or some tips regarding your question. Example of preseed by Debian – Pizza Feb 15 '20 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.