开发者

svn unable to open an ra_local session

开发者 https://www.devze.com 2023-02-17 21:06 出处:网络
I have set up my svn on my Linux server. I created a REPOSITORY with the following command: # svnadmin create /var/svn/REPOSITORY_NAME

I have set up my svn on my Linux server. I created a REPOSITORY with the following command:

# svnadmin create /var/svn/REPOSITORY_NAME

Then I set user access rights in this file:

# vi /var/svn/REPOSITORY_NAME/conf/svnserve.conf

Next, I uncomment the password-db line at line 20 and add user a开发者_Go百科ccess

# vi /var/svn/REPOSITORY_NAME/conf/passwd

Here I add username and password.

Then I kill svn with command # killall svnserve and restart it with command # svnserve -d -r /var/svn/

Later when I access it with the command svn co file:///var/www/html/easton I get the following error:

svn: Unable to open an ra_local session to URL
svn: Unable to open repository 'file:///var/www/html/easton'

How can I fix this?


Please see the document below, you can successfully install svn/websvn (my platform is ubuntu 12.04 LTS)

Install required packages

apt-get install subversion libapache2-svn 

create a root directory to store svn repositories

mkdir /var/sourcecontrol/svn 

create a svn repository “newrepo”

svnadmin create /var/sourcecontrol/svn/newrepo 

create a group “subversion”

groupadd subversion

add a user and 'www-data' user to group

chown username:subversion -R /var/sourcecontrol/svn/newrepo 

ACCESS METHODS

1.for 'file' access to repository

svn co file:///var/sourcecontrol/svn/newrepo/
  1. for http access to repository

    vim /etc/apache2/mods-available/dav_svn.conf

add the following entries at the end

<Location /newrepo>    
DAV svn 
SVNPath /var/sourcecontrol/svn/newrepo 
AuthType Basic 
AuthName "Subversion repository repositoryName" 
</Location> 

Restart apache /etc/init.d/apache2 restart

Now you can checkout the repository “newrepo” to your local folder using http

Eg:

svn co http://<serverip>/newrepo /home/user/Desktop/

you can verify the repository in browser using http://<serverip>/newrepo

  1. for svn access to repository

    svnserve /var/sourcecontrol/svn/

    vim /var/sourcecontrol/svn/newrepo/conf/svnserve.conf

add the following at the end of file

[general]
anon-access = none 
auth-access = write 
password-db = passwd
realm = My First Repository

Add authentication

vim /var/sourcecontrol/svn/newrepo/conf/passwd

add the user and password at the end of file

    username = password

Now you can checkout the repository “newrepo” to your local folder using svn

Eg:

svn co svn://<serverip>/newrepo /home/user/Desktop/

WEBSVN interface

apt-get install websvn 
apt-get install enscript 

(before installating, create a sample repository in your root folder)

on installation give the path of existing repository when prompted.

Copy the websvn directory to apache root folder

cp -r /usr/share/websvn /var/www/

vim /etc/apache2/mods-available/dav_svn.conf

add these entries at the end (do not remove the existing entries that we have made earlier)

<Location /websvn/> 
Options FollowSymLinks 
order allow,deny 
allow from all 
AuthType Basic 
AuthName "Subversion Repository"    
</Location> 

for repository management in websvn, we can use tow methods

  1. dpkg-reconfigure websvn

    enter the path of all repositories separated by a comma (when prompted)
    

    OR

    1. vim /etc/websvn/svn_deb_conf.inc

Eg:

<?php 
// please edit /etc/websvn/config.php 
// or use dpkg-reconfigure websvn 
$config->parentPath("/var/sourcecontrol/svn/newrepo"); 
$config->parentPath("/var/sourcecontrol/svn/myrepo"); 
$config->parentPath("/var/sourcecontrol/svn/myproject"); 
$config->addRepository("newrepo", "file:///var/sourcecontrol/svn/newrepo"); 
$config->addRepository("myrepo", "file:///var/sourcecontrol/svn/myrepo"); 
$config->addRepository("myproject", "file:///var/sourcecontrol/svn/myproject"); 
$config->setEnscriptPath("/usr/bin"); 
$config->setSedPath("/bin"); 
$config->useEnscript(); 
?>

//newrepo,myrepo,myproject are sample repositories


Shouldn't you do:

svn co file:///var/svn/easton

or:

svn co svn://localhost/var/svn/easton

instead of using /var/www/html/easton, since you said that you created the repository in /var/svn?


Follow the Steps given bellow:-

  1. Open terminal ( Ctrl + Alt + T )

  2. Type: sudo apt-get update sudo apt-get install websvn subversion libapache2-svn -y

  3. Do you want to configure WebSVN now? Configure later (dpkg-reconfigure-websvn) Select

  4. sudo nano /etc/apache2/mods-enabled/dav_svn.conf

  5. Uncomment few lines:

    #<Location /svn> to <Location /svn>
    #DAV svn to DAV svn
    #SVNParentPath /var/lib/svn to SVNParentPath /var/lib/svn
    #AuthType Basic to AuthType Basic
    #AuthName "Subversion Repository" to AuthName "Subversion Repository"
    #AuthUserFile /etc/apache2/dav_svn.passwd to AuthUserFile /etc/apache2/dav_svn.passwd
    #<LimitExcept GET PROPFIND OPTIONS REPORT> to <LimitExcept GET PROPFIND OPTIONS REPORT>
    #Require valid-user to Require valid-user
    #</LimitExcept> to </LimitExcept>
    #</Location> to </Location>
    

    Verify if everything is Ok: cat /etc/apache2/mods-enabled/dav_svn.conf | grep -v '#'

    <Location /svn>
        DAV svn
        SVNParentPath /var/lib/svn
    
        AuthType Basic
        AuthName "Subversion Repository"
        AuthUserFile /etc/apache2/dav_svn.passwd
    
        <LimitExcept GET PROPFIND OPTIONS REPORT>
            Require valid-user
    
        </LimitExcept>
    
    </Location>
    

You can use "sed" if you know how to use this command line.

  1. sudo mkdir /var/lib/svn

  2. Create a repo test: sudo svnadmin create /var/lib/svn/mysvnreponame sudo chown -R www-data:www-data /var/lib/svn/mysvnreponame

  3. Restart Apache: sudo service apache2 restart

  4. Add svn user: sudo apt-get update && sudo apt-get install apache2-utils sudo htpasswd -c /etc/apache2/dav_svn.passwd Username

    For additional users or modify password, you can use: sudo htpasswd -m /etc/apache2/dav_svn.passwd Username

    Verify if every user has been created: cat /etc/apache2/dav_svn.passwd | grep Username

  5. Reconfigure websvn: sudo dpkg-reconfigure websvn

    12.1 - Select <Yes>
    12.2 - Select <Ok>
    12.3 - Select <Ok>
    12.4 - Leave Empty & <Ok>  
    12.5 - Select <Ok>
    

    If you receive message: failed to create symbolic link '/etc/apache2/conf.d/websvn': No such file or directory

    Try fix with: sudo cp /etc/websvn/apache.conf /etc/apache2/conf-available/websvn.conf sudo a2enconf websvn sudo service apache2 reload

  6. Test svn: Get IP address: ifconfig or ip addr - If you don't recognize where is the IP address, try go back to Windows. http://IP-address/svn/yourreponame

  7. Test websvn: http://IP-address/websvn

Don't forget to create the most basic structure inside your repository:

  /trunk
  /branches
  /tags
0

精彩评论

暂无评论...
验证码 换一张
取 消