charlesflynn / agiledata

Builds a data science work environment for Russell Jurney's book Agile Data Science.
MIT License
46 stars 27 forks source link

Java not installed correctly #1

Closed macsilber closed 10 years ago

macsilber commented 10 years ago

When you run pig you get /home/vagrant/agiledata/software/java/bin/java: No such file or directory

I notice no directory is set for software/java/bin and the install has the following failures, although when I check the mode is changed to 755 and I can execute manually. the ln also needs to be created from /software/java/bin/.

Also it would be nice to setup env.sh permanently in the pofile.

State: - file
Name:      /srv/salt/agiledata/jdk-6u45-linux-x64.bin
Function:  managed
    Result:    False
    Comment:   Failed to change mode to 755
    Changes:

State: - cmd
Name:      sh /srv/salt/agiledata/jdk-6u45-linux-x64.bin; ln -s jdk1.6.0_45 java
Function:  run
    Result:    False
    Comment:   One or more requisite failed
    Changes:

charlesflynn commented 10 years ago

The pig error and the missing ln are both results of the failure to execute the java installation (.bin) file. Because that didn't execute, the link from software/java -> software/jdk1.6.0_45 wasn't created, and env.sh couldn't add software/java/bin to your PATH or set JAVA_HOME correctly.

If you've installed java manually into software/, you can quickly fix this by doing an ln -s jdk1.6.0_45 java inside the software directory, and then re-running env.sh. I haven't been able to replicate the salt error (Failed to change mode to 755) which is the root cause. What host/guest operating systems are you using?

macsilber commented 10 years ago

I am on windows 7; virtualbox 4.2 and vagrant 1.3.5

benjaminsims commented 10 years ago

I'm also seeing a failure to install java (OS X Mavericks, virtualbox 4.3.0, vagrant 1.3.5).

When vagrant up is run from fresh, the file /srv/salt/agiledata/jdk-6u45-linux-x64.bin contains only the string:

'No hardware id passed'. 

If I then ssh into the VM, I can run

curl -v -L --cookie "oraclelicensejdk-6u45-oth-JPR=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com" http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin -o /srv/salt/agiledata/jdk-6u45-linux-x64.bin

and the full 68.7 MB file will be correctly downloaded.

Any thoughts on this? It seems that executing curl via Salt is doing something different that causes the Oracle server to have problems, but I'm not familiar enough with Salt to investigate further. Running vagrant provision after manually downloading the file doesn't solve things - commands requiring 'java-install' still fail.

charlesflynn commented 10 years ago

Hey, thanks for letting me know. I'm starting to think I should remove Java and let people install the version of their choice. Even though the Getting Started doc specifies 1.6, Pig has been compatible with 1.7 for a while. CDH4 works with 1.7, and MapR and Hortonworks will even work with OpenJDK. Plus, many organizations require a specific version/update. Plus, I don't like being at Oracle's mercy :-)

Now that I've listed it all out, it seems like a pretty compelling argument. What do you think?

benjaminsims commented 10 years ago

I tend towards the view that the beauty of using Vagrant is that you can be ready to get going with a book or course without having to do any of the installing at all. A lot of the time I'm just evaluating new techniques or technology, so I don't want to get involved at all with installations / configuration until I know it's worth my time.

As such, I'd much prefer to just put in anything that works. I'm able to get Pig to work (not yet with the book code, but it executes) by doing:

sudo apt-get install default-jdk

and them modifying env.sh so that JAVA_HOME points to

export JAVA_HOME=/usr/lib/jvm/default-java

The default is I think 1.6.

If this does in fact work, might it be an option to put the apt-get install into salt?

charlesflynn commented 10 years ago

Yes, but apt (and yum) install OpenJDK. It makes me leery because I come from an environment where we're very cautious about vendor/version/update. But I should probably get over it and just put a warning on the README. I'll test it out over the weekend.

benjaminsims commented 10 years ago

I've worked in those environments before so I take your point. But this isn't a production environment - to my mind it's a scratch notebook to enable somebody to get started understanding the concepts. If I can type in the book examples and they work, I'm content. If I have to take things to production, then I can worry about what's installed.

Thanks for taking the time on this - I really appreciate being able to avoid the worries of installing when getting into something new.

charlesflynn commented 10 years ago