Create an OpenSolaris Zone to Run Subversion

 

I’ve taken to start using subversion as a repository/version control for my Audio and Video project files. This is how I set it up, using OpenSolaris zones and zfs. There may be better more efficient ways to set it up but this is what worked for me.

We already have OpenSolaris (snv_126) running, and we’ve already created a ZFS filesystem for zones.

sean@neptune2:~# zfs list | grep zones
rpool/zones                            927M  4.87G    22K  /zones
rpool/zones/neptune_zone1              476M  4.87G    22K  /zones/neptune_zone1

Create a new zone

sean@neptune2:~# zonecfg -z svnzone1
svnzone1: No such zone configured
Use ‘create’ to begin configuring a new zone.
zonecfg:svnzone1> create
zonecfg:svnzone1> set zonepath=/zones/svnzone1
zonecfg:svnzone1> add net
zonecfg:svnzone1:net> set address=10.0.1.206
zonecfg:svnzone1:net> set physical=e1000g0
zonecfg:svnzone1:net> end
zonecfg:svnzone1> verify
zonecfg:svnzone1> commit
zonecfg:svnzone1> exit
sean@neptune2:~# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP   
   0 global           running    /                              native   shared
   4 zone1            running    /zones/zone1                   ipkg     shared
   – svnzone1         configured /zones/svnzone1                ipkg     shared

Next, install the zone

sean@neptune2:~# zoneadm -z svnzone1 install
A ZFS file system has been created for this zone.
   Publisher: Using dev (
http://pkg.opensolaris.org/dev/).
       Image: Preparing at /zones/svnzone1/root.
       Cache: Using /var/pkg/download.
Sanity Check: Looking for ‘entire’ incorporation.
  Installing: Core System (output follows)
No updates necessary for this image.
  Installing: Additional Packages (output follows)
DOWNLOAD                                  PKGS       FILES    XFER (MB)
Completed                                35/35   3249/3249    19.5/19.5

PHASE                                        ACTIONS
Install Phase                              4284/4284

Boot the zone and login

sean@neptune2:~# zoneadm -z svnzone1 boot
zone ’svnzone1′: WARNING: e1000g0:2: no matching subnet found in netmasks(4): 10.0.1.206; using default of 255.0.0.0.
sean@neptune2:~# zlogin -C svnzone1

Follow the install screens for zone name configuration, etc.

In the global zone, create a filesystem for your user account in the new zone

zfs create rpool/export/home/sean_svnzone1

Give the zone access to the global zone’s /export/home directory so you can create home directories

# zonecfg -z svnzone1
zonecfg:svnzone1> add fs
zonecfg:svnzone1:fs> set dir=/export/home
zonecfg:svnzone1:fs> set special=/export/home
zonecfg:svnzone1:fs> set type=lofs
zonecfg:svnzone1:fs> set options=nodevices
zonecfg:svnzone1:fs> end
zonecfg:svnzone1> commit
zonecfg:svnzone1> exit

Add the following line to the zone’s /etc/auto_home file:
$HOST:/export/home/&

zlogin -C svnzone1
root@svnzone1:~# cat >> /etc/auto_home

Reboot the zone

Create a user for access to the svn repository

useradd sean

Create storage for subversion repositories. Create a zfs filesystem that we can add to the non-global zone so we can create additional filesystems within the zone

sean@neptune2:~# zfs create tank/svnzone1_ds
sean@neptune2:~# zonecfg -z svnzone1
zonecfg:svnzone1> add dataset
zonecfg:svnzone1:dataset> set name=tank/svnzone1_ds
zonecfg:svnzone1:dataset> end
zonecfg:svnzone1> verify
zonecfg:svnzone1> commit
zonecfg:svnzone1> exit

Reboot the zone
sean@neptune2:~# zoneadm -z svnzone1 reboot

Login to svnzone and create and filesystem for subversion.

root@svnzone1:/tank/svnzone1_ds# zfs create tank/svnzone1_ds/svn
root@svnzone1:/tank/svnzone1_ds# zfs list
NAME                            USED  AVAIL  REFER  MOUNTPOINT
rpool                          11.2G  4.45G  83.5K  /rpool
rpool/zones                    1.33G  4.45G    25K  /zones
rpool/zones/svnzone1            435M  4.45G    24K  /zones/svnzone1
rpool/zones/svnzone1/ROOT       435M  4.45G    21K  legacy
rpool/zones/svnzone1/ROOT/zbe   435M  4.45G   435M  legacy
tank                           4.02G  5.76G    24K  /tank
tank/svnzone1_ds                 42K  5.76G    21K  /tank/svnzone1_ds
tank/svnzone1_ds/svn             21K  5.76G    21K  /tank/svnzone1_ds/svn

Change Mountpoints to something a little more logical

root@svnzone1:~# zfs set mountpoint=/zfs tank/svnzone1_ds
root@svnzone1:~# zfs set mountpoint=/svn tank/svnzone1_ds/svn

Install Subversion

root@svnzone1:/# pkg install SUNWsvn

If your user account is having problems accessing its own home directory you may have to make the user the owner

chown -R sean sean_svnzone1

Now give the user (in this case, sean) permission to the /svn directory so the account can create repositories and add, check-in files, etc

root@svnzone1:~# chmod -R A+user:sean:list_directory/read_data/add_file/write_d
ata/add_subdirectory/append_data/write_xattr/execute/write_attributes/write_acl
/write_owner:allow /svn

Now the user can create repositories in subversion

sean@svnzone1:~$ svnadmin create /svn/repo1                                    
sean@svnzone1:~$ svnadmin create /svn/repo1/project1

Then with your subversion client, you can import projects into the repository

tardis:GarageBand sean$ ls
MIDI Out.band My Song.band  project
tardis:GarageBand sean$ svn import project  svn+ssh://sean@10.0.1.206/svn/repo1/project1/
tardis:GarageBand sean$ svn list svn+ssh://sean@10.0.1.206/svn/repo1/project1
garageband.band/
tardis:GarageBand sean$

Explore posts in the same categories: Uncategorized

Comment: