0

After logging onto the virtual machine though putty, I got

Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.15.0-91-generic x86_64)
...
80 packages can be updated.
0 updates are security updates

However, when I tried opening local host "localhost:8787/" on chrome, it says the site could not be reached. How do I access the virtual machine from my local host?

0

First, we have to define what you mean by "access" to a machine (either virtual or physical).

When using putty, I assume you used SSH or simple telnet protocols, and the virtual machine was configured to listen for such requests.

When using a web browser, if not defined, it will automatically try to connect using the HTTP or HTTPS protocols, and that means it is looking for a web server with a web application on that address and port. Web protocols also serve different purposes, and act very differently than SSH for example. Apache or IIS are examples of such web server infrastructure.

Access to a machine can also be a remote connection with graphical interface (such as windows remote desktop), or any 3rd party app for linux (such as Remmina).

After you define what you actually need and on what protocol you are going to use, you should install and configure a package on that ubuntu machine that will can listen to the port and handle your requests.

| improve this answer | |
  • basically after successfully logging onto ubuntu, i want to open localhost:8787 on google chrome. I don't rly know how to explain it further – Henry Lim May 18 at 7:07
  • Yes but for what purpose? The stanza you enter in chrome ( localhost:8787) means that you request from your web browser to connect to a website on your local machine on port 8787 (either by HTTP or HTTPS). For that, you will also need to set a web server that will host your website and your web application. Notice that localhost on the virtual machine is different than localhost on the physical machine (it literally means the machine I'm using right now), so the browser will look for the web app on the machine it was launched. – Pizza May 18 at 7:13
  • to connect to virtual machine on google cloud – Henry Lim May 18 at 7:18
  • this is the equivalent on Mac "Go to terminal and execute the following command ssh -L 5901:localhost:5901 -L 8787:localhost:8787 -L 8888:localhost:8888 -L 8080:localhost:8080 -i ~/.ssh/wp-ssh-key username@(External IP) Enter localhost:8787 on your chosen browser" And i'm trying to replicate this using windows – Henry Lim May 18 at 7:25
  • Then as I commented, using localhost on your physical machine wont work, unless you configured an application on it that will actually handle the connection as you described. Either way, you have some things to configure on the google cloud instance first. As described by google here, your instance comes with ssh enabled, that is why it worked easy for you: (cloud.google.com/compute/docs/instances/connecting-to-instance). For web access, you have to do some configurations first: (cloud.google.com/vpc/docs/special-configurations). – Pizza May 18 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.