This has been tested on ubuntu 10.04 and ubuntu 12.04
Follow is a python function that does that, you can see the commands:
For ubuntu 10.04:
def install_java_6(status):
output = ""
status, output = execute('sudo add-apt-repository ppa:sun-java-community-team/sun-java6')
if status == 0:
status, output = execute('sudo apt-get update')
if status == 0:
status, output = execute('sudo sh -c \'echo sun-java6-jre shared/accepted-sun-dlj-v1-1 select true | /usr/bin/debconf-set-selections\' ')
if status == 0:
status, output = execute('sudo apt-get install -y sun-java6-jdk')
if status == 0:
status, output = execute('sudo update-java-alternatives -s java-6-sun')
status = 0;
return status,output
exit
For Ubuntu 12.04:
def install_java_6(status):
output = ""
#2.4 status, output = execute('sudo add-apt-repository ppa:sun-java-community-team/sun-java6')
status, output = execute('sudo add-apt-repository ppa:webupd8team/java -y')
if status == 0:
status, output = execute('sudo apt-get update')
if status == 0:
status, output = execute(' echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections ')
status, output = execute(' echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections ')
if status == 0:
#2.4 status, output = execute('sudo apt-get install -y sun-java6-jdk')i
status, output = execute('sudo apt-get install oracle-java6-installer')
if status == 0:
#status, output = execute('sudo update-java-alternatives -s java-6-sun')
status = 0;
return status,output
exit
IMPORTANT, debconf is receiving select and seen, If you miss selelect you will receive an error like:
error: Cannot find a question for shared/accepted-oracle-license-v1-1
For both 10.04 and 12.04 the execute function is:
def execute( cmd ):
print "\n\n Executing :" + cmd
status, output = commands.getstatusoutput(cmd)
print "status: " + str(status)
print "output: " + output
return status, output
exit
If you want to uninstall java-6-oracle:
# ubuntu@ip-10-136-0-17:~$ sudo apt-get purge oracle-java6-installer
Enjoy!
P.D. Should exist a Cuernavaca's flag!
Follow is a python function that does that, you can see the commands:
For ubuntu 10.04:
def install_java_6(status):
output = ""
status, output = execute('sudo add-apt-repository ppa:sun-java-community-team/sun-java6')
if status == 0:
status, output = execute('sudo apt-get update')
if status == 0:
status, output = execute('sudo sh -c \'echo sun-java6-jre shared/accepted-sun-dlj-v1-1 select true | /usr/bin/debconf-set-selections\' ')
if status == 0:
status, output = execute('sudo apt-get install -y sun-java6-jdk')
if status == 0:
status, output = execute('sudo update-java-alternatives -s java-6-sun')
status = 0;
return status,output
exit
For Ubuntu 12.04:
def install_java_6(status):
output = ""
#2.4 status, output = execute('sudo add-apt-repository ppa:sun-java-community-team/sun-java6')
status, output = execute('sudo add-apt-repository ppa:webupd8team/java -y')
if status == 0:
status, output = execute('sudo apt-get update')
if status == 0:
status, output = execute(' echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections ')
status, output = execute(' echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections ')
if status == 0:
#2.4 status, output = execute('sudo apt-get install -y sun-java6-jdk')i
status, output = execute('sudo apt-get install oracle-java6-installer')
if status == 0:
#status, output = execute('sudo update-java-alternatives -s java-6-sun')
status = 0;
return status,output
exit
IMPORTANT, debconf is receiving select and seen, If you miss selelect you will receive an error like:
error: Cannot find a question for shared/accepted-oracle-license-v1-1
For both 10.04 and 12.04 the execute function is:
def execute( cmd ):
print "\n\n Executing :" + cmd
status, output = commands.getstatusoutput(cmd)
print "status: " + str(status)
print "output: " + output
return status, output
exit
If you want to uninstall java-6-oracle:
# ubuntu@ip-10-136-0-17:~$ sudo apt-get purge oracle-java6-installer
Enjoy!
P.D. Should exist a Cuernavaca's flag!
No hay comentarios:
Publicar un comentario