Customizing the QNAP TS-259 Pro

Reviews and other little ventures that don't quite fit into the other forums
Daniel Wee
Site Admin
Posts: 2084
Joined: Wed 25 Feb 25 2009 8:00 pm

Customizing the QNAP TS-259 Pro

Post by Daniel Wee » Wed 06 Oct 06 2010 8:30 pm

First thing was to install Optware from the configuration site.

Installing IPKG

Then install IPKG following the instructions here:-

http://wiki.qnap.com/wiki/Install_Optware_IPKG

The instructions ask for an edit of the /etc/init.d/Optware.sh file to workaround some bugs. Edited file is attached.

Installing GCC

Then run the following:-

ipkg install gcc
ipkg install binutils
ipkg install automake
ipkg install autoconf
ipkg install make
ipkg install flex
ipkg install bison
ipkg install gettext
ipkg install nano

Then:-

mkdir /share/main/cprogs

where "main" is the share created using the configuration site.

Terminal Compatibility Issues

Note: This mod doesn't work since /etc/profile seems to be reset at boot-up. The correct way of dealing with this is to enter TERM=vt102; resize; into autorun.sh

# temporary file
TMP=/tmp/crontab.tmp
MYCRON=/tmp/cronfinal.tmp

# read out the current crontab settings
crontab -l > $TMP

# append our own tasks
cat /share/main/cron/crontab.txt >> $TMP

# remove duplicates
awk '!x[$0]++' $TMP > $MYCRON

# use the modified list
crontab $MYCRON

# remove temporary file
rm $TMP
rm $MYCRON

# restart
/etc/init.d/crond.sh restart



Issue the following commands:-

TERM=vt102
resize
nano /etc/profile

and:-

change the TERM=linux to TERM=vt102
add the line "resize" at the very end

do the same for ~/.bashrc

That will fix the terminal compatibility issues.

Daniel
Attachments
Optware.zip
(1.26 KiB) Downloaded 301 times

Daniel Wee
Site Admin
Posts: 2084
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Customizing the QNAP TS-259 Pro

Post by Daniel Wee » Wed 06 Oct 06 2010 9:15 pm

Editing php.ini to recognize JPGraph

You can edit /etc/config/php.ini to change "Taipei" to "Singapore". Edited file is attached.

Note that actual location of the config directory is /mnt/HDA_ROOT/.config/

Put the jpgraph directory in /etc/config/php/ from the attached file.

http://jpgraph.net/download/

Fixing up crontab

Note: the following mod is deprecated. Just edit /etc/config/crontab to add the job.

Mount up /tmp/config as per instructions here:-

http://wiki.qnap.com/wiki/Running_Your_ ... at_Startup

You can issue the following commands:-

mount -t ext2 /dev/sdx6 /tmp/config

Place autorun.sh (attached) in /tmp/config and run a chmod a+x on it. Then umount the directory:-

cd /
umount /tmp/config

Next create /share/main/cron the following way:-

mkdir /share/main/cron
cd /share/main/cron
nano crontab.txt

You may place crontab.txt in that directory or edit it to add lines you need. crontab.txt will contain any additional tasks you wish to add to the initial bootup. Duplicate lines will automatically be removed.

More info about this here:-

http://wiki.qnap.com/wiki/Add_items_to_crontab

autorun.sh code is as follows:-
#!/bin/sh

# temporary file
TMP=/tmp/crontab.tmp MYCRON=/tmp/cronfinal.tmp

# read out the current crontab settings
crontab -l > $TMP

# append our own tasks
if [ -f /share/main/cron/crontab.txt ];
then
cat /share/main/cron/crontab.txt >> $TMP
fi

# remove duplicates
awk '!x[$0]++' $TMP > $MYCRON

# use the modified list
crontab $MYCRON

# remove temporary file
rm $TMP
rm $MYCRON

# restart
/etc/init.d/crond.sh restart

# some house keeping

echo >> /etc/profile
echo '# Added by /tmp/config/autorun.sh' >> /etc/profile
echo 'TERM=vt102' >> /etc/profile
echo '/opt/bin/resize' >> /etc/profile
echo '# end of additions' >> /etc/profile
echo >> /etc/profile

if [ -f /share/Web/index.php ];
then
rm /share/Web/index.php
fi

/bin/cp /tmp/config/login.sh /tmp
/bin/sh /tmp/login.sh
Daniel
Attachments
autorun.zip
New autorun.sh which leaves out the crontab mods
(370 Bytes) Downloaded 292 times
autorun.zip
Older autorun.sh with all the mods
(503 Bytes) Downloaded 285 times
crontab.zip
(211 Bytes) Downloaded 272 times
jpgraph.zip
(2.35 MiB) Downloaded 289 times
php.zip
(1.97 KiB) Downloaded 284 times

Daniel Wee
Site Admin
Posts: 2084
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Customizing the QNAP TS-259 Pro

Post by Daniel Wee » Wed 06 Oct 06 2010 10:31 pm

Setting up remote access for MySQL

The MySQL files are located at /usr/local/mysql but I don't remember making any changes to my.cnf so we'll just leave that alone for now.

Log into the database using:-

/usr/local/mysql/bin/mysql -u root -h 127.0.0.1 -p

Default password should be "admin" - be sure to change this. Grant remote privileges using:-

grant all on *.* to root@'%';
flush privileges;
quit

That should do the trick.

Daniel

Daniel Wee
Site Admin
Posts: 2084
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Customizing the QNAP TS-259 Pro

Post by Daniel Wee » Wed 06 Oct 06 2010 11:39 pm

PHP and MySQL

This is not strictly necessary but it allows you to update PHP and MySQL to the latest versions.

Note: maybe leave mysql alone

ipkg install php
ipkg install mysql

ipkg seems to install an older version (4) instead of the standard version (5) of the MySQL server so we should leave that alone.

Daniel

Daniel Wee
Site Admin
Posts: 2084
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Customizing the QNAP TS-259 Pro

Post by Daniel Wee » Thu 07 Oct 07 2010 12:03 am

Fixing symbolic links

To get samba to properly recognize symbolic links, we need to add the following line to /etc/config/smb.conf

wide links = yes

under the [global] section. You will need to restart samba after this change:-

/etc/init.d/smb.sh restart

Then create a sym-link using the following:-

ln -s /share/Web /share/main/Web
ln -s / /share/main/root

That should do the trick. This change persists through a re-boot so there is no need to do more. More info about this here:-

http://forum.qnap.com/viewtopic.php?f=151&t=29848

Daniel

Daniel Wee
Site Admin
Posts: 2084
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Customizing the QNAP TS-259 Pro

Post by Daniel Wee » Thu 07 Oct 07 2010 12:42 am

Install OpenSSH

Follow the instructions here:-

http://wiki.qnap.com/wiki/How_To_Replac ... th_OpenSSH

Note that autorun.sh may have already been updated with the necessary commands.

Daniel
Attachments
autorun.zip
(523 Bytes) Downloaded 290 times

Daniel Wee
Site Admin
Posts: 2084
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Customizing the QNAP TS-259 Pro

Post by Daniel Wee » Thu 07 Oct 07 2010 2:21 am

Setting up rsync from remote to local NAS

On the remote machine (NAS, NAS2 or NAS3), edit /ffp/etc/rsyncd.conf to include a module section which defines one possible rsync job. File is attached. After changing the file, restart the rsync daemon using:-

/ffp/start/rsyncd restart

From the QNAP destination, pull the download (in this case from the Code module) using:-

rsync -ravz rsync://192.168.1.66/Code /share/main/Code

where /share/main/Code is the destination for the pull activity. If the directory does not exist, it will be created automatically.

Now you want to add these into crontab so that they can take place automatically. To do this, add the following lines:-

Code: Select all

0 5 * * * rsync -raz rsync://192.168.1.66/Code /share/main/Code  1>>/dev/null 2>>/dev/null
30 5 * * 0 rsync -raz rsync://192.168.1.66/PCB /share/main/PCB  1>>/dev/null 2>>/dev/null
45 * * * * /share/main/cprogs/trackhits/trackhits 1>>/dev/null 2>>/dev/null
More info here:-

http://www.cyberciti.biz/tips/linux-use ... ories.html

Daniel
Attachments
rsyncd.zip
(493 Bytes) Downloaded 286 times

Daniel Wee
Site Admin
Posts: 2084
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Customizing the QNAP TS-259 Pro

Post by Daniel Wee » Thu 07 Oct 07 2010 3:36 pm

Also installed:-

ipkg install coreutils
ipkg install busybox
ipkg install bash
ipkg install rsync
ipkg install mc
ipkg install nail

The next bit upgrades the shell and should be done after you install the new bash

mv /bin/sh /bin/sh.old
ln -s /opt/bin/bash /bin/sh

This change doesn't seem to survive a reboot though. So maybe I should just put a line in the autorun.sh to:-

mv /bin/sh /bin/sh.old
cp /opt/bin/bash /bin/sh
mv /usr/bin/rsync /usr/bin/rsync.old
cp /opt/bin/rsync /usr/bin

Daniel

Daniel Wee
Site Admin
Posts: 2084
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Customizing the QNAP TS-259 Pro

Post by Daniel Wee » Sun 10 Oct 10 2010 3:57 pm

Fetchmail Installation

ipkg install fetchmail
mkdir /share/main/mail
mkdir /share/main/mail/logs

Edit the /opt/etc/fetchmailrc to contail:-

Code: Select all

set daemon 300
set postmaster 'mailfilter'

set logfile '/share/main/mail/logs/fetchmail.log'

poll mail.tsebi.com with protocol pop3 username 'aggregate' password 'xxxx'
Note that you also need to edit /etc/services to include

pop3 110/tcp
pop3 110/udp

after the pop-3 definitions.

Daniel

Daniel Wee
Site Admin
Posts: 2084
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Customizing the QNAP TS-259 Pro

Post by Daniel Wee » Wed 13 Oct 13 2010 6:17 pm

RAM Upgrade

Three screws at the back and a stiff slide backwards removes the cover, giving access to the SO-DIMM DDR2 CL6 6400-800MHz 1GB Hynix (8-banks) RAM at the top. Releasing the catch you can slowly work the module out. This was replaced by a Kingston DDR2 CL6 6400-800MHz 2GB RAM (16-banks) which is the most the controller will handle I think.

Upon powering up, everything went smoothly and the Systems Info page shows 2GB of RAM. Nice.

Daniel

Post Reply