OLE Nepal:Procedure to build NEXS from OLPC XS
The OLPC server software releases are designated as OLPC_XS-0.x. OLE Nepal needs to build a custom configuration of the XS that meets the needs of our schools. These releases will are designated as NEXS-m.n (short style) or NEXS_0.x-m.n to show the OLPC XS release on which it is based.
The current OLPC release is OLPC_XS-0.4 to be followed very shortly by OLPC_XS-0.5. The former is based on Fedora 7 and the latter on Fedora 9.
We currently plan a release NEXS_0.4-1.4. A release which ends in an even number is considered stable and available for installation. This document describes the procedure for building NEXS_0.4-1.3 from OLPC_XS-0.4. The release ends in an odd number to show that it is still under test. When testing is completed, it will be re-designated as NEXS_0.4-1.4.
Our next release will be NEXS_0.5-1.6. The primary difference in these two releases will be the move to Fedora 9. It is also expected that the OLPC XS-0.5 will incorporate MySQL and Moodle so that we will no longer need to add these ourselves.
Copy OLPC_XS-0.4.iso and other packages to the local fileserver
We need the base iso image to be on our local fileserver (fileserver/ole_storage/software/schoolserver) so that in the case of problems we can go back to the source. In addition this folder contains the other packages which were needed to build NEXS: dansguardian, mysql, and moodle.
OLPC_XS-0.4
Download XS iso and md5 files to the OLENepal fileserver/ole_storage/Software/schoolserver/XS/XS-0.x folder:
wget http://xs-dev.laptop.org/xs/OLPC_XS_0_4.iso md5sum OLPC_XS_0_4.iso > OLPC_XS_0_4.iso.md5 mkdir smb://fileserver/ole_storage/Software/schoolserver/XS/XS_0_4 cp OLPC_XS_0.4.iso smb://fileserver/ole_storage/Software/schoolserver/XS/XS_0_4
Note: currently the md5 checksum for the iso file is not given at http://xs-dev.laptop.org/xs/. It would be better to verify the download of the iso file against an md5 checksum created by the developer. However, this test will confirm that a copy from the fileserver is correct.
Dansguardian
Download Dansguardian to the fileserver.
wget http://mirrors.evis.net.ph/downloads/2/Stable/dansguardian-2.10.tar.gz
MySQL
wget http://mysql.thaiweb.net/Downloads/MySQL-5.0/MySQL-server-community-5.0.67-0.rhel5.i386.rpm MD5: 99dcde3e08536a35d42cb939195def9f wget http://mysql.thaiweb.net/Downloads/MySQL-5.0/MySQL-shared-community-5.0.67-0.rhel5.i386.rpm MD5: bc1f85b62c6bd9ec2b0dc8658d89c16e wget http://mysql.thaiweb.net/Downloads/MySQL-5.0/MySQL-client-community-5.0.67-0.rhel5.i386.rpm MD5: 7dfbb1e9e3c8ee7bd5abda8d620c2507
Moodle
wget http://download.moodle.org/stable19/moodle-weekly-19.tgz
Set up development environment
The Fedora system used to build NEXS must have some development tools installed:
yum -y install squashfs-tools livecd-tools yum -y install gcc automake bison autoconf gcc-c++ binutils cscope zlib-devel pcre-devel patchutils
Procedure to make revised iso image
This procedure allows changes to the kickstart file and to the packages included in the NEXS iso image.
mkdir temp cd temp mkdir XSiso mount -o loop OLPC_XS_0.4.iso XSiso unsquashfs XSiso/LiveOS/squashfs.img mkdir livecd-root mount -o loop,rw squashfs-root/LiveOS/os.img livecd-root
now make changes as needed
umount livecd-root mv squashfs.img squashfs.img.orig mksquashfs squashfs-root squashfs.img mkdir NEXSiso rsync -av --exclude=śquashfs.img' XSiso NEXSiso mv squashfs.img NEXSiso/LiveOS umount XSiso
Additions/Changes to packages in XS required to make NEXS
This section describes the procedure to create a customized version of the OLCP XS (NEXS) server from the original OLPC_XS-0.4 iso image.The resulting NEXS iso image contains additional software that we cannot not included in the OLPC XS distribution.
- Download the iso image and other necessary files from the SAMBA share hosted in our internal LAN :
-> Go to OLE_storate and download the nexs-files directory to your local hard drive
- Check for the necessary files :
root@localhost~# cd nexs-files
root@localhostnexs-files# ls alldb.sql apache.tar.bz2 blacklist.tar.bz2 httpd.conf install.sh OLPC_XS_0_4.iso rc.local squashfs-process XSinstall
root@localhostnexs-files# pwd /root/nexs-files
- Install related tools and then mount the iso image with the help of the loop back device :
root@localhostwork# yum -y install squashfs-tools livecd-tools
root@localhostnexs-files# mkdir /mnt/t
root@localhostnexs-files# mount -o loop,ro -t iso9660 OLPC_XS_0_4.iso /mnt/t
root@localhostnexs-files# mount /dev/sda2 on / type ext3 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda1 on /boot type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) /root/nexs-files/OLPC_XS_0_4.iso on /mnt/t type iso9660 (ro,loop=/dev/loop0)
- Get inside the /mnt/t directory to see the contents of the iso
root@localhostnexs-files# cd /mnt/t root@localhostt# ls isolinux squashfs.img sysroot
- copy the contents of all the /mnt/t i.e the mounted iso images to a new location preserving the file permissions and unsquash the squashfs filesystem:
root@localhostt# mkdir /root/work root@localhostt# cp -varf /mnt/t/* /root/work/ `/mnt/t/isolinux' -> `/root/work/isolinux' `/mnt/t/isolinux/boot.cat' -> `/root/work/isolinux/boot.cat' `/mnt/t/isolinux/initrd.img' -> `/root/work/isolinux/initrd.img' `/mnt/t/isolinux/isolinux.bin' -> `/root/work/isolinux/isolinux.bin' `/mnt/t/isolinux/isolinux.cfg' -> `/root/work/isolinux/isolinux.cfg' `/mnt/t/isolinux/splash.jpg' -> `/root/work/isolinux/splash.jpg' `/mnt/t/isolinux/vesamenu.c32' -> `/root/work/isolinux/vesamenu.c32' `/mnt/t/isolinux/vmlinuz' -> `/root/work/isolinux/vmlinuz' `/mnt/t/squashfs.img' -> `/root/work/squashfs.img' `/mnt/t/sysroot' -> `/root/work/sysroot'
root@localhostt# cd /root/work
root@localhostt# cd /root/work/ root@localhostwork# ls isolinux squashfs.img sysroot root@localhostwork# unsquashfs squashfs.img
created 1 files created 2 directories created 0 symlinks created 0 devices created 0 fifos
root@localhostwork#
root@localhostwork# ls isolinux squashfs.img squashfs-root sysroot
- Make sure that you have a new directory called squashfs-root
- mount the os.img file in a new directory of your choice :
root@localhostsquashfs-root# mkdir /mnt/os root@localhostsquashfs-root# mount -o loop,rw os.img /mnt/os root@localhostsquashfs-root# cd /mnt/os
- copy all the necessary files to /mnt/os/root directory
root@localhostos# cd /mnt/os/root
root@localhostroot# ls anaconda-ks.cfg olpc-install
root@localhostroot# cp -varf /root/nexs-files/ alldb.sql blacklist.tar.bz2 install.sh rc.local XSinstall apache.tar.bz2 httpd.conf OLPC_XS_0_4.iso squashfs-process
root@localhostroot# cp -varf /root/nexs-files/alldb.sql . `/root/nexs-files/alldb.sql' -> `./alldb.sql' root@localhostroot# cp -varf /root/nexs-files/blacklist.tar.bz2 . `/root/nexs-files/blacklist.tar.bz2' -> `./blacklist.tar.bz2' root@localhostroot# cp -varf /root/nexs-files/install.sh . `/root/nexs-files/install.sh' -> `./install.sh' root@localhostroot# cp -varf /root/nexs-files/rc.local . `/root/nexs-files/rc.local' -> `./rc.local' root@localhostroot# cp -varf /root/nexs-files/XSinstall . `/root/nexs-files/XSinstall' -> `./XSinstall' root@localhostroot# cp -varf /root/nexs-files/apache.tar.bz2 . `/root/nexs-files/apache.tar.bz2' -> `./apache.tar.bz2' root@localhostroot# cp -varf /root/nexs-files/httpd.conf . `/root/nexs-files/httpd.conf' -> `./httpd.conf'
root@localhostroot# ls alldb.sql anaconda-ks.cfg apache.tar.bz2 blacklist.tar.bz2 httpd.conf install.sh olpc-install rc.local XSinstall
root@localhostroot# cd
- Chroot inside the /mnt/os directory
root@localhost~# chroot /mnt/os /bin//bash
[root@localhost /]# mount /proc
[root@localhost /]# mount /sys
- Make sure that /proc and /sys are mounted to do so issue the following command :
[root@localhost /]# mount /dev/mapper/livecd-rw on / type ext3 (rw,noatime) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw)
[root@localhost /]# ls bin boot dev etc home lib library lost+found media mnt opt proc root sbin selinux srv sys tmp usr var [root@localhost /]# cd /root/ [root@localhost ~]# ls alldb.sql anaconda-ks.cfg apache.tar.bz2 blacklist.tar.bz2 httpd.conf install.sh olpc-install rc.local XSinstall [root@localhost ~]# ls
Step 8: Make sure that you have changed the /etc/resolv.conf and that we can ping the internet :
[root@localhost ~]# cat /etc/resolv.conf nameserver 18.72.0.3 nameserver 4.2.2.4
[root@localhost ~]# echo nameserver 192.168.5.1 > /etc/resolv.conf
[root@localhost ~]# ping www.google.com PING www.l.google.com (209.85.165.99) 56(84) bytes of data. 64 bytes from eo-in-f99.google.com (209.85.165.99): icmp_seq=1 ttl=232 time=286 ms 64 bytes from eo-in-f99.google.com (209.85.165.99): icmp_seq=2 ttl=232 time=285 ms
--- www.l.google.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 2345ms rtt min/avg/max/mdev = 285.766/285.918/286.071/0.556 ms
- Cusomize your distribution by adding softwares ; here we will be adding only few related softwares :
- Install some rpms :
[root@localhost ~]# yum -y install gcc automake bison autoconf gcc-c++ binutils cscope mysql-server php-mysql zlib-devel pcre-devel patchutils
- Configure apache and moodle :
[root@localhost ~]# cat httpd.conf > /etc/httpd/conf/httpd.conf
- Unzip the moodle and moodle data :
[root@localhost ~]# tar jxpf apache.tar.bz2 [root@localhost ~]# ls alldb.sql anaconda-ks.cfg apache.tar.bz2 blacklist.tar.bz2 httpd.conf install.sh olpc-install rc.local var XSinstall
- Copy the moodle and moodledata to a new place :
[root@localhost ~]# \cp -varf var/www/* /var/www/ [root@localhost ~]# cd /var/www/ [root@localhost www]# ls cgi-bin ds-backup error html icons manual moodle moodledata [root@localhost www]# cd moodle [root@localhost moodle]# ls admin blocks config-dist.php enrol files group install lang manifest.txt mod pix rss tag user auth blog config.php error filter help.php install.php lib message my question search tags userpix backup calendar course file.php grade index.php iplookup login mnet notes README.txt sso theme version.php [root@localhost moodle]# cd .. [root@localhost www]# cd moodle [root@localhost moodle]# ls admin blocks config-dist.php enrol files group install lang manifest.txt mod pix rss tag user auth blog config.php error filter help.php install.php lib message my question search tags userpix backup calendar course file.php grade index.php iplookup login mnet notes README.txt sso theme version.php [root@localhost moodle]#
- Modify Mysql databases
[root@localhost ~]# /etc/init.d/mysqld start
[root@localhost ~]# mysql -u root -p < /root/alldb.sql
[root@localhost ~]# /etc/init.d/mysqld stop
- Change moodle password
[root@localhost /]# mysqld_safe --skip-grant-table & mysql> use mysql; mysql> update user set password=PASSWORD("mysqlroot") where user="root"; mysql> update user set password=PASSWORD("moodle") where user="moodle"; mysql> exit [root@localhost /]# killall mysqld [root@localhost /]# killall mysqld
- Make sure that permission on the /var/www/ directory is correct
[root@localhost /]# chown apache: -R /var/www/
- Installing dansguardian
[root@localhost /]# cd /usr/local/src [root@localhost src]# wget http://dansguardian.org/downloads/2/Stable/dansguardian-2.10.tar.gz [root@localhost src]# tar zxvp dansguardian-2.10.tar.gz [root@localhost src]# cd dansguardian-2.10 [root@localhost dansguardian-2.10]# ./configure --sysconfdir=/etc [root@localhost dansguardian-2.10]# make && make install [root@localhost dansguardian-2.10]# touch /usr/local/var/log/dansguardian/access.log [root@localhost dansguardian-2.10]# chown nobody: -R /usr/local/var/log/dansguardian//access.log
Open up the dansguardian config file: [root@localhost dansguardian-2.10]# vim /etc/dansguardian/dansguardian.conf
Change the filterport to 8081
filterport = 12121
Change the weightedphrasemode to 1
weightedphrasemode = 1
Save and quit the Vi editor
[root@localhost lists]# cd /etc/dansguardian/lists [root@localhost lists]# cp -varf /root/blacklist.tar.bz2 . [root@localhost blacklists]# tar jxpf blacklist.tar.bz2
[root@localhost dansguardian]# vim /etc/dansguardian/lists/bannedsitelist Uncommnet all lines EXCEPT the follwing (leave them as it is and don't remove the pound sign infront of these lines)
- .Include</etc/dansguardian/lists/blacklists/forums/domains>
- .Include</etc/dansguardian/lists/blacklists/onlinegames/domains>
- .Include</etc/dansguardian/lists/blacklists/personalfinance/domains>
- .Include</etc/dansguardian/lists/blacklists/pets/domains>
- .Include</etc/dansguardian/lists/blacklists/publicite/domains>
- .Include</etc/dansguardian/lists/blacklists/redirector/domains>
- .Include</etc/dansguardian/lists/blacklists/ringtones/domains>
- .Include</etc/dansguardian/lists/blacklists/sportnews/domains>
- .Include</etc/dansguardian/lists/blacklists/sports/domains>
Save and quit the Vi editor
[root@localhost dansguardian]# vim /etc/dansguardian/lists/urlregexplist Press shift and ; and type set nu and then press enter to show line nubers in the Vi Uncomment the lines related to google safe search 13 "(^http://[0-9a-z]+\.google\.[a-z]+[-/%.0-9a-z]*/images\?)(.*)(&?)(safe=[^&]*)"->"\1\2\3" 15 "(^http://[0-9a-z]+\.google\.[a-z]+[-/%.0-9a-z]*/images\?)"->"\1safe=vss&" 43 "^http://[.0-9a-z]+\.yahoo\.[a-z]+[-/%.0-9a-z]*/search)(.*)(&?)(vm=[^&]*)"->"\1\2\3" 44 "(^http://[.0-9a-z]+\.yahoo\.[a-z]+[-/%.0-9a-z]*/search+.*\?)"->"\1vm=r&"
Save and quit the Vi editor
- Making squid run in the mounted enviroment for testing :
[root@localhost dansguardian]# cd /etc/squid/ [root@localhost squid]# cp squid-xs.conf.in squid-xs.conf [root@localhost squid]# vim squid-xs.conf Comment out the line 44.Now it should look like this
#append_domain .@@BASEDNSNAME@@
Save and quit the editor Make the squid cache director and set correct permissions [root@localhost squid]# mkdir /library/cache [root@localhost squid]# chown squid:squid /library/cache [root@localhost squid]# squid -z -f /etc/squid/squid-xs.conf [root@localhost squid]# squid -z -f /etc/squid/squid-xs.conf [root@localhost squid]# /etc/init.d/squid restart Stopping squid: [FAILED] Starting squid: [ OK ] [root@localhost squid]#
Run dansguardian : [root@localhost squid]# dansguardian -Q
If everything is fine then we can proceed :
[root@localhost squid]# /etc/init.d/squid stop [root@localhost squid]# killall danguardian
- Open up /etc/rc.local file and make changes to it so that it looks like the following :
#!/bin/bash # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff.
touch /var/lock/subsys/local sh /root/olpc-install sh /root/install.sh
Save and quit the editor
- Configuring ejabberd
- In the SERVED HOSTNAMES section make sure that you have a line that reads :
{hosts, ["localhost","schoolserver"]}.
- If you have only IPV4 available then make sure that you delete the line containing the keyword inet6 for different sections. For example if you have section like this which enables old SSL based connection to the ejabberd :
{5223, ejabberd_c2s, [
inet6, {access, c2s}, {shaper, c2s_shaper}, tls, {certfile, "/etc/ejabberd/ejabberd.pem"}, {max_stanza_size, 524288} ]},
You have to delete the line containing inet6 so that it reads :
{5223, ejabberd_c2s, [
{access, c2s}, {shaper, c2s_shaper}, tls, {certfile, "/etc/ejabberd/ejabberd.pem"}, {max_stanza_size, 524288} ]},
- In ACCESS CONTROL LISTS section add a new admin user :
{acl, admin, {user, "admin","schoolserver" }}. {acl, admin, {user, "admin","localhost" }}.
- Restart ejabberd
[root@localhost]# service ejabberd restart
- Register the admin user :
[root@localhost ~]# ejabberdctl ejabberd@schoolserver register admin schoolserver admin
- Now you can manage the ejabberd daemon via web interface. Open the following URL in the browser :
http://ip.of.your.server:5280/admin or use elinks text based browser
Enter User Name admin and password as admin (we configured this in the section 12.4)
- Make sure that the XOs can now login to the ejabberd and can start the chat ; whenever a XO registers itself with the XS server ; a sqlite database file identity.db is updated which is located in the /home/idmgr. You can list the contents of this Database by issuing the following command :
[root@localhost idmgr]# /home/idmgr/list_registration
Listing students from /home/idmgr/identity.db tony CSN7480103A Arjun SHF8060097D
- Make changes to /root/anaconda-ks.cfg so that it looks like the following :
[root@localhost ~]# cat anaconda-ks.cfg # Kickstart file for installing a school server
# For now, due to anaconda bug #243374 # install lang en_US.UTF-8 keyboard us skipx # xconfig --startxonboot network --device eth0 --bootproto dhcp --hostname schoolserver rootpw --iscrypted $1$Bf0Ag93M$weSucLBipI6jTjtolgZE61 firewall --enabled authconfig --enableshadow --enablemd5 # selinux --permissive selinux --disabled # timezone --utc America/New_York bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
# The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work clearpart --linux --drives=sda # Small Disk Support: (xs #7241) # If space >~10GiB then the sizes are # /boot 100 MiB # / 8 GiB # swap 2 GiB # /library fills all remaining capicity # If space is limited, partition sizes are reduced. # Smallest supported capacity is ~5GiB when no livecd-creator --uncompressed-size argument is # specified (defaults to 4096). # Using livecd-creator --uncompressed-size=2048 allows installation on ~3GiB disks (not tested yet). part /boot --fstype ext3 --size=100 --ondisk=sda part / --fstype ext3 --size=2048 --maxsize=8192 --grow --ondisk=sda # size of pv.6 must be at least enough to fit /library size and swap size part pv.6 --size=1025 --grow --ondisk=sda volgroup VolGroup00 --pesize=32768 pv.6 # Kickstart raises an error if logvol --size=0 logvol /library --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1 --grow logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=1024 --maxsize=2048 --grow reboot
- Delete unnecesary files :
[root@localhost ~]# rm -rf alldb.sql apache.tar.bz2 blacklist.tar.bz2 httpd.conf rc.local var XSinstall [root@localhost ~]# rm -rf /httpd.conf
- Make sure that squid doesnot start at the boot time :
[root@localhost src]# chkconfig squid off
- Get out of the chroot enviroment :
[root@localhost ~]# exit [root@localhost ~]# umount /proc [root@localhost ~]# umount /sys [root@localhost ~]# exit
- Umount the os.img file
root@localhost~# umount /mnt/os
- Make new squashfs.img and then the Bootable ISO:
root@localhost# cd /root/work/ root@localhost# rm -rf rm -rf /root/work/squashfs.img root@localhost# mksquashfs squashfs-root squashfs.img root@localhost# mv squashfs-root ../
The content of /root/work directory must be like this one :
root@localhostwork# ls isolinux squashfs.img sysroot
To create a bootable iso use the following command : root@localhostoriginal-iso-mounted# mkisofs -o ./live.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -r -hide-rr-moved -V "OLPC_XS_0_4" .
Please don't miss the dot at the end of the command
root@localhostwork# ls isolinux live.iso squashfs.img sysroot
- Transferring the iso image to a flash disk :
Mount the flash drive ; I am assuming that the drive is /dev/sdd and has a bootable flag turned on for the primary partition i.e /dev/sdd1 To make this flash drive bootable use the following command :
root@localhost# livecd-iso-to-disk ./live.iso /dev/sdd1
Once done unmount the iso image and you are done.
[root@schoolserver ~]# ejabberdctl ejabberd@schoolserver register admin schoolserver admin
How to NEXS server ISO
This how to describes the process of creating a customized version of OLCP XS server from the original iso.This new iso can contain extra softwares that we cannot find in the standard distribution of OLPC XS.
Step 1: Download the iso image and other necessary files from the SAMBA share hosted in our internal LAN :
-> Go to OLE_storate and download the nexs-files directory to your local hard drive
step 2: Check for the necessary files :
root@localhost~# cd nexs-files
root@localhostnexs-files# ls alldb.sql apache.tar.bz2 blacklist.tar.bz2 httpd.conf install.sh OLPC_XS_0_4.iso rc.local squashfs-process XSinstall
root@localhostnexs-files# pwd /root/nexs-files
Step 3: Install related tools and then mount the iso image with the help of the loop back device :
root@localhostwork# yum -y install squashfs-tools livecd-tools
root@localhostnexs-files# mkdir /mnt/t
root@localhostnexs-files# mount -o loop,ro -t iso9660 OLPC_XS_0_4.iso /mnt/t
root@localhostnexs-files# mount /dev/sda2 on / type ext3 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda1 on /boot type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) /root/nexs-files/OLPC_XS_0_4.iso on /mnt/t type iso9660 (ro,loop=/dev/loop0)
Step 3: Get inside the /mnt/t directory to see the contents of the iso
root@localhostnexs-files# cd /mnt/t root@localhostt# ls isolinux squashfs.img sysroot
step 4: copy the contents of all the /mnt/t i.e the mounted iso images to a new location preserving the file permissions and unsquash the squashfs filesystem:
root@localhostt# mkdir /root/work root@localhostt# cp -varf /mnt/t/* /root/work/ `/mnt/t/isolinux' -> `/root/work/isolinux' `/mnt/t/isolinux/boot.cat' -> `/root/work/isolinux/boot.cat' `/mnt/t/isolinux/initrd.img' -> `/root/work/isolinux/initrd.img' `/mnt/t/isolinux/isolinux.bin' -> `/root/work/isolinux/isolinux.bin' `/mnt/t/isolinux/isolinux.cfg' -> `/root/work/isolinux/isolinux.cfg' `/mnt/t/isolinux/splash.jpg' -> `/root/work/isolinux/splash.jpg' `/mnt/t/isolinux/vesamenu.c32' -> `/root/work/isolinux/vesamenu.c32' `/mnt/t/isolinux/vmlinuz' -> `/root/work/isolinux/vmlinuz' `/mnt/t/squashfs.img' -> `/root/work/squashfs.img' `/mnt/t/sysroot' -> `/root/work/sysroot'
root@localhostt# cd /root/work
root@localhostt# cd /root/work/ root@localhostwork# ls isolinux squashfs.img sysroot root@localhostwork# unsquashfs squashfs.img
created 1 files created 2 directories created 0 symlinks created 0 devices created 0 fifos
root@localhostwork#
root@localhostwork# ls isolinux squashfs.img squashfs-root sysroot
- Make sure that you have a new directory called squashfs-root
step 5: mount the os.img file in a new directory of your choice :
root@localhostsquashfs-root# mkdir /mnt/os root@localhostsquashfs-root# mount -o loop,rw os.img /mnt/os root@localhostsquashfs-root# cd /mnt/os
step 6: copy all the necessary files to /mnt/os/root directory
root@localhostos# cd /mnt/os/root
root@localhostroot# ls anaconda-ks.cfg olpc-install
root@localhostroot# cp -varf /root/nexs-files/ alldb.sql blacklist.tar.bz2 install.sh rc.local XSinstall apache.tar.bz2 httpd.conf OLPC_XS_0_4.iso squashfs-process
root@localhostroot# cp -varf /root/nexs-files/alldb.sql . `/root/nexs-files/alldb.sql' -> `./alldb.sql' root@localhostroot# cp -varf /root/nexs-files/blacklist.tar.bz2 . `/root/nexs-files/blacklist.tar.bz2' -> `./blacklist.tar.bz2' root@localhostroot# cp -varf /root/nexs-files/install.sh . `/root/nexs-files/install.sh' -> `./install.sh' root@localhostroot# cp -varf /root/nexs-files/rc.local . `/root/nexs-files/rc.local' -> `./rc.local' root@localhostroot# cp -varf /root/nexs-files/XSinstall . `/root/nexs-files/XSinstall' -> `./XSinstall' root@localhostroot# cp -varf /root/nexs-files/apache.tar.bz2 . `/root/nexs-files/apache.tar.bz2' -> `./apache.tar.bz2' root@localhostroot# cp -varf /root/nexs-files/httpd.conf . `/root/nexs-files/httpd.conf' -> `./httpd.conf'
root@localhostroot# ls alldb.sql anaconda-ks.cfg apache.tar.bz2 blacklist.tar.bz2 httpd.conf install.sh olpc-install rc.local XSinstall
root@localhostroot# cd
step 7: Chroot inside the /mnt/os directory
root@localhost~# chroot /mnt/os /bin//bash
[root@localhost /]# mount /proc
[root@localhost /]# mount /sys
- Make sure that /proc and /sys are mounted to do so issue the following command :
[root@localhost /]# mount /dev/mapper/livecd-rw on / type ext3 (rw,noatime) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw)
[root@localhost /]# ls bin boot dev etc home lib library lost+found media mnt opt proc root sbin selinux srv sys tmp usr var [root@localhost /]# cd /root/ [root@localhost ~]# ls alldb.sql anaconda-ks.cfg apache.tar.bz2 blacklist.tar.bz2 httpd.conf install.sh olpc-install rc.local XSinstall [root@localhost ~]# ls
Step 8: Make sure that you have changed the /etc/resolv.conf and that we can ping the internet :
[root@localhost ~]# cat /etc/resolv.conf nameserver 18.72.0.3 nameserver 4.2.2.4
[root@localhost ~]# echo nameserver 192.168.5.1 > /etc/resolv.conf
[root@localhost ~]# ping www.google.com PING www.l.google.com (209.85.165.99) 56(84) bytes of data. 64 bytes from eo-in-f99.google.com (209.85.165.99): icmp_seq=1 ttl=232 time=286 ms 64 bytes from eo-in-f99.google.com (209.85.165.99): icmp_seq=2 ttl=232 time=285 ms
--- www.l.google.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 2345ms rtt min/avg/max/mdev = 285.766/285.918/286.071/0.556 ms
Step 8 : Cusomize your distribution by adding softwares ; here we will be adding only few related softwares :
8.1 Install some rpms : [root@localhost ~]# yum -y install gcc automake bison autoconf gcc-c++ binutils cscope mysql-server php-mysql zlib-devel pcre-devel patchutils
8.2 Configure apache and moodle : [root@localhost ~]# cat httpd.conf > /etc/httpd/conf/httpd.conf 8.3 Unzip the moodle and moodle data : [root@localhost ~]# tar jxpf apache.tar.bz2 [root@localhost ~]# ls alldb.sql anaconda-ks.cfg apache.tar.bz2 blacklist.tar.bz2 httpd.conf install.sh olpc-install rc.local var XSinstall
8.4 Copy the moodle and moodledata to a new place : [root@localhost ~]# \cp -varf var/www/* /var/www/ [root@localhost ~]# cd /var/www/ [root@localhost www]# ls cgi-bin ds-backup error html icons manual moodle moodledata [root@localhost www]# cd moodle [root@localhost moodle]# ls admin blocks config-dist.php enrol files group install lang manifest.txt mod pix rss tag user auth blog config.php error filter help.php install.php lib message my question search tags userpix backup calendar course file.php grade index.php iplookup login mnet notes README.txt sso theme version.php [root@localhost moodle]# cd .. [root@localhost www]# cd moodle [root@localhost moodle]# ls admin blocks config-dist.php enrol files group install lang manifest.txt mod pix rss tag user auth blog config.php error filter help.php install.php lib message my question search tags userpix backup calendar course file.php grade index.php iplookup login mnet notes README.txt sso theme version.php [root@localhost moodle]#
8.5 Modify Mysql databases
[root@localhost ~]# /etc/init.d/mysqld start
[root@localhost ~]# mysql -u root -p < /root/alldb.sql
[root@localhost ~]# /etc/init.d/mysqld stop
8.6 Change moodle password
[root@localhost /]# mysqld_safe --skip-grant-table & mysql> use mysql; mysql> update user set password=PASSWORD("mysqlroot") where user="root"; mysql> update user set password=PASSWORD("moodle") where user="moodle"; mysql> exit [root@localhost /]# killall mysqld [root@localhost /]# killall mysqld
8.7 Make sure that permission on the /var/www/ directory is correct [root@localhost /]# chown apache: -R /var/www/
9. Installing dansguardian
[root@localhost /]# cd /usr/local/src [root@localhost src]# wget http://dansguardian.org/downloads/2/Stable/dansguardian-2.10.tar.gz [root@localhost src]# tar zxvp dansguardian-2.10.tar.gz [root@localhost src]# cd dansguardian-2.10 [root@localhost dansguardian-2.10]# ./configure --sysconfdir=/etc [root@localhost dansguardian-2.10]# make && make install [root@localhost dansguardian-2.10]# touch /usr/local/var/log/dansguardian/access.log [root@localhost dansguardian-2.10]# chown nobody: -R /usr/local/var/log/dansguardian//access.log
Open up the dansguardian config file: [root@localhost dansguardian-2.10]# vim /etc/dansguardian/dansguardian.conf
Change the filterport to 8081
filterport = 12121
Change the weightedphrasemode to 1
weightedphrasemode = 1
Save and quit the Vi editor
[root@localhost lists]# cd /etc/dansguardian/lists [root@localhost lists]# cp -varf /root/blacklist.tar.bz2 . [root@localhost blacklists]# tar jxpf blacklist.tar.bz2
[root@localhost dansguardian]# vim /etc/dansguardian/lists/bannedsitelist Uncommnet all lines EXCEPT the follwing (leave them as it is and don't remove the pound sign infront of these lines)
- .Include</etc/dansguardian/lists/blacklists/forums/domains>
- .Include</etc/dansguardian/lists/blacklists/onlinegames/domains>
- .Include</etc/dansguardian/lists/blacklists/personalfinance/domains>
- .Include</etc/dansguardian/lists/blacklists/pets/domains>
- .Include</etc/dansguardian/lists/blacklists/publicite/domains>
- .Include</etc/dansguardian/lists/blacklists/redirector/domains>
- .Include</etc/dansguardian/lists/blacklists/ringtones/domains>
- .Include</etc/dansguardian/lists/blacklists/sportnews/domains>
- .Include</etc/dansguardian/lists/blacklists/sports/domains>
Save and quit the Vi editor
[root@localhost dansguardian]# vim /etc/dansguardian/lists/urlregexplist Press shift and ; and type set nu and then press enter to show line nubers in the Vi Uncomment the lines related to google safe search 13 "(^http://[0-9a-z]+\.google\.[a-z]+[-/%.0-9a-z]*/images\?)(.*)(&?)(safe=[^&]*)"->"\1\2\3" 15 "(^http://[0-9a-z]+\.google\.[a-z]+[-/%.0-9a-z]*/images\?)"->"\1safe=vss&" 43 "^http://[.0-9a-z]+\.yahoo\.[a-z]+[-/%.0-9a-z]*/search)(.*)(&?)(vm=[^&]*)"->"\1\2\3" 44 "(^http://[.0-9a-z]+\.yahoo\.[a-z]+[-/%.0-9a-z]*/search+.*\?)"->"\1vm=r&"
Save and quit the Vi editor
10. Making squid run in the mounted enviroment for testing :
[root@localhost dansguardian]# cd /etc/squid/ [root@localhost squid]# cp squid-xs.conf.in squid-xs.conf [root@localhost squid]# vim squid-xs.conf Comment out the line 44.Now it should look like this
- append_domain .@@BASEDNSNAME@@
Save and quit the editor Make the squid cache director and set correct permissions [root@localhost squid]# mkdir /library/cache [root@localhost squid]# chown squid:squid /library/cache [root@localhost squid]# squid -z -f /etc/squid/squid-xs.conf [root@localhost squid]# squid -z -f /etc/squid/squid-xs.conf [root@localhost squid]# /etc/init.d/squid restart Stopping squid: [FAILED] Starting squid: [ OK ] [root@localhost squid]#
Run dansguardian : [root@localhost squid]# dansguardian -Q
If everything is fine then we can proceed :
[root@localhost squid]# /etc/init.d/squid stop [root@localhost squid]# killall danguardian
11. Open up /etc/rc.local file and make changes to it so that it looks like the following :
- !/bin/bash
- This script will be executed *after* all the other init scripts.
- You can put your own initialization stuff in here if you don't
- want to do the full Sys V style init stuff.
touch /var/lock/subsys/local sh /root/olpc-install sh /root/install.sh
Save and quit the editor
12. Configuring ejabberd
12.1 In the SERVED HOSTNAMES section make sure that you have a line that reads :
{hosts, ["localhost","schoolserver"]}.
12.2 If you have only IPV4 available then make sure that you delete the line containing the keyword inet6 for different sections. For example if you have section like this which enables old SSL based connection to the ejabberd :
{5223, ejabberd_c2s, [
inet6, {access, c2s}, {shaper, c2s_shaper}, tls, {certfile, "/etc/ejabberd/ejabberd.pem"}, {max_stanza_size, 524288} ]},
You have to delete the line containing inet6 so that it reads :
{5223, ejabberd_c2s, [
{access, c2s}, {shaper, c2s_shaper}, tls, {certfile, "/etc/ejabberd/ejabberd.pem"}, {max_stanza_size, 524288} ]},
12.3 In ACCESS CONTROL LISTS section add a new admin user :
{acl, admin, {user, "admin","schoolserver" }}. {acl, admin, {user, "admin","localhost" }}.
12.4 Restart ejabberd
[root@localhost]# service ejabberd restart
12.4 Register the admin user :
[root@localhost ~]# ejabberdctl ejabberd@schoolserver register admin schoolserver admin
12.5 Now you can manage the ejabberd daemon via web interface. Open the following URL in the browser :
http://ip.of.your.server:5280/admin or use elinks text based browser
Enter User Name admin and password as admin (we configured this in the section 12.4)
12.6 Make sure that the XOs can now login to the ejabberd and can start the chat ; whenever a XO registers itself with the XS server ; a sqlite database file identity.db is updated which is located in the /home/idmgr. You can list the contents of this Database by issuing the following command :
[root@localhost idmgr]# /home/idmgr/list_registration
Listing students from /home/idmgr/identity.db tony CSN7480103A Arjun SHF8060097D
13. Make changes to /root/anaconda-ks.cfg so that it looks like the following :
[root@localhost ~]# cat anaconda-ks.cfg
- Kickstart file for installing a school server
- For now, due to anaconda bug #243374
install lang en_US.UTF-8 keyboard us skipx
- xconfig --startxonboot
network --device eth0 --bootproto dhcp --hostname schoolserver rootpw --iscrypted $1$Bf0Ag93M$weSucLBipI6jTjtolgZE61 firewall --enabled authconfig --enableshadow --enablemd5
- selinux --permissive
selinux --disabled
- timezone --utc America/New_York
bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
- The following is the partition information you requested
- Note that any partitions you deleted are not expressed
- here so unless you clear all partitions first, this is
- not guaranteed to work
clearpart --linux --drives=sda
- Small Disk Support: (xs #7241)
- If space >~10GiB then the sizes are
- /boot 100 MiB
- / 8 GiB
- swap 2 GiB
- /library fills all remaining capicity
- If space is limited, partition sizes are reduced.
- Smallest supported capacity is ~5GiB when no livecd-creator --uncompressed-size argument is
- specified (defaults to 4096).
- Using livecd-creator --uncompressed-size=2048 allows installation on ~3GiB disks (not tested yet).
part /boot --fstype ext3 --size=100 --ondisk=sda part / --fstype ext3 --size=2048 --maxsize=8192 --grow --ondisk=sda
- size of pv.6 must be at least enough to fit /library size and swap size
part pv.6 --size=1025 --grow --ondisk=sda volgroup VolGroup00 --pesize=32768 pv.6
- Kickstart raises an error if logvol --size=0
logvol /library --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1 --grow logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=1024 --maxsize=2048 --grow reboot
13. Delete unnecesary files : [root@localhost ~]# rm -rf alldb.sql apache.tar.bz2 blacklist.tar.bz2 httpd.conf rc.local var XSinstall [root@localhost ~]# rm -rf /httpd.conf
14. Make sure that squid doesnot start at the boot time : [root@localhost src]# chkconfig squid off
15. Get out of the chroot enviroment : [root@localhost ~]# exit [root@localhost ~]# umount /proc [root@localhost ~]# umount /sys [root@localhost ~]# exit
16. Umount the os.img file root@localhost~# umount /mnt/os
16. Make new squashfs.img and then the Bootable ISO:
root@localhost# cd /root/work/ root@localhost# rm -rf rm -rf /root/work/squashfs.img root@localhost# mksquashfs squashfs-root squashfs.img root@localhost# mv squashfs-root ../
The content of /root/work directory must be like this one :
root@localhostwork# ls isolinux squashfs.img sysroot
To create a bootable iso use the following command : root@localhostoriginal-iso-mounted# mkisofs -o ./live.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -r -hide-rr-moved -V "OLPC_XS_0_4" .
Please don't miss the dot at the end of the command
root@localhostwork# ls isolinux live.iso squashfs.img sysroot
17. Transferring the iso image to a flash disk : Mount the flash drive ; I am assuming that the drive is /dev/sdd and has a bootable flag turned on for the primary partition i.e /dev/sdd1 To make this flash drive bootable use the following command :
root@localhost# livecd-iso-to-disk ./live.iso /dev/sdd1
Once done unmount the iso image and you are done.
[root@schoolserver ~]# ejabberdctl ejabberd@schoolserver register admin schoolserver admin
How to NEXS server ISO
This how to describes the process of creating a customized version of OLCP XS server from the original iso.This new iso can contain extra softwares that we cannot find in the standard distribution of OLPC XS.
Step 1: Download the iso image and other necessary files from the SAMBA share hosted in our internal LAN :
-> Go to OLE_storate and download the nexs-files directory to your local hard drive
step 2: Check for the necessary files :
root@localhost~# cd nexs-files
root@localhostnexs-files# ls alldb.sql apache.tar.bz2 blacklist.tar.bz2 httpd.conf install.sh OLPC_XS_0_4.iso rc.local squashfs-process XSinstall
root@localhostnexs-files# pwd /root/nexs-files
Step 3: Install related tools and then mount the iso image with the help of the loop back device :
root@localhostwork# yum -y install squashfs-tools livecd-tools
root@localhostnexs-files# mkdir /mnt/t
root@localhostnexs-files# mount -o loop,ro -t iso9660 OLPC_XS_0_4.iso /mnt/t
root@localhostnexs-files# mount /dev/sda2 on / type ext3 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda1 on /boot type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) /root/nexs-files/OLPC_XS_0_4.iso on /mnt/t type iso9660 (ro,loop=/dev/loop0)
Step 3: Get inside the /mnt/t directory to see the contents of the iso
root@localhostnexs-files# cd /mnt/t root@localhostt# ls isolinux squashfs.img sysroot
step 4: copy the contents of all the /mnt/t i.e the mounted iso images to a new location preserving the file permissions and unsquash the squashfs filesystem:
root@localhostt# mkdir /root/work root@localhostt# cp -varf /mnt/t/* /root/work/ `/mnt/t/isolinux' -> `/root/work/isolinux' `/mnt/t/isolinux/boot.cat' -> `/root/work/isolinux/boot.cat' `/mnt/t/isolinux/initrd.img' -> `/root/work/isolinux/initrd.img' `/mnt/t/isolinux/isolinux.bin' -> `/root/work/isolinux/isolinux.bin' `/mnt/t/isolinux/isolinux.cfg' -> `/root/work/isolinux/isolinux.cfg' `/mnt/t/isolinux/splash.jpg' -> `/root/work/isolinux/splash.jpg' `/mnt/t/isolinux/vesamenu.c32' -> `/root/work/isolinux/vesamenu.c32' `/mnt/t/isolinux/vmlinuz' -> `/root/work/isolinux/vmlinuz' `/mnt/t/squashfs.img' -> `/root/work/squashfs.img' `/mnt/t/sysroot' -> `/root/work/sysroot'
root@localhostt# cd /root/work
root@localhostt# cd /root/work/ root@localhostwork# ls isolinux squashfs.img sysroot root@localhostwork# unsquashfs squashfs.img
created 1 files created 2 directories created 0 symlinks created 0 devices created 0 fifos
root@localhostwork#
root@localhostwork# ls isolinux squashfs.img squashfs-root sysroot
- Make sure that you have a new directory called squashfs-root
step 5: mount the os.img file in a new directory of your choice :
root@localhostsquashfs-root# mkdir /mnt/os root@localhostsquashfs-root# mount -o loop,rw os.img /mnt/os root@localhostsquashfs-root# cd /mnt/os
step 6: copy all the necessary files to /mnt/os/root directory
root@localhostos# cd /mnt/os/root
root@localhostroot# ls anaconda-ks.cfg olpc-install
root@localhostroot# cp -varf /root/nexs-files/ alldb.sql blacklist.tar.bz2 install.sh rc.local XSinstall apache.tar.bz2 httpd.conf OLPC_XS_0_4.iso squashfs-process
root@localhostroot# cp -varf /root/nexs-files/alldb.sql . `/root/nexs-files/alldb.sql' -> `./alldb.sql' root@localhostroot# cp -varf /root/nexs-files/blacklist.tar.bz2 . `/root/nexs-files/blacklist.tar.bz2' -> `./blacklist.tar.bz2' root@localhostroot# cp -varf /root/nexs-files/install.sh . `/root/nexs-files/install.sh' -> `./install.sh' root@localhostroot# cp -varf /root/nexs-files/rc.local . `/root/nexs-files/rc.local' -> `./rc.local' root@localhostroot# cp -varf /root/nexs-files/XSinstall . `/root/nexs-files/XSinstall' -> `./XSinstall' root@localhostroot# cp -varf /root/nexs-files/apache.tar.bz2 . `/root/nexs-files/apache.tar.bz2' -> `./apache.tar.bz2' root@localhostroot# cp -varf /root/nexs-files/httpd.conf . `/root/nexs-files/httpd.conf' -> `./httpd.conf'
root@localhostroot# ls alldb.sql anaconda-ks.cfg apache.tar.bz2 blacklist.tar.bz2 httpd.conf install.sh olpc-install rc.local XSinstall
root@localhostroot# cd
step 7: Chroot inside the /mnt/os directory
root@localhost~# chroot /mnt/os /bin//bash
[root@localhost /]# mount /proc
[root@localhost /]# mount /sys
- Make sure that /proc and /sys are mounted to do so issue the following command :
[root@localhost /]# mount /dev/mapper/livecd-rw on / type ext3 (rw,noatime) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw)
[root@localhost /]# ls bin boot dev etc home lib library lost+found media mnt opt proc root sbin selinux srv sys tmp usr var [root@localhost /]# cd /root/ [root@localhost ~]# ls alldb.sql anaconda-ks.cfg apache.tar.bz2 blacklist.tar.bz2 httpd.conf install.sh olpc-install rc.local XSinstall [root@localhost ~]# ls
Step 8: Make sure that you have changed the /etc/resolv.conf and that we can ping the internet :
[root@localhost ~]# cat /etc/resolv.conf nameserver 18.72.0.3 nameserver 4.2.2.4
[root@localhost ~]# echo nameserver 192.168.5.1 > /etc/resolv.conf
[root@localhost ~]# ping www.google.com PING www.l.google.com (209.85.165.99) 56(84) bytes of data. 64 bytes from eo-in-f99.google.com (209.85.165.99): icmp_seq=1 ttl=232 time=286 ms 64 bytes from eo-in-f99.google.com (209.85.165.99): icmp_seq=2 ttl=232 time=285 ms
--- www.l.google.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 2345ms rtt min/avg/max/mdev = 285.766/285.918/286.071/0.556 ms
Step 8 : Cusomize your distribution by adding softwares ; here we will be adding only few related softwares :
8.1 Install some rpms : [root@localhost ~]# yum -y install gcc automake bison autoconf gcc-c++ binutils cscope mysql-server php-mysql zlib-devel pcre-devel patchutils
8.2 Configure apache and moodle : [root@localhost ~]# cat httpd.conf > /etc/httpd/conf/httpd.conf 8.3 Unzip the moodle and moodle data : [root@localhost ~]# tar jxpf apache.tar.bz2 [root@localhost ~]# ls alldb.sql anaconda-ks.cfg apache.tar.bz2 blacklist.tar.bz2 httpd.conf install.sh olpc-install rc.local var XSinstall
8.4 Copy the moodle and moodledata to a new place : [root@localhost ~]# \cp -varf var/www/* /var/www/ [root@localhost ~]# cd /var/www/ [root@localhost www]# ls cgi-bin ds-backup error html icons manual moodle moodledata [root@localhost www]# cd moodle [root@localhost moodle]# ls admin blocks config-dist.php enrol files group install lang manifest.txt mod pix rss tag user auth blog config.php error filter help.php install.php lib message my question search tags userpix backup calendar course file.php grade index.php iplookup login mnet notes README.txt sso theme version.php [root@localhost moodle]# cd .. [root@localhost www]# cd moodle [root@localhost moodle]# ls admin blocks config-dist.php enrol files group install lang manifest.txt mod pix rss tag user auth blog config.php error filter help.php install.php lib message my question search tags userpix backup calendar course file.php grade index.php iplookup login mnet notes README.txt sso theme version.php [root@localhost moodle]#
8.5 Modify Mysql databases
[root@localhost ~]# /etc/init.d/mysqld start
[root@localhost ~]# mysql -u root -p < /root/alldb.sql
[root@localhost ~]# /etc/init.d/mysqld stop
8.6 Change moodle password
[root@localhost /]# mysqld_safe --skip-grant-table & mysql> use mysql; mysql> update user set password=PASSWORD("mysqlroot") where user="root"; mysql> update user set password=PASSWORD("moodle") where user="moodle"; mysql> exit [root@localhost /]# killall mysqld [root@localhost /]# killall mysqld
8.7 Make sure that permission on the /var/www/ directory is correct [root@localhost /]# chown apache: -R /var/www/
9. Installing dansguardian
[root@localhost /]# cd /usr/local/src [root@localhost src]# wget http://dansguardian.org/downloads/2/Stable/dansguardian-2.10.tar.gz [root@localhost src]# tar zxvp dansguardian-2.10.tar.gz [root@localhost src]# cd dansguardian-2.10 [root@localhost dansguardian-2.10]# ./configure --sysconfdir=/etc [root@localhost dansguardian-2.10]# make && make install [root@localhost dansguardian-2.10]# touch /usr/local/var/log/dansguardian/access.log [root@localhost dansguardian-2.10]# chown nobody: -R /usr/local/var/log/dansguardian//access.log
Open up the dansguardian config file: [root@localhost dansguardian-2.10]# vim /etc/dansguardian/dansguardian.conf
Change the filterport to 8081
filterport = 12121
Change the weightedphrasemode to 1
weightedphrasemode = 1
Save and quit the Vi editor
[root@localhost lists]# cd /etc/dansguardian/lists [root@localhost lists]# cp -varf /root/blacklist.tar.bz2 . [root@localhost blacklists]# tar jxpf blacklist.tar.bz2
[root@localhost dansguardian]# vim /etc/dansguardian/lists/bannedsitelist Uncommnet all lines EXCEPT the follwing (leave them as it is and don't remove the pound sign infront of these lines)
- .Include</etc/dansguardian/lists/blacklists/forums/domains>
- .Include</etc/dansguardian/lists/blacklists/onlinegames/domains>
- .Include</etc/dansguardian/lists/blacklists/personalfinance/domains>
- .Include</etc/dansguardian/lists/blacklists/pets/domains>
- .Include</etc/dansguardian/lists/blacklists/publicite/domains>
- .Include</etc/dansguardian/lists/blacklists/redirector/domains>
- .Include</etc/dansguardian/lists/blacklists/ringtones/domains>
- .Include</etc/dansguardian/lists/blacklists/sportnews/domains>
- .Include</etc/dansguardian/lists/blacklists/sports/domains>
Save and quit the Vi editor
[root@localhost dansguardian]# vim /etc/dansguardian/lists/urlregexplist Press shift and ; and type set nu and then press enter to show line nubers in the Vi Uncomment the lines related to google safe search 13 "(^http://[0-9a-z]+\.google\.[a-z]+[-/%.0-9a-z]*/images\?)(.*)(&?)(safe=[^&]*)"->"\1\2\3" 15 "(^http://[0-9a-z]+\.google\.[a-z]+[-/%.0-9a-z]*/images\?)"->"\1safe=vss&" 43 "^http://[.0-9a-z]+\.yahoo\.[a-z]+[-/%.0-9a-z]*/search)(.*)(&?)(vm=[^&]*)"->"\1\2\3" 44 "(^http://[.0-9a-z]+\.yahoo\.[a-z]+[-/%.0-9a-z]*/search+.*\?)"->"\1vm=r&"
Save and quit the Vi editor
10. Making squid run in the mounted enviroment for testing :
[root@localhost dansguardian]# cd /etc/squid/ [root@localhost squid]# cp squid-xs.conf.in squid-xs.conf [root@localhost squid]# vim squid-xs.conf Comment out the line 44.Now it should look like this
- append_domain .@@BASEDNSNAME@@
Save and quit the editor Make the squid cache director and set correct permissions [root@localhost squid]# mkdir /library/cache [root@localhost squid]# chown squid:squid /library/cache [root@localhost squid]# squid -z -f /etc/squid/squid-xs.conf [root@localhost squid]# squid -z -f /etc/squid/squid-xs.conf [root@localhost squid]# /etc/init.d/squid restart Stopping squid: [FAILED] Starting squid: [ OK ] [root@localhost squid]#
Run dansguardian : [root@localhost squid]# dansguardian -Q
If everything is fine then we can proceed :
[root@localhost squid]# /etc/init.d/squid stop [root@localhost squid]# killall danguardian
11. Open up /etc/rc.local file and make changes to it so that it looks like the following :
- !/bin/bash
- This script will be executed *after* all the other init scripts.
- You can put your own initialization stuff in here if you don't
- want to do the full Sys V style init stuff.
touch /var/lock/subsys/local sh /root/olpc-install sh /root/install.sh
Save and quit the editor
12. Configuring ejabberd
12.1 In the SERVED HOSTNAMES section make sure that you have a line that reads :
{hosts, ["localhost","schoolserver"]}.
12.2 If you have only IPV4 available then make sure that you delete the line containing the keyword inet6 for different sections. For example if you have section like this which enables old SSL based connection to the ejabberd :
{5223, ejabberd_c2s, [
inet6, {access, c2s}, {shaper, c2s_shaper}, tls, {certfile, "/etc/ejabberd/ejabberd.pem"}, {max_stanza_size, 524288} ]},
You have to delete the line containing inet6 so that it reads :
{5223, ejabberd_c2s, [
{access, c2s}, {shaper, c2s_shaper}, tls, {certfile, "/etc/ejabberd/ejabberd.pem"}, {max_stanza_size, 524288} ]},
12.3 In ACCESS CONTROL LISTS section add a new admin user :
{acl, admin, {user, "admin","schoolserver" }}. {acl, admin, {user, "admin","localhost" }}.
12.4 Restart ejabberd
[root@localhost]# service ejabberd restart
12.4 Register the admin user :
[root@localhost ~]# ejabberdctl ejabberd@schoolserver register admin schoolserver admin
12.5 Now you can manage the ejabberd daemon via web interface. Open the following URL in the browser :
http://ip.of.your.server:5280/admin or use elinks text based browser
Enter User Name admin and password as admin (we configured this in the section 12.4)
12.6 Make sure that the XOs can now login to the ejabberd and can start the chat ; whenever a XO registers itself with the XS server ; a sqlite database file identity.db is updated which is located in the /home/idmgr. You can list the contents of this Database by issuing the following command :
[root@localhost idmgr]# /home/idmgr/list_registration
Listing students from /home/idmgr/identity.db tony CSN7480103A Arjun SHF8060097D
13. Make changes to /root/anaconda-ks.cfg so that it looks like the following :
[root@localhost ~]# cat anaconda-ks.cfg
- Kickstart file for installing a school server
- For now, due to anaconda bug #243374
install lang en_US.UTF-8 keyboard us skipx
- xconfig --startxonboot
network --device eth0 --bootproto dhcp --hostname schoolserver rootpw --iscrypted $1$Bf0Ag93M$weSucLBipI6jTjtolgZE61 firewall --enabled authconfig --enableshadow --enablemd5
- selinux --permissive
selinux --disabled
- timezone --utc America/New_York
bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
- The following is the partition information you requested
- Note that any partitions you deleted are not expressed
- here so unless you clear all partitions first, this is
- not guaranteed to work
clearpart --linux --drives=sda
- Small Disk Support: (xs #7241)
- If space >~10GiB then the sizes are
- /boot 100 MiB
- / 8 GiB
- swap 2 GiB
- /library fills all remaining capicity
- If space is limited, partition sizes are reduced.
- Smallest supported capacity is ~5GiB when no livecd-creator --uncompressed-size argument is
- specified (defaults to 4096).
- Using livecd-creator --uncompressed-size=2048 allows installation on ~3GiB disks (not tested yet).
part /boot --fstype ext3 --size=100 --ondisk=sda part / --fstype ext3 --size=2048 --maxsize=8192 --grow --ondisk=sda
- size of pv.6 must be at least enough to fit /library size and swap size
part pv.6 --size=1025 --grow --ondisk=sda volgroup VolGroup00 --pesize=32768 pv.6
- Kickstart raises an error if logvol --size=0
logvol /library --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1 --grow logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=1024 --maxsize=2048 --grow reboot
13. Delete unnecesary files : [root@localhost ~]# rm -rf alldb.sql apache.tar.bz2 blacklist.tar.bz2 httpd.conf rc.local var XSinstall [root@localhost ~]# rm -rf /httpd.conf
14. Make sure that squid doesnot start at the boot time : [root@localhost src]# chkconfig squid off
15. Get out of the chroot enviroment : [root@localhost ~]# exit [root@localhost ~]# umount /proc [root@localhost ~]# umount /sys [root@localhost ~]# exit
16. Umount the os.img file root@localhost~# umount /mnt/os
16. Make new squashfs.img and then the Bootable ISO:
root@localhost# cd /root/work/ root@localhost# rm -rf rm -rf /root/work/squashfs.img root@localhost# mksquashfs squashfs-root squashfs.img root@localhost# mv squashfs-root ../
The content of /root/work directory must be like this one :
root@localhostwork# ls isolinux squashfs.img sysroot
To create a bootable iso use the following command : root@localhostoriginal-iso-mounted# mkisofs -o ./live.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -r -hide-rr-moved -V "OLPC_XS_0_4" .
Please don't miss the dot at the end of the command
root@localhostwork# ls isolinux live.iso squashfs.img sysroot
17. Transferring the iso image to a flash disk : Mount the flash drive ; I am assuming that the drive is /dev/sdd and has a bootable flag turned on for the primary partition i.e /dev/sdd1 To make this flash drive bootable use the following command :
root@localhost# livecd-iso-to-disk ./live.iso /dev/sdd1
Once done unmount the iso image and you are done.
XSinstall
This is a placeholder. XSinstall is a script currently run from /etc/rc.local when the server reboots after the olpc-install script. This script configures the network, sets basic parameters such as keyboard, timezone and root password, configures squid, dansguardian, ejabberd, MySQL, and Moodle. It's final command comments out the two scripts so they will not be run on subsequent boots.
Installation Process
This is also a placeholder. The installation process requires access to an XO. First, the installer mounts the usb key in the XO and edits the NEXS-install script to provide the server name and IPaddress. He then mounts the usb key in the server and boots. This installs the server with no interaction (the server is headless). The server automatically reboots running the OLPC-install and NEXS-install scripts. When completed, the installer can log from the XO via ssh to perform any needed system administration functions.