~ubuntu-branches/ubuntu/jaunty/ubuntu-docs/jaunty-proposed

« back to all changes in this revision

Viewing changes to serverguide/C/other-apps.xml

  • Committer: Bazaar Package Importer
  • Author(s): Matthew East
  • Date: 2009-02-15 11:50:28 UTC
  • Revision ID: james.westby@ubuntu.com-20090215115028-exdnd0gtie61uvn2
Tags: 9.04.2
* Various serverguide fixes:
  - Grammar error (LP: #203829) - Dean Sas
  - Fix mailman dependencies (LP: #291772) - Morten Siebuhr
  - CVS installation error (LP: #298605) - Thomas M
  - Postfox installation error (LP: #306289) - Adam Sommer
  - SSH update (LP: #311900) - Dean Sas
  - unzoo replaced by zoo (LP: #312506)
  - Samba instructions update (LP: #313232) - Adam Sommer
  - Clearer SSL instructions (LP: #314951) - Adam Sommer
  - LDAP error (LP: #319179) - Adam Sommer
  - MoinMoin installation fix (LP: #320840) - Adam Sommer
  - Postfix ssl improvements (LP: #323203) - Adam Sommer
  - Ebox instructions error (LP: #324399) - Dean Sas
  - Typo in openssh section (LP: #325828) - Dean Sas
  - Typo in samba section (LP: #285484) - Nick Ellery
  - SSHD fix (LP: #295279) - Adam Sommer
  - Jeos fix (LP: #307582) - Adam Sommer
  - Remove reference to ebox-all package (LP: #322367) - Adam Sommer

* Typo in "switching from windows" (LP: #309735)
* Broken link in "programming" (LP: #310081) - Jonathan Jesse
* lsb_release issue in "basic commands" (LP: #310713) - Thomas M
* Updating logout instructions (LP: #327060) - Dean Sas
* Updating all documents to use apt-url for installation instructions
* Refreshing pot files for Rosetta
* Recompress *.png files with 'advpng -z -4 file.png' to save space -  Sahak Petrosyan
* Improve instructions on pasting commands (LP: #185892) - Martin Mai
* Rewrite of networking instructions (LP: #298513, LP: #321308, LP: #314680, LP: #321179) - Dougie Richardson
* Amend punctuation of about-ubuntu (LP: #275592) - Dougie Richardson
* Documentation for automatic login (LP: #290467) - Dougie Richardson

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8"?>
 
2
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 
 
3
        "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
 
4
<!ENTITY % globalent SYSTEM "../../libs/global.ent">
 
5
%globalent;
 
6
<!ENTITY % gnome-menus-C SYSTEM "../../libs/gnome-menus-C.ent">
 
7
%gnome-menus-C;
 
8
<!ENTITY % xinclude SYSTEM "../../libs/xinclude.mod">
 
9
%xinclude;
 
10
<!ENTITY language "&EnglishAmerican;">
 
11
]>
 
12
<chapter id="other-useful-applications" status="review">
 
13
  <title>Other Useful Applications</title>
 
14
 
 
15
  <para>
 
16
  There are many very useful applications developed by the Ubuntu Server Team, 
 
17
  and others that are well integrated with Ubuntu Server Edition, that might 
 
18
  not be well known.  This chapter will showcase some useful applications that can 
 
19
  make administering an Ubuntu server, or many Ubuntu servers, that much easier.
 
20
  </para>
 
21
 
 
22
  <sect1 id="update-motd" status="review">
 
23
    <title>Update MOTD</title>
 
24
 
 
25
    <para>
 
26
    When logging into an Ubuntu server you may have noticed the informative Message Of The Day (MOTD).  This information
 
27
    is obtained and displayed using a couple of packages:
 
28
    </para>
 
29
 
 
30
    <itemizedlist>
 
31
      <listitem>
 
32
        <para>
 
33
        <emphasis>landscape-common:</emphasis> provides the core libraries of <application>landscape-client</application>,
 
34
        which can be used to manage systems using the web based <emphasis>Landscape</emphasis> application.  The package includes
 
35
        the <application>/usr/bin/landscape-sysinfo</application> utility which is used to gather the information displayed
 
36
        in the MOTD.
 
37
        </para>
 
38
      </listitem>
 
39
      <listitem>
 
40
        <para>
 
41
        <emphasis>update-motd:</emphasis> is used to automatically update the MOTD via <application>cron</application>.
 
42
        </para>
 
43
      </listitem>
 
44
    </itemizedlist>
 
45
 
 
46
    <para>
 
47
    The <application>update-motd</application> utility has several options to further customize the MOTD:
 
48
    </para>
 
49
 
 
50
    <itemizedlist>
 
51
      <listitem>
 
52
        <para>
 
53
        <emphasis>--disable:</emphasis> prevents automatic updates of the MOTD.  Using this option creates the
 
54
        <filename>/var/lib/update-motd/disabled</filename> file, which if present stops <application>update-motd</application>
 
55
        from modifying <filename>/etc/motd</filename>.
 
56
        </para>
 
57
      </listitem>
 
58
      <listitem>
 
59
        <para>
 
60
        <emphasis>--enable:</emphasis> enables the automatic MOTD updates.  If <filename>/var/lib/update-motd</filename>
 
61
        is present it will be removed.
 
62
        </para>
 
63
      </listitem>
 
64
      <listitem>
 
65
        <para>
 
66
        <emphasis>--force:</emphasis> does a one time update of <filename>/etc/motd</filename>, overriding <application>update-motd</application>
 
67
        if it has been disabled. 
 
68
        </para>
 
69
      </listitem>
 
70
      <listitem>
 
71
        <para>
 
72
        <emphasis>d, hourly, weekly, monthly:</emphasis> option will run the scripts in <filename>/etc/update-motd.d/</filename> (default), 
 
73
        <filename>/etc/update-motd.d/hourly</filename>, <filename>/etc/update-motd.d/weekly</filename>, or
 
74
        <filename>/etc/update-motd.d/monthly</filename> respectively.
 
75
        </para>
 
76
      </listitem>
 
77
    </itemizedlist>
 
78
 
 
79
    <para>
 
80
    <application>update-motd</application> executes the scripts in <filename>/etc/update-motd.d</filename> in order based on the number 
 
81
    prepended to the script.  Separate <application>cron</application> scripts execute every ten minutes, hourly, weekly, and monthly
 
82
    running the corresponding scripts in <filename>/etc/update-motd.d</filename>.  The output of the scripts is written to 
 
83
    <filename>/var/run/update-motd/</filename>, keeping the numerical order, then concatenated with 
 
84
    <filename>/etc/motd.tail</filename> and written to <filename>/etc/motd</filename>.
 
85
    </para>
 
86
 
 
87
    <para>
 
88
    You can add your own dynamic information to the MOTD.  For example, to add local weather information:
 
89
    </para>
 
90
 
 
91
    <itemizedlist>
 
92
      <listitem>
 
93
        <para>
 
94
        First, install the <application>weather-util</application> package:
 
95
        </para>
 
96
 
 
97
<screen>
 
98
<command>sudo apt-get install weather-util</command>
 
99
</screen>
 
100
 
 
101
      </listitem>
 
102
      <listitem>
 
103
        <para>
 
104
        The <application>weather</application> utility uses METAR data from the National Oceanic and Atmospheric Administration 
 
105
        and forecasts from the National Weather  Service. In order to find local information you will need the 4-character ICAO 
 
106
        location indicator. This can be determined by browsing to the 
 
107
        <ulink url="http://www.weather.gov/tg/siteloc.shtml">National Weather Service</ulink> site.
 
108
        </para>
 
109
 
 
110
        <para>
 
111
        Although the National Weather Service is a United States government agency there are weather stations available world wide.
 
112
        However, local weather information for all locations outside the U.S. may not be available.
 
113
        </para>
 
114
      </listitem>
 
115
      <listitem>
 
116
        <para>
 
117
        Create <filename>/usr/local/bin/local-weather</filename>, a simple shell script to use 
 
118
        <application>weather</application> with your local ICAO indicator:
 
119
        </para>
 
120
 
 
121
<programlisting>
 
122
#!/bin/sh
 
123
##########################################################################
 
124
#
 
125
# Prints the local weather to /var/run/update-motd/60-local-weather  
 
126
# for update-motd.
 
127
#
 
128
##########################################################################
 
129
 
 
130
# Replace KINT with your local weather station.
 
131
# Local stations can be found here: http://www.weather.gov/tg/siteloc.shtml
 
132
 
 
133
echo "" > /var/run/update-motd/60-local-weather
 
134
weather -i KINT >> /var/run/update-motd/60-local-weather
 
135
 
 
136
</programlisting>
 
137
      </listitem>
 
138
      <listitem>
 
139
        <para>
 
140
        Make the script executable:
 
141
        </para>
 
142
 
 
143
<screen>
 
144
<command>sudo chmod 755 /usr/local/bin/local-weather</command>
 
145
</screen>
 
146
      </listitem>
 
147
      <listitem>
 
148
        <para>
 
149
        Next, create a symlink to <filename>/etc/update-motd.d/60-local-weather</filename>:
 
150
        </para>
 
151
 
 
152
<screen>
 
153
<command>sudo ln -s /usr/local/bin/local-weather /etc/update-motd.d/60-local-weather</command>
 
154
</screen>
 
155
      </listitem>
 
156
      <listitem>
 
157
        <para>
 
158
        Finally, update the MOTD:
 
159
        </para>
 
160
 
 
161
<screen>
 
162
<command>sudo update-motd</command>
 
163
</screen>
 
164
      </listitem>
 
165
    </itemizedlist>
 
166
 
 
167
    <para>
 
168
    You should now be greeted with some useful information, and some information about the local weather that may not be
 
169
    quite so useful. Hopefully the <application>local-weather</application> example demonstrates the flexibility of
 
170
    <application>update-motd</application>.
 
171
    </para>
 
172
 
 
173
  </sect1>
 
174
  <sect1 id="etckeeper" status="review">
 
175
    <title>etckeeper</title>
 
176
 
 
177
    <para>
 
178
    <application>etckeeper</application> allows the contents of <filename role="directory">/etc</filename> be easily stored in 
 
179
    Version Control System (VCS) repository. It hooks into <application>apt</application> to automatically commit changes to
 
180
    <filename>/etc</filename> when packages are installed or upgraded.  Placing <filename>/etc</filename> under version control 
 
181
    is considered an industry best practice, and the goal of <application>etckeeper</application> is to make this process as 
 
182
    painless as possible.  
 
183
    </para>
 
184
 
 
185
    <para>
 
186
    Install <application>etckeeper</application> by entering the following in a terminal:
 
187
    </para>
 
188
 
 
189
<screen>
 
190
<command>sudo apt-get install etckeeper</command>
 
191
</screen>
 
192
 
 
193
    <para>
 
194
    The main configuration file, <filename>/etc/etckeeper/etckeeper.conf</filename>, is fairly simple.  The main options being which
 
195
    VCS and which package management system to use.  By default <application>etckeeper</application> is configured to use 
 
196
    <application>bzr</application> for version control, <application>apt</application> for high level package mangement, and 
 
197
    <application>dpkg</application> for low level package management.
 
198
    </para>
 
199
 
 
200
    <para>
 
201
    With the package installed, it is time to initialize the repository.  In a terminal enter:
 
202
    </para>
 
203
 
 
204
<screen>
 
205
<command>sudo etckeeper init</command>
 
206
</screen>
 
207
 
 
208
   <para>
 
209
   Next, commit the files to the repository:
 
210
   </para>
 
211
 
 
212
<screen>
 
213
<command>sudo etckeeper commit "initial import"</command>
 
214
</screen>
 
215
 
 
216
    <para>
 
217
    Using the VCS commands you can view log information about files in <filename>/etc</filename>:
 
218
    </para>
 
219
 
 
220
<screen>
 
221
<command>sudo bzr log /etc/passswd</command>
 
222
</screen>
 
223
 
 
224
    <para>
 
225
    To demonstrate the integration with the package management system, install <application>postfix</application>:
 
226
    </para>
 
227
 
 
228
<screen>
 
229
<command>sudo apt-get install postfix</command>
 
230
</screen>
 
231
 
 
232
    <para>
 
233
    When the installation is finished, all the <application>postfix</application> configuration files should be committed to the
 
234
    repository:
 
235
    </para>
 
236
 
 
237
<screen>
 
238
<computeroutput>Committing to: /etc/
 
239
added aliases.db
 
240
modified group
 
241
modified group-
 
242
modified gshadow
 
243
modified gshadow-
 
244
modified passwd
 
245
modified passwd-
 
246
added postfix
 
247
added resolvconf
 
248
added rsyslog.d
 
249
modified shadow
 
250
modified shadow-
 
251
added init.d/postfix
 
252
added network/if-down.d/postfix
 
253
added network/if-up.d/postfix
 
254
added postfix/dynamicmaps.cf
 
255
added postfix/main.cf
 
256
added postfix/master.cf
 
257
added postfix/post-install
 
258
added postfix/postfix-files
 
259
added postfix/postfix-script
 
260
added postfix/sasl
 
261
added ppp/ip-down.d
 
262
added ppp/ip-down.d/postfix
 
263
added ppp/ip-up.d/postfix
 
264
added rc0.d/K20postfix
 
265
added rc1.d/K20postfix
 
266
added rc2.d/S20postfix
 
267
added rc3.d/S20postfix
 
268
added rc4.d/S20postfix
 
269
added rc5.d/S20postfix
 
270
added rc6.d/K20postfix
 
271
added resolvconf/update-libc.d
 
272
added resolvconf/update-libc.d/postfix
 
273
added rsyslog.d/postfix.conf
 
274
added ufw/applications.d/postfix
 
275
Committed revision 2.</computeroutput>
 
276
</screen>
 
277
 
 
278
    <para>
 
279
    For an example of how <application>etckeeper</application> tracks manual changes, add new a host to <filename>/etc/hosts</filename>.
 
280
    Using <application>bzr</application> you can see which files have been modified:
 
281
    </para>
 
282
 
 
283
<screen>
 
284
<command>sudo bzr status /etc/</command>
 
285
<computeroutput>modified:
 
286
  hosts</computeroutput>
 
287
</screen>
 
288
 
 
289
    <para>
 
290
    Now commit the changes:
 
291
    </para>
 
292
 
 
293
<screen>
 
294
<command>sudo etckeeper commit "new host"</command>
 
295
</screen>
 
296
 
 
297
    <para>
 
298
    For more information on <application>bzr</application> see <xref linkend="bazaar"/>.
 
299
    </para>
 
300
   
 
301
  </sect1>
 
302
  <sect1 id="screen-profiles" status="review">
 
303
    <title>Screen Profiles</title>
 
304
 
 
305
    <para>
 
306
    One of the most useful applications for any system administrator is <application>screen</application>.  It allows the execution
 
307
    of multiple shells in one terminal. To make some of the advanced <application>screen</application> features more 
 
308
    user friendly, and provide some useful information about the system, the <application>screen-profiles</application> package was 
 
309
    created.  
 
310
    </para>
 
311
 
 
312
    <para>
 
313
    When executing <application>screen</application> for the first time you will be presented with the 
 
314
    <application>screen-profiles-helper</application> menu.  This menu will allow you to:
 
315
    </para>
 
316
 
 
317
    <itemizedlist>
 
318
      <listitem><para>View the Help menu</para></listitem>
 
319
      <listitem><para>Change the key binding set</para></listitem>
 
320
      <listitem><para>Change screen profiles</para></listitem>
 
321
      <listitem><para>Change the escape sequence</para></listitem>
 
322
      <listitem><para>Create new screen windows</para></listitem>
 
323
      <listitem><para>Manage the default windows</para></listitem>
 
324
      <listitem><para>Install screen by default at login</para></listitem>
 
325
    </itemizedlist>
 
326
 
 
327
    <para>
 
328
    The <emphasis>key bindings</emphasis> determine such things as the escape sequence, new window, change window, etc.  There 
 
329
    are two key binding sets to choose from <emphasis>common</emphasis> and <emphasis>none</emphasis>.  If you wish to use the 
 
330
    original key bindings choose the <emphasis>none</emphasis> set.
 
331
    </para>
 
332
 
 
333
    <para>
 
334
    The Ubuntu <application>screen-profiles</application> provide a menu which displays the Ubuntu release, processor information,
 
335
    memory information, and the time and date. The effect is similar to a desktop menu.  When a profile is selected it will be 
 
336
    symlinked to <filename>~/.screenrc</filename>.  The <application>select-screen-profile</application> utility can also be used 
 
337
    to change profiles, in a terminal enter:
 
338
    </para>
 
339
 
 
340
<screen>
 
341
<command>select-screen-profile -s ubuntu-light</command>
 
342
</screen>
 
343
   
 
344
    <para>
 
345
    The <emphasis>plain</emphasis> profile will change <application>screen</application> back to the defaults, which does not include
 
346
    the information menu at the bottom.
 
347
    </para>
 
348
 
 
349
    <para>
 
350
    Using the <emphasis>"Install screen by default at login"</emphasis> option will cause screen to be executed any time a terminal is opened.
 
351
    Changes made to <application>screen</application> are on a per user basis, and will not affect other users on the system.
 
352
    </para>
 
353
 
 
354
    <para>
 
355
    One difference when using screen is the <emphasis>scrollback</emphasis> mode.  If you are using one of the Ubuntu profiles press the 
 
356
    <emphasis>F7</emphasis>, or <emphasis>Ctrl+a+[</emphasis> if not, to enter scrollback mode.  Scrollback mode allows you to navigate 
 
357
    past output using <emphasis>vi</emphasis> like commands.  Here is a quick list of movement commands:
 
358
    </para>
 
359
 
 
360
    <itemizedlist>
 
361
      <listitem><para><emphasis>h</emphasis> - Move the cursor left by one character</para></listitem>
 
362
      <listitem><para><emphasis>j</emphasis> - Move the cursor down by one line</para></listitem>
 
363
      <listitem><para><emphasis>k</emphasis> - Move the cursor up by one line</para></listitem>
 
364
      <listitem><para><emphasis>l</emphasis> - Move the cursor right by one character</para></listitem>
 
365
      <listitem><para><emphasis>0</emphasis> - Move to the beginning of the current line</para></listitem>
 
366
      <listitem><para><emphasis>$</emphasis> - Move to the end of the current line</para></listitem>
 
367
      <listitem><para><emphasis>G</emphasis> - Moves to the specified line (defaults to the end of the buffer)</para></listitem>
 
368
      <listitem><para><emphasis>C-u</emphasis> - Scrolls a half page up</para></listitem>
 
369
      <listitem><para><emphasis>C-b</emphasis> - Scrolls a full page up</para></listitem>
 
370
      <listitem><para><emphasis>C-d</emphasis> - Scrolls a half page down</para></listitem>
 
371
      <listitem><para><emphasis>C-f</emphasis> - Scrolls the full page down</para></listitem>
 
372
      <listitem><para><emphasis>/</emphasis> - Search forward</para></listitem>
 
373
      <listitem><para><emphasis>?</emphasis> - Search backward</para></listitem>
 
374
      <listitem><para><emphasis>n</emphasis> - Moves to the next match, either forward or backword</para></listitem>
 
375
    </itemizedlist>
 
376
 
 
377
  </sect1>
 
378
  <sect1 id="other-app-references" status="review">
 
379
    <title>References</title>
 
380
 
 
381
    <itemizedlist>
 
382
      <listitem>
 
383
        <para>
 
384
        See the <ulink url="http://manpages.ubuntu.com/manpages/jaunty/en/man1/update-motd.1.html">update-motd man page</ulink> for
 
385
        more options available to <application>update-motd</application>.
 
386
        </para>
 
387
      </listitem>
 
388
      <listitem>
 
389
        <para>
 
390
        The Debian Package of the Day 
 
391
        <ulink url="http://debaday.debian.net/2007/10/04/weather-check-weather-conditions-and-forecasts-on-the-command-line/">weather</ulink>
 
392
        article has more details about using the <application>weather</application>utility.
 
393
        </para>
 
394
      </listitem>
 
395
      <listitem>
 
396
        <para>
 
397
        See the <ulink url="http://kitenet.net/~joey/code/etckeeper/">etckeeper</ulink> site for more details on using 
 
398
        <application>etckeeper</application>.
 
399
        </para>
 
400
      </listitem>
 
401
      <listitem>
 
402
        <para>
 
403
        For the latest news and information about <application>bzr</application> see the <ulink url="http://bazaar-vcs.org/">bzr</ulink> web site.
 
404
        </para>
 
405
      </listitem>
 
406
      <listitem>
 
407
        <para>
 
408
        For more information on <application>screen</application> see the <ulink url="http://www.gnu.org/software/screen/">screen web site</ulink>.
 
409
        </para>
 
410
      </listitem>
 
411
      <listitem>
 
412
        <para>
 
413
        Also, see the <application>screen-profiles</application> <ulink url="https://launchpad.net/screen-profiles">project page</ulink> for more
 
414
        information.
 
415
        </para>
 
416
      </listitem>
 
417
    </itemizedlist>
 
418
  </sect1>
 
419
</chapter>