Outils pour utilisateurs

Outils du site


issue95:labo_linux_1

Table des matières

1

Nowadays it is the time of the Cloud. What is the Cloud? It is not pretty clear. By the way, for home users, the most common meaning of the Cloud is file synchronization between devices, like Dropbox, Google Drive, and so on

If you don't trust these solutions, e.g. you have to store sensitive data, or if you need to sync files only inside your network (you don't need these files to be accessible from the Internet), and also while achieving better network performance, or you want as much storage space as possible without spending a cent, then you have to install some software on your own, on your own home machines.

De nos jours, nous ne jurons que par le Cloud (le nuage). Mais qu'est-ce que le Cloud ? Ce n'est pas vraiment clair. D'ailleurs, pour les utilisateurs lambda, la signification la plus commune du Cloud est la synchronisation de fichiers entre différents périphériques, comme Dropbox, Google Drive, etc.

Si vous n'avez pas confiance en ces solutions, par exemple si vous devez stocker des données sensibles, ou si vous avez besoin de synchroniser des fichiers uniquement sur votre réseau local (vous n'avez pas besoin d'avoir accès à ces fichiers sur Internet), ce qui améliore les performances réseau, ou que vous voulez autant d'espace de stockage que possible sans dépenser un sou, alors vous devrez installer certains logiciels vous-même, sur vos propres machines personnelles.

2

An interesting and pretty new software to perform file synchronization is Syncthing (http://syncthing.net/). It is fully Open Source. It is pretty simple to install and easy to use. It is a very promising piece of software, useful to share and replicate your files between your devices using a P2P architecture, and since it is multi platform, you can synchronize your files among Windows, Linux, OS X, Android, Raspberry-Pi, Solaris and openBSD.

It doesn't require any dependency, so you don't have to install and configure Apache, PHP and MySQL like you have to do with Owncloud or Seafile. On the other hand, Syncthing doesn't provide a plethora of features like those programs: it simply synchronizes files between your machines.

Syncthing (http://syncthing.net/) est un logiciel de synchronisation de fichiers intéressant et assez récent. Il est entièrement Open Source. Il est assez simple à installer et facile à utiliser. C'est un logiciel très prometteur et pratique pour partager et copier vos fichiers entre vos différents périphériques en utilisant l'architecture P2P et, étant donné qu'il est interopérable, vous pouvez synchroniser vos fichiers sur Windows, Linux, OS X, Android, Raspberry-Pi, Solaris et openBSD.

Il ne requiert aucune dépendance, vous n'avez donc pas à installer et configurer Apache, PHP et MySQL comme vous auriez à le faire avec Owncloud ou Seafile. En revanche, Syncthing ne propose pas la même pléthore de fonctionnalités qu'on pourrait trouver sur ces programmes : il se contente simplement de synchroniser les fichiers entre vos machines.

3

How to install Syncthing on Ubuntu

Installing and configuring Syncthing on Ubuntu is pretty straightforward. Go to https://github.com/syncthing/syncthing/releases and download the release suitable for your architecture (32 or 64 bits).

cd /var/tmp/

wget https://github.com/syncthing/syncthing/releases/download/v0.10.21/syncthing-linux-amd64-v0.10.21.tar.gz

tar xzvf syncthing-linux-amd64-v0.10.21.tar.gz

cd syncthing-linux-amd64-v0.10.21/

In this directory, you can find some documentation (FAQ and Getting started PDF documents), and some sample startup scripts.

Comment installer Syncthing sur Ubuntu

L'installation et la configuration de Syncthing sur Ubuntu est assez facile. Rendez-vous à l'adresse https://github.com/syncthing/syncthing/releases et téléchargez la version correspondant à votre architecture (32 ou 64 bits).

cd /var/tmp/

wget https://github.com/syncthing/syncthing/releases/download/v0.10.21/syncthing-linux-amd64-v0.10.21.tar.gz

tar xzvf syncthing-linux-amd64-v0.10.21.tar.gz

cd syncthing-linux-amd64-v0.10.21/

Dans ce répertoire, vous trouverez une documentation (les documents .pdf FAQ et Getting started) et quelques échantillons de scripts de démarrage.

4

There is not a default place where to put the executable file. But in order to perform automatic updates, the directory (and the executable itself) should be writable by the user running the service. Yes, the service is not something system wide. The Syncthing process is related to a single user. So, potentially, if your PC is shared between multiple users, every user should run a separate instance (or copy) of the service. But, here, let's suppose that you are the only user of your PC.

sudo mkdir /opt/syncthing

sudo chown youruser /opt/syncthing

cp syncthing /opt/syncthing

Il n'y a pas d'emplacement par défaut où mettre le fichier exécutable. Mais de façon à automatiser les mises à jour, le dossier (et l'exécutable en lui-même) devraient pouvoir être modifiés par l'utilisateur du service. Oui, le service ne s'étend pas au système entier. Le processus de Syncthing n'est associé qu'à un seul utilisateur. Donc, si éventuellement, votre PC est partagé entre plusieurs utilisateurs, chacun d'eux devra lancer une instance séparée (ou une copie) du service. Dans notre cas, supposons que vous êtes le seul utilisateur de votre PC.

sudo mkdir /opt/syncthing

sudo chown youruser /opt/syncthing

cp syncthing /opt/syncthing

5

Once that is done, you can delete the TAR file and the directory in /var/tmp.

Now, in order to start the Syncthing process at every reboot, you need to configure some Linux initialization script: systemd, runit, rc.local. You can find various examples on the Syncthing forum (https://discourse.syncthing.net).

Here below I will show you how to configure the default init daemon on Ubuntu 14.04.

Let's create a new configuration file

sudo vi /etc/init/syncthing.conf

containing these lines shown right.

Please use your username, your home directory, and the path where you have placed the syncthing executable.

Then start the service:

sudo initctl start syncthing

Une fois cela fait, vous pouvez supprimer le fichier .tar et le dossier dans /var/tmp.

Maintenant, vous aurez besoin de configurer quelques scripts d'initialisation Linux de façon à ce que le processus Syncthing se lance à chaque redémarrage : systemd, runit, rc.local. Vous pouvez trouver plusieurs exemples différents sur le forum dédié à Syncthing (https://discourse.syncthing.net).

Je vais vous montrer ci-dessous comment configurer le démon init par défaut sur Ubuntu 14.04.

Créons un nouveau fichier de configuration

sudo vi /etc/init/syncthing.conf

contenant les lignes montrées à droite.

Vous êtes prié d'utiliser votre nom d'utilisateur, votre répertoire personnel et le chemin de l'emplacement où vous avez mis l'exécutable de Syncthing.

Puis démarrez le service :

sudo initctl start syncthing

6

To configure it, Syncthing offers a clear and clever web GUI. You can eventually find the configuration files in the following directory: /home/youruser/.config/syncthing/

So open a web browser and connect to http://127.0.0.1:8080

Delete the default shared folder. Then add a new one: give it a Folder ID (it should be the same on every node), and select a path; if it doesn't exist it will be automatically created.

Pour le configurer, Syncthing propose une interface graphique Web claire. Vous pouvez sans doute trouver les fichiers de configuration dans le dossier suivant : /home/youruser/.config/syncthing/

Ouvrez donc un navigateur Web et connectez-vous à l'adresse http://127.0.0.1:8080

Supprimez le dossier partagé par défaut. Puis ajoutez-en un nouveau : donnez-lui un identifiant (il devrait être le même sur chaque nœud) et sélectionnez un chemin ; s'il n'existe pas il sera automatiquement créé.

7

Here you can enable file versioning, and you can decide if the folder will be shared as read-only to the other nodes. Now click Save, then click on restart.

At this point you should change some settings. Click on the gear wheel in the upper right corner, then select “Settings”.

Here you can set a different “Device Name,” and you can configure the web GUI to listen on the Ethernet interface (i.e. use the 0.0.0.0 address) rather than on localhost only, and on which port (default is 8080). If you enable such options, even if you are on a private network, it is a good thing to set up authentication (User and Password) and HTTPS. Then you can define some bandwidth limits related to this device (Upload and Download rate limit).

Ici, vous pouvez activer la gestion de versions de fichier et vous pouvez choisir si le dossier ne sera partagé qu'avec les droits de lecture vers les autres nœuds. Cliquez maintenant sur « Save », puis redémarrez le service.

À ce stade vous devriez modifier certains paramètres. Cliquez sur le petit engrenage en haut à droite et choisissez le menu « Settings. »

Ici vous pouvez définir un autre « Device Name » et vous pouvez configurer l'interface Web pour écouter sur l'interface Ethernet (c'est-à-dire utiliser l'adresse 0.0.0.0) plutôt que uniquement sur l'hôte local, et vous pouvez préciser le port (par défaut 8080). Si vous activez ces options, même si vous êtes sur un réseau privé, il vaut mieux mettre en place l'authentification (utilisateur et mot de passe) et le HTTPS. Ensuite, vous pouvez définir des limites de bande passante liées à ce dispositif (limite du taux de téléversement et téléchargement).

8

Since I've not tested it yet, and it is out of the scope of this article, remember to disable Global Discovery.

Global Discovery should be useful in order to access your private cloud from the Internet, and in order to share the files with your friends around the world, but, as stated already, this functionality will not be covered here.

When requested, click again on the restart button.

Étant donné que je ne l'ai pas encore testé et que cela sort du cadre de l'article, pensez à désactiver l'option « Global Discovery. »

Cette option devrait être utile pour accéder à votre nuage privé depuis Internet et à partager les fichiers avec vos amis à travers le monde, mais, comme dit précédemment, cette fonctionnalité ne sera pas couverte dans cet article.

Quand cela vous sera demandé, cliquez encore une fois sur le bouton de redémarrage.

9

Now it is time to install Syncthing on another node. Follow the same steps also on the other PC in your network (if they run Ubuntu Linux), otherwise download and install the Windows package, or the Mac one. Delete the default shared folder and stop here.

OK. Now, click on “Show ID”.

Here you will see an ID and a QR-Code. You can scan the QR-Code with your smartphone in order to configure the Android app, very handy! But for now, take note (copy it in the clipboard) of the very long ID string.

Il est maintenant temps d'installer Syncthing sur un autre nœud. Suivez les mêmes étapes sur un autre PC de votre réseau (s'il tourne sous Ubuntu), autrement téléchargez et installez la version Windows ou Mac OS X. Supprimez le dossier partagé par défaut et arrêtez-vous ici.

Bon. Cliquez maintenant sur « Show ID. »

Vous pouvez voir ici un identifiant et un QR-Code. Vous pouvez scanner le QR-Code avec votre smartphone de manière à configurer l'application Android, ce qui s'avère très utile ! Mais pour l'instant, prenez bien note du très long identifiant (copiez-le dans le presse-papier).

10

Go back to the first configured node, click on “Add Device” and write the ID of the second node in the Device ID text box. Then check the box of the folder you want to to share with this device.

On the other node web GUI, you should see a request that the first node wants to connect and that it wants to share a folder. Click on “Add” and then specify the folder path.

You are done!

Put a file on the shared folder on one of the two nodes and magically it will be replicated on the other one.

Retournez sur le premier nœud que nous avons configuré, cliquez sur « Add Device » et écrivez l'identifiant du second nœud dans le champ de texte « Device ID. » Ensuite cochez la case du dossier que vous voulez partager avec ce périphérique.

Sur l'interface Web du second nœud, vous devriez voir une notification vous indiquant que le premier nœud souhaite se connecter et partager un dossier. Cliquez sur « Add » et spécifiez le chemin du dossier.

Le dispositif est prêt !

Placez un fichier dans le dossier partagé sur l'un des deux nœuds et il sera copié comme par magie sur l'autre.

11

Following the above instructions, at this point you can add as many nodes as you want. And you can share a folder between some nodes, but not with others: for instance, if it is not necessary to have a folder shared with a specific node, you can prevent useless bandwidth wasting.

What's next

Well. We have looked at the hard way; now we can look to the unofficial Syncthing PPA repository: https://launchpad.net/~ytvwld/+archive/ubuntu/syncthing

And you can try the GTK GUI that you can find here https://github.com/syncthing/syncthing-gtk (also in this case there is a PPA repository).

À ce stade, vous pouvez ajouter autant de nœuds que vous le souhaitez en suivant les instructions ci-dessus. Et vous pouvez partager un dossier entre certains nœuds, mais pas avec d'autres : par exemple, s'il n'est pas nécessaire de partager un dossier avec un nœud spécifique, vous pouvez éviter le gaspillage inutile de bande passante.

Et après ?

Bien. Nous venons de regarder la façon difficile de faire tout ceci ; nous pouvons à présent aller au dépôt non officiel Syncthing PPA : https://launchpad.net/~ytvwld/+archive/ubuntu/syncthing

Et vous pouvez essayer l'interface graphique GTK que vous trouverez ici https://github.com/syncthing/syncthing-gtk (dans ce cas, il existe aussi un dépôt PPA).

12

This is very interesting: it provides configuration capabilities, like a first run wizard, and more.

It will integrate with the desktop notification area, and with Nautilus as well. In addition, it watches the filesystem in order to perform instant synchronization after changes on the synchronized directory.

Multi platform

As said, Syncthing is multi platform: Windows, Mac, Solaris (and derivatives, like SmartOS), openBSD. There is also a version for Linux on ARM platforms, so you can install it on devices like the Raspberry Pi. And on the Google Play (or on the FOSS F-Droid market) you can find an app for Android. There is not an iOS app right now.

C'est très intéressant et fournit des fonctionnalités de configuration, comme un assistant au premier démarrage, et plus encore.

Il s'intégrera avec la zone de notification du bureau, ainsi qu'avec Nautilus. En outre, il surveille le système de fichiers pour pouvoir faire une synchronisation immédiate après des modifications du dossier synchronisé.

Multi-plateforme

Comme déjà précisé, Syncthing est multi-plateforme : Windows, Mac, Solaris (et ses dérivés, comme SmartOS), open BSD. Une version pour Linux sur des plate-formes ARM existe aussi et vous permet de l'installer sur des dispositifs comme le Raspberry Pi. Vous trouverez actuellement, sur le Play Store de Google (ou sur le marché F-Droid, qui est gratuit et Open Source), une appli pour Android. Mais à ce stade, il n'existe pas d'appli pour iOS.

13

Conclusion

As you have seen, Syncthing is very simple to install and configure. With this software you can only share and replicate files among your devices, a job that it performs pretty well.

On the other hand, other than the configuration web page, there is not a web interface that allows you to access and manage files via the web: so you can't access or upload your files from a web browser, like with Dropbox, Google Drive or Seafile and Owncloud.

Conclusion

Comme vous avez pu le voir, Syncthing est très simple à installer et à configurer. Avec ce logiciel vous pouvez seulement partager et copier des fichiers entre vos périphériques, un travail qu'il accomplit plutôt bien.

En revanche, à part la page Web de configuration, il n'y a pas d'interface Web qui vous permettrait d'accéder aux fichiers et de les gérer par le biais de votre navigateur : vous ne pouvez donc pas accéder à vos fichiers ni les téléverser depuis un navigateur Web, comme vous pourriez le faire avec Dropbox, Google Drive ou Seafile et Owncloud.

14

And you don't have other facilities, like the ones you can find on products like Owncloud: shared calendar, address book, task scheduler, and so on.

But if all that you need is to share your documents and pictures between all your devices (and eventually share files with your friend without relying on a third party infrastructure), Syncthing is what you need.

Il manque également d'autres outils que vous pourriez trouver sur d'autres logiciels comme Owncloud : calendrier partagé, carnet d'adresses, planificateur de tâches, etc.

Mais si tout ce dont vous avez besoin est de partager vos documents et vos images entre vos périphériques (et éventuellement partager des fichiers avec vos amis sans passer par une infrastructure tierce), Syncthing répondra parfaitement à vos attentes.

issue95/labo_linux_1.txt · Dernière modification : 2015/04/24 14:36 de auntiee