<!-- --> <script><!-- function msoCommentShow(anchor_id, com_id) { if(msoBrowserCheck()) { c = document.all(com_id); a = document.all(anchor_id); if (null != c && null == c.length && null != a && null == a.length) { var cw = c.offsetWidth; var ch = c.offsetHeight; var aw = a.offsetWidth; var ah = a.offsetHeight; var x = a.offsetLeft; var y = a.offsetTop; var el = a; while (el.tagName != "BODY") { el = el.offsetParent; x = x + el.offsetLeft; y = y + el.offsetTop; } var bw = document.body.clientWidth; var bh = document.body.clientHeight; var bsl = document.body.scrollLeft; var bst = document.body.scrollTop; if (x + cw + ah / 2 > bw + bsl && x + aw - ah / 2 - cw >= bsl ) { c.style.left = x + aw - ah / 2 - cw; } else { c.style.left = x + ah / 2; } if (y + ch + ah / 2 > bh + bst && y + ah / 2 - ch >= bst ) { c.style.top = y + ah / 2 - ch; } else { c.style.top = y + ah / 2; } c.style.visibility = "visible"; } } } function msoCommentHide(com_id) { if(msoBrowserCheck()) { c = document.all(com_id); if (null != c && null == c.length) { c.style.visibility = "hidden"; c.style.left = -1000; c.style.top = -1000; } } } function msoBrowserCheck() { ms = navigator.appVersion.indexOf("MSIE"); vers = navigator.appVersion.substring(ms + 5, ms + 6); ie4 = (ms > 0) && (parseInt(vers) >= 4); return ie4; } if (msoBrowserCheck()) { document.styleSheets.dynCom.addRule(".msocomanchor","background: infobackground"); document.styleSheets.dynCom.addRule(".msocomoff","display: none"); document.styleSheets.dynCom.addRule(".msocomtxt","visibility: hidden"); document.styleSheets.dynCom.addRule(".msocomtxt","position: absolute"); document.styleSheets.dynCom.addRule(".msocomtxt","top: -1000"); document.styleSheets.dynCom.addRule(".msocomtxt","left: -1000"); document.styleSheets.dynCom.addRule(".msocomtxt","width: 33%"); document.styleSheets.dynCom.addRule(".msocomtxt","background: infobackground"); document.styleSheets.dynCom.addRule(".msocomtxt","color: infotext"); document.styleSheets.dynCom.addRule(".msocomtxt","border-top: 1pt solid threedlightshadow"); document.styleSheets.dynCom.addRule(".msocomtxt","border-right: 2pt solid threedshadow"); document.styleSheets.dynCom.addRule(".msocomtxt","border-bottom: 2pt solid threedshadow"); document.styleSheets.dynCom.addRule(".msocomtxt","border-left: 1pt solid threedlightshadow"); document.styleSheets.dynCom.addRule(".msocomtxt","padding: 3pt 3pt 3pt 3pt"); document.styleSheets.dynCom.addRule(".msocomtxt","z-index: 100"); } // --></script> <!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体;} h1 {mso-style-update:auto; mso-style-next:Normal; margin-top:12.0pt; margin-right:0in; margin-bottom:3.0pt; margin-left:0in; mso-pagination:widow-orphan; page-break-after:avoid; mso-outline-level:1; font-size:16.0pt; font-family:Arial; mso-font-kerning:16.0pt; font-weight:bold;} h2 {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; mso-outline-level:2; font-size:18.0pt; font-family:"Times New Roman"; font-weight:bold;} p.MsoCommentText, li.MsoCommentText, div.MsoCommentText {mso-style-noshow:yes; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体;} span.MsoCommentReference {mso-style-noshow:yes; mso-ansi-font-size:8.0pt; mso-bidi-font-size:8.0pt;} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} p {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体;} pre {margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt; font-size:10.0pt; font-family:"Courier New"; mso-fareast-font-family:宋体;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:1502507205; mso-list-type:hybrid; mso-list-template-ids:1057518902 612806328 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l0:level1 {mso-level-number-format:alpha-lower; mso-level-text:"%1/)"; mso-level-tab-stop:.75in; mso-level-number-position:left; margin-left:.75in; text-indent:-.25in;} ol {margin-bottom:0in;} ul {margin-bottom:0in;} -->
SVN Installation Document
<Third Edition>
Time Series
2009-04-27
Introduction
SVN, also known as Subversion, is a widely used version control tool. It’s said to be the next generation tool of CVS. And, in this document, you will get to know how to install Subversion in your Linux system and a brief introduction of how to configure and use it. According to our current environment in Time Series team, all the works described here are under Cent OS 5.
Normally, there’re two ways to use Subversion as a version control tool: use Subversion server directly, and use Subversion + Apache so the files you stored in the server could be accessed and modified through HTTP. Also, at last, this document shows how to combine your Subversion with KDevelop, a IDE for c/c++ programming in Linux.
Here’s a description of all the sections:
First, in One thing to notice, you could find one import difference between Subversion and CVS. And according to that, you should have a general view of how Subversion works.
Second, in Set Subversion on Web, introduces the way how to install and configure Subversion on Apache server. This section uses a large part to give a detailed introduction on the installation of all the related software. It’s actually a overwhelming work, thought it’s been tested several times, some odd things may happen according to different versions of Linux.
Third, in Subversion and KDevelop, introduces how to use Subversion through KDevelop, a C/C++ development IDE. (Just could not make it work now, need further try.)
One thing to notice
Most of you may have the experience of using CVS or something related to it as a version control tool. The normal modal is that when you check a file or folder out, this very file or folder is locked and other users could not check it out again or change it until the first user unlock it, whether there’s a modification or not. This is the typically “Lock-modify-unlock” module.
But, in Subversion, a “Copy-modify-merge” solution is used. In that situation, you have to check out a copy from server to local every time you want to work on it. No lock would be set right now, so every one could get the old copy while you are working (on your local copy). After you’ve finished your job and want to submit it to the server, the server would check the version of you copy first, it the version is not the same, that means some one else has made a change, and your submission would be rejected. And your local new work could only be merged to the one on the server manually.
Here’re the figures that make the procedure easier to understand. Harry and Sally both checked out a copy of file A and make some changes. After Sally has submitted her file to the server, Harry can’t submit his copy directly and he’s get a file “out of date” error.
What Harry could do now, as shown in the next figure, is to get a new copy of file A from the server, and manually merge these two file together into a new file( of course this should be done with Sally), and then submit the new file into the server.
Then, next time, when Sally wants to work with file A again, she has to check out a new version of the file to local, otherwise she could not submit the file successfully neither.
Subversion applies a “look-modify-unlock” mechanic, too, which could be done by a command. For more information about that, you could refer to Subversion Lock.
Set Machine
OS Centos5.2
HD Ext3
Free Space 1G for software
Port 80
Application software installs path: /usr/local
Repository data path: /data/svn
MySQL database data path: /mnt/dbdata
Application Software version
Subversion: 1.6.1
Subversion-deps:1.6.1
MySQL: 6.0.10_0
PHP: 5.2.9
Svnmanager: 1.05
VersionControl_SVN:0.3.1
Apr: 1.3.3
Apr_util: 1.3.4
//data//Subversion_Software
Set Subversion On Web
This is a typical Apache+PHP+MySQL+Subversion setting which approves accesses via HTTP to Subversion server.
Also, this process could take you a long time to download everything and make it work. Just be patient.
Preparation:
GCC is a tool to compile Linux c/c++ program.
Please make sure that GCC was installed on your Linux. To do that, you could just use yum install:
#yum install gcc
Step 1: Apache
Note: Do NOT install Apache through “yum” or “rpm”. According to Xinfang’s research, SVN can’t work with it.
If you have done that, you can try to uninstall it with
#yum remove httpd
Or
#rpm –e httpd
Here is the address to download the latest source of Apache. What I’ve tried is httpd-2.2.11. After you have downloaded the .gz file, do the following:
a) Installation (no support LDAP module) if you want to support LDAP authentication, refer to next
#tar –zxvf httpd-2.2.11.tar.gz
#cd /httpd-2.2.11
#./configure –enable-module=so –enable-dav –enable-dav-fs –enable-so –prefix=/usr/local/apache2
#make
#make install
#make clean
Installation (no support LDAP module) if you want to support LDAP authentication, refer to next
#yum install openldap-devel zlib-devel expat-devel
#tar –zxvf httpd-2.2.11.tar.gz
#cd /httpd-2.2.11
#./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=all --enable-dav=share --enable-dav-fs --with-ldap --enable-ldap --enable-authnz-ldap
#make
#make install
#make clean
b) Copy the httpd file to init.d folder.
#cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
c) Start Apache service and check the result.
#/etc/init.d/httpd stop (or : service httpd stop)
#/etc/init.d/httpd start (or : service httpd start)cd ls
Then, open your Web browser and input http://localhost into the address blank, if you could see “It workds!”, that means your Apache service has been started successfully.
And, you can change the httpd default folder in “httpd.conf”, the default folder for that is “/usr/local/apache2/htdocs”.
Step 2: MySQL
For this part, you just have to download the listed “rpms” and run them one by one. The listed order is not necessary, the dependency check function of “cpm” command will do that for you.
Related rpms are listed as following, and you could get them here . Remember to choose the right edition for you operation system.
MySQL-server-community-6.0.10-0.rhel5.i386.rpm
MySQL-client-community-6.0.10-0.rhel5.i386.rpm
MySQL-devel-community-6.0.10-0.rhel5.i386.rpm
MySQL-shared-community6.0.10-0.rhel5.i386.rpm
MySQL-test-community-6.0.10-0.rhel5.i386.rpm
MySQL-shared-compat-6.0.10-0.rhel5.i386.rpm (Optional)
MySQL-community-debuginfo-6.0.10_0.rhel5.i386.rpm (Optional)
And to install them, you can just use: rpm -ivh file name on each one.
#rpm –ivh MySQL-server-community-6.0.10-0.rhel5.i386.rpm
#rpm –ivh MySQL-client-community-6.0.10-0.rhel5.i386.rpm
#rpm –ivh MySQL- devel -community-6.0.10-0.rhel5.i386.rpm
#rpm –ivh MySQL- shared -community-6.0.10-0.rhel5.i386.rpm
#rpm –ivh MySQL- test -community-6.0.10-0.rhel5.i386.rpm
Step 3: PHP
Please make sure you have installed the xml-config, libpng2, libpng2-devel, libxml2-devel and libxml2.
#rpm –qa|grep libpng libpng-devel libxml2 libxml2-devel
Or
#rpm –qa|grep libpng
#rpm –qa|grep libpng-devel
#rpm –qa|grep libxml2
#rpm –qa|grep libxml2-devel
If not please install them by yum or download the source code
#yum install libpng*
#yum install libxml2*
#yum install libxml*
First, download PHP source package from here . What we use here is php.5.2.9.
a) Installation
#tar –zxvf php-5.2.9.tar.gz
#cd php-5.2.9
#./configure -prefix=/usr/local/php -with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-zlib --with-gd --with-pear --enable-force-cgj-redirect --with-config-file-path=/etc/
#make
#make install
#chmod 755 /usr/local/apache2/modules/libphp5.so
b) Configuration
Copy php.ini file from source
Cp php.ini–dist /etc/php.ini
Then, open the php.ini file and add the following information to the proper position.
Include_path = “.:/usr/local/php/lib/php”
Open “/etc/profile” and add the following information to the proper position.
pathmunge /usr/local/apache2/bin
pathmunge /usr/local/php/bin
Open “/usr/local/apache2/conf/httpd.conf” file and add the following information.
<IfModule mime_module>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule>
Restart the apache
#/etc/init.d/httpd restart
To make sure that PHP could be used properly by Apache.
d) Testing.
Create a test file “test.php” in the httpd folder which is set to be “/usr/local/apace2/htdocs / ” according to the configuration in this file, and input:
<?
phpinfo();
?>
Then run the command in console “/usr/local/apache2/bin/apachectl start”. Open your web browser and type in http://localhost/test.php in the address blank, if you could see some information about the PHP, you have it installed correctly.
PS:
To install PHP in your system, some dependent software should be installed first. This may vary from different editions, even different installations of your OS. In my case, I installed “xm2-config”, “libxml2-devel” and “libpng2”. For the first two you could easily install them by “yum”, and you could get the rmp package for “libpng2” here. And the other possible required software are listed here:
php_devel, php-xml, php-mysql, php-common, php-cli
Step 4: Apr and Apache Apr-Util
Please make sure you have installed expat and expat-devel
#rpm –qa|grep expat
Or
#yum install expat*
Or
#yum install expat
#yum install expat-devel
Both source packages could be found here.
#tar –zxvf apr-1.3.3
#cd apr-1.3.3
#./configure -–prefix=/usr/local/apr
#make
#make install
#tar –zxvf apr-util-1.3.4
#cd apr-util-1.3.4
#./configure –prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#make
#make install
Step 5: Some modules
Make sure “neon” and “serf” are installed in your system, which make it possible for SVN to access httpd service.
a) Preparation
Make sure have install openssl
#rpm –qa|grep openssl
#yum install openssl
#yum install openssl-devel
Download source package of subversion-deps-1.6.1, which could be got here.
b) Installation
#tar –zxvf subversion-deps-1.6.1.tar.gz
#cd subversion-deps-1.6.1
#cd neon
#./configure
#make
#make install
#cd ..
#cd serf
#./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
#make
#make install
c) Panic
This step may need some dependency preparationi.
You may have to install OpenSSL first to install serf, according to your system configuration. If you do, download the source package here.
### after untar
#./configure –prefix=/usr/local/openssl
#make
#make install
And, if you do have done it, then back in b), installation of serf, you should use:
#./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-openssl=/usr/local/openssl
#make
#make install
And before that, you may have to install expat-lib, the source package of which could be got here. Then
### after untar
#./configure –prefix=/usr/local/expat
#make
#make install
This part really made me crazy -_-~.
Step 6 : Subversion
a) Download and install
You could get the source package of Subversion ww. What we use is Subversion 1.6.1.
#tar –vxzf subversion -1.6.1.tar.gz
#cd subversion-1.6.1
#./configure --prefix=/usr/local/subversion --without-berkeley-db --with-apxs=/usr/local/apache2/bin/apxs --with-swing --enable-swing-binding=python --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-openssl --with-neon=/usr/local/bin --with-serf=/usr/local/serf
#make
#make install
( You may encounter a error says: error while loading shared libraries: libexpat.so.1: cannot open object file: No such file or directory.
If you do, just copy the “.so” file into /subversion/lib, using:
cp /usr/local/expat/lib/libexpat.so.1.6.1 /usr/local/subversion/lib)
b) Configure
1. Open the profiles add the command into file and restart your PC.
pathmunge /usr/local/subversion/bin
2. Create a Subversion folder and setup the user and password
#mkdir –p /data/svn/repos
#/usr/local/apache2/bin/htpasswd –cm /data/svn/passwdfile admin
And then the system will inform you to input a password for user “admin”, twice.
3. Open the access file and setup the user rights. Just copy the following information into file.
#cd /data/svn/
#vi accessfile
Accessfile context:
[/]
* = rw
admin = rw
OR
4. Run the following commands
#svnadmin create /data/svn/repos/test
#chown -R daemon:daemon /data/svn
#/
5 Open /usr/local/apache2/conf/httpd.config and add the following information.
< Location /svn>
DAV svn
SVNParentPath /data/svn/repos
AuthzSVNAccessFile /data/svn/accessfile
Satisfy Any
Require valid-user
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /data/svn/passwdfile
</Location>
6. Restart Apache ctl.
#apachectl stop
#apachectl start
7. Test
Open your web browser and type in “http://locolhost/svn/test” and now you should be able to see the folder tree.
Right now, you could use Subversion through command line and see all the contents via your web browser. But, in order to make it easier to use and control, you have to do more··
Step 7: SVN Manager
You could get the source package here. After you have untar it, just copy it to /usr/local/apache2/htdocs/.
#cd /usr/local/apache2/htdocs/svnmanager
#mv config.php.linux config.php
Open the “config.php” file and make those settings according to your installation process.
$htpassword_cmd = "/usr/local/apache2/bin/htpasswd";
$svn_cmd = "/usr/local/subversion/bin/svn";
$svnadmin_cmd = "/usr/local/subversion/bin/svnadmin --config-dir /tmp";
//Subversion locations
$svn_repos_loc = "/data/svn/repos";
$svn_passwd_file = "/data/svn/passwdfile";
$svn_access_file = "/data/svn/accessfile";
$svn_config_dir = "/tmp”
Step 8 : VersionControl_SVN and PEAR
The VersionControl_SVN could be got here. After you have untared it, just rename the name of the folder to “VersionControl” and put it somewhere. Then, ./configure, make and install.
Then, download PEAR from here. Untar it and just copy the folder into your VersionControl_SVN folder.
Then, run
#pear install –a VersionControl_SVN_0.3.1.tgz
Note: you may get a error while installing VersionControl_SVN. If you do, just download and install XML_Parser module first. In that case, the command you have to run is:
#pear install –a XML_Parser-1.0.tgz
#pear upgrade XML_Parser-1.3.2.tgz
#pear install –a VersionControl_SVN_0.3.1.tgz
Step 9: Create a table for SVNManager
#ervice mysqld restart
mysql
mysql> create database svn;
mysql> grant all privileges on svn.* to mstar@localhost identified by ‘123456;
mysql> flush privileges;
mysql> quit
Step 10: Setup the svnmanager connection string
Open the config.php, make sure the dsn connection is setup
$dsn = "mysql://svnmanager:123456@localhost/svn";
Finally.
Now, you could start to use svnmanager.
a) start your Apache
b) Open a new wev browser and type in “http://localhost/svnmanager” and login with temporary administrator account.
Set Subversion On Web
[x1] Can delete it