Tuesday, April 9, 2013

Mele as a media server

Perfect media server

Your media (and general purpose) server should have:
  1. Torrent daemon
  2. samba share
  3. mysql + php + nginx
  4. software to queue, rename and organize your downloads (I'm using sickbeard+ couchpotato) 
  5. misc

Operative system

I'm choosing debian armhf, but feel free to try ubuntu arm or arch arm.
Follow either Guillaume's or Roman's instructions on how to install.


Software

Torrent daemon

I chose to use transmission-daemon over deluge (and didn't try any other) because deluged + deluge-web was eating up to 30MB of ram, where as transmission-daemon uses 2MB of ram, and the Mele has only 512MB.

Configuration

# apt-get install transmission-daemon
# service transmission-daemon stop
# vi /etc/transmission-daemon/settings.json

set rpc-whitelist-enabled to false
add
   "watch-dir": "/home/storage/torrentfiles",
   "watch-dir-enabled": true
at the end of the file if you want transmission to pick up the torrents placed in that folder (both couchpotato and sickbeard can do that)

# service transmission-daemon start

Log in to the default port http://127.0.0.1:9091. The default password is transmission.
On the webui I set up a watch directory because sickbeard stores the torrent files there, and transmission loads them.

Samba share

Configuration

#apt-get install samba-common-bin samba-common samba

Each samba share configuration is unique to the user, but I've set a share with read-write, anonymous access.
At the end of the /etc/samba/smb.cnf file add
[share-name]
  path = /path/to/share
  read only = no
  writeable = yes
  guest ok = yes



Mysql + php + nginx

#apt-get install nginx php5 php5-mysql php5-fpm mysql-server-5.5 mysql-client-5.5 php5-mysql

Mysql configuration

Remote access
I'm assuming  you used 'root' for your username.

mysql -u root
If you didn't set up a password
mysql> SET PASSWORD FOR 'ROOT'@'LOCALHOST' = PASSWORD('your_new_password');

To gain remote access with the username

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> exit


#vi /etc/mysql/my.cnf
comment out the line that says 
bind-address = 127.0.0.1
#service mysql restart

Optimize the ram usage of mysql


nginx

I chose nginx because of it's small memory footprint and high performance. Check benchmarks vs apache to see the difference.
Configuration
#vi /etc/nginx/sites-available/default

A webserver's config changes totally, depending the needs of the host. Here's an example link


Couchpotato, SickBeard

#apt-get install git-core python2.7 python-cheetah
$ git clone git://github.com/RuudBurger/CouchPotato.git
$ git clone git://github.com/midgetspy/Sick-Beard.git

Follow on-screen intructions for both.



Misc

Here's the server running all the processes (no couchpotato)

Mount ntfs with write permission
#apt-get install ntfs-3g
#mount /dev/sd# /path/you/want

Overclock

#echo '1110000' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

Leds

use "1" to turn them on, you might need to run #insmod sun4i-gpio
power off blue led
echo "0" > /sys/devices/virtual/misc/sun4i-gpio/pin/ph20
power off red led

echo "0" > /sys/devices/virtual/misc/sun4i-gpio/pin/ph10

No comments:

Post a Comment