Pages

Monday, November 11, 2013

how-to-install-oracle-java-7-update-45-on-ubuntu-12-10-linux

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" http://download.oracle.com/otn-pub/java/jdk/7u45-b18/jdk-7u45-linux-x64.tar.gz
tar -xvzf jdk-7u45-linux-x64.tar.gz  -C /usr/lib/jvm
cd /usr/lib/jvm
ls -ltr
update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_45/bin/javac" 1
update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_45/bin/java" 1
update-alternatives --set "javac" "/usr/lib/jvm/jdk1.7.0_45/bin/javac"
update-alternatives --set "java" "/usr/lib/jvm/jdk1.7.0_45/bin/java"
java -version
javac -version


Source :

http://hendrelouw73.wordpress.com/2013/10/16/how-to-install-oracle-java-7-update-45-on-ubuntu-12-10-linux/

Wget JDK

Download Oracle Java JRE & JDK using a script

Oracle has recently disallowed direct downloads of java from their servers (without going through the browser and agreeing to their terms, which you can look at here: http://www.oracle.com/technetwork/java/javase/terms/license/index.html). So, if you try:
wget "http://download.oracle.com/otn-pub/java/jdk/7u4-b20/jdk-7u4-linux-x64.tar.gz"
you will receive a page with "In order to download products from Oracle Technology Network you must agree to the OTN license terms" error message.
This can be rather troublesome for setting up servers with automated scripts.
Luckily, it seems that a single cookie is all that is needed to bypass this (you still have to agree to the terms to install):
Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F
So, if you want to download jdk7u4 for 64-bit Linux (e.g., Ubuntu) using wget, you can use:
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" "http://download.oracle.com/otn-pub/java/jdk/7u4-b20/jdk-7u4-linux-x64.tar.gz"


source : https://ivan-site.com/2012/05/download-oracle-java-jre-jdk-using-a-script/

Friday, November 8, 2013

Installing salt master and salt minion (agent) on CentOS 6

h3. Installing salt master and salt minion (agent) on CentOS 6

{color:#313131}Beginning with version 0.9.4, Salt has been available in{color}{color:#313131} {color}[EPEL|http://fedoraproject.org/wiki/EPEL]{color:#313131}. It is installable using yum. Salt should work properly with all mainstream derivatives of RHEL, including CentOS.{color}

Salt and all dependencies have been accepted into the yum repositories for EPEL5 and EPEL6. The latest salt version can be found in epel-testing, while an older but more tested version can be found in regular epel.

h5. Salt (master) dependencies:

* PyYAML
* libyaml
* m2crypto
* openpgm
* sshpass
* python-babel
* python-crypto
* python-jinja2
* python-msgpack
* python-zmq
* zeromq3


Now installing salt-master.

{code}
[root@tiber07vm2 ~]# yum install salt-master

[root@tiber07vm2 ~]# salt --version
salt 0.16.4
{code}

Install python pip to install python additional modules
{code}
[root@tiber07vm2 ~]# yum install python-setuptools

[root@tiber07vm2 ~]# easy_install pip
{code}

Upgrade salt which is supported version salt-ssh (first resolved the dependancies for it)
{code}
[root@tiber07vm2 ~]# pip install markupsafe

[root@tiber07vm2 ~]# pip install --upgrade salt

[root@tiber07vm2 ~]# salt --version
salt 0.17.1

[root@tiber07vm2 ~]# salt-ssh --version
salt-ssh 0.17.1
{code}


h5. Basically salt-stack comes with two environment

* Stack master (Server) \-> stack minion (Agent)

* Stack master (SSH) \-> Master connects to agent using ssh, so no additional salt agent is required.

h5. Managed Node Requirements


h5. 1) Salt (minion) dependencies:

On the managed nodes, you only need Python 2.4 or later,
* m2crypto
* openpgm
* python-babel
* python-crypto
* python-jinja2
* python-msgpack
* python-yaml  
* python-zmq    
* zeromq3           

Now installing salt-minion.

{code}
[root@tiber07vm2 ~]# yum install salt-minion

[root@tiber07vm2 ~]# salt-minion --version
salt-minion 0.16.4
{code}

h5. Inventory of manged hosts:

Edit the /etc/salt/minion file on salt-minion server and add entry for salt-master server

{code}
[root@tiber07vm4 ~]# cat /etc/salt/minion
master: tiber07vm2.glam.colo
{code}

Start the master and minion services on salt master and client server
{code}
[root@tiber07vm2 ~]# /etc/init.d/salt-master start
Starting salt-master daemon:                               [  OK  ]

[root@tiber07vm2 ~]# /etc/init.d/salt-minion start
Starting salt-minion daemon:                               [  OK  ]

[root@tiber07vm4 ~]# /etc/init.d/salt-minion start
Starting salt-minion daemon:                               [  OK  ]
{code}

Check discovery for new minion and view the certificate requests on master:
{code}
[root@tiber07vm2 ~]# salt-key -L
Accepted Keys:
Unaccepted Keys:
tiber07vm2
tiber07vm4
Rejected Keys:
{code}

Looks perfect now\!\!

Accept the certificate requests on master:
{code}
[root@tiber07vm2 ~]# salt-key -A
The following keys are going to be accepted:
Unaccepted Keys:
tiber07vm2
tiber07vm4
Proceed? [n/Y] Y
Key for minion tiber07vm2 accepted.
Key for minion tiber07vm4 accepted.
{code}

Verify to see keys are accepted
{code}
[root@tiber07vm2 ~]# salt-key -L
Accepted Keys:
tiber07vm2
tiber07vm4
Unaccepted Keys:
Rejected Keys:
{code}


h5. Test the connection with the children:

Great you have done so far, now it is time to test


{code}
[root@tiber07vm2 ~]# salt 'tiber07vm4' test.ping
tiber07vm4:
    True

[root@tiber07vm2 ~]#  salt '*' test.ping
tiber07vm4:
    True
tiber07vm2:
    True
{code}


h5. 2) Salt (ssh) dependencies:

On the managed nodes, you only need Python 2.4 or later.



h5. SSH trust : since you want pass wordless authentication from your master machine ,its advisable to establish a trust

{code}
ssh-copy-id tiber07vm2

ssh-copy-id tiber07vm4
{code}

Inventory of manged hosts will be at /etc/salt/roster, this example configuration contains host without password (shared auth_key) and with password host entries.
{code}
[root@tiber07vm2 ~]# cat /etc/salt/roster
tiber07vm2:
  host: tiber07vm2
  user: root
tiber07vm4:
  host: tiber07vm4
  user: root
  passwd: myrootpassword
{code}

h5. Test the connection with the children:

Great you have done all, now it is time to test

{code}
[root@tiber07vm2 ~]# salt-ssh '*' test.ping
tiber07vm2:
    True
tiber07vm4:
    True
{code}

h5. Sample run :

{code}
[root@tiber07vm2 ~]# salt-ssh  'tiber07vm4'  -r  'uptime'
tiber07vm4:
     02:38:11 up 20 days, 14:16,  1 user,  load average: 0.09, 0.08, 0.02

[root@tiber07vm2 ~]# salt-ssh  '*'  -r  'uptime'
tiber07vm2:
     02:38:22 up 20 days, 14:16,  1 user,  load average: 0.08, 0.08, 0.02
tiber07vm4:
     02:38:23 up 20 days, 14:16,  1 user,  load average: 0.08, 0.08, 0.02
{code}


h5. Known Errors and fixes:

{code}[root@tiber07vm2 ~]# salt-ssh  'tiber07vm2'  -r  'uptime'
OSError: [Errno 38] Function not implemented
{code}

Ohh LXC\!\!, You will get python OSError because of not to write /dev/shm (tmpfs), so to enable it  update your /dev/shm mount options (rw, noexec) and remount /dev/shm.


{code}
[root@tiber07vm2 ~]# cat /etc/fstab
/dev/root               /                       rootfs   defaults        0 0
none                    /dev/shm                tmpfs    rw,nosuid,nodev,noexec    0 0
#none                    /dev/shm                tmpfs    nosuid,nodev    0 0

[root@tiber07vm2 ~]# mount /dev/shm
{code}