Unison: Difference between revisions

From IThelp
Ihu041 (talk | contribs)
No edit summary
Mhu027 (talk | contribs)
→‎Cleanly sync your home directory: advice to use key authentication
 
(8 intermediate revisions by 3 users not shown)
Line 6: Line 6:


=== Setting up Unison GTK in Ubuntu ===
=== Setting up Unison GTK in Ubuntu ===
(Advanced users might want to [[#Cleanly_sync_your_home_directory|further down]].)
Open Unison by clicking on the Dash home and type unison in the search area. If you would like to open Unison from the terminal, just type "unison-gtk"
Open Unison by clicking on the Dash home and type unison in the search area. If you would like to open Unison from the terminal, just type "unison-gtk"


[[Image:400px-Unison_profile_selection.png|thumb|left|400px|Før du kan starte synkroniseringen må du lage en ny profil. I vinduet ''Profile Selection'' klikker du på ''Add'' - det skal åpne ''Unison Profile Creation Assistant''. Velg ''Forward''  ]]
[[Image:400px-Unison_profile_selection.png|thumb|left|400px|Before you can start the synchronization, you must create a new profile. In the ''Profile Selection'' click ''Add'' - it will open ''Unison Profile Creation Assistant''. Select ''Forward''  ]]
 


[[Image:400px-Unison_profile_creation.png|thumb|left|400px|Under ''Profile name'' skriver du inn det du vil kalle profilen din for, f.eks. ''UiB''. ''Description'' er valgfritt. Klikk ''Forward''. ]]
[[Image:400px-Unison_profile_creation.png|thumb|left|400px|In ''Profile name'' type what you would name your profile, for example. ''UiB''. Description is optional. Click ''Forward''. ]]




[[Image:400px-Unison_connection_setup.png|thumb|left|400px|I vinduet Connection Setup velger du ''Using SSH'' under ''Synchronization kind''. Under ''Configuration'' skriver du ''sync.uib.no'' under ''Host'' og ditt UiB-brukernavn under ''User''. Ta vekk haken fra boksen ''Enable compression'' ]]
[[Image:400px-Unison_connection_setup.png|thumb|left|400px|In the window Connection Setup choose ''Using SSH''. In Configuration write ''sync.uib.no'' and your UiB ''username''. Uncheck ''Enable compression'' ]]




[[Image:400px-Unison_directory_selection.png|thumb|left|400px|I vinduet ''Directory Selection'' velger du hvilke to kataloger du vil synkronisere. Et greit utgangspunkt kan være å synkronisere mappene Documents lokalt og remote. Det anbefales '''ikke''' å synkronisere hele hjemmekatalogen, siden en da tar med konfigurasjonsfiler (dot-filer) og temporære data. Remote-katalogen er relativ til din hjemmekatalog, slik at ''Documents'' blir ''$HOME/Documents'']]
[[Image:400px-Unison_directory_selection.png|thumb|left|400px|In the ''Directory Selection'' select which two directories you want to sync. A good starting point might be to synchronize the folders Documents local and remote. It is '''not''' recommended to sync your entire home directory, due to the configuration files (dot files) and temporal data. Remote directory is relative to your home directory, so that the ''Documents'' becomes ''$HOME/Documents'']]
<br style="clear: both" />
<br style="clear: both" />


Når profilen er satt opp velger du den fra listen i ''Profile Selection'' og klikker på ''Open''
When the profile is set up, select the profile from the list in the ''Profile Selection'' and click ''Open''
 




[[Image:500px-Unison_screenshot.png|thumb|left|500px| ]]
[[Image:500px-Unison_screenshot.png|thumb|left|500px| ]]
Første gang du åpner profilen din vil du bli bedt om å autentisere deg, og da bruker du ditt vanlige UiB-passord. Unison er [[SSH Secure Shell|SSH-basert]] så ved å sette opp [[Passordløs SSH-oppkobling|nøkkelautentisering]] slipper du unna med å taste passord én gang.


Første synkronisering kan ta litt tid avhengig av hvor store datamengden; Unison registrerer nå timestamp for siste endring, tillatelser, eierskap og i-node-nummer for hver fil både lokalt og remote, og lagrer dette i en arkivfil.
The first time you open your profile you will be asked to authenticate, and then use your normal UiB password. Unison is [[SSH Secure Shell|SSH-based]] so by setting up key authentication it is not required to entering the password more than once.
 
The first synchronization may take some time depending on how large amount of data; Unison now detects timestamp of last modification, permissions, ownership and i-node number for each file in both local and remote, and stores this in an archive.
 
 
The picture on the left shows how a typical Unison synchronization may appear. At the top you will see a file with the same name, local and remote, but have different content. Unison requires that you determine how to resolve the conflict, click on the'' Right to Left'' overwrites the file remote file locally, click the'' Left to Right'', the opposite happens. ''Merge'' will merge the files, and click'''' Diff shows the differences between them (this only works with plain text files).  
 
If you would like to not synchronize specific files you just click on them and select ''Skip''


Bildet til venstre viser hvordan en en typisk Unison-synkronisering kan se ut. Øverst ser du en fil som har samme navn lokalt og remote, men har forskjellig innhold. Her krever Unison at du bestemmer hvordan konflikten skal løses; klikker du på ''Right to Left'' overskriver filen remote filen lokalt, klikker du på ''Left to Right'' skjer det motsatte. Klikker du ''Merge'' sammenslår du de to filene, og klikker du ''Diff'' vises forskjellene mellom dem (dette fungerer kun med rene tekstfiler). Filen under viser en ny fil som finnes remote, men ikke lokalt. Filen under der igjen viser en fil som finnes lokalt, men ikke remote. I raden under ser du informasjon om filen(e), som når de sist ble modifisert, størrelse og rettigheter (merk endringer i filrettigheter registreres som en endring, med mindre du spesifiserer noe annet).  
When you are ready to start the synchronization, click'' Go''. If the file list disappears and the status at the bottom says'' Everything is up to date'' is all as it should be.


Dersom du ikke ønsker å synkronisere bestemte filer kan du klikke på dem og velge ''Skip''
=== Cleanly sync your home directory ===
If you are careful, you can cleanly sync your complete home directory with Unison.  But for this you should exclude some exceptions, and sync while not running any other programs under your user name.
You can set up key authentication between your laptop and ''loginb'' (same as ''sync''), see sshd(8), such that you don't have to enter your password into Unison.
Since some user intervention is preferred to investigate potential file conflicts, and we use X(7) anyway, we also here use the graphical interface of unison(1).


Når du er klar til å sette i gang synkroniseringen klikker du ''Go''. Dersom fillisten forsvinner, og status nederst sier ''Everything is up to date'' er alt som det skal være.
First create ''${HOME}/.unison/UiB.prf'' with something based on this:
<source>
# Unison preferences
label = Home directory UiB
root = /home/USER
root = ssh://USER@sync.uib.no/.
 
# Paths only on the laptop
ignore = Path {laptop_only}
 
# Other paths to not synchronise (it's content is allowed to be different)
ignore = BelowPath {Downloads,installed,mail,.local}
ignore = BelowPath {.cache,.ICEauthority,.ssh,.unison,.Xauthority}
ignore = Name {*.bak,*.log,*.aux,*.bbl,*.blg}
</source>
Replace ''USER'' by your user name (whoami(1)).
The ''Name'' directive is any file name that matches with the pattern, whereas ''BelowPath'' is recursive.
 
Assuming Xsession(5) is used, edit ${HOME}/.xsession (symlink to ''${HOME}/.xinitrc'' to be sure), and include:
<source>
unison-gtk UiB
unity
unison-gtk UiB
</source>
and optionally replace ''unity'' for the command to start your preferred window manager or desktop environment.
This will start Unison both before you login and after you logout.
 
Apropos, other great X commands that you could put there are setxkbmap(1), xrandr(1), xmodmap(1) and xsetroot(1).
 
=== Configure Unison in OS X ===
 
Coming soon


=== Sette opp Unison i OS X ===


Kommer snart.


[[Category:BRA]]
[[Category:BRS]]
[[Category:Private computer]]
[[Category:Private computer]]
[[Category:Free software]]
[[Category:Free software]]
Line 49: Line 89:
[[Category:Home directory]]
[[Category:Home directory]]
[[Category:File storage and backup]]
[[Category:File storage and backup]]
[[Category:BRA]]
 
[[Category:BRS]]
 
[[Category:Private computer]]
[[Category:Private computer]]
[[Category:Free software]]
[[Category:Free software]]

Latest revision as of 08:22, 24 April 2017

Template:Utvikling

Unison is a two-way synchronization tool. It is easy to use, has a graphical user interfaces, are quick (Unison uses # Algorithm rsync algorithm which transmits only part of the file that has been modified) and an efficient and easily understandable conflict management. From 05.03.2013 the Unison software is installed on all Linux clients, and there are also compiled versions for both Mac and Windows.

Setting up Unison GTK in Ubuntu

(Advanced users might want to further down.)

Open Unison by clicking on the Dash home and type unison in the search area. If you would like to open Unison from the terminal, just type "unison-gtk"

Before you can start the synchronization, you must create a new profile. In the Profile Selection click Add - it will open Unison Profile Creation Assistant. Select Forward


In Profile name type what you would name your profile, for example. UiB. Description is optional. Click Forward.


In the window Connection Setup choose Using SSH. In Configuration write sync.uib.no and your UiB username. Uncheck Enable compression


In the Directory Selection select which two directories you want to sync. A good starting point might be to synchronize the folders Documents local and remote. It is not recommended to sync your entire home directory, due to the configuration files (dot files) and temporal data. Remote directory is relative to your home directory, so that the Documents becomes $HOME/Documents


When the profile is set up, select the profile from the list in the Profile Selection and click Open


The first time you open your profile you will be asked to authenticate, and then use your normal UiB password. Unison is SSH-based so by setting up key authentication it is not required to entering the password more than once.

The first synchronization may take some time depending on how large amount of data; Unison now detects timestamp of last modification, permissions, ownership and i-node number for each file in both local and remote, and stores this in an archive.


The picture on the left shows how a typical Unison synchronization may appear. At the top you will see a file with the same name, local and remote, but have different content. Unison requires that you determine how to resolve the conflict, click on the Right to Left overwrites the file remote file locally, click the Left to Right, the opposite happens. Merge will merge the files, and click' Diff shows the differences between them (this only works with plain text files).

If you would like to not synchronize specific files you just click on them and select Skip

When you are ready to start the synchronization, click Go. If the file list disappears and the status at the bottom says Everything is up to date is all as it should be.

Cleanly sync your home directory

If you are careful, you can cleanly sync your complete home directory with Unison. But for this you should exclude some exceptions, and sync while not running any other programs under your user name. You can set up key authentication between your laptop and loginb (same as sync), see sshd(8), such that you don't have to enter your password into Unison. Since some user intervention is preferred to investigate potential file conflicts, and we use X(7) anyway, we also here use the graphical interface of unison(1).

First create ${HOME}/.unison/UiB.prf with something based on this:

# Unison preferences
label = Home directory UiB
root = /home/USER
root = ssh://USER@sync.uib.no/.

# Paths only on the laptop
ignore = Path {laptop_only}

# Other paths to not synchronise (it's content is allowed to be different)
ignore = BelowPath {Downloads,installed,mail,.local}
ignore = BelowPath {.cache,.ICEauthority,.ssh,.unison,.Xauthority}
ignore = Name {*.bak,*.log,*.aux,*.bbl,*.blg}

Replace USER by your user name (whoami(1)). The Name directive is any file name that matches with the pattern, whereas BelowPath is recursive.

Assuming Xsession(5) is used, edit ${HOME}/.xsession (symlink to ${HOME}/.xinitrc to be sure), and include:

unison-gtk UiB
unity
unison-gtk UiB

and optionally replace unity for the command to start your preferred window manager or desktop environment. This will start Unison both before you login and after you logout.

Apropos, other great X commands that you could put there are setxkbmap(1), xrandr(1), xmodmap(1) and xsetroot(1).

Configure Unison in OS X

Coming soon