欢迎访问本站,祝大家玩得愉快。

Ubuntu上Nginx+Apache+SVN+PHP+IF.SVNADMIN搭建SVN服务器

服务器 kany.wang 3787℃ 0评论

环境简介

Ubuntu:Ubuntu 12.04

安装路径:/usr/local/softs/

安装权限:所有软件均在root权限下操作

安装基础环境

我使用的是Ubuntu的系统,更换系统的源地址:

#备份当前的地址
mv /etc/apt/sources.list{,-bak}
vi /etc/apt/sources.list
#清空所有内容,并选择当前的源地址:
deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
#注意这个 precise 是当前的系统版本,也就是代。一般修改这个名称就可以让系统的版本对应。

配置完成后执行

apt-get update

 完成之后请执行

apt-get install autoconf libtool openssl libssl-dev make gcc g++ libxml2 libxml2-dev expat libaio1  libjpeg-dev libpng12-dev libgd2-xpm-dev libt1-dev libmcrypt-dev libmysql++-dev libxslt1-dev vim unzip libpcre3-dev

 安装Apache2

准备软件:apr-1.5.1.tar.gz、apr-util-1.5.4.tar.gz、httpd-2.4.12.tar.gz

tar -zxvf apr-1.5.1.tar.gz -C /usr/local/softs/
cd /usr/local/softs/apr-1.5.1
./configure --prefix=/usr/local/softs/apr #(配置安装路径为:/usr/local/softs/apr)
make;make install;

tar  -zxvf apr-util-1.5.4.tar.gz -C /usr/local/softs/
cd /usr/local/softs/apr-util-1.5.4
./configure --prefix=/usr/local/softs/apr-util --with-apr=/usr/local/softs/apr/ #(配置安装路径为:/usr/local/softs/apr-util)
make;make install;

tar -zxvf httpd-2.4.12.tar.gz -C /usr/local/softs/
cd httpd-2.4.12
./configure --prefix=/usr/local/softs/apache2 --with-apr=/usr/local/softs/apr/bin/apr-1-config --with-apr-util=/usr/local/softs/apr-util/bin/apu-1-config --with-pcre=/usr/local/softs/pcre --enable-so --enable-dav --enable-maintainer-mode --enable-rewrite
make;make install;
cp /usr/local/softs/apache2/bin/apachectl /etc/init.d/httpd;
/etc/init.d/httpd restart;
ps aux|grep httpd;

  

apache2暂时就配置到这里。最后修改完成之后再来处理。

安装SVN软件

准备软件:subversion-1.8.13.tar.gz、sqlite-amalgamation-3080900.zip

tar subversion-1.8.13.tar.gz -C /usr/local/softs/
cd /usr/local/softs/subversion-1.8.13
mv sqlite-amalgamation-3080900.zip /usr/local/softs/subversion-1.8.13
unzip sqlite-amalgamation-3080900.zip
mv sqlite-amalgamation-3080900 sqlite-amalgamation

如果当前未使用apache2则使用下面这一句:

./configure --prefix=/usr/local/softs/subversion --with-openssl=/usr/bin/openssl --without-serf --with-apr=/usr/local/softs/apr/ --with-apr-util=/usr/local/softs/apr-util/

 当前使用的是:

./configure --prefix=/usr/local/softs/subversion --with-apxs=/usr/local/softs/apache2/bin/apxs --with-openssl=/usr/bin/openssl --without-serf --with-apr=/usr/local/softs/apr/ --with-apr-util=/usr/local/softs/apr-util/ --enable-maintainer-mode --with-zlib
cp /usr/local/softs/subversion/libexec/* /usr/local/softs/apache2/modules/
vi /usr/local/softs/apache2/conf/httpd.conf

 编译之后会生成Apache的svn插件:

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/repos			#硬盘上svn的路径
    AuthType Basic
    AuthName "Authorization SVN"
    AuthzSVNAccessFile /var/www/svn/etc/authz		#访问权限文件
    AuthUserFile /var/www/svn/etc/passwd		#用户文件安
    Require valid-user
</Location>

 创建对应的文件目录,配置SVN的目录:

mkdir -p /var/www/svn
mkdir /var/www/svn/{etc,repos}
touch /var/www/svn/etc/authz
touch /var/www/svn/etc/passwd

目前就处理到这里,等待安装php后整合。

安装Tengine

准备软件:pcre-8.36.tar.gz、tengine-2.1.0.tar.gz

tar -zxvf pcre-8.36.tar.gz -C /usr/local/softs/
cd pcre-8.36
./configure --prefix=/usr/local/softs/pcre
make;make install;

tar -zxvf tengine-2.1.0.tar.gz -C /usr/local/softs/
cd tengine-2.1.0
./configure --prefix=/usr/local/softs/nginx --with-pcre=/usr/local/softs/pcre-8.36
make;make install;

安装Php环境

准备软件:bzip2-1.0.6.tar.gz、curl-7.42.1.tar.gz、php-5.5.12.tar.gz

tar -zxvf bzip2-1.0.6.tar.gz -C /usr/local/softs/
cd bzip2-1.0.6
vi Makefile

  

修改之后的截图为:

  

#编译当前的bzip
make;make install;

#编译当前的curl插件
tar -zxvf curl-7.42.1.tar.gz -C /usr/local/softs/
cd curl-7.42.1
./configure
make;make install;

#编译当前的php5.5的源码
tar -zxvf php-5.5.12.tar.gz -C /usr/local/softs/
cd php-5.5.12
./configure --prefix=/usr/local/softs/php5 --with-config-file-path=/usr/local/softs/php5/etc --with-curl --with-pear --with-gd --with-jpeg-dir --with-png-dir --with-zlib --with-xpm-dir --with-freetype-dir --with-t1lib --with-mcrypt --with-mhash --with-mysql --with-mysqli --enable-pdo --with-pdo-mysql --with-openssl --with-xmlrpc --with-xsl --with-gettext --with-fpm-user=www --with-fpm-group=www-data --enable-fpm --enable-exif --enable-wddx --enable-zip --enable-bcmath -with-bz2 --enable-calendar --enable-ftp --enable-mbstring --enable-soap --enable-sockets --enable-shmop --enable-dba --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-debug --enable-maintainer-zts --enable-embed
make;make install;

#处理当前php安装完成之后的配置文件
cp /usr/local/softs/php-5.5.12/sapi/fpm/init.d.php-fpm /usr/local/softs/php5/etc
cp /usr/local/softs/php-5.5.12/sapi/fpm/php-fpm /usr/local/softs/php5/etc
cp /usr/local/softs/php-5.5.12/sapi/fpm/php-fpm.conf /usr/local/softs/php5/etc
cp /usr/local/softs/php-5.5.12/php.ini-development /usr/local/softs/php5/etc/php.ini

#添加一个组并将www用户添加到www-data组中
groupadd www-data;
useradd --shell /sbin/nologin -g www-data www;

 配置SvnAdmin

准备软件:svnadmin-1.6.2.zip

cp svnadmin-1.6.2.zip /usr/local/softs/nginx/html/;
cd /usr/local/softs/nginx/html/;
unzip svnadmin-1.6.2.zip;

mv iF.SVNAdmin-stable-1.6.2 svnadmin;
#修改Nginx配置整合php;
vi /usr/local/softs/nginx/conf/nginx.conf;

#修改前
#user  nobody;
worker_processes  1;

#修改后
user  www www-data;
worker_processes  4;

#找到配置文件中的php部分,修改为如下数据:
location ~ \.php$ {
#    root   html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    includefastcgi_params;
}

安装IF.SVNADMIN

3

目前就写这么多,基本上按照这个文档你能够成功了。一定要注意文中使用的软件版本,如果有版本变化,可能会造成安装不成功。

联系方式

  • 小伙伴群:J2EE技术交流

打赏

转载请注明:懒人屋 » Ubuntu上Nginx+Apache+SVN+PHP+IF.SVNADMIN搭建SVN服务器

喜欢 (0)
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(2)个小伙伴在吐槽
  1. 我承认,你是个好程序员!可惜我看不懂。
    酸菜2015-06-24 19:39 回复
  2. 好程序员,可是我看不懂。
    酸菜2015-06-24 19:39 回复