force ipv4 pada server linux debian dan ubuntu

force ipv4

Pada sebuah kasus ipv6 kadang lama sekali ga update, seperti pada kasusnya beberapa cloud server di luar negri, saya disini akan berbagi cara mengatasinya,

cukup ketikan perintah

apt-get -o Acquire::ForceIPv4=true update

berikut log pada server saya

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Mar 2 20:43:34 2017
root@localhost:~# curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash –

Installing the NodeSource Node.js v8.x repo…

Populating apt-get cache…

  • apt-get update
    Ign http://mirrors.linode.com jessie InRelease
    Get:1 http://mirrors.linode.com jessie-updates InRelease [145 kB]
    Get:2 http://mirrors.linode.com jessie Release.gpg [2,373 B]
    Get:3 http://mirrors.linode.com jessie Release [148 kB]
    Get:4 http://mirrors.linode.com jessie-updates/main Sources [15.7 kB]
    Get:5 http://mirrors.linode.com jessie-updates/main amd64 Packages/DiffIndex [8,392 B]
    Get:6 http://mirrors.linode.com jessie-updates/main Translation-en/DiffIndex [3,196 B]
    Get:7 http://mirrors.linode.com jessie/main Sources [7,055 kB]
    Get:8 http://mirrors.linode.com jessie/main amd64 Packages [6,790 kB]
    Get:9 http://mirrors.linode.com jessie/main Translation-en [4,583 kB]
    Get:10 http://mirrors.linode.com jessie-updates/main amd64 2017-03-14-2025.02.pdiff [526 B]
    Get:11 http://mirrors.linode.com jessie-updates/main amd64 2017-04-15-2027.16.pdiff [528 B]
    Get:12 http://mirrors.linode.com jessie-updates/main amd64 2017-06-18-1416.03.pdiff [473 B]
    Get:13 http://mirrors.linode.com jessie-updates/main 2017-06-18-1416.03.pdiff [196 B]
    Get:14 http://mirrors.linode.com jessie-updates/main amd64 2017-06-18-1416.03.pdiff [473 B]
    Get:15 http://mirrors.linode.com jessie-updates/main 2017-06-18-1416.03.pdiff [196 B]
    100% [Connecting to security.debian.org (2607:ea00:101:3c0b::1deb:215)]^Croot@localhost:~#
    root@localhost:~#
    root@localhost:~#
    root@localhost:~# apt-get -o Acquire::ForceIPv4=true update
    Ign http://mirrors.linode.com jessie InRelease
    Hit http://mirrors.linode.com jessie-updates InRelease
    Hit http://mirrors.linode.com jessie Release.gpg
    Hit http://mirrors.linode.com jessie Release
    Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
    Get:2 http://mirrors.linode.com jessie-updates/main amd64 Packages/DiffIndex [8,392 B]
    Get:3 http://mirrors.linode.com jessie-updates/main Translation-en/DiffIndex [3,196 B]
    Hit http://mirrors.linode.com jessie-updates/main Sources
    Hit http://mirrors.linode.com jessie/main Sources
    Hit http://mirrors.linode.com jessie/main amd64 Packages
    Hit http://mirrors.linode.com jessie/main Translation-en
    Get:4 http://security.debian.org jessie/updates/main Sources [211 kB]
    Get:5 http://security.debian.org jessie/updates/main amd64 Packages [417 kB]
    Get:6 http://security.debian.org jessie/updates/main Translation-en [220 kB]
    Fetched 923 kB in 3s (253 kB/s)
    Reading package lists… Done
    root@localhost:~# curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash –

Installing the NodeSource Node.js v8.x repo…

Populating apt-get cache…

  • apt-get update
    Ign http://mirrors.linode.com jessie InRelease
    Hit http://mirrors.linode.com jessie-updates InRelease
    Hit http://mirrors.linode.com jessie Release.gpg
    Hit http://mirrors.linode.com jessie Release
    Hit http://security.debian.org jessie/updates InRelease
    Hit http://mirrors.linode.com jessie-updates/main Sources
    Get:1 http://mirrors.linode.com jessie-updates/main amd64 Packages/DiffIndex [8,392 B]
    Get:2 http://mirrors.linode.com jessie-updates/main Translation-en/DiffIndex [3,196 B]
    Hit http://mirrors.linode.com jessie/main Sources
    Hit http://mirrors.linode.com jessie/main amd64 Packages
    Hit http://mirrors.linode.com jessie/main Translation-en
    Hit http://security.debian.org jessie/updates/main Sources
    Hit http://security.debian.org jessie/updates/main amd64 Packages
    Hit http://security.debian.org jessie/updates/main Translation-en
    Fetched 11.6 kB in 2s (4,780 B/s)
    Reading package lists… Done

Installing packages required for setup: apt-transport-https…

  • apt-get install -y apt-transport-https > /dev/null 2>&1

Confirming “jessie” is supported…

  • curl -sLf -o /dev/null ‘https://deb.nodesource.com/node_8.x/dists/jessie/Release’

Adding the NodeSource signing key to your keyring…

  • curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add –
    OK

Creating apt sources list file for the NodeSource Node.js v8.x repo…

  • echo ‘deb https://deb.nodesource.com/node_8.x jessie main’ > /etc/apt/sources.list.d/nodesource.list
  • echo ‘deb-src https://deb.nodesource.com/node_8.x jessie main’ >> /etc/apt/sources.list.d/nodesource.list

Running apt-get update for you…

  • apt-get update
    Ign http://mirrors.linode.com jessie InRelease
    Hit http://mirrors.linode.com jessie-updates InRelease
    Hit http://security.debian.org jessie/updates InRelease
    Hit http://mirrors.linode.com jessie Release.gpg
    Hit http://mirrors.linode.com jessie Release
    Hit http://mirrors.linode.com jessie-updates/main Sources
    Get:1 https://deb.nodesource.com jessie InRelease [4,634 B]
    Get:2 http://mirrors.linode.com jessie-updates/main amd64 Packages/DiffIndex [8,392 B]
    Get:3 http://mirrors.linode.com jessie-updates/main Translation-en/DiffIndex [3,196 B]
    Hit http://security.debian.org jessie/updates/main Sources
    Hit http://mirrors.linode.com jessie/main Sources
    Hit http://mirrors.linode.com jessie/main amd64 Packages
    Hit http://mirrors.linode.com jessie/main Translation-en
    Hit http://security.debian.org jessie/updates/main amd64 Packages
    Hit http://security.debian.org jessie/updates/main Translation-en
    Get:4 https://deb.nodesource.com jessie/main Sources [762 B]
    Get:5 https://deb.nodesource.com jessie/main amd64 Packages [970 B]
    Get:6 https://deb.nodesource.com jessie/main Translation-en_US [162 B]
    Get:7 https://deb.nodesource.com jessie/main Translation-en [162 B]
    Get:8 https://deb.nodesource.com jessie/main Translation-en_US [162 B]
    Get:9 https://deb.nodesource.com jessie/main Translation-en [162 B]
    Get:10 https://deb.nodesource.com jessie/main Translation-en_US [162 B]
    Get:11 https://deb.nodesource.com jessie/main Translation-en [162 B]
    Get:12 https://deb.nodesource.com jessie/main Translation-en_US [162 B]
    Get:13 https://deb.nodesource.com jessie/main Translation-en [162 B]
    Get:14 https://deb.nodesource.com jessie/main Translation-en_US [162 B]
    Ign https://deb.nodesource.com jessie/main Translation-en_US
    Get:15 https://deb.nodesource.com jessie/main Translation-en [162 B]
    Ign https://deb.nodesource.com jessie/main Translation-en
    Fetched 18.0 kB in 2s (7,040 B/s)
    Reading package lists… Done

Run apt-get install nodejs (as root) to install Node.js v8.x and npm

root@localhost:~# sudo apt-get install -y nodejs
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 59 not upgraded.
Need to get 12.7 MB of archives.
After this operation, 64.9 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_8.x/ jessie/main nodejs amd64 8.1.3-1nodesource1~jessie1 [12.7 MB]
Fetched 12.7 MB in 0s (14.7 MB/s)
Selecting previously unselected package nodejs.
(Reading database … 31631 files and directories currently installed.)
Preparing to unpack …/nodejs_8.1.3-1nodesource1~jessie1_amd64.deb …
Unpacking nodejs (8.1.3-1nodesource1~jessie1) …
Processing triggers for man-db (2.7.0.2-5) …
Setting up nodejs (8.1.3-1nodesource1~jessie1) …
root@localhost:~#

credit postingan