Add a new APT mirror from command-line

I need to add a new APT mirror via command-line (I have to add it from a Bash Script).

You can found the Bash Script I'm working on here:

apt-rollback

A little Demo here:enter image description here

It's a script able to Undo the last APT command.

The Script have to works on every Ubuntu version from the 18.04.

The mirror I need to add is:

FOSS Oman Ubuntu Mirror - -HTTP

or

FOSS Oman Ubuntu Mirror - -HTTPS

3

2 Answers

Making some assumptions as the the commenters already noticed. Have a look at the MAN-pages for apt-mirror management. FOr instance and

Make sure your release/version is properly supported, otherwise you will break your system (not able to update/upgrade).

After some researches I found this:

what is the function of /etc/apt/sources.list.d?

A little extract:

The function of the /etc/apt/sources.list.d directory is as follows:

Using the directory you can easily add new repositories without the need to edit the central /etc/apt/sources.list file. I.e. you can just put a file with a unique name and the same format as /etc/apt/sources.list into this folder and it is used by apt.

In order to remove this source again you can just remove that specific file without the need for handling side effects, parsing or mangling with /etc/apt/sources.list.

I think to can use this method to add my mirror. ;)

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like