Автоматически устанавливать пакеты / зависимости для установки произвольного пакета?
сценарий
Когда я начинаю с новой установки Ubuntu 16.04, моя цель - установить и использовать пакет исключительно default-jre
как можно быстрее для целей отладки. Я могу установить это, выполнив команды:
yes | sudo apt update && sudo apt upgrade
а также:
yes | sudo apt install default-jre
Однако первая команда занимает примерно 30 минут на моем текущем устройстве, и, хотя это отличное упражнение, которое хорошо продумывает мой код перед его запуском, я пытаюсь увеличить скорость, с которой я могу тестировать свой код, что означает увеличение скорости. с помощью которого я могу выполнить .jar
файл, начиная со свежей установки Ubuntu 16.04.
попытки
Сначала я исключительно побежал:
yes | sudo apt install default-jre
И это вернулось:
a@DESKTOP-:~$ yes | sudo apt install default-jre --fix-missing
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ca-certificates-java default-jre-headless fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-extra
hicolor-icon-theme java-common libasound2 libasound2-data libasyncns0 libatk1.0-0 libatk1.0-data libavahi-client3
libavahi-common-data libavahi-common3 libcairo2 libcups2 libdatrie1 libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2
libdrm-radeon1 libflac8 libfontconfig1 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgif7 libgl1-mesa-dri
libgl1-mesa-glx libglapi-mesa libgraphite2-3 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libharfbuzz0b libjbig0
libjpeg-turbo8 libjpeg8 liblcms2-2 libllvm6.0 libnspr4 libnss3 libnss3-nssdb libogg0 libpango-1.0-0
libpangocairo-1.0-0 libpangoft2-1.0-0 libpciaccess0 libpcsclite1 libpixman-1-0 libpulse0 libsensors4 libsndfile1
libthai-data libthai0 libtiff5 libtxc-dxtn-s2tc0 libvorbis0a libvorbisenc2 libx11-xcb1 libxcb-dri2-0 libxcb-dri3-0
libxcb-glx0 libxcb-present0 libxcb-render0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1 libxdamage1
libxfixes3 libxi6 libxinerama1 libxrandr2 libxrender1 libxshmfence1 libxtst6 libxxf86vm1 openjdk-8-jre
openjdk-8-jre-headless x11-common
Suggested packages:
default-java-plugin libasound2-plugins alsa-utils cups-common librsvg2-common gvfs liblcms2-utils pcscd pulseaudio
lm-sensors icedtea-8-plugin libnss-mdns fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei
fonts-wqy-zenhei fonts-indic
The following NEW packages will be installed:
ca-certificates-java default-jre default-jre-headless fontconfig fontconfig-config fonts-dejavu-core
fonts-dejavu-extra hicolor-icon-theme java-common libasound2 libasound2-data libasyncns0 libatk1.0-0 libatk1.0-data
libavahi-client3 libavahi-common-data libavahi-common3 libcairo2 libcups2 libdatrie1 libdrm-amdgpu1 libdrm-intel1
libdrm-nouveau2 libdrm-radeon1 libflac8 libfontconfig1 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgif7
libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libgraphite2-3 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common
libharfbuzz0b libjbig0 libjpeg-turbo8 libjpeg8 liblcms2-2 libllvm6.0 libnspr4 libnss3 libnss3-nssdb libogg0
libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpciaccess0 libpcsclite1 libpixman-1-0 libpulse0 libsensors4
libsndfile1 libthai-data libthai0 libtiff5 libtxc-dxtn-s2tc0 libvorbis0a libvorbisenc2 libx11-xcb1 libxcb-dri2-0
libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1
libxdamage1 libxfixes3 libxi6 libxinerama1 libxrandr2 libxrender1 libxshmfence1 libxtst6 libxxf86vm1 openjdk-8-jre
openjdk-8-jre-headless x11-common
0 upgraded, 83 newly installed, 0 to remove and 0 not upgraded.
Need to get 28.8 MB/57.9 MB of archives.
After this operation, 341 MB of additional disk space will be used.
Err:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libavahi-common-data amd64 0.6.32~rc+dfsg-1ubuntu2.2
404 Not Found [IP: 91.189.88.161 80]
Err:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libavahi-common3 amd64 0.6.32~rc+dfsg-1ubuntu2.2
404 Not Found [IP: 91.189.88.161 80]
Err:3 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libavahi-client3 amd64 0.6.32~rc+dfsg-1ubuntu2.2
404 Not Found [IP: 91.189.88.161 80]
Err:4 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libcups2 amd64 2.1.3-4ubuntu0.5
404 Not Found [IP: 91.189.88.161 80]
Ign:5 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libnss3-nssdb all 2:3.28.4-0ubuntu0.16.04.3
Ign:6 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libnss3 amd64 2:3.28.4-0ubuntu0.16.04.3
Ign:7 http://security.ubuntu.com/ubuntu xenial-security/main amd64 openjdk-8-jre-headless amd64 8u181-b13-0ubuntu0.16.04.1
Ign:8 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libtiff5 amd64 4.0.6-1ubuntu0.4
Err:9 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgdk-pixbuf2.0-common all 2.32.2-1ubuntu1.5
404 Not Found [IP: 91.189.88.161 80]
Err:10 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgdk-pixbuf2.0-0 amd64 2.32.2-1ubuntu1.5
404 Not Found [IP: 91.189.88.161 80]
Ign:11 http://security.ubuntu.com/ubuntu xenial-security/main amd64 openjdk-8-jre amd64 8u181-b13-0ubuntu0.16.04.1
Err:4 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libcups2 amd64 2.1.3-4ubuntu0.5
404 Not Found [IP: 91.189.88.161 80]
Err:5 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libnss3-nssdb all 2:3.28.4-0ubuntu0.16.04.3
404 Not Found [IP: 91.189.88.161 80]
Err:6 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libnss3 amd64 2:3.28.4-0ubuntu0.16.04.3
404 Not Found [IP: 91.189.88.161 80]
Err:7 http://security.ubuntu.com/ubuntu xenial-security/main amd64 openjdk-8-jre-headless amd64 8u181-b13-0ubuntu0.16.04.1
404 Not Found [IP: 91.189.88.161 80]
Err:8 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libtiff5 amd64 4.0.6-1ubuntu0.4
404 Not Found [IP: 91.189.88.161 80]
Err:11 http://security.ubuntu.com/ubuntu xenial-security/main amd64 openjdk-8-jre amd64 8u181-b13-0ubuntu0.16.04.1
404 Not Found [IP: 91.189.88.161 80]
Unable to correct missing packages.
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/avahi/libavahi-common-data_0.6.32~rc+dfsg-1ubuntu2.2_amd64.deb
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/avahi/libavahi-common3_0.6.32~rc+dfsg-1ubuntu2.2_amd64.deb
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/avahi/libavahi-client3_0.6.32~rc+dfsg-1ubuntu2.2_amd64.deb
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/c/cups/libcups2_2.1.3-4ubuntu0.5_amd64.deb
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/nss/libnss3-nssdb_3.28.4-0ubuntu0.16.04.3_all.deb
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/nss/libnss3_3.28.4-0ubuntu0.16.04.3_amd64.deb
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openjdk-8/openjdk-8-jre-headless_8u181-b13-0ubuntu0.16.04.1_amd64.deb
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/t/tiff/libtiff5_4.0.6-1ubuntu0.4_amd64.deb
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/gdk-pixbuf/libgdk-pixbuf2.0-common_2.32.2-1ubuntu1.5_all.deb
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/gdk-pixbuf/libgdk-pixbuf2.0-0_2.32.2-1ubuntu1.5_amd64.deb
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openjdk-8/openjdk-8-jre_8u181-b13-0ubuntu0.16.04.1_amd64.deb
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/gdk-pixbuf/libgdk-pixbuf2.0-common_2.32.2-1ubuntu1.5_all.deb
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/gdk-pixbuf/libgdk-pixbuf2.0-0_2.32.2-1ubuntu1.5_amd64.deb
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openjdk-8/openjdk-8-jre_8u181-b13-0ubuntu0.16.04.1_amd64.deb
404 Not Found [IP: 91.189.88.161 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Поэтому я попытался:
yes | sudo apt install default-jre --fix-missing
Но это вернулось:
a@DESKTOP-:~$ yes | sudo apt install default-jre --fix-missing
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ca-certificates-java default-jre-headless fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-extra
hicolor-icon-theme java-common libasound2 libasound2-data libasyncns0 libatk1.0-0 libatk1.0-data libavahi-client3
libavahi-common-data libavahi-common3 libcairo2 libcups2 libdatrie1 libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2
libdrm-radeon1 libflac8 libfontconfig1 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgif7 libgl1-mesa-dri
libgl1-mesa-glx libglapi-mesa libgraphite2-3 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libharfbuzz0b libjbig0
libjpeg-turbo8 libjpeg8 liblcms2-2 libllvm6.0 libnspr4 libnss3 libnss3-nssdb libogg0 libpango-1.0-0
libpangocairo-1.0-0 libpangoft2-1.0-0 libpciaccess0 libpcsclite1 libpixman-1-0 libpulse0 libsensors4 libsndfile1
libthai-data libthai0 libtiff5 libtxc-dxtn-s2tc0 libvorbis0a libvorbisenc2 libx11-xcb1 libxcb-dri2-0 libxcb-dri3-0
libxcb-glx0 libxcb-present0 libxcb-render0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1 libxdamage1
libxfixes3 libxi6 libxinerama1 libxrandr2 libxrender1 libxshmfence1 libxtst6 libxxf86vm1 openjdk-8-jre
openjdk-8-jre-headless x11-common
Suggested packages:
default-java-plugin libasound2-plugins alsa-utils cups-common librsvg2-common gvfs liblcms2-utils pcscd pulseaudio
lm-sensors icedtea-8-plugin libnss-mdns fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei
fonts-wqy-zenhei fonts-indic
The following NEW packages will be installed:
ca-certificates-java default-jre default-jre-headless fontconfig fontconfig-config fonts-dejavu-core
fonts-dejavu-extra hicolor-icon-theme java-common libasound2 libasound2-data libasyncns0 libatk1.0-0 libatk1.0-data
libavahi-client3 libavahi-common-data libavahi-common3 libcairo2 libcups2 libdatrie1 libdrm-amdgpu1 libdrm-intel1
libdrm-nouveau2 libdrm-radeon1 libflac8 libfontconfig1 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgif7
libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libgraphite2-3 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common
libharfbuzz0b libjbig0 libjpeg-turbo8 libjpeg8 liblcms2-2 libllvm6.0 libnspr4 libnss3 libnss3-nssdb libogg0
libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpciaccess0 libpcsclite1 libpixman-1-0 libpulse0 libsensors4
libsndfile1 libthai-data libthai0 libtiff5 libtxc-dxtn-s2tc0 libvorbis0a libvorbisenc2 libx11-xcb1 libxcb-dri2-0
libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1
libxdamage1 libxfixes3 libxi6 libxinerama1 libxrandr2 libxrender1 libxshmfence1 libxtst6 libxxf86vm1 openjdk-8-jre
openjdk-8-jre-headless x11-common
0 upgraded, 83 newly installed, 0 to remove and 0 not upgraded.
Need to get 28.8 MB/57.9 MB of archives.
After this operation, 341 MB of additional disk space will be used.
Err:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libavahi-common-data amd64 0.6.32~rc+dfsg-1ubuntu2.2
404 Not Found [IP: 91.189.88.161 80]
Err:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libavahi-common3 amd64 0.6.32~rc+dfsg-1ubuntu2.2
404 Not Found [IP: 91.189.88.161 80]
Err:3 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libavahi-client3 amd64 0.6.32~rc+dfsg-1ubuntu2.2
404 Not Found [IP: 91.189.88.161 80]
Err:4 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libcups2 amd64 2.1.3-4ubuntu0.5
404 Not Found [IP: 91.189.88.161 80]
Ign:5 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libnss3-nssdb all 2:3.28.4-0ubuntu0.16.04.3
Ign:6 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libnss3 amd64 2:3.28.4-0ubuntu0.16.04.3
Ign:7 http://security.ubuntu.com/ubuntu xenial-security/main amd64 openjdk-8-jre-headless amd64 8u181-b13-0ubuntu0.16.04.1
Ign:8 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libtiff5 amd64 4.0.6-1ubuntu0.4
Err:9 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgdk-pixbuf2.0-common all 2.32.2-1ubuntu1.5
404 Not Found [IP: 91.189.88.161 80]
Err:10 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgdk-pixbuf2.0-0 amd64 2.32.2-1ubuntu1.5
404 Not Found [IP: 91.189.88.161 80]
Ign:11 http://security.ubuntu.com/ubuntu xenial-security/main amd64 openjdk-8-jre amd64 8u181-b13-0ubuntu0.16.04.1
Err:4 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libcups2 amd64 2.1.3-4ubuntu0.5
404 Not Found [IP: 91.189.88.161 80]
Err:5 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libnss3-nssdb all 2:3.28.4-0ubuntu0.16.04.3
404 Not Found [IP: 91.189.88.161 80]
Err:6 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libnss3 amd64 2:3.28.4-0ubuntu0.16.04.3
404 Not Found [IP: 91.189.88.161 80]
Err:7 http://security.ubuntu.com/ubuntu xenial-security/main amd64 openjdk-8-jre-headless amd64 8u181-b13-0ubuntu0.16.04.1
404 Not Found [IP: 91.189.88.161 80]
Err:8 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libtiff5 amd64 4.0.6-1ubuntu0.4
404 Not Found [IP: 91.189.88.161 80]
Err:11 http://security.ubuntu.com/ubuntu xenial-security/main amd64 openjdk-8-jre amd64 8u181-b13-0ubuntu0.16.04.1
404 Not Found [IP: 91.189.88.161 80]
Unable to correct missing packages.
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/avahi/libavahi-common-data_0.6.32~rc+dfsg-1ubuntu2.2_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/avahi/libavahi-common3_0.6.32~rc+dfsg-1ubuntu2.2_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/avahi/libavahi-client3_0.6.32~rc+dfsg-1ubuntu2.2_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/c/cups/libcups2_2.1.3-4ubuntu0.5_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/nss/libnss3-nssdb_3.28.4-0ubuntu0.16.04.3_all.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/nss/libnss3_3.28.4-0ubuntu0.16.04.3_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openjdk-8/openjdk-8-jre-headless_8u181-b13-0ubuntu0.16.04.1_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/t/tiff/libtiff5_4.0.6-1ubuntu0.4_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/gdk-pixbuf/libgdk-pixbuf2.0-common_2.32.2-1ubuntu1.5_all.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/gdk-pixbuf/libgdk-pixbuf2.0-0_2.32.2-1ubuntu1.5_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openjdk-8/openjdk-8-jre_8u181-b13-0ubuntu0.16.04.1_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Aborting install.
На основе Как запустить "apt-get install" для установки всех зависимостей? Я попробовал следующую команду после yes | sudo apt install default-jre
вернулся возможно беги --fix-missing
?
sudo apt-get install -f
Который вернулся:
DESKTOP-:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libfreetype6
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Теперь, используя обратную связь yes | sudo apt install default-jre
Я мог бы выбрать требуемые пакеты и сгенерировать список команд, которые устанавливают эти пакеты, которые потенциально могут обойти sudo apt update && sudo apt upgrade
команда.
Вопрос
Но мне было любопытно, есть ли команда, которая автоматически устанавливает необходимые пакеты / зависимости, когда вы запускаете ее для установки <some package>
?
1 ответ
Вы получаете 404 ошибки, потому что индексы пакетов, которые идут с вашей новой установкой, устарели, следовательно, они заставляют Apt пытаться получить старые пакеты, которые больше не существуют. Чтобы обновить ваши индексы, вы должны запустить sudo apt update
, Бег sudo apt upgrade
однако не требуется, в том смысле, что sudo apt install default-jre
будет работать, даже если ты не бежишь sudo apt upgrade
, Однако, если он не будет запущен, у вас останутся устаревшие пакеты, которые могут содержать ошибки. Действуйте на свой страх и риск.