This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
user:jbrant:csit1320:afs_install [2010/05/14 09:57] – jbrant | user:jbrant:csit1320:afs_install [2010/05/15 17:55] (current) – jbrant | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== The first thing we need to do is create a virtual disk: ====== | ||
+ | |||
+ | **dd if=/ | ||
+ | |||
+ | **mkfs -t ext3 vicepa.disk** | ||
+ | |||
+ | **vi / | ||
+ | add the highlighted line below \\ | ||
+ | # \\ | ||
+ | root = '/ | ||
+ | disk = [ | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ] | ||
+ | after saving the file then do a shutdown of vm14 and bring it back up.(a reboot will not work | ||
+ | |||
+ | |||
+ | Next we need to logon to vm14 and mount the disk: \\ | ||
+ | **mount -o loop -t ext3 /dev/xvda3 /vicepa** \\ | ||
+ | next do a df -k to verify that the disk is mounted. \\ | ||
+ | **df -k** | ||
+ | |||
+ | < | ||
+ | Filesystem | ||
+ | / | ||
+ | tmpfs 65632 | ||
+ | udev | ||
+ | tmpfs 65632 | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | ====== Now we are ready to start the afs install ====== | ||
+ | |||
+ | To get it going we will us the module-assistant method.: | ||
+ | |||
+ | **apt-get install module-assistant** \\ | ||
+ | **m-a prepare openafs** \\ | ||
+ | **m-a a-i openafs** | ||
+ | |||
+ | After the kernel module is installed, we can proceed with installing the OpenAFS client: \\ | ||
+ | This will be run on vm14, vm15, and vm16 | ||
+ | |||
+ | | ||
+ | |||
+ | AFS cell this workstation belongs to: student.lab | ||
+ | # (Your domain name in lowercase, matching the Kerberos realm in uppercase) | ||
+ | |||
+ | Size of AFS cache in kB? **50000** | ||
+ | |||
+ | Run Openafs client now and at boot? **No** | ||
+ | |||
+ | Look up AFS cells in DNS? **Yes** | ||
+ | |||
+ | Encrypt authenticated traffic with AFS fileserver? **No** | ||
+ | |||
+ | |||
+ | Dynamically generate the contents of /afs? **Yes** | ||
+ | |||
+ | Use fakestat to avoid hangs when listing /afs? **Yes** | ||
+ | |||
+ | DB server host names for your home cell: **afs1** | ||
+ | |||
+ | now on vm14 we will install the server software. | ||
+ | ** apt-get install openafs-{fileserver, | ||
+ | |||
+ | Cell this server serves files for: **student.lab** | ||
+ | |||
+ | ====== Now for the configuration part of the work: ====== | ||
+ | |||
+ | |||
+ | Next to configure the server. | ||
+ | | ||
+ | |||
+ | Authenticating as principal root/ | ||
+ | |||
+ | kadmin.local: | ||
+ | Principal " | ||
+ | |||
+ | kadmin.local: | ||
+ | Entry for principal afs with kvno 2, encryption type DES cbc mode with CRC-32 added to keytab WRFILE:/ | ||
+ | |||
+ | kadmin.local: | ||
+ | |||
+ | Once the key's been created and exported to file / | ||
+ | |||
+ | | ||
+ | |||
+ | To verify the key has been loaded and that there is only one key in the AFS KeyFile, run bos listkeys: | ||
+ | **bos listkeys afs1 -localauth** | ||
+ | |||
+ | You should get something like this: | ||
+ | key 2 has cksum 2035850286 | ||
+ | Keys last changed on Tue Jun 24 14:04:02 2008. | ||
+ | |||
+ | edit the / | ||
+ | Restart krb5-kdc with **invoke-rc.d krb5-kdc restart** | ||
+ | After restarting kerbros we need to create the afs cell. | ||
+ | |||
+ | ====== Next we will create the AFS cell: ====== | ||
+ | |||
+ | | ||
+ | |||
+ | |||
+ | Do you meet these requirements? | ||
+ | |||
+ | What administrative principal should be used? **root/ | ||
+ | |||
+ | |||
+ | |||
+ | This will creating initial protection database. | ||
+ | about an id already existing and a bad ubik magic. We can ignore them. | ||
+ | The next thing to do is to setup our first partition | ||
+ | first we need to get an admin token. | ||
+ | |||
+ | **kinit root/ | ||
+ | |||
+ | Password for root/ | ||
+ | |||
+ | **aklog** | ||
+ | |||
+ | We need to verify that you hold the Kerberos ticket and AFS token: | ||
+ | |||
+ | **klist -5f** \\ | ||
+ | You will get some thing like this: | ||
+ | |||
+ | Ticket cache: FILE:/ | ||
+ | Default principal: root/ | ||
+ | |||
+ | Valid starting | ||
+ | 02/09/10 17: | ||
+ | renew until 02/10/10 17:18:16, Flags: FPRIA | ||
+ | 02/09/10 17: | ||
+ | renew until 02/10/10 17:18:16, Flags: FPRAT | ||
+ | |||
+ | tokens | ||
+ | |||
+ | Tokens held by the Cache Manager: | ||
+ | apri | ||
+ | User's (AFS ID 1) tokens for afs@student.lab [Expires Apr 15 03:18] | ||
+ | --End of list-- | ||
+ | - | ||
+ | Now, with a successful kinit and aklog in place, we can run afs-rootvol: | ||
+ | **afs-rootvol** | ||
+ | |||
+ | The AFS client must be running and pointed at the new cell. | ||
+ | Do you meet these conditions? (y/n)** y** | ||
+ | |||
+ | What AFS Server should volumes be placed on? **afs1** | ||
+ | What partition? [a]** a** | ||
+ | |||
+ | ====== We now have an afs cell there is still some configuration left to do ====== | ||
+ | |||
+ | lets enable the client in / | ||
+ | |||
+ | | ||
+ | | ||
+ | next to check the mount point of our afs cell. | ||
+ | **fs lsm / | ||
+ | |||
+ | '/ | ||
+ | |||
+ | Let's check the volume stats | ||
+ | |||
+ | **fs lv / | ||
+ | |||
+ | File / | ||
+ | Volume status for vid = 536870919 named root.cell.readonly | ||
+ | Current disk quota is 5000 | ||
+ | Current blocks used are 4 | ||
+ | The partition has 843456 blocks available out of 907096 | ||
+ | |||
+ | now to test that we can read and write to the afs cell. | ||
+ | **cd / | ||
+ | |||
+ | **ls -al** | ||
+ | |||
+ | total 14 | ||
+ | drwxrwxrwx 2 root root 2048 2008-06-25 02:05 . | ||
+ | drwxrwxrwx 2 root root 8192 2008-06-25 02:05 .. | ||
+ | drwxrwxrwx 2 root root 2048 2008-06-25 02:05 service | ||
+ | drwxrwxrwx 2 root root 2048 2008-06-25 02:05 user | ||
+ | |||
+ | **echo TEST > testfile** | ||
+ | |||
+ | -bash: testfile: Read-only file system | ||
+ | |||
+ | **cd / | ||
+ | |||
+ | **echo TEST > testfile** | ||
+ | |||
+ | -bash: testfile: Permission denied | ||
+ | inorder to write we will need to get a token. | ||
+ | |||
+ | **cd / | ||
+ | ** | ||
+ | fs la .** | ||
+ | |||
+ | Access list for . is | ||
+ | Normal rights: | ||
+ | system: | ||
+ | system: | ||
+ | |||
+ | **kinit root/admin; aklog** | ||
+ | |||
+ | Password for root/ | ||
+ | |||
+ | **echo TEST > testfile** | ||
+ | |||
+ | **cat testfile** | ||
+ | |||
+ | TEST | ||
+ | |||
+ | **rm testfile** | ||
+ | |||
+ | ====== Adding new users to AFS ====== | ||
+ | |||
+ | In order to add new user to AFS you will need to first set them up in Kerberos and then in afs.\\ | ||
+ | Once we have the user setup in Kerberos now we can add them to AFS. \\ | ||
+ | **pts createuser mirko 20000** | ||
+ | |||
+ | User mirko has id 20000 | ||
+ | next we need to create the home volume for user. | ||
+ | |||
+ | **vos create afs1 a user.mirko 20000** | ||
+ | |||
+ | Volume 536997357 created on partition /vicepa of afs1 | ||
+ | |||
+ | **vos examine user.mirko** | ||
+ | |||
+ | user.mirko | ||
+ | afs1.student.lab / | ||
+ | RWrite | ||
+ | MaxQuota | ||
+ | Creation | ||
+ | Copy Sun Apr 19 18:30:45 2010 | ||
+ | Backup | ||
+ | Last Update Never | ||
+ | |||
+ | RWrite: 536997357 | ||
+ | number of sites -> 1 | ||
+ | | ||
+ | |||
+ | ====== | ||
+ | |||
+ | |||
+ | **cd / | ||
+ | ** | ||
+ | mkdir -p m/mi** | ||
+ | ** | ||
+ | fs mkm m/mi/mirko user.mirko -rw** | ||
+ | next to view volume and directory information: | ||
+ | **fs lsm m/ | ||
+ | |||
+ | ' | ||
+ | |||
+ | **fs lv m/ | ||
+ | |||
+ | File m/mi/mirko (536997357.1.1) contained in volume 536997357 | ||
+ | Volume status for vid = 536997357 named user.mirko | ||
+ | Current disk quota is 20000 | ||
+ | Current blocks used are 2 | ||
+ | The partition has 843456 blocks available out of 907096 | ||
+ | |||
+ | now lets view the permissions on the volume: | ||
+ | **fs la m/ | ||
+ | |||
+ | Access list for m/mi/mirko is | ||
+ | Normal rights: | ||
+ | system: | ||
+ | |||
+ | **fs sa m/mi/mirko mirko all** | ||
+ | |||
+ | **fs la m/ | ||
+ | |||
+ | Access list for m/mi/mirko is | ||
+ | Normal rights: | ||
+ | system: | ||
+ | mirko rlidwka | ||
+ | Next we are going to switch user to mirko and make sure we still have access to the home directory: | ||
+ | **unlog; kdestroy** | ||
+ | |||
+ | **kinit mirko; aklog** | ||
+ | |||
+ | Password for mirko@student.lab: | ||
+ | |||
+ | **cd / | ||
+ | |||
+ | **echo IT WORKS > test** | ||
+ | |||
+ | **cat test** | ||
+ | |||
+ | now to check the volume data size quota and increase it from the default 5 MB to 100 MB: | ||
+ | |||
+ | **cd / | ||
+ | |||
+ | **fs lq** | ||
+ | |||
+ | Volume Name | ||
+ | root.cell | ||
+ | |||
+ | **fs sq . 100000** | ||
+ | |||
+ | **fs lq** | ||
+ | |||
+ | Volume Name | ||
+ | root.cell.readonly | ||
+ | |||
+ | ====== Updating Ldap ====== | ||
+ | |||
+ | Now we need to let ldap know where the new home directory for mirko is located. | ||
+ | We first need to create a ldif file we will put it in tmp. | ||
+ | |||
+ | **vi / | ||
+ | |||
+ | **dn: uid=mirko, | ||
+ | **changetype: | ||
+ | **replace: homeDirectory** | ||
+ | **homeDirectory: | ||
+ | **:wq!** | ||
+ | |||
+ | Once the file has been create then we need to apply it to the ldap database. | ||
+ | |||
+ | **ldapmodify -c -x -D cn=admin, | ||
+ | let verify that the change took: | ||
+ | |||
+ | **getent passwd mirko** | ||
+ | |||
+ | mirko: | ||
+ | |||
+ | |||
+ | ====== The final step is to make the need pam configuration files changes ====== | ||
+ | |||
+ | These will need to be done on the server and all client systems. | ||
+ | apt-get install libpam-afs-session | ||
+ | |||
+ | To limit the chance of get locked out of the system will doing the PAM configurations. It is best to have another root terminal open and that you make a backup of all of the / | ||
+ | |||
+ | **cd /etc** | ||
+ | **cp -a pam.d pam.d, | ||
+ | |||
+ | Note:If after you finish these step and you can not login then the above will allow you to be able to revert back to a functioning state by using the open root terminal and executing: | ||
+ | |||
+ | **cp -a pam.d, | ||
+ | |||
+ | Once you have edited the PAM files shown below it is best to restart the services. This isn't necessary, but it do ensures that the services will read the new PAM configuration. | ||
+ | ** | ||
+ | vi / | ||
+ | auth sufficient | ||
+ | auth sufficient | ||
+ | **auth | ||
+ | auth required | ||
+ | |||
+ | vi / | ||
+ | session required pam_limits.so | ||
+ | session optional pam_krb5.so | ||
+ | session optional pam_unix.so | ||
+ | **session optional pam_afs_session.so program=/ | ||
+ | |||
+ | At this point you can scp these two file to the afs clients, vm15 and vm16 or you could log on to each and make the need pam changes I would go with the SCP as it removes the chance of a typo. | ||
+ | |||
+ | At this point you now have a working afs file system. | ||
+ | |||
+ | ====== Reference: ====== | ||
+ | |||
+ | http:// |