Sage
Some notes on the installation of Sage in a vserver:
Create a vserver, remove tmpfs /tmp in /etc/vservers/sage/fstab as 16M is too short for compilation
Create an account for the compilation
# adduser --disabled-password --shell /bin/false sage
Install packages needed for the compilation + some for runtime
# apt-get install gcc-4.1-base make m4 bison flex tar perl binutils \ libstdc++6-dev g++ openssh-client \ less screen imagemagick
Download and compile sources
# cd /opt # export http_proxy=http://proxy....:8080 # wget http://www.sagemath.org/dist/src/sage-2.10.tar # tar xf sage-2.10.tar # chown -R sage:sage * # su -s /bin/bash - sage sage$ cd /opt/sage-2.10/ sage$ make
Time for triple coffee...
To maintain the installation and install optional packages:
sage$ export http_proxy=http://proxy....:8080 sage$ ./sage -upgrade sage$ ./sage -optional sage$ ./sage -i extra_docs- sage$ ./sage -i openssl-0.9.8d.p1 sage$ ./sage -i pyopenssl-0.6 sage$ ./sage -i gap_packages-4.4.10_3 sage$ ./sage -i database_gap-4.4.10 ...
Create an account to run sage as webserver
# adduser --disabled-password --shell /bin/false saged # cp /opt/sage-2.10/sage /home/install
Edit the launch script /home/install/sage to point to the right directory:
SAGE_ROOT="/opt/sage-2.10" # ln -s /home/install/sage /usr/local/bin
To start & stop the webserver as a real daemon, in a screen session, save the following script as /home/install/saged:
#! /bin/sh # Author: Philippe Teuwen # Do NOT "set -e" PATH=/usr/sbin:/usr/bin:/sbin:/bin DESC="Launching SAGE webserver" NAME=sage PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME DAEMON=/usr/local/bin/sage HOST="fqdn.of.the.server" PORT="8000" ARGS="-c \"notebook(address=\\\"$HOST\\\",port=$PORT,accounts=true)\"" USER=saged # Exit if mysql client is not installed [ -x "$DAEMON" ] || exit 0 # Load the VERBOSE setting and other rcS variables [ -f /etc/default/rcS ] && . /etc/default/rcS # Define LSB log_* functions. # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions # # Function that starts the daemon/service # do_start() { if [ -e $PIDFILE ]; then if ps -p $(cat $PIDFILE) >/dev/null; then echo -n -e "\nError: $NAME seems to be already running!" return 1 else rm -f $PIDFILE fi fi screen -d -m -S sage su -s /bin/bash - $USER -c "$DAEMON $ARGS" # PID of screen PID=$(screen -ls sage|grep sage|sed 's/[[:space:]]*\([0-9]\+\)\..*/\1/') # PID of su PID=$(ps --ppid $PID -o pid --no-headers) # PID of sage PID=$(ps --ppid $PID -o pid --no-headers) echo $PID > $PIDFILE } # # Function that stops the daemon/service # do_stop() { if [ -e $PIDFILE ]; then PID=$(cat $PIDFILE) if ps -p $PID > /dev/null; then # kill script kill $PID rm -f $PIDFILE return 0 else echo -e "\nWarning: $NAME was not running." echo -n -e "\nCleaning PID file" rm -f $PIDFILE return 1 fi else echo -n -e "\nWarning: $NAME was not running" return 1 fi } case "$1" in start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" do_start case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; stop) [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" do_stop case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; restart|force-reload) # # If the "reload" option is implemented then remove the # 'force-reload' alias # log_daemon_msg "Restarting $DESC" "$NAME" do_stop case "$?" in 0|1) do_start case "$?" in 0) log_end_msg 0 ;; 1) log_end_msg 1 ;; # Old process is still running *) log_end_msg 1 ;; # Failed to start esac ;; *) # Failed to stop log_end_msg 1 ;; esac ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac :
Install the script:
# ln -s /home/install/saged /etc/init.d # update-rc.d saged defaults 99 01
If you want to install the jsMath fonts locally on your client for a faster rendering:
Download TEX fonts and install them either in ~/.fonts/ or C:\Windows\Fonts
Some notes if you want to use your Maple 32-bit on a 64-bit arch:
apt-get install ia32-libs /bin/maple -binary IBM_INTEL_LINUX
Or from Sage:
maple.fsolve('x^2=cos(x)+4', 'x=0..5')