Knoppix-elane:
how to change the contents of the CD
back

Requirements
Steps
Going deeper
References

In this tutorial I will explain step by step how you can create a dotLRN demo-CD taking one already created as a starting point, to add more courses, update the packages or adding new ones, etcetera. It makes use of some dangerous operations, so take care, and better make copies of important data in your computer before you start. Use this tutorial at your own risk.

Requirements

The most important thing you need is lots of free disk space. You will need a 2 GB swap partition, and 5 GB more of a linux partition (preferably, separated in another ext2 partition from the rest of the disk). I made the customization on a 1200MHz AMD athlon with 256Mb of RAM, but it may work on smaller computers. I believe it is enough with 128.

If new OpenACS packages are to be installed a good internet connection is needed, unless the packages are already in the computer.

Steps

All the steps mentioned are to be executed in a root shell, which you can open at Start Button>KNOPPIX>root shell.

  1. First of all, you must download the iso image you want to modify and burn it in a cd. Then, insert the cd and reboot the computer, so that knoppix and KDE start.
  2. Setup partitions and swap: With a partition tool such as cfdisk, create two partitions. The first one, of 2GB and swap type, will be used for swap. In this tutorial, this partition will be called /dev/hda2. In the second one, of 5 GB and linux native (ext2) type, we will place the remaster and the iso image. We will call this one /dev/hda3. You may need to reboot after this.

    The next task is to set up the swap. You can do so with the orders:

    $ mkswap /dev/hda2

    $ swapon /dev/hda2

    There can be several swap partitions working at the same time, but you can stop the original one with:

    $ swapoff /dev/hda4

    You can check the swap memory you are really using with:

    $ swapon -s

    To finish the basic setup for re-mastering, we have to mount the work partition with:

    $ mount -w /dev/hda3 /mnt/hda3

    (Mount with mount point and device, like this, or you will get error later when you chroot)

    If you get a message saying something "/mnt/hda3 is already mounted", maybe your /knoppix-elane file is in that partition, take this into account for the space needed.

    Finally, create some directories to separate the master copy (the contents of the knoppix cd) from the source copy (linux filesystem, uncompressed from the KNOPPIX file).

    $ mkdir /mnt/hda3/knx

    $ mkdir /mnt/hda3/knx/master

    $ mkdir /mnt/hda3/knx/source

    $ mkdir /mnt/hda3/knx/source/KNOPPIX

  3. Make master and source copies: Copy into ./master, everything in the cdrom, except the 700Mb KNOPPIX file:

    $ cd /cdrom;find . -size -10000k -type f -exec cp -p --parents {} /mnt/hda3/knx/master/ \;

    We will create a new KNOPPIX file with the contents of ./source. When a Knoppix cd is booted, the compressed image file is mounted at /KNOPPIX. We will copy it (uncompressed) to the ./source directory:

    $ cp -Rp /KNOPPIX/* /mnt/hda3/knx/source/KNOPPIX

    This will take a little while.

  4. Stop servers: In order to be able to start servers from the source copy, you must stop the ones already running in the cd. To do so, type

    $ killall nsd; killall postmaster

  5. Copy the /OpenACS folder: To make the server work when we chroot, we have to copy the /OpenACS folder, which contains OpenACS and PostgreSQL files that need to be in hard drive.

    $ cp -rp /OpenACS/ /mnt/hda3/knx/source/KNOPPIX/

    On installation, the folder is created and its contents are copied from the cd, so if we need to modify something in the folder, we must go to the source of the files in the cd. This folder is only a temporary way to make the server work in the source copy, and we will delete this folder, before creating the iso image.

    Now you must create a symbolic link to the configuration file knoppix.tcl. It already exist in the cd, but in a slightly different place, that changes when the image is created. Just type:

    $ cd /mnt/hda3/knx/source/KNOPPIX

    $ mkdir ./KNOPPIX/home/aolserver

    $ ln -s /OpenACS/knoppix.tcl
    ./KNOPPIX/home/aolserver/knoppix.tcl

    We will also delete this before creating the image.

  6. Add new packages or other files: Right now at /mnt/hda3/source/KNOPPIX we have the knoppix filesystem as it is deployed when you boot the knoppix cd. What we will do now is modify the files and software installed, specially OpenACS. In the knoppix-elane cd, AOLserver and OpenACS are already installed, so you need not to worry about them, just modify and add to the existing installation.

    To download new OpenACS packages, move to the folder where the OpenACS and dotLRN are and use cvs to check out the desired packages:

    $ cd /mnt/hda3/knx/source/KNOPPIX/home/aolserver
    /knoppix/packages

    $ cvs -z3 -d :pserver:anonymous@cvs.openacs.org:/cvsroot co <PACKAGE_NAME>

    You may add any number of files you want anywhere in the Linux filesystem tree. Do not try to install programs at this point, we will do it at the next step. Remember not to use more than 2GB there. When we compress all this into the KNOPPIX file, it must reduce to 700Mb or less, so there is space enough for it in a cd. You will have to check this later, when we create the KNOPPIX file.

    If you want only OpenACS and not dotLRN, remove from the folder all the dotLRN packages and also the file "/mnt/hda3/knx/source/KNOPPIX/home/aolserver/knoppix/install.xml", which gets these packages installed when OpenACS is. Then reinstall OpenACS as explained below.

  7. Chroot and start server: Now we will change the root of the filesystem to /mht/hda3/KNOPPIX, so we can install software, and start AOLserver and OpenACS from the source copy:

    $ chroot /mnt/hda3/knx/source/KNOPPIX

    Now we are at /mnt/hda3/knx/source/KNOPPIX, which is now our root: The prompt shows / only. To use the internet we have to mount proc:

    $ mount -t proc /proc proc

    Now check you have access to the internet with a ping or the like. Next thing to do is start postgreSQL and AOLserver to access and manage OpenACS:

    $ /etc/init.d/postgresql start

    $ /home/aolserver/aolserver start

    After a minute or so (in the meantime, you will not be able to connect!), the OpenACS portal is available at <IP_ADDRESS>:8000, from any internet browser such as Mozilla. You can check the current IP address of the machine using ifconfig.

  8. Modify OpenACS or dotLRN:

    • Reinstall OpenACS: You may want to reinstall OpenACS, for example in case you want to uninstall a package, erase a LORS course, etc. To do so, first stop AOLserver:

      $ /home/aolserver/aolserver stop

      Then you just have to delete the database used by OpenACS, called "knoppix", and create it again (so it will be empty):

      $ su postgres -c "dropdb knoppix"

      $ su postgres -c "createdb knoppix"

      The system must answer "DROP DATABASE" and "CREATE DATABASE",respectively. After this, we start again the server:

      /home/aolserver/aolserver start

      And enter the OpenACS portal with a browser. It now shows the installation screen, and you just have to follow the instructions. When this is done, restart once more the server and enter the portal, which now shows the dotLRN login screen. Now you still must install the LORS (lors, lorsm, lorsm-portlet and views) and Assesment (assessment, assessment-portlet and dotlrn-assessment) packages, as explained in next step. This, in case you want these packages in the cd and have not removed them before. You also may want to install locales, create communities, users, etc.

    • Install new packages: In this step we will install the packages we downloaded before. You can still go to the /packages folder and download packages, if you need to. When you are done, enter the OpenACS-dotLRN portal using a browser, and go to the Package Installation page, located at the URL: http://<IP_ADDRESS>:8000/acs-admin/apm/packages-install. Then select the packages you want to install and click "Next". Then the packages will be installed or the system will show the dependencies found.

      After the installation you have to restart the AOLserver again, and if the package has applets, you will have to add them to each community from its Control panel. Note: The Assessment packages contained in this cd are early versions; to load new LORS courses properly, you must not have the Assessment applet added to the community. So, remember to install all the courses you want to have in the cd before adding the applet; or, replace the Assessment packages for a stable version.

    • Add new LORS courses: A course must be contained by a community, so first of all you have to create that community or choose an existing one. Then enter that community and click "Control Panel". There, look for the square labeled "LORS Management Administration". One of the options there is "Add a Course". Click on it and select the zip file containing que course. Click OK and write the name you want for the course (Remember, install all the courses before adding the Assessment applet to the community).

      If you get a message like "The file contains no data", that may mean you need more space in the file storage upload limit. Edit the file /OpenACS/knoppix.tcl, look for the line ns_section ns/server/${server}/module/nssock. If there is not a line like ns_param maxinput 50000000, add it. Restart the server. When you get it working, repeat the same with the file /home/aolserver/knoppix_dump.tcl (Remeber the folder /OpenACS will be erased).

      Remember you cannot uninstall courses, so to delete one you need to reinstall the hole OpenACS. You cannot order them. If you want to install several courses, remember to do it in inverse order: The last course you install will be the upper one.

      With this procedure, the files of a course is installed in hard-drive, but in fact these files are never modified. To save hard-drive space, you can move them to someplace in the cd (this is out of the /OpenACS folder) and replace them with symlinks. These files are in the folder /OpenACS/knoppix/content-repository-content-files. Suppose you want to move them to a folder called /courses:

      mkdir /courses;

      mv /OpenACS/knoppix/content-repository-content-files /courses/

      ln -s /courses/content-repository-content-files /OpenACS/knoppix/content-repository-content-files

      When all the courses are installed, remember to add the Assessment applet in the community Control Panel.

  9. Install other software: You can install or uninstall other Linux programs using apt. You may need to uninstall some applications in order to free space and make it small enough for a cd. The knoppix-elane cd already has less applications than a standard knoppix distro, but still keeps some big ones, such as the OpenOffice suite. You can see installed packages with:

    $ dpkg-query -l | less

    And uninstall it with:

    $ apt-get remove <name-of-package-to-remove>

    After this you can check for orphaned packages with deborphan. You may also want to add some other packages to the cd. It this is the case, type:

    $ apt-get install <name-of-package-to-install>

    To finish, clean spare files with:

    $ apt-get clean

  10. Copy database: The Postgres database files (which contains data of the OpenACS portal in the state it is now) must be copied from the /OpenACS folder to the cd, where it will be copied back to hard drive on installation. Type:

    $ rm -rf /var/lib/postgres/data_dump2; cp -rp /OpenACS/postgres_data/ /var/lib/postgres/data_dump2

  11. Delete auxiliar files and end chroot: Before we quit being chrooted, we have to delete the /OpenACS folder and the symlink we made at the beginning:

    $ rm -rf /OpenACS

    $ rm -rf /KNOPPIX/home/aolserver

    Then unmount the proc device (very important!!)

    $ umount /proc

    When all this is done, just press CTRL+D or type "exit".

  12. Create .iso image: The iso image is created in two steps. First, we compress the Linux filesystem into the 700Mb file called KNOPPIX, and then we add it with the rest of the contents of the cd (wich, among other things, are the isolinux bootfiles) and compile all that into the final image. In both steps we use mkisofs. To compress the filesystem and create the new KNOPPIX file, type:

    $ rm .bash_history, /tmp/* (etc. Some cleanup)

    $ rm -rf /mnt/hda3/knx/source/KNOPPIX/.rr_moved

    $ mkisofs -R -U -V "KNOPPIX.net filesystem" -P "KNOPPIX www.knoppix.net" -hide-rr-moved -cache-inodes -no-bak -pad /mnt/hda3/knx/source/KNOPPIX | nice -5 /usr/bin/create_compressed_fs - 65536 > /mnt/hda3/knx/master/KNOPPIX/KNOPPIX

    This will take about 20 or 30 minutes. When it is over, the KNOPPIX file is in /master/KNOPPIX, with the rest of the contents of the cd. To create the final iso image, type:

    $ cd /mnt/hda3/knx/master

    $ mkisofs -pad -l -r -J -v -V "KNOPPIX" -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -hide-rr-moved -o /mnt/hda3/knx/knoppix.iso /mnt/hda3/knx/master

    This takes a minute or so. The image is stored in /mnt/hda3/knx/knoppix.iso. You can rename it at will.

  13. Finished! You can try the image before burning the cd doing the following: Reboot the computer with the knoppix cd in the cd drive, and when the boot prompt appears, instead of pressing enter, write:

    $ knoppix bootfrom=/dev/hda3/knx/knoppix.iso

    This way the loaded filesystem will be the one in the iso image and not the one in the cd. Remember the boot is still the one in the cd, not in the iso image, so for example, if you have changed the initial language (Which I have not explained here), you will only see it when you burn the cd. Look for errors, correct them in the source copy, recompile the image and repeat. When it is ready, burn the image and you have your customized demo CD. You can use cdrecord, K3B, etcetera.

Going deeper

This tutorial explains how to modify the contents of the cd and of the OpenACS portal it deploys. However, its major feature is the deployment itself, wich includes scanning the partitions of the computer for free space, creating persistent sessions, etc. In some cases it may be desirable to modify this procedures. It goes beyond the scope of this tutorial, but the file that does it all at startup is /etc/init.d/openacs (altough it calls some other files) and is just a bash script, so feel free to play around with it.

References

back to knoppix-elane main page

Valid HTML 4.01! Valid CSS!