Lab - Apache Tomcat Q#1 command in hint not working

Hello, @oba
Hint is working fine for me.

$ sudo curl -O https://downloads.apache.org/tomcat/tomcat-8/v8.5.58/bin/apache-tomcat-8.5.58.tar.gz
$ ls
$ sudo tar -xvf apache-tomcat-8.5.58.tar.gz
$ sudo mv apache-tomcat-8.5.58 /opt/apache-tomcat-8

Can you please tell me where you are facing issue? May be I can help you to troubleshoot your issue.

1 Like

Thanks. It works now

Thanks for the corrected steps.It works fine

Hi Team,

Facing the same issue.

Hello, @Priyanka
What kind of issue you are facing? I already provided solution. It didn’t work?

I tried the solution provided. it didnt work.
Attaching screenshot

Hello, @Priyanka
Because version has been changed.
You can try below one,

$ sudo curl -O https://downloads.apache.org/tomcat/tomcat-8/v8.5.61/bin/apache-tomcat-8.5.61.tar.gz

rest steps is same.
You can cross verify of available version by visiting that site (https://downloads.apache.org/tomcat/tomcat-8/v8.5.61/bin/).

Let me know if you are still facing the issue.

I had tried it with latest version as well.
But it is working now.
Thanks!

Good to hear that, :+1:

hi @Tej-Singh-Rana / @Ayman

I just tried this and it is not working now . Can you please review and suggest


hor@host01 /$
thor@host01 /$
thor@host01 /$ cd /opt
thor@host01 /opt$
thor@host01 /opt$ sudo curl -O https://downloads.apache.org/tomcat/tomcat-8/v8.5.61/bin/apache-tomcat-v8.5.61.tar.gz;
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   196  100   196    0     0   1767      0 --:--:-- --:--:-- --:--:--  1781
thor@host01 /opt$
thor@host01 /opt$ pwd
/opt
thor@host01 /opt$
thor@host01 /opt$ ls
apache-tomcat-v8.5.61.tar.gzthor@host01 /opt$
thor@host01 /opt$ sudo tar -xvf apache-tomcat-v8.5.61.tar.gz
tar: This does not look like a tar archive

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
thor@host01 /opt$
thor@host01 /opt$ date
Fri Jan 15 14:24:54 UTC 2021
thor@host01 /opt$
thor@host01 /opt$ ls -la
total 12
drwxr-xr-x 1 root root 4096 Jan 15 14:24 .
drwxr-xr-x 1 root root 4096 Jan 15 14:21 ..
-rw-r--r-- 1 root root  196 Jan 15 14:24 apache-tomcat-v8.5.61.tar.gz
thor@host01 /opt$
thor@host01 /opt$

hi @Tej-Singh-Rana /@Ayman

This time I have updated / upgraded CentOs which is underlying OS to see whether this helps . But still the output is same .

Can you please review and suggest ?


thor@host01 /$ cd /opt
thor@host01 /opt$
thor@host01 /opt$ sudo curl -O https://downloads.apache.org/tomcat/tomcat-8/v8.5.61/bin/apache-tomcat-v8.5.61.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   196  100   196    0     0   1143      0 --:--:-- --:--:-- --:--:--  1139
thor@host01 /opt$
thor@host01 /opt$ pwd
/opt
thor@host01 /opt$
thor@host01 /opt$ ls -al
total 12
drwxr-xr-x 1 root root 4096 Jan 15 14:47 .
drwxr-xr-x 1 root root 4096 Jan 15 14:41 ..
-rw-r--r-- 1 root root  196 Jan 15 14:47 apache-tomcat-v8.5.61.tar.gz
thor@host01 /opt$
thor@host01 /opt$
thor@host01 /opt$ sudo tar -xvf apache-tomcat-v8.5.61.tar.gz
tar: This does not look like a tar archive

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
thor@host01 /opt$
thor@host01 /opt$ date
Fri Jan 15 14:47:56 UTC 2021
thor@host01 /opt$
thor@host01 /opt$ ls -la
total 12
drwxr-xr-x 1 root root 4096 Jan 15 14:47 .
drwxr-xr-x 1 root root 4096 Jan 15 14:41 ..
-rw-r--r-- 1 root root  196 Jan 15 14:47 apache-tomcat-v8.5.61.tar.gz
thor@host01 /opt$
thor@host01 /opt$ history
    1  sudo yum install update -y
    2  sudo yum install upgrade -y
    3  clear
    4  sudo dnf install udpate -y
    5  clear
    6  cat /etc/*release*
    7  sudo yum check update
    8  sudo yum update
    9  sudo yum upgrade
   10  clear
   11  cd /opt
   12  sudo curl -O https://downloads.apache.org/tomcat/tomcat-8/v8.5.61/bin/apache-tomcat-v8.5.61.tar.gz
   13  pwd
   14  ls -al
   15  sudo tar -xvf apache-tomcat-v8.5.61.tar.gz
   16  date
   17  ls -la
   18  history
thor@host01 /opt$
thor@host01 /opt$
thor@host01 /opt$ date
Fri Jan 15 14:48:20 UTC 2021
thor@host01 /opt$
thor@host01 /opt$

hi @Tej-Singh-Rana / @Ayman

When same thing is attempted on v9.0.41 I do not get this error.

Can you please investigate and suggest why there is error in version suggested earlier v8.5.61 but this error is not seen when V9.0.41 is chosen.

Am I missing anything ?

Output is provided below


thor@host01 /opt$ sudo curl -O https://downloads.apache.org/tomcat/tomcat-9/v9.0.41/bin/apache-tomcat-9.0.41.tar.gz;
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10.9M  100 10.9M    0     0  38.4M      0 --:--:-- --:--:-- --:--:-- 38.5M
thor@host01 /opt$
thor@host01 /opt$ ls -al
total 11184drwxr-xr-x 1 root root     4096 Jan 15 19:25 .
drwxr-xr-x 1 root root     4096 Jan 15 19:22 ..
-rw-r--r-- 1 root root 11442169 Jan 15 19:25 apache-tomcat-9.0.41.tar.gz
thor@host01 /opt$
thor@host01 /opt$ sudo tar -xvf apache-tomcat-9.0.41.tar.gz
apache-tomcat-9.0.41/conf/
apache-tomcat-9.0.41/conf/catalina.policy
apache-tomcat-9.0.41/conf/catalina.properties
apache-tomcat-9.0.41/bin/tool-wrapper.sh
apache-tomcat-9.0.41/bin/version.sh
thor@host01 /opt$
thor@host01 /opt$ ls -al
total 11188
drwxr-xr-x 1 root root     4096 Jan 15 19:26 .
drwxr-xr-x 1 root root     4096 Jan 15 19:22 ..
drwxr-xr-x 9 root root     4096 Jan 15 19:26 apache-tomcat-9.0.41
-rw-r--r-- 1 root root 11442169 Jan 15 19:25 apache-tomcat-9.0.41.tar.gz
thor@host01 /opt$
thor@host01 /opt$ ls -al /opt/apache-tomcat-9.0.41
total 156
drwxr-xr-x 9 root root  4096 Jan 15 19:26 .
drwxr-xr-x 1 root root  4096 Jan 15 19:26 ..
drwxr-x--- 2 root root  4096 Jan 15 19:26 bin
-rw-r----- 1 root root 18982 Dec  3 11:48 BUILDING.txt
drwx------ 2 root root  4096 Dec  3 11:48 conf
-rw-r----- 1 root root  5409 Dec  3 11:48 CONTRIBUTING.md
drwxr-x--- 2 root root  4096 Jan 15 19:26 lib
-rw-r----- 1 root root 57092 Dec  3 11:48 LICENSE
drwxr-x--- 2 root root  4096 Dec  3 11:43 logs
-rw-r----- 1 root root  2333 Dec  3 11:48 NOTICE
-rw-r----- 1 root root  3257 Dec  3 11:48 README.md
-rw-r----- 1 root root  6898 Dec  3 11:48 RELEASE-NOTES
-rw-r----- 1 root root 16507 Dec  3 11:48 RUNNING.txt
drwxr-x--- 2 root root  4096 Jan 15 19:26 temp
drwxr-x--- 7 root root  4096 Dec  3 11:45 webapps
drwxr-x--- 2 root root  4096 Dec  3 11:43 work
thor@host01 /opt$
thor@host01 /opt$ pwd
/opt
thor@host01 /opt$ sudo mv apache-tomcat-9.0.41 /opt/apache-tomcat-9.0.41
mv: cannot move ‘apache-tomcat-9.0.41’ to a subdirectory of itself, ‘/opt/apache-tomcat-9.0.41/apache-tomcat-9.0.41’
thor@host01 /opt$ date
Fri Jan 15 19:28:30 UTC 2021
thor@host01 /opt$
thor@host01 /opt$ pwd
/opt
thor@host01 /opt$
thor@host01 /opt$ history
    1  PWD
    2  clear
    3  pwd
    4  clear
    5  cd /opt
    6  sudo curl -O https://downloads.apache.org/tomcat/tomcat-8/v9.0.41/bin/apache-tomcat-9.0.41.tar.gz;
    7  ls -al
    8  sudo tar -xvf apache-tomcat-9.0.41.tar.gz
    9  rm *
   10  ls -al
   11  rm apache-tomcat-9.0.41.tar.gz
   12  sudo rm apache-tomcat-9.0.41.tar.gz
   13  ls -al
   14  clear
   15  sudo curl -O https://downloads.apache.org/tomcat/tomcat-9/v9.0.41/bin/apache-tomcat-9.0.41.tar.gz;
   16  ls -al
   17  sudo tar -xvf apache-tomcat-9.0.41.tar.gz
   18  ls -al
   19  ls -al /opt/apache-tomcat-9.0.41
   20  pwd
   21  sudo mv apache-tomcat-9.0.41 /opt/apache-tomcat-9.0.41
   22  date
   23  pwd
   24  history
thor@host01 /opt$
thor@host01 /opt$


Output of extraction is ommited due to limitation imposed on characters . But this is enough for me to pass the checks at the end if I manually create directory with -8 just for sake of passing.

Hello @Ayman facing couple of issues while performing the followup task

Now run tomcat with default settings Open the http://localhost:8080 tab to see the tomcat web page in web browser

  1. There two download options in the tomcat webpage one with bin and another src
    https://downloads.apache.org/tomcat/tomcat-8/v8.5.63/
    a .Which one should be downloded? both or only the tar file present in bin directory. As per this page both needs to be downloaded
    b. If I just download bin there is no bin folder within it neither it has startup.sh file

  2. I can find the startup.sh file if I download the tar file present in the src path from the above link. However while trying to execute sudo ./startup.sh I am getting an error command not found. I am sure I am missing some steps here since I have tried the same steps in my own centos virtual system, and it give me the same error. So I don’t think this is an issue with the lab but with my steps.

Can you please explain what is going wrong here?

Hello, @praddasg
In lecture, provided a URL to download a package:

http://tomcat.apache.org/download-80.cgi

You have to copy a link of tar file from core binary distribution section:

https://downloads.apache.org/tomcat/tomcat-8/v8.5.63/bin/apache-tomcat-8.5.63.tar.gz

Then install the wget package, if it’s not available on a server.

sudo yum install -y wget

If it’s already available then download the package:

wget <apache-tomcat download path>

Extract it tar file,

tar xvf apache-tomcat-8.5.63.tar.gz

Under the apache-tomcat-8.5.63/bin directory, you will see startup.sh file. Execute it.

./startup.sh

then check it from top of the terminal localhost:8080.

From this URL, https://downloads.apache.org/tomcat/tomcat-8/v8.5.63/
You have to download a tar file(which is apache-tomcat-8.5.63.tar.gz) from the bin directory. Extract it from tar then execute it the same as above.

Hello @Tej-Singh-Rana, thanks for explaining this, I was literally checking the website https://downloads.apache.org/tomcat/tomcat-8/v8.5.63/ and did not find any tar package so went in to the bin folder and the package name ends with deployer, which does not have the startup.sh file. I tried the src folder, it does have the startup.sh file but when I tried executing it, it was giving me error bad command

But if I simply use the path which you mentioned, i can see the details.
https://downloads.apache.org/tomcat/tomcat-8/v8.5.63/bin/apache-tomcat-8.5.63.tar.gz
image
Note: As of now to test the url, i downloaded in my local machine but yet to try out the process in linux machine. But I think this will work.

Moral of the story, the url actually confused me while looking in the browser.

Hello, @praddasg
I don’t know why you’re not able to see this tar file.

Ahh. Because I am blind and assumed the tar files will be present at the top. Thank you @Tej-Singh-Rana for taking time pointing this out and extremely sorry for this such silly miss.

1 Like

No, issue. We are here to learn from our mistakes or from others. :+1:

Regards,

Thanks, I’ve faced issue in tomcat 8 but 8.5.63 is working fine

still i have a issue please rectify it

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
[root@tomcat opt]# sudo tar -xvf apache-tomcat-8.61.tar.gz
tar: apache-tomcat-8.61.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
[root@tomcat opt]# tar xvf apache-tomcat-8.5.63.tar.gz
tar: apache-tomcat-8.5.63.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now