Launch EC2 instance
We are going to run an EC2 instance of the EBS amazon linux p_w_picpath and install apache Web server with subversion.
Go to http://aws.amazon.com/fr/amazon-linux-ami/ and find out the best EBS Linux AMI for you.
Personally I will run the ami-827540f6 because I’m in Europe.
Run an instance of the p_w_picpath you choosed and ssh your server with ec2-user.
Install subversion
Install subversion, apache and mod_dav_svn:
# sudo yum –y install mod_dav_svn
Edit the Apache configuration file for subversion:
# sudo vi /etc/httpd/conf.d/subversion.conf
Replace subversion.conf content by:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /repos>
DAV svn
SVNParentPath /var/www/svn
# Limit write permission to list of valid users.
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /var/www/svn-auth/passwd
AuthzSVNAccessFile /var/www/svn-auth/access
Require valid-user
</Location>
Create the directory which will contain the subversion repository:
# sudo mkdir /var/www/svn
Create the directory which will contain the permissions files.
# sudo mkdir /var/www/svn-auth
Create the permission file:
# sudo vi /var/www/svn-auth/access
[/]
xiaoming = rw
Note: Replace <theUser> by the login you want to use to access your repository.
<theUser> will have read write access to all repositories.
It is possible to setup authorization by group or user for each repository.
Create the password file:
# sudo htpasswd -cm /var/www/svn-auth/passwd xiaoming
# sudo htpasswd -m /var/www/svn-auth/passwd xiaohong
Note: Replace xiaoming by the login you want to use to access your repository.
Create a repository (here project1):
# cd /var/www/svn
# sudo svnadmin create project1
Change files authorization:
# sudo chown -R apache.apache /var/www/svn /var/www/svn-auth
# chmod 600 /var/www/svn-auth/access /var/www/svn-auth/passwd
Start apache web server:
# sudo service httpd start
Note: to restart server use # sudo service httpd restart
Test subversion
Now subversion and apache should work.
Open a web browser and point to the URL : http://<Public DNS of your EC2 instance>/repos/project1
You should be prompted for your credential (Enter <theUser> <thePassword>) before accessing the repository
Subversion client
We are now going to interact with our repository from a windows PC.
If you don’t have a subversion client installed on your PC then you can install one from http://www.sliksvn.com/en/download .
You can test your subversion client from your PC by listing files on your repository:
svn ls http://<Public DNS of your EC2 instance>/repos/project1
The first time we often want to import some files to the repository:
svn import -m "Initial import." <path of the reposity where are the files on your PC> http://<Public DNS of your EC2 instance>/repos/project1
We are going to run an EC2 instance of the EBS amazon linux p_w_picpath and install apache Web server with subversion.
Go to http://aws.amazon.com/fr/amazon-linux-ami/ and find out the best EBS Linux AMI for you.
Personally I will run the ami-827540f6 because I’m in Europe.
Run an instance of the p_w_picpath you choosed and ssh your server with ec2-user.
Install subversion
Install subversion, apache and mod_dav_svn:
# sudo yum –y install mod_dav_svn
Edit the Apache configuration file for subversion:
# sudo vi /etc/httpd/conf.d/subversion.conf
Replace subversion.conf content by:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /repos>
DAV svn
SVNParentPath /var/www/svn
# Limit write permission to list of valid users.
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /var/www/svn-auth/passwd
AuthzSVNAccessFile /var/www/svn-auth/access
Require valid-user
</Location>
Create the directory which will contain the subversion repository:
# sudo mkdir /var/www/svn
Create the directory which will contain the permissions files.
# sudo mkdir /var/www/svn-auth
Create the permission file:
# sudo vi /var/www/svn-auth/access
[/]
xiaoming = rw
Note: Replace <theUser> by the login you want to use to access your repository.
<theUser> will have read write access to all repositories.
It is possible to setup authorization by group or user for each repository.
Create the password file:
# sudo htpasswd -cm /var/www/svn-auth/passwd xiaoming
# sudo htpasswd -m /var/www/svn-auth/passwd xiaohong
Note: Replace xiaoming by the login you want to use to access your repository.
Create a repository (here project1):
# cd /var/www/svn
# sudo svnadmin create project1
Change files authorization:
# sudo chown -R apache.apache /var/www/svn /var/www/svn-auth
# chmod 600 /var/www/svn-auth/access /var/www/svn-auth/passwd
Start apache web server:
# sudo service httpd start
Note: to restart server use # sudo service httpd restart
Test subversion
Now subversion and apache should work.
Open a web browser and point to the URL : http://<Public DNS of your EC2 instance>/repos/project1
You should be prompted for your credential (Enter <theUser> <thePassword>) before accessing the repository
Subversion client
We are now going to interact with our repository from a windows PC.
If you don’t have a subversion client installed on your PC then you can install one from http://www.sliksvn.com/en/download .
You can test your subversion client from your PC by listing files on your repository:
svn ls http://<Public DNS of your EC2 instance>/repos/project1
The first time we often want to import some files to the repository:
svn import -m "Initial import." <path of the reposity where are the files on your PC> http://<Public DNS of your EC2 instance>/repos/project1
转载于:https://blog.51cto.com/flandycheng/620818