I found a lack of articles on the matter, so I put together this small guide that has the goal to show you – in few easy steps – how to set up a machine that acts as a central bazaar repository using bzr+ssh://. This allows a team of people to use it à la Subversion.
By the way: Bazaar is wonderful! Kudos to the devs!
Okay, we’re system administrators, and we have little time, so let’s keep it short and simple:
- This one is fairly obvious: install bazaar on your server machine. Please use your distribution packages. For this guide, I’ll assume the main executable lies in /usr/bin/bzr.
- Create a new group, say bzrusers.
- Add a new user account, say bzruser. Set bzrusers as its main group.
- chown -R bzruser:bzrusers /home/bzruser. If, at a later stage, a user complains she/he can’t commit because of permission issues, it’s likely you touched some file herein by hand and now it’s got wrong permissions. Issue this command to fix it.
- I like to create a symbolic link from /repo to /home/bzruser, so that users are able to type easy-to-remember URLs later on.
- Create a very simple script in /usr/local/bin/bzr (so that it has precedence in the path), and give it executable permissions:
sudo -u bzruser /usr/bin/bzr “$@”
- Use visudo to edit /etc/sudoers in order to let any user in bzrusers execute /usr/bin/bzr as bzruser without needing to type a password:
# Host alias specification
# User alias specification
# Cmnd alias specification
Cmnd_Alias BAZAAR = /usr/bin/bzr
# User privilege specification
root ALL=(ALL) ALL
# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# bzr users needs to write in /home/bzrusers with the right permissions
%bzrusers ALL=(bzruser) NOPASSWD: BAZAAR
Everything’s there! Try to push something:
bzr init-repo bzr+ssh://utente@nomehost/repo/projectname
bzr push bzr+ssh://utente@nomehost/repo/projectname/branchname