Difference between revisions of "WorkingOnServers/JFBsWorkFlow"

From mn/geo/geoit
Jump to: navigation, search
m (cleaned nilu refs)
Line 1: Line 1:
 
I have put this guide together for reference, but also to help anyone who is intending to work on the UiO servers. It is mostly specific to connecting to the machines from a linux computer, but there may be alternatives for some of the tools I am discussing here. If I know of them, I will try to make reference as appropriate. Feel free to contribute.
 
I have put this guide together for reference, but also to help anyone who is intending to work on the UiO servers. It is mostly specific to connecting to the machines from a linux computer, but there may be alternatives for some of the tools I am discussing here. If I know of them, I will try to make reference as appropriate. Feel free to contribute.
  
==First Things First==
+
== First Things First ==
 +
 
 
Let's first take care of a few definitions:
 
Let's first take care of a few definitions:
;client / local: your local machine/computer that is sitting in front of you
 
;host / remote: the machine/computer that you are connecting to
 
;display: the monitor in front of you
 
  
==The Client Environment==
+
;client / local
 +
:your local machine/computer that is sitting in front of you
 +
;host / remote
 +
:the machine/computer that you are connecting to
 +
;display
 +
:the monitor in front of you
 +
 
 +
== The Client Environment ==
  
 
List of software I use regularly to connect to servers and work on remote machines:
 
List of software I use regularly to connect to servers and work on remote machines:
* [http://www.tenshu.net/p/terminator.html terminator]
 
* [http://www.gnu.org/software/screen/screen.html screen]
 
  
 +
*[http://www.tenshu.net/p/terminator.html terminator]
 +
*[http://www.gnu.org/software/screen/screen.html screen]
 +
 +
 +
 +
==== Editors ====
  
====Editors====
 
 
Critical to software programming and working on servers is to have a good editor. I dare not make strong recommendations here, but would suggest that you find one you are comfortable working with. Key features I look for:
 
Critical to software programming and working on servers is to have a good editor. I dare not make strong recommendations here, but would suggest that you find one you are comfortable working with. Key features I look for:
* syntax highlighting
 
* project browser (e.g. a panel that displays project resources next to your editor)
 
* an object browser (this is getting toward an [http://www.vogella.com/tutorials/Python/article.html IDE], but many text editors also have this capacity)
 
  
 +
*syntax highlighting
 +
*project browser (e.g. a panel that displays project resources next to your editor)
 +
*an object browser (this is getting toward an [http://www.vogella.com/tutorials/Python/article.html IDE], but many text editors also have this capacity)
 +
 +
<br/>An extremely elegant and highly configurable system that is cross platform, and I've now started to use is [http://www.sublimetext.com sublime-text]. It seems quite powerful, is fun to customize, has a **ton** of packages available. [http://opensourcehacker.com/2014/03/10/sublime-text-3-for-python-javascript-and-web-developers/ OpenSourceHacker] provides a nice overview of getting it configured for productivity. I'm a bit concerned over some rumors of ceased development, and it costs 70 dollars, but I think it's already worth it. Let's hope progress continues.
  
An extremely elegant and highly configurable system that is cross platform, and I've now started to use is [http://www.sublimetext.com sublime-text]. It seems quite powerful, is fun to customize, has a **ton** of packages available. [http://opensourcehacker.com/2014/03/10/sublime-text-3-for-python-javascript-and-web-developers/ OpenSourceHacker] provides a nice overview of getting it configured for productivity. I'm a bit concerned over some rumors of ceased development, and it costs 70 dollars, but I think it's already worth it. Let's hope progress continues.
+
On windows, [http://notepad-plus-plus.org notepad++] is a good option. For Linux there are many to choose from, and if you're using linux, you probably have a favorite&nbsp;;)
  
On windows, [http://notepad-plus-plus.org notepad++] is a good option. For Linux there are many to choose from, and if you're using linux, you probably have a favorite ;)
+
==== Shell / Terminal ====
  
====Shell / Terminal====
 
 
For linux I think [http://www.tenshu.net/p/terminator.html terminator] is a terrific environment for working with the command line.
 
For linux I think [http://www.tenshu.net/p/terminator.html terminator] is a terrific environment for working with the command line.
  
 
Once connected to the host machine, you may want to invoke [http://www.gnu.org/software/screen/screen.html screen] if you're running a big job. You can also use 'nohup' of course.
 
Once connected to the host machine, you may want to invoke [http://www.gnu.org/software/screen/screen.html screen] if you're running a big job. You can also use 'nohup' of course.
  
Note, if you start to use <code>screen</code> on the servers, be sure to read: [[WorkingOnServers/SSHTricks | SSHTricks]]
+
Note, if you start to use <code>screen</code> on the servers, be sure to read: [[WorkingOnServers/SSHTricks|SSHTricks]]
 +
 
 +
==== Connecting to the Servers ====
  
====Connecting to the Servers====
 
 
In order to make connecting to the servers seemless, it is highly recommended to set up ssh keys. It takes a little bit of time and configuring, but once completed, passwordless login is a breeze, and you'll find using commands such as scp, sshfs, and ssh to be painless. In terms of the choice of ssh utilities, that will largely depend on your OS. For linux, it's built in, but for Windows you'll need to download a client program such as Putty.
 
In order to make connecting to the servers seemless, it is highly recommended to set up ssh keys. It takes a little bit of time and configuring, but once completed, passwordless login is a breeze, and you'll find using commands such as scp, sshfs, and ssh to be painless. In terms of the choice of ssh utilities, that will largely depend on your OS. For linux, it's built in, but for Windows you'll need to download a client program such as Putty.
  
 
Here we'll work through:
 
Here we'll work through:
# Setting up your ssh keys for passwordless login
 
# Setting up your ssh connection to forward X displays
 
  
======1. SSH Keys======
+
#Setting up your ssh keys for passwordless login
 +
#Setting up your ssh connection to forward X displays
 +
 
 +
====== 1. SSH Keys ======
 +
 
 
Shamelessly take from [http://sshmenu.sourceforge.net/articles/key-setup.html sourceforge]
 
Shamelessly take from [http://sshmenu.sourceforge.net/articles/key-setup.html sourceforge]
  
'''Goal'''
+
'''Goal''' You want to use Linux and OpenSSH to automize your tasks. Therefore you need an automatic login from userA@local to userB@host (note userA and userB may or may not be the same user). You don't want to enter any passwords, because you want to call ssh from a within a shell script.
You want to use Linux and OpenSSH to automize your tasks. Therefore you need an automatic login from userA@local to userB@host (note userA and userB may or may not be the same user). You don't want to enter any passwords, because you want to call ssh from a within a shell script.
 
  
 
First log in to your machine as userA@local and generate a pair of authentication keys:
 
First log in to your machine as userA@local and generate a pair of authentication keys:
 
+
<pre>usera@loca:~> ssh-keygen -t rsa
<pre>
 
usera@loca:~> ssh-keygen -t rsa
 
 
Generating public/private rsa key pair.
 
Generating public/private rsa key pair.
 
Enter file in which to save the key (/home/a/.ssh/id_rsa):  
 
Enter file in which to save the key (/home/a/.ssh/id_rsa):  
Line 60: Line 69:
 
</pre>
 
</pre>
 
Now use ssh-copy-id to copy over your public key to the remote server:
 
Now use ssh-copy-id to copy over your public key to the remote server:
<pre>
+
<pre>usera@local:~> ssh-copy-id remote
usera@local:~> ssh-copy-id remote
 
 
</pre>
 
</pre>
 
OR
 
OR
<pre>
+
<pre>usera@local:~> ssh-copy-id userb@remote
usera@local:~> ssh-copy-id userb@remote
 
 
</pre>
 
</pre>
 
 
From now on you can log into remote as userb from local as usera without password:
 
From now on you can log into remote as userb from local as usera without password:
<pre>
+
<pre>usera@local:~> ssh userb@remote
usera@local:~> ssh userb@remote
 
 
</pre>
 
</pre>
 +
Depending on your version of SSH you ''may'' also have to do the following changes:
  
Depending on your version of SSH you ''may'' also have to do the following changes:
+
*Put the public key in .ssh/authorized_keys2
 +
*Change the permissions of .ssh to 700
 +
*Change the permissions of .ssh/authorized_keys2 to 640
  
* Put the public key in .ssh/authorized_keys2
+
====== 2. Forward X and use Compression ======
* Change the permissions of .ssh to 700
 
* Change the permissions of .ssh/authorized_keys2 to 640
 
  
======2. Forward X and use Compression======
 
 
For linux machines this is easy:
 
For linux machines this is easy:
  
Line 86: Line 91:
 
For Windows machines it may require a little more work. I have had success in the past with the following tools:
 
For Windows machines it may require a little more work. I have had success in the past with the following tools:
  
* [http://www.straightrunning.com/XmingNotes/portableputty.php#head-111 XmingPortablePutty]
+
*[http://www.straightrunning.com/XmingNotes/portableputty.php#head-111 XmingPortablePutty]
  
 
I believe following the instructions to use the Xmingportableputty software should provide you with a working x-server and a ssh client on windows machines to connect to the servers. Note that if give options with the ssh software to '''forward X connections''' choose yes, or click the box and do the same with '''compression'''.
 
I believe following the instructions to use the Xmingportableputty software should provide you with a working x-server and a ssh client on windows machines to connect to the servers. Note that if give options with the ssh software to '''forward X connections''' choose yes, or click the box and do the same with '''compression'''.
 +
 +
====== 3. Now, make sure you can start right where you left off ======
 +
 +
One of the biggest advantages to working on a server is 'context'. Generally, you don't have all the context switching while you are working that you do when you are working on the laptop in front of you. Now, of course, you are probably using a laptop to connect to the server, so it doesn't really make that big a difference. But a nice feature of the server is that --[[WorkingOnServers/DisplayEnvironmentTricks|if you follow this Guide -]]- you'll always be able to pick up right where you left off. That is, the context will be the same as you left it.

Revision as of 10:41, 4 October 2014

I have put this guide together for reference, but also to help anyone who is intending to work on the UiO servers. It is mostly specific to connecting to the machines from a linux computer, but there may be alternatives for some of the tools I am discussing here. If I know of them, I will try to make reference as appropriate. Feel free to contribute.

First Things First

Let's first take care of a few definitions:

client / local
your local machine/computer that is sitting in front of you
host / remote
the machine/computer that you are connecting to
display
the monitor in front of you

The Client Environment

List of software I use regularly to connect to servers and work on remote machines:


Editors

Critical to software programming and working on servers is to have a good editor. I dare not make strong recommendations here, but would suggest that you find one you are comfortable working with. Key features I look for:

  • syntax highlighting
  • project browser (e.g. a panel that displays project resources next to your editor)
  • an object browser (this is getting toward an IDE, but many text editors also have this capacity)


An extremely elegant and highly configurable system that is cross platform, and I've now started to use is sublime-text. It seems quite powerful, is fun to customize, has a **ton** of packages available. OpenSourceHacker provides a nice overview of getting it configured for productivity. I'm a bit concerned over some rumors of ceased development, and it costs 70 dollars, but I think it's already worth it. Let's hope progress continues.

On windows, notepad++ is a good option. For Linux there are many to choose from, and if you're using linux, you probably have a favorite ;)

Shell / Terminal

For linux I think terminator is a terrific environment for working with the command line.

Once connected to the host machine, you may want to invoke screen if you're running a big job. You can also use 'nohup' of course.

Note, if you start to use screen on the servers, be sure to read: SSHTricks

Connecting to the Servers

In order to make connecting to the servers seemless, it is highly recommended to set up ssh keys. It takes a little bit of time and configuring, but once completed, passwordless login is a breeze, and you'll find using commands such as scp, sshfs, and ssh to be painless. In terms of the choice of ssh utilities, that will largely depend on your OS. For linux, it's built in, but for Windows you'll need to download a client program such as Putty.

Here we'll work through:

  1. Setting up your ssh keys for passwordless login
  2. Setting up your ssh connection to forward X displays
1. SSH Keys

Shamelessly take from sourceforge

Goal You want to use Linux and OpenSSH to automize your tasks. Therefore you need an automatic login from userA@local to userB@host (note userA and userB may or may not be the same user). You don't want to enter any passwords, because you want to call ssh from a within a shell script.

First log in to your machine as userA@local and generate a pair of authentication keys:

usera@loca:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa): 
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/usera/.ssh/id_rsa.
Your public key has been saved in /home/usera/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A

Now use ssh-copy-id to copy over your public key to the remote server:

usera@local:~> ssh-copy-id remote

OR

usera@local:~> ssh-copy-id userb@remote

From now on you can log into remote as userb from local as usera without password:

usera@local:~> ssh userb@remote

Depending on your version of SSH you may also have to do the following changes:

  • Put the public key in .ssh/authorized_keys2
  • Change the permissions of .ssh to 700
  • Change the permissions of .ssh/authorized_keys2 to 640
2. Forward X and use Compression

For linux machines this is easy:

   ssh -XC user@remote

For Windows machines it may require a little more work. I have had success in the past with the following tools:

I believe following the instructions to use the Xmingportableputty software should provide you with a working x-server and a ssh client on windows machines to connect to the servers. Note that if give options with the ssh software to forward X connections choose yes, or click the box and do the same with compression.

3. Now, make sure you can start right where you left off

One of the biggest advantages to working on a server is 'context'. Generally, you don't have all the context switching while you are working that you do when you are working on the laptop in front of you. Now, of course, you are probably using a laptop to connect to the server, so it doesn't really make that big a difference. But a nice feature of the server is that --if you follow this Guide -- you'll always be able to pick up right where you left off. That is, the context will be the same as you left it.