Saturday, June 27, 2009

RedHat / Centos Disable IPv6 Networking

Our policy and network configuration does not requires IPv6 support in RHEL / CentOS / Fedora Linux. How do I prevent the kernel module from loading at boot time and disable IPv6 networking?
You can easily prevent the kernel module from loading by updating the following two files:

  1. /etc/modprobe.conf - Kernel driver configuration file.
  2. /etc/sysconfig/network - RHEL / CentOS networking configuration file.

/etc/modprobe.conf
Edit /etc/modprobe.conf, enter:
# vi /etc/modprobe.conf

Append the following line:
install ipv6 /bin/true
Save and close the file.

/etc/sysconfig/network
Edit /etc/sysconfig/network, enter:
# vi /etc/sysconfig/network

Update / add as follows:
NETWORKING_IPV6=no
IPV6INIT=no

Save and close the file. Restart networking service
# service network restart
# rmmod ipv6

Alternatively, simple reboot the box:
# reboot

Verify IPv6 is disabled, enter:
# lsmod | grep ipv6
# /sbin/ifconfig

J A V A in L I N U X

Download the JDK from Oracle. The latest version as of now is Java SE 7u51.

I'm on 64-bit machine, therefore I downloaded jdk-7u51-linux-x64.tar.gz

It's easy to get the tar.gz package as we just have to extract the JDK, I usually extract the JDK to /usr/lib/jvm directory.
cd /usr/lib/jvm/
sudo tar -xf ~/Software/jdk-7u51-linux-x64.tar.gz
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_51/bin/javac" 1
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_51/bin/java" 1
sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.7.0_51/jre/lib/amd64/libnpjp2.so" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_51/bin/javaws" 1

After installing, we should configure each alternative
sudo update-alternatives --config javac
sudo update-alternatives --config java
sudo update-alternatives --config mozilla-javaplugin.so
sudo update-alternatives --config javaws

Now we can configure JAVA_HOME. We can edit ~/.bashrc and add following.
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_51/

Download Oracle JDK on Linux:
$ wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz --no-check-certificate
$ mv jdk-8u5-linux-x64.tar.gz?AuthParam=1399837157_13a216ce71be82d57322314c7d258f1a jdk-8u5-linux-x64.tar.gz

# it will create a directory('jdk1.8.0_05/') under default.
$ tar -zxf jdk-8u5-linux-x64.tar.gz -C /usr/java

# this will change the last modified date of directory recursively
$ find /usr/java/jdk1.8.0_05 -exec touch -t 201103161212.33 {} \;

# this will give randam date
$ find /home -exec touch -t `random` {} \;

################################################################################
[root@anuppc-01 ~]# wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz --no-check-certificate
--2014-05-11 19:37:17--  http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz
Resolving download.oracle.com... 23.67.251.57, 23.67.251.50
Connecting to download.oracle.com|23.67.251.57|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz [following]
--2014-05-11 19:37:17--  https://edelivery.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz
Resolving edelivery.oracle.com... 23.45.38.140
Connecting to edelivery.oracle.com|23.45.38.140|:443... connected.
WARNING: certificate common name `www.oracle.com' doesn't match requested host name `edelivery.oracle.com'.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz?AuthParam=1399837157_13a216ce71be82d57322314c7d258f1a [following]
--2014-05-11 19:37:17--  http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz?AuthParam=1399837157_13a216ce71be82d57322314c7d258f1a
Reusing existing connection to download.oracle.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 159008252 (152M) [application/x-gzip]
Saving to: `jdk-8u5-linux-x64.tar.gz?AuthParam=1399837157_13a216ce71be82d57322314c7d258f1a'

100%[======================================================================================================>] 159,008,252 18.4M/s   in 14s

2014-05-11 19:37:31 (10.7 MB/s) - `jdk-8u5-linux-x64.tar.gz?AuthParam=1399837157_13a216ce71be82d57322314c7d258f1a' saved [159008252/159008252]

[root@anuppc-01 ~]#
#################################################################################