Project

General

Profile

Add host » History » Version 12

Anchi Cheng, 08/12/2014 02:41 PM

1 2 Anchi Cheng
h2. Add the IP address and matching hostname of the microscope and digital camera computer in your host file on the main Leginon computer, and vice versa.
2 1 Anchi Cheng
3 11 Anchi Cheng
h3. Find out what python thinks the hostname is with python command line.  REPEAT this both on Linux and Windows PC
4 3 Anchi Cheng
5
Run the following in python command line:
6
<pre>
7
import socket
8
socket.gethostname()
9
</pre>
10 1 Anchi Cheng
11 8 Anchi Cheng
h3. Find out the ip address associate with the hostname
12
13
Run the following in python command line:
14 4 Anchi Cheng
<pre>
15 8 Anchi Cheng
import socket
16
socket.gethostbyname('your_host_name')
17 4 Anchi Cheng
</pre>
18 2 Anchi Cheng
19 10 Anchi Cheng
h3. Modify your "hosts" file on the linux Leginon computer to include the instrument hosts if the latter is not already mapped by your domain name server
20
21
*  On Linux, this "hosts" file is at
22 1 Anchi Cheng
> /etc/hosts
23
24 10 Anchi Cheng
Example of a "hosts" file:
25 8 Anchi Cheng
26 1 Anchi Cheng
<pre>
27 8 Anchi Cheng
192.000.1.222   instrument_host_name.domain_name instrument_short_host_name
28
</pre>
29
30 10 Anchi Cheng
h3. Use shorter linux hostname if desired
31 9 Anchi Cheng
32 8 Anchi Cheng
If you'd like to shorten your linux hostname recognized by socket without the domain name, you may do so as root
33
<pre>
34
hostname your_shorter_hostname
35
</pre>
36
37
and also add that to the /etc/hosts as an alternative name
38
<pre>
39
192.000.1.333   long_host_name.domain_name your_shorter_hostname
40
</pre>
41 9 Anchi Cheng
42
You will need to restart networking to make it persistent.
43
<pre>
44
/etc/init.d/network restart
45
</pre>
46
47
Test the change by finding the ip address with the hostname as in the above section.
48 8 Anchi Cheng
49
h3. The Linux main Leginon computer also needs to identify itself by its hostname registered on the instrument Windows computer.
50 1 Anchi Cheng
51 7 Anchi Cheng
*  On Window XP and WIndows 7 this host file is
52 1 Anchi Cheng
> C:\\WINDOWS\system32\drivers\etc\hosts
53
54 7 Anchi Cheng
*  On Window NT, this host file is
55 1 Anchi Cheng
> C:\\WINNT\system32\drivers\etc\hosts