apache+mysql+php+svn自动发布服务器搭建.docx
《apache+mysql+php+svn自动发布服务器搭建.docx》由会员分享,可在线阅读,更多相关《apache+mysql+php+svn自动发布服务器搭建.docx(23页珍藏版)》请在冰豆网上搜索。
![apache+mysql+php+svn自动发布服务器搭建.docx](https://file1.bdocx.com/fileroot1/2022-11/23/7b6650d0-0114-4c8d-a7f0-6e70e639b03e/7b6650d0-0114-4c8d-a7f0-6e70e639b03e1.gif)
apache+mysql+php+svn自动发布服务器搭建
服务器搭建步骤
系统:
linux2.6内核
软件:
httpd-2.2.17.tar.gz,mysql-5.1.54-linux-i686-glibc23.tar.gz,php-5.2.16.tar.gz,subversion-1.5.9.tar.gz,subversion-deps-1.5.9.tar.gz,openssl-1.0.0c.tar.tar
注:
如无特别说明,安装顺序由上到下,安装前用户为root,为了复制方便,命令前不加#路径,【】部分可省略,对于外网服务器,对apache和php只加载有效使用的模块,并不安装subversion。
Apr,apr-util,neon,serf,zlib安装包在subversion-deps-1.5.9.tar.gz内。
所有目标安装路径为/usr/local/应用名称(仅个人习惯,可更改安装中的prefix选项)
安装前准备(如无以下包需提前安装)
Apr
./configure--prefix=/usr/local/apr
Make&&makeinstall
Apr-util
./configure--with-apr=/usr/local/apr
Make&&makeintall
Neon
./configure–prefix=/usr/local/neon
Make&&makeinstall
Zlib
./configure–prefix=/usr/local/neon
Make&&makeinstall
Serf
./configure–prefix=/usr/local/neon
Make&&makeinstall
httpd-2.2.17.tar.gz安装
tar–zxvfhttpd-2.2.17.tar.gz
cdhttpd-2.2.17
./configure-prefix=/usr/local/httpd-2.2.17-enable-dav-enable-so-enable-maintainer-mode-enable-rewrite--enable-speling=shared
Make
[Maketest]
Makeinstall
/usr/local/httpd-2.2.17/bin/apachectlstart
mysql-5.1.54-linux-i686-glibc23.tar.gz
tar–zxvfmysql-5.1.54-linux-i686-glibc23.tar.gz
mvmysql-5.1.54-linux-i686-glibc23/usr/local/mysql-5.1.54-3306
cd/usr/local/mysql-5.1.54-3306
groupaddmysql
useradd–gmysqlmysql
cp./support-files/my-ff
./scripts/mysql_install_db--user=mysql
chown-Rroot.
chown-Rmysqldata
chgrp-Rmysql.
/usr/local/mysql-5.1.54-3306/bin/mysqld_safe--user=mysql&
./bin/mysqladmin-urootpassword'helloehsy'
./bin/mysqladmin-uroot-pehsyvvgoodshutdown
vi/usr/local/mysql-5.1.54-3306/support-files/mysql.server
修改如下内容:
basedir=/usr/local/mysql-5.1.54-3306
datadir=$basedir/data
cp/usr/local/mysql-5.1.54-3306/support-files/mysql.server/etc/rc.d/init.d/mysql-3306
chmod+x/etc/rc.d/init.d/mysql-3306
chkconfig--addmysql-3306
servicemysql-3306stop/start/restart
注:
如安装在其它端口,在cp./support-files/my-ff后执行如下操作
vif
[client]
#password=your_password
port=3309
socket=/tmp/mysql-3309.sock
#Herefollowsentriesforsomespecificprograms
#TheMySQLserver
[mysqld]
port=3309
socket=/tmp/mysql-3309.sock
#./scripts/mysql_install_db--user=mysql
向下安装步骤同3306,请自行更改相关配置
mysql-S/tmp/mysql-3309.sock-uroot-phelloehsy
php-5.2.16.tar.gz
tar–zxvfphp-5.2.16.tar.gz
mkdir/usr/local/php-5.2.16
cdphp-5.2.16
cpphp.ini-dist/usr/local/php-5.2.16/php.ini
./configure--with-apxs2=/usr/local/httpd-2.2.17/bin/apxs--with-mysql=/usr/local/mysql-5.1.54--prefix=/usr/local/php-5.2.16--with-config-file-path=/usr/local/php-5.2.16/php.ini
带mhash的插件
./configure--with-apxs2=/usr/local/httpd-2.2.17/bin/apxs--with-mysql=/usr/local/mysql-5.1.54-3306--prefix=/usr/local/php-5.2.16--with-config-file-path=/usr/local/php-5.2.16/php.ini--with-mhash=/usr/local/mhash
Make
[maketest]
Makeinstall
subversion-1.5.9.tar.gz
tar–zxvfsubversion-1.5.9.tar.gz
cdsubversion-1.5.9
./configure--with-apr=/usr/local/apr/bin/apr-1-config--with-apr-util=/usr/local/apr/bin/apu-1-config--with-apxs=/usr/local/httpd-2.2.17/bin/apxs--prefix=/usr/local/subversion-1.5.9--with-ssl=/usr/local/openssl--with-neon=/usr/local/neon--with-serf=/usr/local/serf
Make
Makeinstall
svnadmin–version
vi/usr/local/httpd-2.2.17/conf/httpd.conf
#在最后加上
DAVsvn
SVNParentPath/usr/svnroot/repository/
AuthzSVNAccessFile/usr/svnroot/repository/authz.conf
AuthTypeBasic
AuthName"EHSYsaidthatyourareMIMI-BOYfromSubversion"
AuthUserFile/usr/svnroot/repository/authfile
Requirevalid-user
/usr/local/subversion-1.5.9/bin/svnadmincreate/home/svnroot/repository/ehsy_old
#一般会在库内创建三个文件夹branches,tags和trunk
chmod700/usr/svnroot/repository
/usr/local/httpd-2.2.17/bin/htpasswd[-c]/usr/svnroot/repository/authfileadmin
#第一次创建使用-c
vi/usr/svnroot/repository/authz.conf
#参考如下内容自行设定
[ehsy_old:
/]//这表示,仓库ehsy_old的根目录下的访问权限
admin=rw//ehsy_old仓库admin用户具有读和写权限
[/]//这个表示在所有仓库的根目录下
*=r//这个表示对所有的用户都具有读权限
#[groups]//这个表示群组设置
#svn1-developers=admin,bowen//这个表示某群组里的成员
#svn2-developers=rick,andy
#[svn1:
/]
#@svn1-developers=rw//如果在前面加上@符号,则表示这是个群组权限设置
/usr/local/httpd-2.2.17/bin/apachectlrestart
chowndaemon.daemon-R/usr/svnroot
svnserve–d
#svnimporttmp/svn:
//localhost/svn/ehsy_old-m"init"
#将下面的conf文件夹复制到/usr/svnroot/repositoty目录下
#将下面的[同步]post-commit文件复制到/usr/svnroot/repository/ehsy_old/hooks目录下
#配置其中的文件,修改读取的配置文件路径指向到conf目录下的文件中,并修改其所指向的配置文件
chowndeamon.daemonpost-commit
chmoda+xpost-commit
同步外网服务器
#如果rsync密码文件是/etc/rsync.pwd
Chmod–R0600/etc/rsync.pwd
#请复制下面的“同步post-commit”到/usr/svnroot/repository/ehsy_old/hooks目录下
Cp同步post-commit/usr/svnroot/repository/ehsy_old/hooks/post-commit
自动导出到网站目录
#请将网站目录设置为daemon用户
Chmod–Rdaemon.daemon/var/www/
配置文件内容
ServerRoot"/usr/local/httpd-2.2.17"
#
#Listen:
AllowsyoutobindApachetospecificIPaddressesand/or
#ports,insteadofthedefault.Seealsothe
#directive.
#
#ChangethistoListenonspecificIPaddressesasshownbelowto
#preventApachefromglommingontoallboundIPaddresses.
#
#Listen12.34.56.78:
80
Listen80
#
#DynamicSharedObject(DSO)Support
#
#TobeabletousethefunctionalityofamodulewhichwasbuiltasaDSOyou
#havetoplacecorresponding`LoadModule'linesatthislocationsothe
#directivescontainedinitareactuallyavailable_before_theyareused.
#Staticallycompiledmodules(thoselistedby`httpd-l')donotneed
#tobeloadedhere.
#
#Example:
#LoadModulefoo_modulemodules/mod_foo.so
#
#LoadModulespeling_modulemodules/mod_speling.so
#LoadModulerewrite_modulemodules/mod_rewrite.so
LoadModulephp5_modulemodules/libphp5.so
LoadModuledav_svn_modulemodules/mod_dav_svn.so
LoadModuleauthz_svn_modulemodules/mod_authz_svn.so
AddTypeapplication/x-httpd-php.php
mpm_netware_module>
mpm_winnt_module>
#
#Ifyouwishhttpdtorunasadifferentuserorgroup,youmustrun
#httpdasrootinitiallyanditwillswitch.
#
#User/Group:
Thename(or#number)oftheuser/grouptorunhttpdas.
#Itisusuallygoodpracticetocreateadedicateduserandgroupfor
#runninghttpd,aswithmostsystemservices.
#
Userdaemon
Groupdaemon
#'Main'serverconfiguration
#
#Thedirectivesinthissectionsetupthevaluesusedbythe'main'
#server,whichrespondstoanyrequeststhataren'thandledbya
#definition.Thesevaluesalsoprovidedefaultsfor
#anycontainersyoumaydefinelaterinthefile.
#
#Allofthesedirectivesmayappearinsidecontainers,
#inwhichcasethesedefaultsettingswillbeoverriddenforthe
#virtualhostbeingdefined.
#
#
#ServerAdmin:
Youraddress,whereproblemswiththeservershouldbe
#e-mailed.Thisaddressappearsonsomeserver-generatedpages,such
#aserrordocuments.e.g.admin@your-
#
ServerAdminyou@
#
#ServerNamegivesthenameandportthattheserverusestoidentifyitself.
#Thiscanoftenbedeterminedautomatically,butwerecommendyouspecify
#itexplicitlytopreventproblemsduringstartup.
#
#Ifyourhostdoesn'thavearegisteredDNSname,enteritsIPaddresshere.
#
#ServerName:
80
#
#DocumentRoot:
Thedirectoryoutofwhichyouwillserveyour
#documents.Bydefault,allrequestsaretakenfromthisdirectory,but
#symboliclinksandaliasesmaybeusedtopointtootherlocations.
#
DocumentRoot"/var/www"
#
#EachdirectorytowhichApachehasaccesscanbeconfiguredwithrespect
#towhichservicesandfeaturesareallowedand/ordisabledinthat
#directory(anditssubdirectories).
#
#First,weconfigurethe"default"tobeaveryrestrictivesetof
#features.
#
OptionsFollowSymLinks
AllowOverrideNone
Orderdeny,allow
Denyfromall
#
#Notethatfromthispointforwardyoumustspecificallyallow
#particularfeaturestobeenabled-soifsomething'snotworkingas
#youmightexpect,makesurethatyouhavespecificallyenabledit
#below.
#
#
#ThisshouldbechangedtowhateveryousetDocumentRootto.
#
#
#PossiblevaluesfortheOptionsdirectiveare"None","All",
#oranycombinationof:
#IndexesIncludesFollowSymLinksSymLinksifOwnerMatchExecCGIMultiViews
#
#Notethat"MultiViews"mustbenamed*explicitly*---"OptionsAll"
#doesn'tgiveittoyou.
#
#TheOptionsdirectiveisbothcomplicatedandimportant.Pleasesee
#http:
//httpd.apache.org/docs/2.2/mod/core.html#options
#formoreinformation.
#
OptionsIndexesFollowSymLinks
#
#AllowOverridecontrolswhatdirectivesmaybeplacedin.htaccessfiles.
#Itcanbe"All","None",oranycombinationofthekeywords:
#OptionsFileInfoAuthConfigLimit
#
AllowOverrideAll
#
#Controlswhocangetstufffromthisserver.
#
Orderallow,deny
Allowfromall
#
#DirectoryIndex:
setsthefilethatApachewillserveifadirectory
#isrequested.
#
DirectoryIndexindex.html
#
#Thefollowinglinesprevent.htaccessand.htpasswdfilesfrombeing
#viewedbyWebclients.
#
Orderallow,deny
Denyfromall
SatisfyAll
#
#ErrorLog:
Thelocationoftheerrorlogfile.
#IfyoudonotspecifyanErrorLogdirectivewithina
#container,errormessagesrelatingtothatvirtualhostwillbe
#loggedhere.Ifyou*do*defineanerrorlogfilefora
#container,thathost'serrorswillbeloggedthereandnothere.
#
ErrorLog"logs/error_log"
#
#LogLevel:
Controlthenumberofmessagesloggedtotheerror_log.
#Possiblevaluesinclude:
debug,info,notice,warn,error,crit,
#alert,emerg.
#
LogLevelwarn