Writing Python Programs on a FreeBSD server

Connect to the server from a Windows PC

  1. Start the PuTTY program.
  2. Type "STU.ipv6.club.tw" as the Host Name, change the port number to 2020, and click Open.
    PuTTY Sessions
  3. If this is the first time you connect to this server, it will pop up a security alert window as follow. Verify the fingerprint is 1e:02:bc:a3:3e:f5:d7:1d:66:4e:d6:2f:ee:fb:76:d8 and click Yes to accept.
  4. Type your username, press Enter.
  5. Type your password, press Enter.
    Please notice that your password will not be shown on the screen while you are typing.
  6. You will see a welcome message, and the last line is "1 STU:~>". This is the prompt of the server, which implies that it is ready to get commands from you.

Connect to the server from MAC OS X

Acknowledgment: The following tips are provided with the courtesy of Jaslin Tan Shi Yee.
  1. First go to Terminal (you can find it in Launchpad>Other) , and type the command "ssh -p 2017 s1053210xx@STU.ipv6.club.tw".
  2. If this is the first time which you connect to STU from this MacBook, it will ask you to confirm. Please type "yes" and press Enter. (Don't simply type "y".)
  3. Then, the same as Windows PuTTY, type your password (which will not be shown on the screen), and you will successfully log into the server. Now you are ready to start writing programs on the server.

Run Python interactively

  1. When you see the Unix prompt "1 STU:~>", type "python" and press Enter. Please notice that Unix systems are case-sensitive, so be sure to type the command in lower-case letters.
  2. You will see a welcome message

    
    Python 3.4.3 (default, Aug 27 2015, 01:28:25)
    [GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd10
    Type "help", "copyright", "credits" or "license" for more information.
    
    

    and the python prompt ">>>".
  3. Try to type some python statements, such as print(2 + 3)
  4. When you want to leave Python, press Ctrl-D or type the command "exit()". Then you'll see the Unix prompt again.
    Notice that Python and Unix have different prompts, so that you know you are interacting with Python or Unix.

Edit a Python program and execute it

  1. Type the name of an editor ("nano" or "vi"), and the filename you want to edit.
  2. Type the contents of the program. For testing purpose, you may simply have a single-line program

    print("2 + 3 = ", 2+3)

  3. Exit the editor and save the program file.
  4. When you see the Unix prompt, type "python test.py" to run your program.

If your location is outside the campus ...

  1. Solution 1: Enable IPv6 on your PC.
  2. Solution 2: Use the TWAREN SSL/VPN service to access "site-local" servers.