markdown Debian的系apt-get的强制IPV4

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Debian的系apt-get的强制IPV4相关的知识,希望对你有一定的参考价值。

# Debian系apt-get强制IPV4

Fast command line option
If you want to force the `apt-get` to use IPv4 or IPv6 only one time, follow these steps. This feature is available after the 0.9.7.9~exp1 version of apt-get. First, make sure your version of apt-get is newer than 0.9.7.9~exp1 by running the following command:

```
apt-get --version
```

The result will be something like this:

apt 1.0.1ubuntu2 for amd64 compiled on Oct 28 2014 20:55:14
If the version checks out, then you can force IPv4 with:
```
apt-get -o Acquire::ForceIPv4=true update
```

or IPv6:

```
apt-get -o Acquire::ForceIPv6=true update
```

This will update the repositories resolving the URLs in sources.list to IPv4 only.

Persistent option
To make the setting persistent, create the file 99force-ipv4 in /etc/apt/apt.conf.d/.

sudoedit `/etc/apt/apt.conf.d/99force-ipv4`
Put the following contents in it:

```
Acquire::ForceIPv4 "true";
```

Save the file, and you're good to go. If you want to force IPv6 instead, change the 4 to 6 in the file name and settings. To choose between one of them, test with the fast method and see which works better.

以上是关于markdown Debian的系apt-get的强制IPV4的主要内容,如果未能解决你的问题,请参考以下文章

debian和ubuntu用apt-get安装nodejs

基础:yum(RedHat系列)和apt-get(Debian系列 )用法及区别

debian apt-get 权限被拒绝

debian 用apt-get时出问题

在Debian/Ubuntu系统上获取apt-get的GPG密钥

在debian下用apt-get install zeroc-ice33 安装了ice,如何修改安装路径?