Source code installation of apache+subversion version controller under ubuntu

1. Install the required libraries

1、sudo -s

 

apt-get install build-essential automake autoconf libtool libssl-dev libserf-1-1

 

 

 

2. Download the required download source code

httpd-2.2.19.tar.gz  http://httpd.apache.org/download.cgi

subversion-1.6.6.tar.gz  http://archive.apache.org/dist/subversion/

expat-2.2.0.tar.bz2  https://sourceforge.net/projects/expat/

apr-1.4.5.tar.gz  http://apr.apache.org/

apr-util-1.3.12.tar.gz http://apr.apache.org/

zlib-1.2.5.tar.gz  http://zlib.net/fossils/

neon-0.28.2.tar.gz http://www.webdav.org/neon/

 

2. Install apache

1. Install the required plugins

tar zxvf apr-1.3.5.tar.gz

cd apr-1.3.5

./configure --prefix=/usr/local/apr && make && make install

cd ../

 

 

tar jxvf apr-util-1.3.7.tar.gz2

cd apr-util-1.3.7

./configure --with-apr=/usr/local/apr && make && make install

cd ../

 

tar jxvf expat-2.2.0.tar.bz2

cd expat-2.2.0

./configure && make && make install

cd ../

 

tar zxvf zlib-1.2.8.tar.bz

cd zlib-1.2.8

./configure  --prefix=/usr/local/zlib && make && make install

cd ../

 

 

2. Install apache

tar jxvf httpd-2.2.11.tar.gz2

cd httpd-2.2.11

./configure --prefix=/usr/local/apache2 --enable-dav --enable-modules=so --enable-maintainer-mode --enable-rewrite --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config && make && make install

cd ..

Start the Apache service:

/usr/local/apache2/bin/apachectl start

 

View http://localhost/ with a browser and get It works!

It means that apache has been configured successfully.

 

3 Install neon-0.28.2.tar.gz

tar zxvf neon-0.28.2.tar.gz

cd neon-0.28.2

./configure --prefix=/usr/local/neon

 

At this point, you need to modify the Makefile file:

Configure ./src/Makefile and change CFLAGS = -g -O2 to CFLAGS = -fPIC -g -O2

 

make && make install

cd ../

 

4 Install Subversion

tar jxvf subversion-1.5.0.tar.gz2

tar jxvf subversion-deps-1.5.0.tar.gz2

tar zxvf openssl-1.0.1o.tar.gz

cd subversion-1.5.0

rm -rf apr

rm -rf apr-util

 

./configure --with-apxs=/usr/local/apache2/bin/apxs --prefix=/usr/local/subversion --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config --with-neon=/usr/local/neon  --enable-maintainer-mode --with-zlib=/usr/local/zlib --with-openssl=/data/soft/openssl-1.0.1o

 

Note: --with-openssl=/data/soft/openssl-1.0.1o points to the path to decompress the source package, not the path to install, otherwise an error will be reported.

 

make && make install

 

Note:

1) Since the APR in the subversion-deps package is 0.9.x, when compiling svn, it is necessary to delete the apr and apr-util extracted from deps, and use the ones provided in apache 2.2 instead;

2) When ./configure, you must add –with-neon=/usr/local/neon, otherwise it will prompt an error (it was emphasized when installing neon);

3) View the Apache configuration file: /usr/local/apache2/conf/httpd.conf

See the following two modules indicating that the installation was successful

LoadModule dav_svn_module modules/mod_dav_svn.so

LoadModule authz_svn_module modules/mod_authz_svn.so

 

 

3.1 

add apache user

/usr/sbin/groupadd apache

/usr/sbin/useradd -g apache -s /usr/sbin/nologin apache 

 

 

 

Configure the Apache configuration file httpd.conf,

Modify the httpd.conf file to

 

User daemon

Group daemon

change into

 

User apache

Group apache

 

 

 

Modify the path of the svn site

Will

DocumentRoot "/usr/local/apache2/htdocs"

change into

DocumentRoot "/data/svnroot"

 

<Directory "/usr/local/apache2/htdocs">

change into

<Directory "/data/svnroot">

 

find

Options Indexes FollowSymLinks

change into

Options -Indexes FollowSymLinks

 

 

Press shift+g to the end of httpd.conf and add content

<Location /svn>

        DAV svn

        SVNParentPath /data/svnroot

        AuthType Basic

        AuthName "Subversion repository"

        AuthUserFile /data/svndataconf/passwd

        AuthzSVNAccessFile /data/svndataconf/auth

        Require valid-user

</Location>

 

 

Open the apache site configuration file extra/httpd-vhosts.conf

vi extra/httpd-vhosts.conf, go to the bottom of the page, delete the initial site configuration information

Enter the following

######################################

<VirtualHost *:80>

    ServerAdmin [email protected]

    DocumentRoot "/data/svnroot"

    ServerName svn.abc.com

    ErrorLog "logs/svn.log"

</VirtualHost>

######################################

 

3.2 Create passwd file and auth file

mkdir /data/svndataconf/

chown -R apache:apache /data/svndataconf/

vi /data/svndataconf/auth

Enter the following

######################################

[groups]

 

[cms:/]

user1 =rw

######################################

 

 

Create passwd and create user 

/usr/local/apache2/bin/htpasswd -c /data/svndataconf/passwd user1

 

new user

/usr/local/apache2/bin/htpasswd -m /data/svndataconf/passwd user2

 

Create the initial data in the import library

mkdir /data/svnroot

touch /data/svnroot/index.html

chown -R apache:apache /data/svnroot

mkdir /data/svndataconf/import

mkdir /data/svndataconf/import/trunk

mkdir /data/svndataconf/import/data

mkdir /data/svndataconf/import/result

touch /data/svndataconf/import/trunk/test.txt

 

 

创建库:/usr/local/subversion/bin/svnadmin create /data/svnroot/cms

 

Import initial folder: /usr/local/subversion/bin/svn import /data/svndataconf/import/ file:///data/svnroot/cms/ -m "cms subversion 1"

 

Give permission: chown apache:apache -R /data/svnroot/

 

重启apache /usr/local/apache2/bin/apachectl restart

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326400054&siteId=291194637