Halo sobat sekolahlinux, kali ini saya akan coba membuat tutorial sederhana dan tidak terlalu wah, namun tutorial ini saya rasa sangat berguna, khususnya bagi saya yang saat ini sedang dalam project pembangunan infra server di client yang tidak dibolehkan medapat akses internet di dalam vm nya, jadi jika ingin install apps maka saya harus download package nya secara manual, namun terkadang satu apps / package memerlukan package lainnya untuk dapat berjalan atau bahasa lainnya dependencies, nah untuk mengakali itu semua saya membuat local repo pada server saya, namun pada tutorial kali ini saya tidak akan membahas bagaimana cara membuat local repo, namun saya akan membahas bagaimana caranya mendownload apps / package yang dibutuhkan beserta dependencies nya pada os ubuntu dan centos tanpa harus menginstall package tersebut di server tempat kita mendownload package nya, oke langsung saja kita mulai
Centos:
secara default yum pada os centos 7 sudah mendukung untuk melakukan download tanpa install, namun jika ternyata belum mendukung maka kamu bisa menginstall package dibawah terlebih dahulu
yum install yum-plugin-downloadonly
jika sudah sekarang mari kita coba untuk melakukan download pada package yang kita inginkan, oh iya jika kita menggunakan metode ini maka biasanya yang terdownload bukan hanya package yang akan kita install saja, tapi juga dependency yang dibutuhkan package tersebut akan ikut terdownload, pertama mari kita buat dahulu folder untuk menampung package & dependency yang akan kita download
mkdir /root/package
selanjutnya kita download package & dependency yang dibutuhkan dengan cara dibawah
yum install --downloadonly --downloaddir=/root/package/ python python-pip
maka prosesnya akan seperti dibawah ini
[root@localhost ~]# yum install --downloadonly --downloaddir=/root/package/ python-pip nginx Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.biz.net.id * epel: mirror01.idc.hinet.net * extras: centos.biz.net.id * updates: centos.biz.net.id Resolving Dependencies --> Running transaction check ---> Package nginx.x86_64 1:1.12.2-2.el7 will be installed --> Processing Dependency: nginx-filesystem = 1:1.12.2-2.el7 for package: 1:nginx-1.12.2-2.el7.x86_64 --> Processing Dependency: nginx-all-modules = 1:1.12.2-2.el7 for package: 1:nginx-1.12.2-2.el7.x86_64 --> Processing Dependency: nginx-filesystem for package: 1:nginx-1.12.2-2.el7.x86_64 --> Processing Dependency: libprofiler.so.0()(64bit) for package: 1:nginx-1.12.2-2.el7.x86_64 ---> Package python2-pip.noarch 0:8.1.2-6.el7 will be installed --> Processing Dependency: python-setuptools for package: python2-pip-8.1.2-6.el7.noarch --> Running transaction check ---> Package gperftools-libs.x86_64 0:2.6.1-1.el7 will be installed ---> Package nginx-all-modules.noarch 1:1.12.2-2.el7 will be installed --> Processing Dependency: nginx-mod-stream = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch --> Processing Dependency: nginx-mod-mail = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch --> Processing Dependency: nginx-mod-http-xslt-filter = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch --> Processing Dependency: nginx-mod-http-perl = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch --> Processing Dependency: nginx-mod-http-image-filter = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch --> Processing Dependency: nginx-mod-http-geoip = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch ---> Package nginx-filesystem.noarch 1:1.12.2-2.el7 will be installed ---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed --> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-7.el7.noarch --> Running transaction check ---> Package nginx-mod-http-geoip.x86_64 1:1.12.2-2.el7 will be installed ---> Package nginx-mod-http-image-filter.x86_64 1:1.12.2-2.el7 will be installed --> Processing Dependency: gd for package: 1:nginx-mod-http-image-filter-1.12.2-2.el7.x86_64 --> Processing Dependency: libgd.so.2()(64bit) for package: 1:nginx-mod-http-image-filter-1.12.2-2.el7.x86_64 ---> Package nginx-mod-http-perl.x86_64 1:1.12.2-2.el7 will be installed ---> Package nginx-mod-http-xslt-filter.x86_64 1:1.12.2-2.el7 will be installed --> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18)(64bit) for package: 1:nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64 --> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11)(64bit) for package: 1:nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64 --> Processing Dependency: libxslt.so.1()(64bit) for package: 1:nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64 --> Processing Dependency: libexslt.so.0()(64bit) for package: 1:nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64 ---> Package nginx-mod-mail.x86_64 1:1.12.2-2.el7 will be installed ---> Package nginx-mod-stream.x86_64 1:1.12.2-2.el7 will be installed ---> Package python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 will be installed --> Processing Dependency: python-ipaddress for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch --> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch --> Running transaction check ---> Package gd.x86_64 0:2.0.35-26.el7 will be installed --> Processing Dependency: libpng15.so.15(PNG15_0)(64bit) for package: gd-2.0.35-26.el7.x86_64 --> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: gd-2.0.35-26.el7.x86_64 --> Processing Dependency: libpng15.so.15()(64bit) for package: gd-2.0.35-26.el7.x86_64 --> Processing Dependency: libjpeg.so.62()(64bit) for package: gd-2.0.35-26.el7.x86_64 --> Processing Dependency: libfontconfig.so.1()(64bit) for package: gd-2.0.35-26.el7.x86_64 --> Processing Dependency: libXpm.so.4()(64bit) for package: gd-2.0.35-26.el7.x86_64 --> Processing Dependency: libX11.so.6()(64bit) for package: gd-2.0.35-26.el7.x86_64 ---> Package libxslt.x86_64 0:1.1.28-5.el7 will be installed ---> Package python-backports.x86_64 0:1.0-8.el7 will be installed ---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed --> Running transaction check ---> Package fontconfig.x86_64 0:2.10.95-11.el7 will be installed --> Processing Dependency: fontpackages-filesystem for package: fontconfig-2.10.95-11.el7.x86_64 --> Processing Dependency: font(:lang=en) for package: fontconfig-2.10.95-11.el7.x86_64 ---> Package libX11.x86_64 0:1.6.5-1.el7 will be installed --> Processing Dependency: libX11-common >= 1.6.5-1.el7 for package: libX11-1.6.5-1.el7.x86_64 --> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.5-1.el7.x86_64 ---> Package libXpm.x86_64 0:3.5.12-1.el7 will be installed ---> Package libjpeg-turbo.x86_64 0:1.2.90-5.el7 will be installed ---> Package libpng.x86_64 2:1.5.13-7.el7_2 will be installed --> Running transaction check ---> Package fontpackages-filesystem.noarch 0:1.44-8.el7 will be installed ---> Package libX11-common.noarch 0:1.6.5-1.el7 will be installed ---> Package libxcb.x86_64 0:1.12-1.el7 will be installed --> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.12-1.el7.x86_64 ---> Package lyx-fonts.noarch 0:2.2.3-1.el7 will be installed --> Running transaction check ---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================= Package Arch Version Repository Size ======================================================================================================================================= Installing: nginx x86_64 1:1.12.2-2.el7 epel 530 k python2-pip noarch 8.1.2-6.el7 epel 1.7 M Installing for dependencies: fontconfig x86_64 2.10.95-11.el7 base 229 k fontpackages-filesystem noarch 1.44-8.el7 base 9.9 k gd x86_64 2.0.35-26.el7 base 146 k gperftools-libs x86_64 2.6.1-1.el7 base 272 k libX11 x86_64 1.6.5-1.el7 base 606 k libX11-common noarch 1.6.5-1.el7 base 164 k libXau x86_64 1.0.8-2.1.el7 base 29 k libXpm x86_64 3.5.12-1.el7 base 55 k libjpeg-turbo x86_64 1.2.90-5.el7 base 134 k libpng x86_64 2:1.5.13-7.el7_2 base 213 k libxcb x86_64 1.12-1.el7 base 211 k libxslt x86_64 1.1.28-5.el7 base 242 k lyx-fonts noarch 2.2.3-1.el7 epel 159 k nginx-all-modules noarch 1:1.12.2-2.el7 epel 16 k nginx-filesystem noarch 1:1.12.2-2.el7 epel 17 k nginx-mod-http-geoip x86_64 1:1.12.2-2.el7 epel 23 k nginx-mod-http-image-filter x86_64 1:1.12.2-2.el7 epel 26 k nginx-mod-http-perl x86_64 1:1.12.2-2.el7 epel 36 k nginx-mod-http-xslt-filter x86_64 1:1.12.2-2.el7 epel 26 k nginx-mod-mail x86_64 1:1.12.2-2.el7 epel 54 k nginx-mod-stream x86_64 1:1.12.2-2.el7 epel 76 k python-backports x86_64 1.0-8.el7 base 5.8 k python-backports-ssl_match_hostname noarch 3.5.0.1-1.el7 base 13 k python-ipaddress noarch 1.0.16-2.el7 base 34 k python-setuptools noarch 0.9.8-7.el7 base 397 k Transaction Summary ======================================================================================================================================= Install 2 Packages (+25 Dependent packages) Total size: 5.3 M Installed size: 19 M Background downloading packages, then exiting: exiting because "Download Only" specified
isi dari folder /root/package
[root@localhost ~]# ll -h /root/package/ total 5,5M -rw-r--r--. 1 root root 230K Aug 10 2017 fontconfig-2.10.95-11.el7.x86_64.rpm -rw-r--r--. 1 root root 9,9K Jul 4 2014 fontpackages-filesystem-1.44-8.el7.noarch.rpm -rw-r--r--. 1 root root 146K Jul 4 2014 gd-2.0.35-26.el7.x86_64.rpm -rw-r--r--. 1 root root 273K Apr 25 18:02 gperftools-libs-2.6.1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 135K Jul 4 2014 libjpeg-turbo-1.2.90-5.el7.x86_64.rpm -rw-r--r--. 1 root root 213K Dec 10 2015 libpng-1.5.13-7.el7_2.x86_64.rpm -rw-r--r--. 1 root root 607K Aug 11 2017 libX11-1.6.5-1.el7.x86_64.rpm -rw-r--r--. 1 root root 164K Aug 11 2017 libX11-common-1.6.5-1.el7.noarch.rpm -rw-r--r--. 1 root root 30K Jul 4 2014 libXau-1.0.8-2.1.el7.x86_64.rpm -rw-r--r--. 1 root root 211K Aug 11 2017 libxcb-1.12-1.el7.x86_64.rpm -rw-r--r--. 1 root root 56K Aug 11 2017 libXpm-3.5.12-1.el7.x86_64.rpm -rw-r--r--. 1 root root 242K Jul 4 2014 libxslt-1.1.28-5.el7.x86_64.rpm -rw-r--r--. 1 root root 160K May 28 2017 lyx-fonts-2.2.3-1.el7.noarch.rpm -rw-r--r--. 1 root root 531K Mar 6 2018 nginx-1.12.2-2.el7.x86_64.rpm -rw-r--r--. 1 root root 17K Mar 6 2018 nginx-all-modules-1.12.2-2.el7.noarch.rpm -rw-r--r--. 1 root root 18K Mar 6 2018 nginx-filesystem-1.12.2-2.el7.noarch.rpm -rw-r--r--. 1 root root 24K Mar 6 2018 nginx-mod-http-geoip-1.12.2-2.el7.x86_64.rpm -rw-r--r--. 1 root root 27K Mar 6 2018 nginx-mod-http-image-filter-1.12.2-2.el7.x86_64.rpm -rw-r--r--. 1 root root 36K Mar 6 2018 nginx-mod-http-perl-1.12.2-2.el7.x86_64.rpm -rw-r--r--. 1 root root 26K Mar 6 2018 nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64.rpm -rw-r--r--. 1 root root 54K Mar 6 2018 nginx-mod-mail-1.12.2-2.el7.x86_64.rpm -rw-r--r--. 1 root root 77K Mar 6 2018 nginx-mod-stream-1.12.2-2.el7.x86_64.rpm -rw-r--r--. 1 root root 1,7M Apr 4 20:30 python2-pip-8.1.2-6.el7.noarch.rpm -rw-r--r--. 1 root root 5,8K Mar 14 2015 python-backports-1.0-8.el7.x86_64.rpm -rw-r--r--. 1 root root 13K Apr 25 18:38 python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm -rw-r--r--. 1 root root 35K Nov 21 2016 python-ipaddress-1.0.16-2.el7.noarch.rpm -rw-r--r--. 1 root root 397K Aug 11 2017 python-setuptools-0.9.8-7.el7.noarch.rpm
lalu bagaimana jika saya ingin mendownload package berdasarkan group, misal group development tools
kamu bisa dengan menggunakan cara dibawah ini
yum group install --downloadonly --downloaddir=/root/package/ "development tools"
maka file-file package pada group development tools
akan terdownload
Ubuntu:
pada ubuntu kita juga melakukan hal yang sama seperti yang kita lakukan pada centos, namun pada prakteknya akan sedikit berbeda, misal jika pada centos kita bisa menentukan di folder mana package yang kita download akan di letakan, pada ubuntu sudah ada folder sendiri yang memang by default system ubuntu tetapkan yaitu di `/var/cache/apt/archives` oke langsung saja mari kita mencoba implementasinya
apt-get install --download-only apache2 nginx
maka prosesnya akan seperti dibawah ini
Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: apache2-bin apache2-data apache2-utils fontconfig-config libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8 liblua5.1-0 libtiff5 libvpx3 libxpm4 nginx-common nginx-core ssl-cert Suggested packages: www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom libgd-tools fcgiwrap nginx-doc openssl-blacklist The following NEW packages will be installed: apache2 apache2-bin apache2-data apache2-utils fontconfig-config libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8 liblua5.1-0 libtiff5 libvpx3 libxpm4 nginx nginx-common nginx-core ssl-cert 0 upgraded, 22 newly installed, 0 to remove and 10 not upgraded. Need to get 3375 kB of archives. After this operation, 12.7 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libapr1 amd64 1.5.2-3 [86.0 kB] Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1 amd64 1.5.4-1build1 [77.1 kB] Get:3 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1-dbd-sqlite3 amd64 1.5.4-1build1 [10.6 kB] Get:4 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1-ldap amd64 1.5.4-1build1 [8720 B] Get:5 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 liblua5.1-0 amd64 5.1.5-8ubuntu1 [102 kB] Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2-bin amd64 2.4.18-2ubuntu3.9 [925 kB] Get:7 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2-utils amd64 2.4.18-2ubuntu3.9 [81.8 kB] Get:8 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2-data all 2.4.18-2ubuntu3.9 [162 kB] Get:9 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2 amd64 2.4.18-2ubuntu3.9 [86.6 kB] Get:10 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libjpeg-turbo8 amd64 1.4.2-0ubuntu3.1 [111 kB] Get:11 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libjbig0 amd64 2.1-3.1 [26.6 kB] Get:12 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 fontconfig-config all 2.11.94-0ubuntu1.1 [49.9 kB] Get:13 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libfontconfig1 amd64 2.11.94-0ubuntu1.1 [131 kB] Get:14 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libjpeg8 amd64 8c-2ubuntu8 [2194 B] Get:15 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libtiff5 amd64 4.0.6-1ubuntu0.4 [148 kB] Get:16 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libvpx3 amd64 1.5.0-2ubuntu1 [732 kB] Get:17 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libxpm4 amd64 1:3.5.11-1ubuntu0.16.04.1 [33.8 kB] Get:18 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgd3 amd64 2.1.1-4ubuntu0.16.04.10 [126 kB] Get:19 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx-common all 1.10.3-0ubuntu0.16.04.2 [26.6 kB] Get:20 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx-core amd64 1.10.3-0ubuntu0.16.04.2 [428 kB] Get:21 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx all 1.10.3-0ubuntu0.16.04.2 [3490 B] Get:22 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 ssl-cert all 1.0.37 [16.9 kB] Fetched 3375 kB in 29s (115 kB/s) Download complete and in download only mode
selanjutnya mari kita coba cek isi dari folder `/var/cache/apt/archives` maka hasilnya package dan dependency yang terdownload akan seperti dibawah
root@ubuntu:/var/cache/apt/archives# ll total 3364 drwxr-xr-x 3 root root 12288 Sep 6 22:24 ./ drwxr-xr-x 3 root root 4096 Sep 6 22:22 ../ -rw-r--r-- 1 root root 924572 Jun 13 22:08 apache2-bin_2.4.18-2ubuntu3.9_amd64.deb -rw-r--r-- 1 root root 162048 Jun 13 22:08 apache2-data_2.4.18-2ubuntu3.9_all.deb -rw-r--r-- 1 root root 81812 Jun 13 22:08 apache2-utils_2.4.18-2ubuntu3.9_amd64.deb -rw-r--r-- 1 root root 86570 Jun 13 22:08 apache2_2.4.18-2ubuntu3.9_amd64.deb -rw-r--r-- 1 root root 49934 Aug 17 2016 fontconfig-config_2.11.94-0ubuntu1.1_all.deb -rw-r--r-- 1 root root 85958 Aug 21 2015 libapr1_1.5.2-3_amd64.deb -rw-r--r-- 1 root root 10594 Apr 5 2016 libaprutil1-dbd-sqlite3_1.5.4-1build1_amd64.deb -rw-r--r-- 1 root root 8720 Apr 5 2016 libaprutil1-ldap_1.5.4-1build1_amd64.deb -rw-r--r-- 1 root root 77084 Apr 5 2016 libaprutil1_1.5.4-1build1_amd64.deb -rw-r--r-- 1 root root 131248 Aug 17 2016 libfontconfig1_2.11.94-0ubuntu1.1_amd64.deb -rw-r--r-- 1 root root 125666 Aug 27 21:38 libgd3_2.1.1-4ubuntu0.16.04.10_amd64.deb -rw-r--r-- 1 root root 26562 Nov 10 2014 libjbig0_2.1-3.1_amd64.deb -rw-r--r-- 1 root root 110614 Jul 9 23:38 libjpeg-turbo8_1.4.2-0ubuntu3.1_amd64.deb -rw-r--r-- 1 root root 2194 Jul 9 2013 libjpeg8_8c-2ubuntu8_amd64.deb -rw-r--r-- 1 root root 102450 Apr 14 2016 liblua5.1-0_5.1.5-8ubuntu1_amd64.deb -rw-r--r-- 1 root root 148100 Mar 26 18:53 libtiff5_4.0.6-1ubuntu0.4_amd64.deb -rw-r--r-- 1 root root 731668 Apr 6 2016 libvpx3_1.5.0-2ubuntu1_amd64.deb -rw-r--r-- 1 root root 33818 Feb 2 2017 libxpm4_1%3a3.5.11-1ubuntu0.16.04.1_amd64.deb -rw-r----- 1 root root 0 Sep 6 22:24 lock -rw-r--r-- 1 root root 26614 Jul 14 2017 nginx-common_1.10.3-0ubuntu0.16.04.2_all.deb -rw-r--r-- 1 root root 428290 Jul 14 2017 nginx-core_1.10.3-0ubuntu0.16.04.2_amd64.deb -rw-r--r-- 1 root root 3490 Jul 14 2017 nginx_1.10.3-0ubuntu0.16.04.2_all.deb drwx------ 2 _apt root 4096 Sep 6 22:24 partial/ -rw-r--r-- 1 root root 16874 Aug 17 2015 ssl-cert_1.0.37_all.deb
yak kurang lebih sekian tutorial kali ini, semoga bermanfaat ya 😀