Version 1 (modified by ibaldin, 10 years ago)

--

ZFS Server Installation and Configuration

1. Install OpenSolaris?. OpenSolaris? will create a default ZFS pool called rpool.

2. You must create the following ZFS hierarchy:

zfs create rpool/images
zfs create rpool/images/orca
zfs create rpool/images/orca/base
zfs create rpool/images/orca/clone

We will use orca/base for template images and orca/clone for cloned filesystems.

3. You must enable NFS sharing for rpool/images/orca

zfs set sharenfs=rw=@192.168.0.0/16,root=@192.168.0.0/16 rpool/images/orca

This command enables mount (and root mount) from 192.168.0.0/16

ZFS Driver Preparation

1. Create a user sharp on the ZFS server

useradd -d /export/home/sharp -m -s /bin/bash sharp
passwd sharp

2. Generate a keypair for user sharp

Login as sharp and invoke:

ssh-keygen -b 1024 -t dsa

Select the default location. When prompted for key password press enter (no password).

3. Enable password-less ssh login for user sharp

cd ~/.ssh
cat id_dsa.pub > authorized_keys

To test your setup:

ssh localhost

This command should succeed without requiring a password.

4. Copy /root/.ssh/id_dsa to your build machine. We will refer to this key as sharp_dsa.

5. Enable user sharp to invoke zfs

Add this to ~sharp/.profile

export PATH=${PATH}:/usr/sbin/

6. As root install sudo:

wget ftp://ftp.sunfreeware.com/pub/freeware/intel/10/sudo-1.6.9p18-sol10-x86-local.gz
wget ftp://ftp.sunfreeware.com/pub/freeware/intel/10/libintl-3.4.0-sol10-x86-local.gz
wget ftp://ftp.sunfreeware.com/pub/freeware/intel/10/libiconv-1.11-sol10-x86-local.gz
wget ftp://ftp.sunfreeware.com/pub/freeware/intel/10/libgcc-3.3-sol10-intel-local.gz

gunzip sudo-1.6.9p18-sol10-x86-local.gz
gunzip libintl-3.4.0-sol10-x86-local.gz
gunzip libiconv-1.11-sol10-x86-local.gz
gunzip libgcc-3.3-sol10-intel-local.gz

pkgadd -d sudo-1.6.9p18-sol10-x86-local 
pkgadd -d libintl-3.4.0-sol10-x86-local
pkgadd -d libiconv-1.11-sol10-x86-local
pkgadd -d libgcc-3.3-sol10-intel-local

Answer yes to all prompts during the installation.

Create symbolic links:

ln -s -f /usr/local/bin/sudo /usr/bin/sudo
ln -s -f /usr/local/etc/sudoers /etc/sudoers

Invoking sudo should produce output similar to this one:

-sh-3.2$ sudo
usage: sudo -K | -L | -V | -h | -k | -l | -v
usage: sudo [-HPSb] [-p prompt] [-u username|#uid]
            { -e file [...] | -i | -s | <command> }

7. Edit the sudoers file to enable sharp to invoke zfs

Make /etc/sudoers writable:

chmod u+w /etc/sudoers

Edit /etc/sudoers and add the following line:

sharp   ALL=NOPASSWD:/usr/sbin/zfs

Change the permissions on /etc/sudoers back:

chmod 0440 /etc/sudoers

Now login as sharp and test with the following command:

sudo zfs list