How to upload a file from the Internet to my Linux server using Bash

I recently had to switch to a VPS server (HostGator Linux) because I wanted to run a script that was a bit more complicated than the usual PHP-db manipulation. I am trying to install JDK and Apache Ant (if it is important, to compile Android applications on the server).

I watched Linux Bash tutorials and started using it. I am currently trying to install Java (with JDK and JRE) on a server.

I follow the tutorial on this page: http://www.oracle.com/technetwork/java/javase/install-linux-64-self-extracting-142068.html

However, I do not know what to do on this line:

  • Download and check the size of the downloaded file.

    You can upload to any directory that you can write.

How to load Java from the command line?

If that matters, I am running CentOS v5.8

+49
linux centos
Jan 13 '13 at 4:54
source share
3 answers

Using wget

wget -O /tmp/myfile 'http://www.google.com/logo.jpg' 

or curl:

 curl -o /tmp/myfile 'http://www.google.com/logo.jpg' 
+69
Jan 13 '13 at 5:01
source share

You can use the wget command to boot from the command line. In particular, you can use

 wget http://download.oracle.com/otn-pub/java/jdk/7u10-b18/jdk-7u10-linux-x64.tar.gz 

However, since Oracle requires you to accept the license agreement, this may not work (and I currently cannot test it).

+17
Jan 13 '13 at 4:58
source share

I think you could use curl and wget , but since Oracle requires you to check some checkboxes, it will be painful to imitate with the mentioned tools. You will need to download the page with the license agreement, and looking at it, find out what request is needed for the actual download.

Of course, you can just launch the browser, but it may not qualify as β€œfrom the command line”. So you can look in lynx , a text browser.

+2
Jan 13 '13 at 4:59
source share



All Articles