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
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 fillingbionic
in? I want to make it reusable for all Ubuntu versions.Also if I add the line to an individual file instead of
/etc/apt/sources.list
, how shall I name the file?Do I need to make the filename unique so that I will not overwrite an existing file? Ho?
The purpose of individual file is for scripting to check existence of a repository or remove an existing repository. So is it correct that an arbitrary filename isn't okay? For example:
echo "deb https://download.virtualbox.org/virtualbox/debian bionic contrib" > /etc/apt/sources.list.d/my.virtualbox.list
Thanks.