Monday, May 17, 2010

plan 9 tutorial

http://www.magma.com.ni/moin/Plan9Tutorial


Logo The Magma Soft Wiki
MagmaSoft

* Plan9Tutorial

Wiki

* RecentChanges
* FindPage
* HelpContents
* Plan9Tutorial

Page

* Immutable Page
* Comments
* Info
* Attachments
*
More Actions:

User

* Login

TableOfContents

1. Plan9

[http://cm.bell-labs.com/plan9/ Plan9] is an operating system designed by developers at Bell Labs.

Although Plan 9 derives from Unix it uses a different approach, and is not compatible with Unix like Operating Systems.. Commands differ, the internal workings differ, setup, configuration and maintenance differ.

See the [http://cm.bell-labs.com/plan9/ Plan9 Homepage] for lots of Talk about this.

2. About this Tutorial

This Tutorial walks through setup and configuration and maintenance tasks of a Network of Plan9 machines, taking into account the most recent kernels and tools (at the time of writing, of course).

A rather good understanding of computers and operating systems is required, you should at least know Linux or any other Unix like operating system from the point of view of a Systemadministrator.

I have put it together while figureing out things out for myself. The main source of information have been the excelent manual pages of Plan9 as well as the papers, all found on the Plan9 [http://cm.bell-labs.com/plan9/ homepage].

There are two intended modes of reading:

Newcomers:
should be able to read and execute this tutorial from top to bottom and find themselves left with a working Plan9 network
Recidivists:
should find it easy to encounter the bits and pieces of information they always wanted to have in one place

While following the steps, one should be able to copy and paste the given examples (with shaded background) either directly to the target system, or, as I do often for the Xen/textonly installations, copy them to an open editor window of the host operating system, modify what needs to, and copy and paste from the editor window to the Plan9 console or terminal.

Since this is a [http://c2.com/cgi/wiki?WikiWikiWeb Wiki], the whole tutorial is made up of single Wiki pages containing just the information of a certain context, and can be accessed directly. Find here the list of pages of the tutorial:

PageList(Plan9Tutorial/)

3. A Plan9 Network

in Plan9 (almost) any resource can be on another machine in the Network so, there are several roles a machine can take:

terminal:

Every end user is working with a terminal. A terminal machine has mouse, keyboard and a graphics display. It needs not have a hard disk, since files can be provided by a fileserver. The program drawterm simulates the behaviour of a terminal under other operating systems thus can be used as a terminal too.
fileserver:
the name is ambiguous, since a fileserver really is a program serving files either locally or via the network. As a machine, a "fileserver" runs a fileserver, thus providing its disk space, to other computers. Mainly: space for the user to store data as well as the program files the user is executing.

There can be several "fileservers" in a network, and a user will surely use external fileservers like for example the [http://cm.bell-labs.com/wiki/plan9/sources_repository/index.html Plan9 sources] fileserver.
cpuserver:
programs can be executed either locally or on a cpuserver; also processortime is a shared resource to Plan9. There can be several cpuservers in a Plan9 Network.
authserver:

A Plan9 network is "hold together" by an authserver. This is a program which authenticates users of an authentication domain via the network. For security reasons it is recommendable to run the authserver on a dedicate machine, which would then be the "authserver". So in one Plan9 network there is just one authentication server. In practice the authentication domain will be a string the same as the DNS domain of the network, or a subdomain of it.

4. Kernel types

File, cpu and authentication server normally don't need a mouse, keyboard, and display, since they should be left alone and are probably locked away in a serverroom.

The Plan9 kernel can be (re)compiled to accomplish the different tasks described in "A Plan9 Network", as well as with the drivers needed for a certain hardware configuration. Thus the kernel size is kept small and more space for user processes is left.

There is a distinction between "cpu" and "terminal" kernels:

terminal:

at bootup a terminal kernel asks for a username. This user will be the hostowner until the next reboot. If any resource on the network which requires authorization is accessed, authentication against the user with the same name in the authserver is initiated. BR It is often handy to have a terminal kernel around even on cpu machines for administrative and maintenance tasks, because you can become any user without being asked for a password.
cpu:
a cpu kernel reads the username (an password) of the hostowner either from nvram, or from a 1 block partition on the harddisk which is used to simulate the nvram. Thus the cpu kernel can startup without user interaction.

During the boot process an initial rc script is run. On a terminal kernel it is looked for at /rc/bin/termrc, on the cpu kernel in /rc/bin/cpurc

Include(Plan9Tutorial/SetupConsiderations, 'Setup Considerations', 1)

5. Os Installation

You will (obviously) have to install Plan9 on several computers. For this you have several choices:

* Install on a dedicated hardware:
o

See the [http://cm.bell-labs.com/wiki/plan9/installation_instructions/ official installation instructions]
* Installation under Qemu
o

./QemuInstall
* Installation under Xen
o

./XenInstall

After this you can proceed with the network setup.

If you are using Xen instances - which do not provide a grafical environment, you will want to connect to your Plan9 computers via [http://swtch.com/drawterm/ drawterm] which runs under Linux, OsX and Windows.

6. Setup of different Services

Include(Plan9Tutorial/AuthServer, 'Authentication Server', 2)

Include(Plan9Tutorial/FileServer, 'CPU & Fileserver', 2)

6.1. Connecting with a Terminal

* TODO: there are several forms how to get to a terminal, e.g. installing Plan9 under Qemu. However I'd like to facilitate a prefabricated Qemu-Term kernel and setup, which doesn't need the setup CD then. TODO: termrc and especially /lib/ndb/* setup for the terminal

6.2. Secstore

There are essentially two tasks to set up and fill a secstore for a user:

* creating the secstore user on the authserver with an "administrative" account
* creating a (factotum) file on the secstore as the secstore user

The first step has already been done for the hostowner user of the authserver. We repeat the command here for reference, you must be logged in as the hostowner on the authserver:

auth/secuser

You will be asked for the secstore password (which is not the user password) and some other data for which you can (should) use the defaults.

Now start a terminal as the user for which you created the secstore. Or tell the user to do this and proceed as follows. You need both: the secstore password and the users password.

* open a fresh window in the terminal
* log into the authserver to generate an entry in factotum

cpu -h porticus
exit

* create an initial factotum file and edit it

ramfs –p; cd /tmp
cat /mnt/factotum/ctl > factotum
acme factotum

*

You get a line like: key proto=p9sk1 dom=magma.intern user=user !password?
*

change the ? sign at the end of the line to =password, ok, make it look like:
o

key proto=p9sk1 dom=magma.intern user=user !password=password
* store the modified file to the secstore

auth/secstore –p factotum

*

then destroy the window, to leave no traces of your cleartext password.

When you login next time, you will be asked for your secstore password instead of your user password.

Maintenance of the factotum file is done by the ipso command, which must be run from a standalone terminal. We'll see into that later.

7. Administrative Tasks

Include(Plan9Tutorial/AddUser, 'Adding a user', 2)

8. Other Helpful Things

*

./RcProfile
o This sets up a system wide 'profile' for the rc(1) shell, separating concerns from shell setup and user environment setup
*

./RcScripts
o Several scripts which provide commands I find nice to have.
* ndb setup, to include Plan9 related systems:

cat > /lib/ndb/plan9 <# /lib/ndb/plan9
# LEG20061122
#
# Plan9 related external systems

auth=sources.cs.bell-labs.com authdom=outside.plan9.bell-labs.com
auth=brd.9grid.de authdom=9grid.de
EOF

* then modify /lib/ndb/local to contain:

database=
file=/lib/ndb/local
file=/lib/ndb/common
file=/lib/ndb/plan9
file=/lib/ndb/auth

9. TODO

* delete a user
* setup ssh connections
* fossil+venti adm
* secstore
* explain network config, ntp config
* drawterm from Linux, Windows (?)
* 9fs to/from Linux
* nfs
*

./CpuChangeHostowner

MagmaSoft: Plan9Tutorial (last edited 2006-12-18 21:26:29 by GeorgLehner)

* MoinMoin Powered
* Python Powered
* GPL licensed
* Valid HTML 4.01

No comments: