Ask Your Question
1

Unable to Connect to localhost:8000

asked 2012-07-02 08:20:16 -0500

ec92 gravatar image

updated 2012-07-02 08:53:38 -0500

I am trying to use Sage by SSH into my university's computer system. I succeeded in getting into the computer which has Sage installed on it. I am running SecureShellClient on a windows machine. However, when I try to actually run the program, I run into problems. I type

$ sage -n

and get the following

----------------------------------------------------------------------
| Sage Version 4.5.3, Release Date: 2010-09-04                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------

Please wait while the Sage Notebook server starts...
...
The notebook files are stored in: sage_notebook.sagenb
**************************************************
*                                                *
* Open your web browser to http://localhost:8000 *
*                                                *
**************************************************
2012-07-02 13:00:49-0500 [-] Log opened.

2012-07-02 13:00:49-0500 [-] twistd 9.0.0 (/usr/share/sage-4.5.3/local/bin/python 2.6.4) starting up.

2012-07-02 13:00:49-0500 [-] reactor class: 
twisted.internet.selectreactor.SelectReactor.

2012-07-02 13:00:49-0500 [-] twisted.web2.channel.http.HTTPFactory starting on 8000

2012-07-02 13:00:49-0500 [-] Starting factory <twisted.web2.channel.http.HTTPFactory instance at 0xa6be8ec>

xprop:  unable to open display ''

usage:  xprop [-options ...] [[format [dformat]] atom] ...


where options include:

    -grammar                       print out full grammar for command line

    -display host:dpy              the X server to contact

    -id id                         resource id of window to examine

    -name name                     name of window to examine

    -font name                     name of font to examine

    -remove propname               remove a property

    -set propname value            set a property to a given value

    -root                          examine the root window

    -len n                         display at most n bytes of any property

    -notype                        do not display the type field

    -fs filename                   where to look for formats for properties

    -frame                         don't ignore window manager frames

    -f propname format [dformat]   formats to use for property of given name

    -spy                           examine window properties forever

When I try to open http://localhost:8000 in an in internet window, I get "Unable to Connect" from Firefox, and a similar message when I try to open it in Internet Explorer.

I'm very new to Sage and Linux, and have no idea what's going wrong here. I haven't been able to find any instructions on how to run Sage through ssh, so I'm wondering if I'm missing a step somewhere.

Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-07-02 08:57:48 -0500

benjaminfjones gravatar image

If you want to use the Sage notebook on a remote machine using an ssh tunnel, you need to login to the machine and run sage (like you did). Then you need to setup a tunnel to forward traffic from your local machine's port 8000 to the remote machine's port 8000. See these instructions.

The following commands should do the job:

$ local> ssh user@remote.net
$ remote> cd <SAGE_ROOT>; echo "notebook(open_viewer=False)" | ./sage
... create admin password if needed ...

In another terminal, run:

ssh user@remote.net -L 8000:remote.net:8000

This sets up a tunnel to redirect port 8000 on your local machine to port 8000 on remote.net. Now, load up your local browser and surf to http://localhost:8000 and you should be up and running.

edit flag offensive delete link more

Comments

Sweet! I've always wanted to do this so it's not required to do every change ever on my local machine. I knew this was possible in theory but having explicit instructions is great.

kcrisman gravatar imagekcrisman ( 2012-07-02 09:37:23 -0500 )edit

Followup: what if port 8000 is already in use on the remote machine (like a machine that is also a server)? I think sagenb can set the port... and isn't sagenb switching to port 8080 now anyway?

kcrisman gravatar imagekcrisman ( 2012-07-02 09:38:03 -0500 )edit

Thanks, but this doesn't seem to work for me. I use a SecureShellClient interface to log into my university's system, and then I have the Linux command lines. At that point, I'm already logged onto a remote server ( I think), and then SSH again into the specific machine I need. I don't think that the command lines are ever associated with my local machine.

ec92 gravatar imageec92 ( 2012-07-02 09:50:15 -0500 )edit

If port 8000 on the remote machine is already in use, just change the second occurance of the number 8000 in the second ssh command to be the port that you want to forward to, e.g. `ssh ... -L 8000:remote.net:8765`. Also, you would change the `echo ... | ./sage` command to `echo "notebook(open_viewer=False, port=8765)" | ./sage`.

benjaminfjones gravatar imagebenjaminfjones ( 2012-07-02 09:50:47 -0500 )edit

@ec92 what ssh client are you using? It should be possible to use it to setup a tunnel, you'll just have to read the manual or use google to figure out how. If you are running windows, you can try "Bitvise Tunnelier" by the people who produce the putty ssh client.

benjaminfjones gravatar imagebenjaminfjones ( 2012-07-02 09:53:54 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-07-02 08:20:16 -0500

Seen: 6,906 times

Last updated: Jul 02 '12