I want to install the Оракле Виртуальбокс by adding в repository with the apt-add-repository
command. In order to gain experience in using the apt commands, I would not like to directly modify the sources.list file. I understand I also need to add the key. I found in the ручной Ubuntu the following command to insert:
sudo sh -c "echo 'deb http://download.virtualbox.org/virtualbox/debian '$(lsb_release -cs)' contrib non-free' > /etc/apt/sources.list.d/virtualbox.list" && wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add - && sudo apt-get update && sudo apt-get install virtualbox-5.0
Unfortunately I do not understand what it does. Хан anyone "dismantle" this command and give я the отделись list of the commands I should используйте?
Когда Вы встречаетесь с командами, что Вы не понимаете, используете страницы руководства.
Эта большая команда может быть разделена в трех основных частях:
sudo sh -c "echo 'deb http://download.virtualbox.org/virtualbox/debian '$(lsb_release -cs)' contrib non-free' > /etc/apt/sources.list.d/virtualbox.list"
Давайте повредим каждую часть:
sh -c
Если Вы вводите man sh
Вы доберетесь:
-c Read commands from the command_string operand
instead of from the standard input. Special
parameter 0 will be set from the command_name operand
and the positional parameters ($1, $2, etc.)
set from the remaining argument operands.
Теперь:
deb http://download.virtualbox.org/virtualbox/debian '$(lsb_release -cs)' contrib non-free
адрес, где пакеты VirtualBox расположены.
Когда Вы выполняете команду lsb_release -cs
это произведет Вашу версию Ubuntu:
$ lsb_release -cs
trusty
>
оператор перенаправления. Это пишет предыдущий вывод в следующий файл:
/etc/apt/sources.list.d/virtualbox.list
Когда Вы работаете
echo 'deb http://download.virtualbox.org/virtualbox/debian '$(lsb_release -cs)' contrib non-free'
это произведет в Вашем терминале:
deb http://download.virtualbox.org/virtualbox/debian '$(lsb_release -cs)' contrib non-free
Выполнение
echo 'deb http://download.virtualbox.org/virtualbox/debian '$(lsb_release -cs)' contrib non-free' > /etc/apt/sources.list.d/virtualbox.list
запишет строку:
deb http://download.virtualbox.org/virtualbox/debian '$(lsb_release -cs)' contrib non-free
к /etc/apt/sources.list.d/virtualbox.list
файл вместо того, чтобы дать терминальный вывод.
Примечание: Это не рекомендуемый метод для использования. Это может вести для дублирования записей при выполнении дважды.
Рекомендуемый способ добавить репозиторий VirtualBox к системе add-apt-repository
:
sudo add-apt-repository "deb http://download.virtualbox.org/virtualbox/debian trusty contrib"
Замените надежного человека своей текущей версией Ubuntu.
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
man wget
вывод:
DESCRIPTION
GNU Wget is a free utility for non-interactive download of files from
the Web
[...]
-q
--quiet
Turn off Wget's output.
С этой командой Вы загружаете открытый ключ VirtualBox...
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O-
... и зарегистрируйте его к системе (Что делает “-” средний?):
sudo apt-key add -
sudo apt-get update
man apt-get
вывод:
update
update is used to resynchronize the package index files from their
sources. The indexes of available packages are fetched from the
location(s) specified in /etc/apt/sources.list.
И наконец sudo apt-get install virtualbox-5.0
установки virtualbox-5.0
пакет.
При необходимости в дополнительном разъяснении не смущайтесь спрашивать.
Больше информации можно найти в ответе от @takkat.
Существует список всех разделенных команд, необходимых для установки VirtualBox.