UbuntuにSubversionをインストール
環境
- OS
- Ubuntu10.10
- Subversion
- 1.6.12dfsg-1ubuntu1.2
手順
前提
- Apache2がインストール済み
必要なライブラリをインストール
Subversion本体はRVMインストール時にすでにいれてあります。もし入れてなかったら
$ sudo aptitude install subversion
します。
そのほか、
$ sudo aptitude install subversion-tools $ aptitude install libapache2-svn
をインストールします。
/etc/apache2/mods-enabled/dav_svn.conf編集
$ sudo vim /etc/apache2/mods-enabled/dav_svn.conf
13、16、23、54行目のコメントアウトを解除します。
1 # dav_svn.conf - Example Subversion/Apache configuration 2 # 3 # For details and further options see the Apache user manual and 4 # the Subversion book. 5 # 6 # NOTE: for a setup with multiple vhosts, you will want to do this 7 # configuration in /etc/apache2/sites-available/*, not here. 8 9 # <Location URL> ... </Location> 10 # URL controls how the repository appears to the outside world. 11 # In this example clients access the repository as http://hostname/svn/ 12 # Note, a literal /svn should NOT exist in your document root. 13 <Location /svn> 14 15 # Uncomment this to enable the repository 16 DAV svn 17 18 # Set this to the path to your repository 19 #SVNPath /var/lib/svn 20 # Alternatively, use SVNParentPath if you have multiple repositories under 21 # under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...). 22 # You need either SVNPath and SVNParentPath, but not both. 23 SVNParentPath /var/lib/svn 24 25 # Access control is done at 3 levels: (1) Apache authentication, via 26 # any of several methods. A "Basic Auth" section is commented out 27 # below. (2) Apache <Limit> and <LimitExcept>, also commented out 28 # below. (3) mod_authz_svn is a svn-specific authorization module 29 # which offers fine-grained read/write access control for paths 30 # within a repository. (The first two layers are coarse-grained; you 31 # can only enable/disable access to an entire repository.) Note that 32 # mod_authz_svn is noticeably slower than the other two layers, so if 33 # you don't need the fine-grained control, don't configure it. 34 35 # Basic Authentication is repository-wide. It is not secure unless 36 # you are using https. See the 'htpasswd' command to create and 37 # manage the password file - and the documentation for the 38 # 'auth_basic' and 'authn_file' modules, which you will need for this 39 # (enable them with 'a2enmod'). 40 #AuthType Basic 41 #AuthName "Subversion Repository" 42 #AuthUserFile /etc/apache2/dav_svn.passwd 43 44 # To enable authorization via mod_authz_svn 45 #AuthzSVNAccessFile /etc/apache2/dav_svn.authz 46 47 # The following three lines allow anonymous read, but make 48 # committers authenticate themselves. It requires the 'authz_user' 49 # module (enable it with 'a2enmod'). 50 #<LimitExcept GET PROPFIND OPTIONS REPORT> 51 #Require valid-user 52 #</LimitExcept> 53 54 </Location>
リポジトリ作成
SVNParentPath で設定した/var/lib/svn を作成します。
$ cd /var/lib $ sudo mkdir svn
リポジトリ作成
$ cd svn $ sudo svnadmin create test
権限変更
$ cd .. $ sudo chown -R www-data.www-data test/
Apache再起動
$ sudo /etc/init.d/apache2 restart
テスト用ファイルを作成してインポート
テストファイル作成
$ cd $ mkdir work $ cd work $ echo "Hello World" > first.txt
インポート
svn import ./first.txt http://localhost/svn/test/first.txt -m "first import"
Webから確認
ゲストOSのブラウザを起動して
http://localhost/svn/test/
にアクセス。
test - Revision 1: /
first.txt
のようなかんじになっていたらOK。
チェックアウトしてみる
$ cd $ mkdir repos $ cd repos $ svn checkout http://localhost/svn/test test $ cd test $ svn info パス: . URL: http://localhost/svn/test リポジトリのルート: http://localhost/svn/test リポジトリ UUID: 486b6f7a-cd2c-4686-8887-07bc5ab129ef リビジョン: 1 ノード種別: ディレクトリ 準備中の処理: 特になし 最終変更リビジョン: 1 最終変更日時: 2011-05-22 16:25:38 +0900 (日, 22 5月 2011)