The synology (ds209+ii) NAS has a python 2.7 package. I was not able to get the required packages for weewx installed without getting compilation errors.
At last I found a way to install everything succesfully including proper system logging and an automatic startup of weewx after a system boot.
Note: The description below starts with a backup of an earlier installed weewx version. You can skip the backup and restore actions when you install weewx for the first time.
# delete old ipkg installation (not weewx)
rm -rf /volume1/@optware
rm -rf /usr/lib/ipkg
# backup current weewx version (in /home/weewx)
# note: I made a share "linux" on my disk station on volume 1. This share can be seen from Windows via a network share to 'linux', e,g. t:/0/weewx
mkdir /home
cp -rf /volume1/linux/0/weewx /home/
# install ipkg
cd /volume1/linux/0
sh syno-e500-bootstrap_1.2-7_powerpc.xsh
# find path to mysqladmin
cd /
find -name mysqladmin
./usr/syno/mysql/bin/mysqladmin
# boot diskstation to make syslog.deny active
# start a putty session with user root
ipkg update
ipkg upgrade
ipkg install py26-setuptools
# note: this command installs also pyton 2.6
ipkg install py26-configobj
ipkg install py26-cheetah
ipkg install py26-pil
ipkg install py25-usb
# note: this command installs also pyton 2.5
# solution for python2.5 module usb not found in python2.6
cp /volume1/linux/0/usb.pth /opt/lib/python2.6/site-packages/
# contents of usb.pth:
/opt/lib/python2.5/site-packages/
ipkg install mysql
# notes during installation:
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/bin/mysqladmin -u root password 'new-password'
/opt/bin/mysqladmin -u root -h ds-luc3 password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /opt ; /opt/bin/mysqld_safe &
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests
mysql - 4.1.22-3 - Popular free SQL database system
ipkg install py26-mysql
# change password of user root
/opt/bin/mysqladmin -u root password '[mypassword]'
# solution for remembering path to ipkg after a boot
cp /volume1/linux/0/.profile /root/
# contents of file .profile (the PATH line was changed):
umask 022
PATH=/opt/bin:/opt/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin
export PATH
#This fixes the backspace when telnetting in.
#if [ "$TERM" != "linux" ]; then
# stty erase
#fi
HOME=/root
export HOME
TERM=${TERM:-cons25}
export TERM
PAGER=more
export PAGER
PS1="`hostname`> "
alias dir="ls -al"
alias ll="ls -la"
# solution for logging inf and debug messages in /var/log/messages
cp /volume1/linux/0/syslog.deny /etc.defaults/
# contents of file syslog.deny (lines debug and info commented out):
# These priorities in this config file are not logged
# refer to syslog.h
#alert
#crit
###debug
#emerg
#err
###info
notice
# Always keep these setting , as these are obselete
# refer to syslog.h
error
none
warn
panic
# solution for python2.5 module usb not found in python2.6
cp /volume1/linux/0/usb.pth /opt/lib/python2.6/site-packages/
# contents of file usb.pth:
/opt/lib/python2.5/site-packages/
# start-stop-restart command file for weewx
cp /volume1/linux/0/S01weewx.sh /usr/local/etc/rc.d/
# contents of file S01weewx.sh:
#!/bin/sh
### Initializing vars
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="weewx"
WEEWX_HOME_DIR=/home/weewx
WEEWX_CONF_FILE=weewx.conf
WEEWX_FILE=weewxd
WEEWX_ARGS="--daemon"
PIDFILE=/var/run/weewx.pid
USER=root
# Function tot start the weather service
start_weatherservice() {
echo "Trying to start $WEEWX_HOME_DIR/bin/$WEEWX_FILE $WEEWX_ARGS..." >&2
# Check if the service isn't running already
if [[ ! -e $PIDFILE ]]
then
# Start the weather service
( ( nohup $WEEWX_HOME_DIR/bin/$WEEWX_FILE $WEEWX_HOME_DIR/$WEEWX_CONF_FILE $WEEWX_ARGS ) & echo $! > $PIDFILE & ) > /dev/null
echo "$WEEWX_HOME_DIR/bin/$WEEWX_FILE $WEEWX_HOME_DIR/$WEEWX_CONF_FILE $WEEWX_ARGS sucessfully started!" >&2
return 1
else
echo "$WEEWX_HOME_DIR/bin/$WEEWX_FILE $WEEWX_ARGS was already running!" >&2
return 0
fi
}
# Function to stop the weatherservice
stop_weatherservice() {
echo "Trying to stop $WEEWX_HOME_DIR/bin/$WEEWX_FILE $WEEWX_ARGS..." >&2
if [ -f "$PIDFILE" ]
then
# Let read the PID id from the file
read PID < $PIDFILE
if [ -d "/proc/$PID" ]
then
# It is running, so kill it
kill -9 "$PID"
rm -f $PIDFILE
# Give it some time to exit
sleep 5
# Check if it was really killed
if [ -d "/proc/$PID" ]
then
echo "Couldn't kill PID $PID!" >&2
else
echo "$WEEWX_HOME_DIR/bin/$WEEWX_FILE (PID:$PID) was killed!" >&2
fi
else
# It is'nt running, remove the PIDfile
rm -f "$PIDFILE"
fi
else
echo "$WEEWX_HOME_DIR/bin/$WEEWX_FILE $WEEWX_ARGS isn't running!" >&2
fi
}
# Start, stop, restart actions
case "$1" in
start)
start_weatherservice
;;
stop)
stop_weatherservice
;;
restart)
stop_weatherservice
sleep 5
start_weatherservice
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
exit 3
;;
esac
:
# install less file browser
ipkg install less
# Note: The actions below are done within the GUI of the disk station:
1. Control panel - Webservices – Enable Webstation – Enable MySQL
2. Package Center – Install phpMyAdmin
3. log in with user root password [mypassword]
4. Check if all (weewx) databases are still present
5. Rename stats databse to stats_[date]
# Note: the actions below are done in a putty session with user root
# install pyephem (almanac)
cd /volume1/linux/0
tar -xvf pyephem-3.7.5.2.tar.gz
cd /volume1/linux/0/pyephem-3.7.5.2
python2.6 setup.py build
python2.6 setup.py install
# install urllib3 (needed by weewx-wd)
cd /volume1/linux/0
tar -xvf urllib3-1.8.2.tar.gz
cd /volume1/linux/0/urllib3-1.8.2
python2.6 setup.py build
# set PYTHONPATH to get an install without error
export PYTHONPATH=/opt/local/lib/python2.5/site-packages
python2.6 setup.py install
# restore weewx version
mkdir /home
mkdir /home/weewx
cp -rf /volume1/linux/1/weewx /home
# backfill stats database
cd /home/weewx
./bin/wee_config_database_wd weewx.conf --backfill-stats
# finished
# how to upgrade weewx (to a higher version 2.x)
cd /volume1/linux/0
tar -xvf weewx-2.7.0.tar.gz
cd /volume1/linux/0/weewx-2.7.0
python2.6 setup.py build
python2.6 setup.py install