0

I try to install VirtualBox in ubuntu 18.04, following https://www.virtualbox.org/wiki/Linux_Downloads

Add the following line to your /etc/apt/sources.list. According to your distribution, replace '' with 'artful', 'zesty', 'yakkety', 'xenial', 'trusty', 'stretch', 'jessie', or 'wheezy' (older versions of VirtualBox supported different distributions):

deb https://download.virtualbox.org/virtualbox/debian <mydist> contrib
  1. Here is my command:

    sudo echo "deb https://download.virtualbox.org/virtualbox/debian bionic contrib" | sudo tee -a /etc/apt/sources.list
    

    Is there some programitcal way to get the value of <mydist> instead of filling bionic in? I want to make it reusable for all Ubuntu versions.

  2. Also if I add the line to an individual file instead of /etc/apt/sources.list, how shall I name the file?

Thanks.

  • As for your last point of 2, it is a convention. So in principle, even if it is your convention, it should be ok. – Rui F Ribeiro Oct 28 '18 at 12:46
2
  1. On Ubuntu, lsb_release -sc will give you the codename corresponding to the installed release.

  2. If you use a filename which is already in use, and the > redirection operator, you will overwrite the existing file, yes.

    For single-line repository descriptors, filenames must end with .list. See the sources.list manpage for details. Apart from that you can use any name you like, as long as it uses only alphanumeric characters, underscores, hyphens, and periods. If you want to check for a file’s existence, you know the name you want to use; there’s no official registry of repository filenames.

  • Thanks. Shall I overwrite when it is possible? If not, how can I avoid overwriting? – Tim Oct 28 '18 at 12:57
  • 1
    What problem are you trying to avoid? A virtualbox.list file is unlikely to be used for anything other than the VirtualBox repository, so overwriting it is fine IMO. – Stephen Kitt Oct 28 '18 at 12:59

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.