apr-1.5.1.tar.gz apr-util-1.5.3.tar.gz pcre-8.35.tar.gz httpd-2.4.9.tar.bz2 subversion-1.8.9.tar.bz2 zlib-1.2.8.tar.gz
scons-2.3.1.tar.gz
serf-1.3.5.tar.bz2
sqlite-amalgamation-3080403.zip
openssl-1.0.1g.tar.gz
tar zxvf ***.tar.gz tar jxvf ***.tar.bz2
unzip ***.zip
cd apr-1.5.1 ./configure --prefix=/usr/local/apr make sudo make install
cd apr-util-1.5.3 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make sudo make install
cd pcre-8.35 ./configure --prefix=/usr/local/pcre make make install
(安裝pcre報錯configure: error: You need a C++ compiler for C++ support)python
sudo apt-get install build-essential (Ubuntu默認並不提供C/C++的編譯環境)或者: yum install -y gcc gcc-c++
cd openssl-1.0.1g ./config -fPIC --prefix=/usr/local/openssl/ enable-shared make sudo make install
PIC就是position independent code,它的做用是代碼共享,若是不加-fPIC,則加載.so文件的代碼段時,代碼段引用的數據對象須要重定位, 重定位會修改代碼段的內容,這就形成每一個使用這個.so文件代碼段的進程在內核裏都會生成這個.so文件代碼段的copy.
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --with-openssl=/usr/local/openssl --with-ssl make make install
sudo /usr/local/apache/bin/apachectl start (stop|restart)
啓動httpd報錯:AH00558: httpd: Could not reliably determine the server's fully qualified domain name sudo vi /usr/local/apache/conf/httpd.conf 找到#ServerName new.host.name:80,去掉前面的#,重啓Apache
cd zlib-1.2.8/ ./configure --prefix=/usr/local/zlib make sudo make install
cd scons-2.3.1 sudo python setup.py install sudo ln -s /usr/local/bin/scons /usr/bin scons --version
cd serf-1.3.5 scons PREFIX=/usr/local/serf APR=/usr/local/apr APU=/usr/local/apr-util OPENSSL=/usr/local/openssl sudo scons install
配置scons的時候報錯:zlib.h: No such file or directory
sudo cp /usr/local/zlib/include/zlib.h /usr/local/include
sudo cp /usr/local/zlib/include/zconf.h /usr/local/include
cp -r sqlite-amalgamation-3080403 subversion-1.8.9/sqlite-amalgamation
cd subversion-1.8.9/ ./configure --prefix=/usr/local/svn --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-zlib=/usr/local/zlib --with-apxs=/usr/local/apache/bin/apxs --enable-maintainer-mode --with-openssl=/usr/local/openssl --with-serf=/usr/local/serf make sudo make install
報錯:configure: error: Subversion requires SQLite 在http://www.sqlite.org官網下載最新版的sqlite-amalgamation.zip,解壓縮到subversion-1.8.9目錄下新建的sqlite-amalgamation文件夾
報錯:libexpat.so.1: cannot open shared object file: No such file or directory
連接庫文件沒有找到的問題
sudo /etc/ld.so.conf
最後另起一行,添加該共享庫的絕對路徑
/usr/local/serf/lib
sudo ldconfig
sudo adduser apache sudo mkdir /usr/svn_root sudo mkdir /usr/svn_root/config sudo mkdir /usr/svn_root/repository sudo chmod -R 770 /usr/svn_root/ sudo chown -R apache:apache /usr/svn_root/
sudo cp /usr/local/svn/libexec/mod_dav_svn.so /usr/local/apache/modules/ sudo cp /usr/local/svn/libexec/mod_authz_svn.so /usr/local/apache/modules/ sudo vi /usr/local/apache/conf/httpd.conf
a修改User和Group爲apache帳號啓動 User apache Group apache b: 把下面兩個行前面的#號去掉,注意行前不能有空格: LoadModule dav_module modules/mod_dav.so LoadModule dav_fs_module modules/mod_dav_fs.so c: 在模塊加載的最後添加下面兩句: LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so d: 在配置文件最末尾添加: <Location /svn> DAV svn SVNListParentPath on SVNParentPath "/usr/svn_root/repository" AuthType Basic AuthName "Subversion repositories" AuthUserFile "/usr/svn_root/config/passwd.conf" AuthzSVNAccessFile "/usr/svn_root/config/authz.conf" Require valid-user </Location>
註釋: SVNParentPath------------------SVN的庫根目錄路徑,能夠在這下面建立多個版本庫; AuthUserFile-------------------用戶賬號信息文件; AuthzSVNAccessFile-------------權限控制文件
su apache 建立代碼庫repo1 /usr/local/svn/bin/svnadmin create /usr/svn_root/repository/repo1 建立svn用戶,第一次增長鬚要加-c參數(建立新的passwd.conf文件) /usr/local/apache/bin/htpasswd -c /usr/svn_root/config/passwd.conf wwl New password: Re-type new password: Adding password for user wwl /usr/local/apache/bin/htpasswd /usr/svn_root/config/passwd.conf test1 /usr/local/apache/bin/htpasswd /usr/svn_root/config/passwd.conf test2 /usr/local/apache/bin/htpasswd /usr/svn_root/config/passwd.conf test3
vi /usr/svn_root/config/authz.conf
[groups] admin = wwl CM = test1 test = test3,test2 [/] * = @admin = rw @CM = r [repo1:/] * = @CM = rw @test = r [repo1:/branches] @test = rw [repo1:/trunk] test2 = rw
[groups]表明組定義:「組名 = 用戶1,用戶2...」; [repo1:/]表明repo1配置庫,repo1是配置庫名稱; [repo1:/trunk]表明repo1配置庫下/trunk目錄; @ 符號,則表示這是個羣組權限設置; @ admin = rw表明admin 這個組的全部用戶有讀寫權限 test2 = rw表明test2這個用戶對trunk有讀寫權限 PS:注意svn的權限繼承關係
13.重啓apache:c++
增長repo1代碼庫裏面文件並上傳後,重啓apache會看到:sql
sudo /usr/local/apache/bin/apachectl restart
題外話:apache
每次輸svn、apache命令都要寫絕對地址好煩,ln是你的好幫手服務器
sudo ln -s /usr/local/svn/bin/* /usr/bin
sudo ln -s /usr/local/apache/bin/* /usr/bin
使用svn涉及到http路徑的話 例如:svn checkout http://192.168.186.144/svn/repo1
報錯svn: E170000: Unrecognized URL scheme for ${url}
緣由:從Subversion-1.8開始須要使用serf軟件包支持訪問http協議的版本庫
解決方法:安裝serf https://code.google.com/p/serf/
安裝serf1.3.x須要先安裝scons http://www.scons.org/dom
svn1.8.x須要serf1.2.1和以上的版本:
serf1.2.1使用make方式安裝
serf1.3.x使用scons方式安裝
任君選擇svn
若是不安裝serf,本機器做爲客戶端使用svn命令行涉及http路徑會有問題,可是不妨礙其做爲服務器端對外提供服務。ui