7.9. File services (NFS)

Important

The NFS system allows a server to export a file system so that it can be used interactively from a client. The service consists of an nfsd server and a client (mountd) which can share a file system (or part of it) through the network.

In Debian, installapt-get install nfs-common portmapfor the client, while the server needs:
apt-get install nfs-kernel-server nfs-common portmap.

The server (in Debian) starts through the nfscommon and nfs-kernel-server scripts in /etc/init.d (and the appropriate links in /etc/rcX.d).

The server uses a file (/etc/exports) to manage the access and control of the file systems that will be accessed remotely. On the client, the root (or other user through sudo) can mount the remote system using the command:

mount IPserver:remote-directory local_directory

and as of that moment, the remote-directory will be seen within the local directory (which must exist before executing the mount). This task in the client can be automated using the automatic mount file (/etc/fstab) including a line; for example:

pirulo.remix.com:/usr/local /pub nfs rsize=8192,wzise=8192,timeo=14

This sentence indicates that the directory /usr/local of the host pirulo.remix.com will be mounted in the /pub local directory. The parameters rsize, wzise are the size of the reading and writing blocks, timeo is the RPC timeout (if these three values are not specified, the default values are taken).

The /etc/exports file serves as ACL (access control list) of the file systems that can be exported to the clients. Every line contains a file system to be exported followed by the clients that can mount it, separated by blank spaces. Each client can have a set of options associated to it in order to modify the behaviour (see the exports man for a detailed list of the options). An example of this could be:

# Example of /etc/exports
/ /master(rw) trusty(rw,no_root_squash)
/projects proj*.local.domain(rw)
/usr *.local.domain(ro) @trusted(rw)
/pub (ro,insecure,all_squash)
/home 195.12.32.2(rw,no_root_squash) www.first.com(ro)
/user 195.12.32.2/24(ro,insecure)

The first line exports the entire file system (/) to master and trusty in read/write mode. Plus, for trusty there is no uid squashing (the root of the client will access as root the root files of the server, in other words, the two root are equivalent despite being from different machines; it is suited for machines without a disk). The second and third lines show examples of '*' and netgroups (indicated by @). The fourth line exports the /pub directory to any machine in the world, read-only, allows access to NFS clients that do not use a port reserved for NFS (option insecure) and everything is executed under the user nobody (option all squash). The fifth line specifies one client for its IP and the sixth the same but with a network mask (/24) and with options between brackets () and without any spaces. There can only be spaces between the enabled clients. It is important to bear in mind that there are 3 versions of NFS (V2, V3 and recently V4). The most common ones are V3 and in some installations V2. If from a V3 client we connect to a V2 server, this situation must be indicated with a parameter.

7.9.1. Wiki server

A wiki (from Hawaiian wiki wiki, "fast") is a collaborative website that can be edited by various users who can create, edit, delete or modify the content of a web page, in an easy, fast and interactive manner; these capabilities make wiki an effective tool for collaborative writing. Wiki technology allows web pages stored in a public server (the wiki pages) to be written in a collaborative fashion through a navigator, using simple notation for giving format, creating links etc., saving a log of changes that makes it possible to recover easily any prior status of the page. When someone edits a wiki page, its changes appear immediately on the web, without passing through any type of prior revision. Wiki can also refer to pages of hypertext, which can be visited and edited by anyone (definition of Wikipedia). Debian has its wiki in http://wiki.debian.org/ and FC in http://fedoraproject.org/wiki/ and both are based on Moin Moin (http://moinmoin.wikiwikiweb.de/). MoinMoin is a Python WikiClone that can rapidly initiate its own wiki; it just needs a web server and the installed Python language.

In http://moinmoin.wikiwikiweb.de/MoinMoinPackages/DebianLinux we can find detailed instructions for installing Moin Moin on Debian, but, basically, it comes down to: 1) Installing apache2 and mod_python, 2) configuring Apache to note the code of MoinMoin, 3) installing the moinmoin package, 4) configuring MoinMoin and 5) restarting Apache. A configuration example:

apt-get install python-moinmoin mkdir /var/www/mywiki cp -r /usr/share/moin/data /usr/share/moin/underlay \ /usr/share/moin/server/moin.cgi /var/www/mywiki chown -R www-data:www-data /var/www/mywiki chmod -R g+w /var/www/mywiki

The Wiki will be installed on http://yoursite.com/mywiki/