How to disable IPv6 in Ubuntu 14.04

I am tired of trying to update Ubuntu and see that it is trying to use the IPv6 that hangs the installation (ocasionally forever). My solution still is to disable IPv6 until it is properly used, so this time…

I learned how to disable IPv6 in Ubuntu 14.04

There are a lot of resources on how to disable IPv6 in Ubuntu 14.04, and this is yet another one (but this is mine).

It is as easy as

$ sudo su -
$ cat >> /etc/sysctl.conf << EOT
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
EOT
$ sysctl -p

To check if it has worked, you can issue a command like

$ cat /proc/sys/net/ipv6/conf/all/disable_ipv6

If it returns 1, it has been properly disabled. Otherwise try to reboot and check it again.