On 6/5/07, Michel Van den Bergh <[EMAIL PROTECTED]> wrote:
> Hi.
>
> I have things running pretty well now. Below are my notes.
> Perhaps they can posted on the Wiki somewhere (in polished form).
>

Could you make a new section of the SAGE install
guide and send me a patch?  To do this:
  (1) cd to SAGE_ROOT/devel/doc/inst
  (2) Type ./build_pdf or ./build_dvi depending
      on your preference to make sure you can
      build the install guide.
  (3) Edit it -- it's just latex.
  (4) Start SAGE and type hg_doc.ci() to
      check in your changes.  Then type
      hg_doc.send('inst-doc-patch.hg')
      to make a patch for me.
Don't worry -- I'll look over the patch and edit
it after you send it to me.



> Michel
>
> =============================================
>
> The following instructions for making
> sage run in a chroot environment have
> not been audited for security.
>
> Unless otherwise specified all instructions
> have to be executed as root.
>
>
> Step 0: Creating a root directory
> =================================
>
> #mkdir /sage-server
>
> Below we will refer to /sage-server as <sage-server>.
>
> Step 1: Teaching yum how to work with installroot
> =================================================
>
> We want to use
>
> #yum --installroot <sage-server>  install packages
>
> Unfortunately the standard entries in /etc/yum.repos.d do not work
> well with "--installroot". No doubt there is a clean solution
> to this problem but I didn't find it.
> So I made a backup copy of /etc/yum.repos.d and
> created the following two files in /etc/yum.repos.d
>
> /etc/yum.repos.d/fedora.repo
> ============================
>
> [base]
> name=Fedora 7  - i386 - Base
> baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/7/Fedora/i386/os
> #mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-core-7
> enabled=1
> gpgcheck=1
> gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
>
> /etc/yum.repos.d/fedora-updates.repo
> ====================================
>
> [updates-released]
> name=Fedora 7 - i386 - Released Updates
> baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/7/i386/
> #mirrorlist=http://fedora.redhat.com/download/mirrors/updates-released-fc7
> enabled=1
> gpgcheck=1
> gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
>
> I disabled all other repos.
>
>
> Step 2: Installing a minimal FC7 system
> =======================================
>
> My definition of minimal was the following
>
> #yum --installroot <sage-server> bash fileutils sed which make gcc
> gcc-c++ m4 tar
> gzip bzip2 flex bison findutils yum rpm passwd
>
> Sit back and relax. After this command completes you should be able
> to do (as root)
>
> #/usr/sbin/chroot <sage-server>
>
> and be greeted with a bash prompt. Type ^D to exit.
>
> Step 4: Auxiliary steps.
> =======================
>
> a) Populating the dev directory. We use the dev directory of the host
> environment.
>
> #mount --rbind /dev <sage-server>/dev
>
> c) Creating a sage user inside the chrooted environment
>
> #/usr/sbin/chroot <sage-server>
> #/usr/sbin/useradd -u 5000 sage            # 5000 is a UID not existing in
>                                           # the host environment
>
> #passwd sage
> Changing password for user sage.
> New UNIX password:
> etc...
>
>
> Step 3: Dowloading and compiling sage
> =====================================
>
> Download the sage source code (a big tar file). Move the source code
> to <sage-server>/root. Do
>
> #tar xvf <source-archive>
>
> This extracts the source code into a directory <sage-root>.
>
> #/usr/sbin/chroot <sage-server>
> #chdir <sage-root>
> #make
> #make test
> #make install
>
>
> This should succeed, otherwise install extra packages as needed. This
> can be done from within the chroot environment (since we have installed
> yum and rpm).
>
> Run sage once to modify the hardcoded paths
>
> #sage
>
> Test if the command "sage" works. If so: exit.
>
> #^D
>
> Step 4: Firing up the notebook
> ==============================
>
> Do as root in the host environment
>
> #/usr/sbin/chroot <sage-server> su - sage -c "sage -notebook"
>
>
> Step 5: Making things more user friendly
> ========================================
>
> Scripts:
>
> /etc/sysconfig/sage-config
> ==========================
> SAGE_SERVER=/sage-root
> ADDRESS=xxx.xxx.xxx.xxx
> PORT=8000
> USER=5000
>
> /usr/local/bin/sage-server
> ==========================
> #!/bin/bash
> . /etc/sysconfig/sage-config
> COMMAND="notebook(address='$ADDRESS', port=$PORT)"
> if ! ( grep $SAGE_SERVER /etc/mtab > /dev/null )
> then
>         mount --rbind /dev/ $SAGE_SERVER/dev
> fi
>
> nohup /usr/sbin/chroot $SAGE_SERVER su - sage -c "sage -c \"$COMMAND\" " &
>
> /usr/local/bin/sage-killer
> ===========================
> #!/bin/bash
> . /etc/sysconfig/sage-config
> kill -9 `ps -u $USER -o "pid="` > /dev/null 2>/dev/null
>
> /etc/rc.d/init.d/sage
> =====================
>
> Note: I hate bash. The script below is very bad. It does no error checking
> whatsoever.
>
> To run the initscript at boot do
>
> #/sbin/chkconfig sage on
>
> To disable the initscript do
>
> #/sbin/chkconfig sage off
> =======================================================================
> #!/bin/sh
> #
> # This script starts up a sage notebook in a chroot environment.
> #
> # chkconfig: 2345 35 98
> # description: Run a notebook in chroot environment
> #
>
> . /etc/rc.d/init.d/functions
>
> start()
> {
>         echo -n $"Starting sage "
>         if [ ! -f  /var/lock/subsys/sage ]; then
>                 nohup /usr/local/bin/sage-server 2> /dev/null > /dev/null &
>         fi
>         touch /var/lock/subsys/sage
>         success
>         echo
>         return 0
> }
>
> stop()
> {
>         echo -n $"Stopping sage "
>         /usr/local/bin/sage-killer
>         rm -f  /var/lock/subsys/sage
>         success
>         echo
>         return 0
> }
>
> status () {
>     if [ ! -f /var/lock/subsys/sage ]; then
>         echo $"We're stopped!"
>         return 1
>     else
>         echo $"We're running!"
>         return 0
>     fi
>
> }
> # See how we were called.
> case "$1" in
>   start)
>         start
>         ;;
>   stop)
>         stop
>         ;;
>   status)
>         status
>         ;;
>   restart)
>         stop
>         start
>         ;;
>   *)
>         echo $"Usage: $0 {start|stop|restart|status}"
>         exit 1
> esac
>
> exit 0
>
>
>
>
>
>
>
>
>
>
>
>
>


-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://www.williamstein.org

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to