0018linux源碼安裝svn
阿新 • • 發佈:2018-07-26
note 軟件 toc tails l命令 源碼 usr 成功 源碼安裝 linux源碼安裝svn
參考資料
一、關閉SELINUX
二、開啟防火墻端口
三、安裝編譯工具包
yum list subversion #檢查是否安裝svn
參考資料
#configure參數參考 http://www.linuxfromscratch.org/blfs/view/svn/general/subversion.html #安裝步驟 https://blog.csdn.net/shgh_2004/article/details/77884876 說明: SVN(subversion)的運行方式有兩種: 一種是基於Apache的http、https網頁訪問形式; 還有一種是基於svnserve的獨立服務器模式。 SVN的數據存儲方式也有兩種:一種是在Berkeley DB數據庫中存儲數據;另一種是使用普通的文件FSFS存儲數據。 由於Berkeley DB方式在使用中有可能鎖住數據,一般建議使用FSFS方式更安全。 實現目的: 以svnserve的獨立服務器模式,使用FSFS數據存儲方式源碼編譯安裝配置SVN服務器。 具體操作: 操作系統:CentOS 7.x 服務器IP:192.168.1.151
一、關閉SELINUX
vi /etc/selinux/config #SELINUX=enforcing #註釋掉 #SELINUXTYPE=targeted #註釋掉 SELINUX=disabled #增加 :wq! #保存退出 setenforce 0 #使配置立即生效
二、開啟防火墻端口
firewall-cmd --zone=public --add-port=3690/tcp --permanent firewall-cmd --reload
三、安裝編譯工具包
yum install apr* autoconf automake bison cloog-ppl compat* cpp curl curl-devel fontconfig fontconfig-devel freetype freetype* freetype-devel gcc gcc-c++ gtk+-devel gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng* libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool libtool* libgomp libxml2 libxml2-devel libXpm* libtiff libtiff* libX* make mpfr ncurses* ntp openssl openssl-devel patch pcre-devel perl php-common php-gd policycoreutils ppl telnet t1lib t1lib* nasm nasm* wget zlib-devel zlib unzip perl-ExtUtils-Embed
yum grouplist
#Installed Groups: yum groupinstall -y ‘Development Tools‘ yum remove apr apr-util subversion subversion-libs #刪除系統中原有的svn及依賴包四、下載svn需要的依賴軟件包
說明:安裝svn需要的軟件包:apr apr-util serf scons openssl 軟件包存放目錄:/usr/local/src https://dist.apache.org/repos/dist/release/apr/apr-1.6.2.tar.gz https://dist.apache.org/repos/dist/release/apr/apr-util-1.6.0.tar.gz https://sourceforge.net/projects/scons/files/scons/2.5.1/scons-2.5.1.tar.gz https://www.openssl.org/source/openssl-1.1.0f.tar.gz https://fossies.org/linux/www/serf-1.3.9.tar.gz http://www.apache.org/dist/subversion/subversion-1.9.7.tar.gz http://www.sqlite.org/2017/sqlite-amalgamation-3200100.zip
1、安裝apr
#檢查是否已安裝rpm -qa apr#若沒安裝,則安裝:./configure --prefix=/usr/local/apr #配置make #編譯make install #安裝#make && make insatll
2、安裝apr-util
#檢查是否已安裝rpm -qa apr-util#若沒安裝,則安裝:./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprmake && make install
3、安裝scons
#檢查是否已安裝rpm -qa scons#若沒安裝,則安裝:cd scons-2.5.1python setup.py install #配置安裝
4、安裝openssl
#檢查是否已安裝rpm -qa openssl#若沒安裝,則安裝:cd openssl-1.1.0fCFLAGS=-fPIC ./config --prefix=/home/programs/openssl enable-sharedmake && make installvi /etc/profile #添加系統環境變量export PATH=$PATH:/home/programs/openssl/bin:wq! #保存退出source /etc/profile #使配置生效ln -s /home/programs/openssl/include/openssl /usr/include/openssl #添加系統軟連接
5、安裝serf
#檢查是否已安裝rpm -qa serf#若沒安裝,則安裝:#rpm -aql apr* 查看apr安裝目錄#rpm -aql openssl 查看openssl安裝目錄 whereis opensslcd serf-1.3.9scons PREFIX=/usr/local/serf APR=/usr/local/apr/bin/apr-1-config APU=/usr/local/apr-util/bin/apu-1-config OPENSSL=/usrscons install#拷貝文件到系統目錄cp /usr/local/serf/lib/libserf-1.so* /usr/local/lib/
6、安裝svn
tar -zxvf subversion-1.9.7.tar.gz#解壓sqlite-amalgamation軟件包到sqlite-amalgamation目錄unzip sqlite-amalgamation-3200100.zip#移動目錄下文件mv sqlite-amalgamation-3200100 /data/soft/subversion-1.10.0/sqlite-amalgamationrm sqlite-amalgamation-3200100 -rf#配置./configure --prefix=/usr/local/svn --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config --with-serf=/usr/local/serf --with-openssl=/usr --enable-mod-activation --with-utf8proc=internal --with-lz4=internalmake #編譯make install #安裝vi /etc/profile #添加系統環境變量,添加到最後一行export PATH=$PATH:/usr/local/svn/bin:wq! #保存退出source /etc/profile #使配置立刻生效# whereis libserf-1.so.1libserf-1.so: /usr/local/lib/libserf-1.so /usr/local/lib/libserf-1.so.1vi /etc/ld.so.conf #編輯加入libexpat.so.1的目錄,如下:/usr/local/lib/:wq! #保存退出ldconfig #使配置生效
7、測試安裝是否成功:
svn help #查看svn幫助信息svnserve --version #查看svn版本信息svn --version
NOTE:
五、配置svn1、configure執行報錯解決rm: cannot remove `libtoolT‘: No such file or directoryhttps://blog.csdn.net/a673341766/article/details/9078011在configure裏面 RM=‘$RM -f‘ 這裏的$RM後面一定有一個空格。 如果後面沒有空格,直接連接減號,就依然會報錯。把RM=‘$RM‘改為RM=‘$RM -f‘2、安裝svn,執行config報錯: requires LZ4 >= r129,增加--with-lz4=internal參數,參考http://www.linuxfromscratch.org/blfs/view/svn/general/subversion.html./configure --prefix=/usr/local/svn --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config --with-serf=/usr/local/serf --with-openssl=/usr --enable-mod-activation --with-lz4=internal3、configure: error: Subversion requires UTF8PROC,參考http://www.linuxfromscratch.org/blfs/view/svn/general/subversion.html--with-utf8proc=internal
1、創建svn代碼庫
mkdir -p /data/file/svn/repo #創建目錄svnadmin create /data/file/svn/repo #創建svn代碼庫#上面的命令執行完成之後,會自動建立svn庫,在/data/file/svn/repo文件夾含了conf,db,format,hooks,locks,README.txt等文件。#說明svn代碼庫創建成功。
2、配置svn代碼庫
(1)vi /data/file/svn/repo/conf/svnserve.conf #配置全局文件,在最後添加以下代碼
[general]#禁止匿名訪問,設置為none。默認為read,參數:read,write,noneanon-access=none#授權用戶寫權限auth-access=write#用戶賬號密碼文件路徑,可以寫絕對路徑password-db=passwd#訪問控制權限文件路徑,可以寫絕對路徑authz-db=authz#每個SVN項目的認證命,會在認證提示裏顯示,建議寫項目名稱。realm=svn
:wq! #保存退出
(2)vi /data/file/svn/repo/conf/passwd #配置用戶密碼
[users]# harry = harryssecret# sally = sallyssecretosyunwei=123456
(3)vi /mnt/svn/conf/authz #配置權限控制文件,設置用戶可以訪問的目錄
[groups]admin = osyunweiusers = test,test2[/]@admin = rw* = r:wq! #保存退出#[/]代表根目錄下所有的資源
3、啟動svn
svnserve -d -r /data/file/svn --listen-port 3690ps -ef|grep svn|grep -v grep #查看svn進程root 12538 1 0 14:40 ? 00:00:00 svnserve -d -r /mnt/svnnetstat -ln |grep 3690 #檢查svn端口tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTENkillall svnserve #關閉svn服務
4、設置svn服務開機啟動,註:yum search killall,腳本中killall命令依賴
vi /etc/rc.d/init.d/svn #編輯,添加以下代碼 whereis svnserve
#!/bin/sh# chkconfig: 2345 85 85# processname: svnsvn_port=3690svn_home=/mnt/svnif [ ! -f "/usr/local/svn/bin/svnserve" ]thenecho "svnserver startup: cannot start"exitficase "$1" instart)echo "Starting svnserve..."/usr/local/svn/bin/svnserve -d -r $svn_home --listen-port $svn_portecho "Successfully!";;stop)echo "Stoping svnserve..."killall svnserveecho "Successfully!";;restart)$0 stop$0 start;;*)echo "Usage: svn { start | stop | restart } "exit 1esac:wq! #保存退出chmod +x /etc/rc.d/init.d/svn #添加執行權限chkconfig svn on #開啟自啟動service svn stopservice svn start
5、測試svn
svn checkout svn://192.168.123.7/repo --username=osyunwei --password=123456 #將文件下載到本地目錄svn checkout svn://192.168.123.7 --username=osyunwei --password=123456svn update --username=osyunwei --password=123456 #更新上次修改之後的版本庫
NOTE:svn提交的時候強制寫註釋cd /mnt/svn/hookscp pre-commit.tmpl pre-commitchmod 777 pre-commitvi pre-commit#!/bin/shREPOS="$1"TXN="$2"SVNLOOK=/usr/local/bin/svnlook #修改為pre-commit中的提示路徑,服務器安裝的subversion目錄 whereis svnlookLOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c`if [ "$LOGMSG" -lt 5 ];thenecho -e "註釋信息不能為空且不少於5個字!" 1>&2exit 1fiexit 0
0018linux源碼安裝svn