Friday, November 14, 2014

Install aria2 to Raspberry Pi

Install via apt-get
#apt-get install aria2

Create init script
#! /bin/sh
# /etc/init.d/aria2

### BEGIN INIT INFO
# Provides: aria2cRPC
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: aria2c RPC init script.
# Description: Starts and stops aria2 RPC services.
### END INIT INFO

#VAR
RUN="/usr/bin/aria2c"
ARIA_PID=$(ps ux | awk '/aria2c --enable-rpc/ && !/awk/ {print $2}')

# Some things that run always
touch /var/lock/aria2cRPC

# Carry out specific functions when asked to by the system
case "$1" in

start)
echo "Starting script aria2cRPC "
if [ -z "$ARIA_PID" ]; then
nohup $RUN --enable-rpc --rpc-user=admin --rpc-passwd=rfujcfdh --rpc-listen-port=8000 --rpc-listen-all --daemon -D --conf-path=/root/.aria2/aria2.conf
/bin/mount -t cifs -o user=,password=,rw,file_mode=0777,dir_mode=0777 //192.168.1.3/DuneHDD_90eab4c2_0dd9_4cac_84fa_d551745cd532 /mnt
echo "Started"
else
echo "aria2cRPC already started"
fi
;;

stop)
echo "Stopping script aria2cRPC"
if [ ! -z "$ARIA_PID" ]; then
kill $ARIA_PID
fi
echo "OK"
;;

status)
if [ ! -z "$ARIA_PID" ]; then
echo "The aria2cRPC is running with PID = "$ARIA_PID
else
echo "No process found for aria2c RPC"
fi
;;
*)
echo "Usage: /etc/init.d/aria2cRPC {start|stop|status}"
exit 1
;;
esac

exit 0

Install no-ip to Rasberry Pi

You will be able to install No-IP.com’s DUC on Ubuntu in just a few minutes with Terminal. Once you have opened up your Terminal window you will need to login as the “root” user. You can become the root user from the command line by entering “sudo -s” followed by the root password on your machine.
cd /usr/local/src/
wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
tar xf noip-duc-linux.tar.gz
cd noip-2.1.9-1/
make install

You will then be prompted to login with your No-IP.com account username and password.

If you get “make not found” or “missing gcc” then you do not have the gcc compiler tools on your machine. You will need to install these in order to proceed.

Resize root partition on Raspberry Pi

You have 8GB SD card for your Pi, however some images that you install to your Pi is just for 2GB, 4GB SD card. Therefor you could not use the left capacity of you SD card. In my case I have 2GB SD card on 1GB image.

To utilizes this, you must re-size the root partition and this is how to do that.
Log in to your Pi via SSH:
root@raspberry-pi:~# fdisk -l

Disk /dev/mmcblk0: 1967 MB, 1967128576 bytes
4 heads, 16 sectors/track, 60032 cylinders, total 3842048 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00027aa3

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048      104447       51200    b  W95 FAT32
/dev/mmcblk0p2          104448     1742847      819200   83  Linux
/dev/mmcblk0p3         1742848     1945599      101376   82  Linux swap / Solaris