lundi 9 janvier 2012

My media server



The goal of this article is to describe how to have a central computer (PC 1) as a media center to:
- watch movie, listen to music, browse the web
- share content (movies, music ...) with Windows, Apple or Android devices on the wifi network.




First, install ubuntu on PC 1 (i use an old Intel Pentium 4 with an 160GB hard drive and a powerpoint mouse as the remote control).

After installation, lauch konsole (Alt+F2) and install more packages with this command :
sudo apt-get update ; sudo apt-get firefox openssh-server amule-daemon amule-utils samba apache2 kubuntu-restricted-extras vim vlc


Use Windows protocol to access PC 1

Configure samba server on PC 1 to share movies and downloaded files.

Edit the samba configuration file:
sudo nano /etc/samba/smb.conf
Make sure you have the following configuration at the end:
[Videos]
    comment = Videos
    path = /home/YOUR_USER/Videos
    browsable = yes
    guest ok = yes
    read only = yes
    create mask = 0755

[aMule]
    comment = aMule incoming files
    path = /home/YOUR_USER/.aMule/Incoming
    browsable = yes
    guest ok = yes
    read only = yes
    create mask = 0755
then restart the services:
sudo restart smbd ; sudo restart nmbd

You can now see what PC 1 has to share.

To see it from Windows, go on "Microsoft Windows Networks" in the file browser.

To see it from KDE, enter the following address on the url bar (you can access the url bar by typing Ctrl+l on Dolphin)
smb://192.168.1.105

To see it from Gnome, enter the following address on the url bar (you can access the url bar by typing Ctrl+l on Nautilus)
smb://192.168.1.105

Note: you can watch videos directly from a smb source using VLC.

Note: make sure the directory you are sharing have the right to be read by all unix users (chmod 755).


Use SSH protocol to access PC 1

To access PC 1 from linux (PC 2) through SSH with the command line, enter the following command
ssh -X YOUR_USER@192.168.1.105
You can now launch any program from PC 1 on PC 2 (for example, type "amule").

It's possible to bypass the password by installing a private/public key. Generate the key on both PC1 and PC2 :
ssh-keygen -t dsa

Copy the public key (.ssh/id_dsa.pub) from PC2 in .ssh/authorized_keys of PC1

To access PC 1 from KDE , enter the following url in Dolphin (Ctrl+l):
fish://YOUR_USER@192.168.1.105/home/YOUR_USER/.aMule/Incoming/

To access PC 1 from Gnome, enter the following url in Nautilus (Ctrl+l):
ssh://YOUR_USER@192.168.1.105/home/YOUR_USER/.aMule/Incoming/


Use http protocol to access PC 1

We are going to configure Apache on PC 1 to share movies through the WIFI network.

Edit Apache configuration file from the command line:
sudo nano /etc/apache2/sites-available/default
and replace the default directory /var/www by the one you want (/home/YOUR_USER/.aMule/Incoming/ in my case).

Then restart Apache via:
sudo /etc/init.d/apache2 restart

You can now download any content from PC 1 by typing http://192.168.1.105/ on your favorite browser.

It's a very convenient way to download movies on an Android device.

Note : you can make sure amuled starts at every startup by adding this line to /etc/rc.local
su -l YOUR_USER -c amuled


Useful links :
http://wiki.amule.org/index.php/Firewall
http://wiki.amule.org/index.php/FAQ_amulecmd

samedi 31 décembre 2011

Installer debian testing avec KDE


Ce post détaille l'installation de Debian Testing avec KDE. Après avoir utiliser ubuntu, kubuntu, linux mint et autres dérivés, j'ai souhaité revenir à une debian avec KDE.

Le mieux est d'être relié à votre fournisseur internet via un cable ethernet car les cartes WIFI requièrent souvent des pilotes non-libres donc pas toujours présents à l'installation de Debian.

Télécharger le CD d'installation : weekly-builds. Perso, j'ai installé debian-testing-amd64-kde-CD-1.iso

Graver, redémarrer et installer le CD.

Le but de la configuration qui suit est de configurer une distribution debian wheezy. On déclare tous les sources (experimental/unstable/testing/stable) et on définit une priorité plus forte pour la source testing. En déclarant wheezy et non testing, on aura une testing qui se transformera en stable au moment de la release de wheezy. Cette configuration pourra permettre d'installer, si besoin, un package venant d'unstable par exemple.

Modifier le fichier /etc/apt/sources.list pour qu'il soit comme suit :
deb http://ftp.fr.debian.org/debian/ wheezy main contrib non-free
deb http://ftp.fr.debian.org/debian/ sid main contrib non-free
deb http://ftp.fr.debian.org/debian/ experimental main contrib non-free

deb http://www.debian-multimedia.org/ wheezy main non-free
deb http://www.debian-multimedia.org/ sid main non-free
deb http://www.debian-multimedia.org/ experimental main non-free

Modifier/créer le fichier /etc/apt/preferences pour qu'il soit comme suit :
Package: *
Pin: release n=wheezy
Pin-Priority: 900

Vous pouvez maintenant mettre votre système à jour :
su -
apt-get install debian-multimedia-keyring -y
apt-get update -y ; apt-get dist-upgrade -y ; apt-get autoremove -y
apt-get install gstreamer0.10-fluendo-mp3 gstreamer0.10-ffmpeg ffmpeg sox twolame vorbis-tools lame faad
apt-get install vim vlc amule icedove flashplugin-nonfree digikam ktorrent sux amarok chromium

Grace à la commande suivante, on constate que le dépôt Testing a Eclipse 3.5 alors que Sid a la version 3.7 :
apt-cache policy eclipse
Il est possible d'ajouter Eclipse 3.7 depuis le dépôt Sid via la commande :
apt-get install -t sid eclipse

Ajouter un disque dur au démarrage :
su -
mkdir /media/dd2
#ajout de la ligne suivante dans /etc/rc.local
mount /dev/sdb1 /media/dd2

Liens utiles :

http://stackoverflow.com/questions/8266994/adb-devices-command-shows-nothing-solved
http://forum.xda-developers.com/showthread.php?t=732337
distrowatch
http://pkg-kde.alioth.debian.org/