Install ReadyMedia miniDLNA 1.1.4 on Raspbian

Source: Install ReadyMedia miniDLNA 1.1.4 Raspberry Pi

The latest version of ReadyMedia miniDLNA in the Raspbian repos is ancient so we are going to compile miniDLNA (now ReadyMedia) from source on Raspbian. This should fix avi problems you may have had in the past like them not showing up in the library.

Remove your old miniDLNA 1.0.24 (if they exist)

sudo apt-get purge minidlna -y
sudo apt-get remove minidlna
sudo apt-get autoremove -y

Make sure you have a source repository, default Raspbian does not include this

echo "deb-src wheezy main contrib non-free" | sudo tee -a /etc/apt/sources.list


edit /etc/apt/sources.list file:

sudo nano /etc/apt/sources.list

and add next line:

deb-src wheezy main contrib non-free rpi

Update repositories so it will detect your new source repo

sudo apt-get update

Grab dependencies for building it from source

sudo apt-get build-dep minidlna -y

If you get any errors you can install the dependencies manually

sudo apt-get install libjpeg-dev libsqlite3-dev libexif-dev libid3tag0-dev libvorbis-dev libflac-dev -y

Download miniDLNA 1.1.4 source


Unpack it

tar -xvf minidlna-1.1.4.tar.gz

Enter the miniDLNA directory

cd minidlna-1.1.4

Configure, make and install miniDLNA, it will take 5 minutes.

./configure && make && sudo make install

Copy the default configuration file

sudo cp minidlna.conf /etc/

Copy the startup daemon script to autostart ReadyMedia miniDLNA on boot

sudo cp linux/minidlna.init.d.script /etc/init.d/minidlna

Make the startup script executable

sudo chmod 755 /etc/init.d/minidlna

Update rc to use the miniDLNA defaults

sudo update-rc.d minidlna defaults

Edit the configuration

sudo nano /etc/minidlna.conf

Note: Edit the following to point to your media

This version of minidlna will give you multiple folders under Video. Before movies and TV would have been under separate categories, now movies and TV will both be under the category video. It will also show the folder structure of them instead of showing just the video files. Avi files will also show up and be streamable.

inotify uses resources because it autoupdates your library, if you don’t use inotify you will have to manually restart and reload the miniDLNA service

The friendly name is how your miniDLNA server will show up to its streaming clients

# Names the DLNA server
friendly_name=RasPi Media Server
# Tells the DLNA to update the library when there are changes

Ctrl+X, Y and Enter to save and exit

Start the minidlna service

sudo service minidlna start

Now make sure it starts on boot

sudo reboot

Your Raspberry Pi DLNA server will now be accessible to stream media to your clients: PCs, XBOX, PS3, Phones, TVs and more.

Install Seafile on Raspian, Raspberry Pi

Prerequisites: Install LAMP (optional: Installing No-IP client on Raspian)

More info at: Deploying Seafile under Linux

Login as root:

sudo su

Create directory for Seafile: (example*)

mkdir /media/usbhdd/seafile

Move to created directory:

cd /media/usbhdd/seafile

Download latest Seafile server for Raspberry Pi:


Extract archive:

tar xvf seafile-server_4.0.6_pi.tar.gz

Create directory:

mkdir installed

Move your archive to newly created directory:

mv seafile-server_4.0.6_pi.tar.gz installed

Check prerequisites:

dpkg-query -l python2.7 python-setuptools python-imaging python-mysqldb

and install missing packages:

apt-get install python-setuptools python-mysqldb

Move to directory:

cd seafile-server-4.0.6/

Run the script:

What is the name of the server? It will be displayed on the client.
3 - 15 letters or digits
[ server name ] <hostname/servername>

What is the ip or domain of the server?
For example:,
[ This server's ip or domain ] <your-dynamic-dns-address> OR <hostname>.local OR <local-IP-address>

Which port do you want to use for the ccnet server?
[ default "10001" ]

Where do you want to put your seafile data?
Please use a volume with enough free space
[ default "/media/usbhdd/seafile/seafile-data" ]

Which port do you want to use for the seafile server?
[ default "12001" ]

Which port do you want to use for the seafile fileserver?
[ default "8082" ]

Please choose a way to initialize seafile databases:

[1] Create new ccnet/seafile/seahub databases
[2] Use existing ccnet/seafile/seahub databases

[ 1 or 2 ] 1 *recomended by seafile

What is the host of mysql server?
[ default "localhost" ]

What is the port of mysql server?
[ default "3306" ]

What is the password of the mysql root user?
[ root password ] <your-mysql-root-password>

verifying password of user root ... done

Enter the name for mysql user of seafile. It would be created if not exists.
[ default "root" ] seafile OR <any-other-username-for-seafile-mysql-user>

Enter the password for mysql user "seafile":
[ password for seafile ] <password>

Enter the database name for ccnet-server:
[ default "ccnet-db" ]

Enter the database name for seafile-server:
[ default "seafile-db" ]

Enter the database name for seahub:
[ default "seahub-db" ]

This is your configuration

server name: <hostname/servername-you-used>
 server ip/domain: <ip-adress/domain-you-used>
 ccnet port: 10001
seafile data dir: /media/usbhdd/seafile/seafile-data
 seafile port: 12001
 fileserver port: 8082

database: create new
 ccnet database: ccnet-db
 seafile database: seafile-db
 seahub database: seahub-db
 database user: seafile

Press ENTER to continue, or Ctrl-C to abort

While in /media/usbhdd/seafile/seafile-server-4.0.6:

Start seafile:

./ start # Start seafile service

Start seahub

./ start # Start seahub website, port defaults to 8000
Starting seahub at port 8000 ...

It's the first time you start the seafile server. Now let's create the admin account

What is the email for the admin account?
[ admin email ] <your-mail>

What is the password for the admin account?
[ admin password ] <password>

Enter the password again:
[ admin password again ] <repeat-password>

Successfully created seafile admin

Type in your browser, and check if setup is successful:




Generate and apply your ssl keys (logged in as user):

sudo openssl genrsa -out seafile-key.pem 2048
sudo openssl req -new -x509 -key seafile-key.pem -out seafile-cacert.pem -days 1095
sudo mkdir /etc/apache2/ssl
sudo mv *.pem /etc/apache2/ssl
sudo mkdir /var/www/seafile
sudo a2enmod ssl

Edit file:

sudo nano /media/usbhdd/seafile/ccnet/ccnet.conf

Add this line:

SERVICE_URL = https://<your-dynamic-dns-address>:8001


SERVICE_URL = https://<hostname>.local:8001


SERVICE_URL = https://<local-IP-address>:8001

Edit file:

sudo nano /media/usbhdd/seafile/

Add this line:

FILE_SERVER_ROOT = 'https://<your-dynamic-dns-address>:8001/seafhttp'


FILE_SERVER_ROOT = 'https://<hostname>.local:8001/seafhttp'


FILE_SERVER_ROOT = 'https://<local-IP-address>:8001/seafhttp'

Enable modes on Apache:

sudo a2enmod rewrite
sudo a2enmod fastcgi
sudo a2enmod proxy_http

Edit file:

sudo nano /etc/apache2/ports.conf

Add these lines:

<IfModule ssl_module>
Listen 8001

<IfModule mod_gnutls.c>
Listen 8001

Edit file:

sudo nano /etc/apache2/sites-available/seafile-ssl.conf:
FastCGIExternalServer /var/www/seafile/seahub.fcgi -host -idle-timeout 600

<Directory /data/opt/seafile/seafile-server-latest/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted

<VirtualHost *:8001>
ServerAdmin <your-mail>

Servername <hostname/servername-you-used>
ServerAlias <hostname/servername-you-used>

DocumentRoot /var/www/seafile
Alias /media /media/usbhdd/seafile/seafile-server-latest/seahub/media

SSLEngine On
SSLCertificateFile /etc/apache2/ssl/<cert-name-you-used>.pem (*seafile-cacert.pem previously as an example)
SSLCertificateKeyFile /etc/apache2/ssl/<key-name-you-used>.pem (seafile-key.pem previously as an example)

RewriteEngine On

# seafile httpserver
ProxyPass /seafhttp
ProxyPassReverse /seafhttp
RewriteRule ^/seafhttp - [QSA,L]

# seahub
RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /seahub.fcgi/$1 [QSA,L,E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

Enable site:

sudo a2ensite seafile-ssl.conf

Restart Apache:

/etc/init.d/apache2 restart

Log in as root:

sudo su

Move to folder:

cd /media/usbhdd/seafile/seafile-server-latest


./ stop
./ stop


./ start
./ start-fastcgi

Forward ports on your router if you are using dynamic dns:

  • 8001
  • 10001
  • 12001

to local IP address.

Test your setup in browser:


Install client on your computer or smartphone and test. (Download client here.)


Create a script /etc/init.d/seafile-server (*logged in as user)

sudo nano /etc/init.d/seafile-server

The content of this script is: (You need to modify the value of user and script_path accordingly)


# Provides: seafile-server
# Required-Start: $local_fs $remote_fs $network mysql
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts Seafile Server
# Description: starts Seafile Server

# Change the value of "user" to your linux user name

# Change the value of "script_path" to your path of seafile installation

# Change the value of fastcgi to true if fastcgi is to be used
# Set the port of fastcgi, default is 8000. Change it if you need different.

case "$1" in
sudo -u ${user} ${script_path}/ start >> ${seafile_init_log}
if [ $fastcgi = true ];
sudo -u ${user} ${script_path}/ start-fastcgi ${fastcgi_port} >> ${seahub_init_log}
sudo -u ${user} ${script_path}/ start >> ${seahub_init_log}
sudo -u ${user} ${script_path}/ restart >> ${seafile_init_log}
if [ $fastcgi = true ];
sudo -u ${user} ${script_path}/ restart-fastcgi ${fastcgi_port} >> ${seahub_init_log}
sudo -u ${user} ${script_path}/ restart >> ${seahub_init_log}
sudo -u ${user} ${script_path}/ $1 >> ${seafile_init_log}
sudo -u ${user} ${script_path}/ $1 >> ${seahub_init_log}
echo "Usage: /etc/init.d/seafile {start|stop|restart}"
exit 1

Note: If you want to start seahub in fastcgi, just change the fastcgi variable to true.

Note: If you deployed Seafile with MySQL, append “mysql” to the Required-Start line: # Required-Start: $local_fs $remote_fs $network mysql

Add Directory for Logfiles:

sudo mkdir /media/usbhdd/seafile/logs

Make the seafile-sever script executable:

sudo chmod +x /etc/init.d/seafile-server

Add seafile-server to rc.d

sudo update-rc.d seafile-server defaults



MINIBIAN 2015-02-18 is out!


MINIBIAN - raspberry pi

rpi2htopMinibian 4th release is out! This new release corrects some minor bugs and supports the new Raspbbery Pi 2 with updated firmware  (kernel 3.18.7+ #755) and system based on official Raspbian repositories.
The release is backward compatible with RPi B and RPi B+.
I did some benchmark tests on RPi B+ and RPi 2 and i can confirm that the CPU speed is 6x faster than older version.
You can check here for the features list, while you can download the compressed image following this link:

MD5: 6ac4eda21993204393a0e830762580d9
SHA1: 797bcee94f32b899654e018fcded6e49e5ab6c20

View original post

Backup Raspian using rsync

Create a folder on external disk, for example:


Create exclude list, to avoid loop and unnecessary files:

sudo nano /media/usbhdd/backup/rsync-exclude.txt

Add next lines: (Note: new rule – new line)


Test and backup using next command:

sudo rsync -av --progress --delete --exclude-from=/media/usbhdd/backup/rsync-exclude.txt / /media/usbhdd/backup/rsync/

Lets make backup runs automatically and send an email after execution:

(Note: Setup your mail using Gmail)

Create a script:

nano /home/<username>/scripts/

Add next lines:

sudo rsync -av --delete --exclude-from=/media/usbhdd/backup/rsync-exclude.txt / /media/usbhdd/backup/rsync/
if [ "$?" -eq "0" ]
   echo "rsync backup OK - $(date)" | mail -s "rsync backup status" <your-gmail-account>
   echo "Error while running rsync. Exit code: $? - $(date)" | mail -s "rsync backup status" <your-gmail-account>

Make it executable:

chmod u+x /home/<username>/scripts/

Login as root:

sudo su

Edit crontab file:

crontab -e

And add next lines:

#every wednesday at 12:00
00 12 * * 3 /home/<username>/scripts/ >> /home/<username>/logs/cron.log 2>&1
@monthly mail -s "cron monthly log report" <your-gmail-account> < /home/<username>/logs/cron.log

*The last three lines are for monthly report on crontab jobs. They are not necessary for backup. They are just there for monthly check if everything in crontab went smoothly.

Sending mail from Raspbian using Gmail

Sources: Prepare Your Pi To Send Mail Through Gmail / Google 2-step verification and Send Mail with Gmail and sSMTP

First install basic tools:

sudo apt-get install ssmtp mailutils mpack

Next steps:
– create strong password (you can use:
– setup Google 2-step verification:
create Google App password:

Edit configuration file:

sudo nano /etc/ssmtp/ssmtp.conf

comment out all using #, then add:




In your home folder create file body.txt (nano /body.txt) and add some text to it.

Send test mail using:

mail -s "Test mail subject" <your-gmail-account> < body.txt


echo "Test mail body." | mail -s "Test mail subject"<your-gmail-account>

Samba Printer Sharing on Raspian

Edit Samba configuration file:

sudo nano /etc/samba/smb.conf

Remove “;”

# CUPS printing. See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
; printing = cups
; printcap name = cups

so it looks like:

# CUPS printing. See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
 printing = cups
 printcap name = cups

Allow gests:

 comment = All Printers
 browseable = no
 path = /var/spool/samba
 printable = yes
 guest ok = no
 read only = yes
 create mask = 0700
 comment = All Printers
 browseable = no
 path = /var/spool/samba
 printable = yes
 guest ok = yes
 read only = yes
 create mask = 0700

Finally restart samba:

sudo service samba restart

Install CUPS print server on Rasbian

Install Samba on Raspbian

PRINTER: Installing HP LaserJet P1005 on Raspbian

First, install USB tools:

sudo apt-get install usbutils

List USB devices:

sudo lsusb

There should be a line like this:

Bus 001 Device 006: ID 03f0:3d17 Hewlett-Packard LaserJet P1005

HP LaserJet P1005 printer needs firmware:

sudo getweb P1005

Visit CUPS administration page:



https://<PI address>/admin

Click on Add Printer

You should see next list. Choose “HP LaserJet P1005 (HP LaserJet P1005)“:

Local Printers:
o HP LaserJet P1005 USB BB082PA HPLIP (HP LaserJet P1005)
x HP LaserJet P1005 (HP LaserJet P1005)
o HP Fax (HPLIP)

Next step should look like this. Dont forget to sellect “Share This Printer“:

Name: HP_LaserJet_P1005
Description: HP LaserJet P1005
Location: <location>
Connection: usb://HP/LaserJet%20P1005?serial=BB082PA
Sharing: x Share This Printer

Choose the driver:

HP LaserJet P1005 Foomatic/foo2xqx (recommended) (en)

I have tried many options, but this one is the only that actually worked for me.
Printing is slow, you will need a patience with this printer on Raspberry Pi.

%d bloggers like this: