📄 1491.html
字号:
<input type=hidden value=result name=action2>
<input type=radio checked value=title name=type>标题
<input type=radio value=content name=type>内容
<input type=image src="images/button_go.gif" tppabs="http://www.linuxhero.com/docs/images/button_go.gif" border=0 name=image2>
</font></div>
</td>
</tr>
<tr>
<td noWrap>
<div align="center">
<input maxlength=100 size=30 name=keyword2>
</div>
</td>
</tr></tbody>
</table>
</form>
</TD>
<TD rowSpan=2><IMG src="images/header_r1_c7.gif" tppabs="http://www.linuxhero.com/docs/images/header_r1_c7.gif" width=26 border=0 name=header_r1_c7></TD>
<TD><IMG height=83 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1 border=0></TD></TR>
<TR>
<TD background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif"><IMG height=22
src="images/header_r2_c1.gif" tppabs="http://www.linuxhero.com/docs/images/header_r2_c1.gif" width=296 border=0
name=header_r2_c1></TD>
<TD background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colSpan=5>
<DIV align=right><FONT class=normalfont>当前位置:
<A href="index.html" tppabs="http://www.linuxhero.com/docs/index.html">本站首页</A>
<font color="#FF6699">>></font>
<A href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</A> | <A href="copyright.html" tppabs="http://www.linuxhero.com/docs/copyright.html">版权说明</A></font></DIV>
</TD>
<TD><IMG height=22 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1
border=0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=10 cellPadding=0 width="100%" bgColor=#ffffff
border=0>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
<TR>
<TD vAlign=top align=middle width="60%">
<TABLE cellSpacing=0 cellPadding=0 width="100%"
background="images/back.gif" tppabs="http://www.linuxhero.com/docs/images/back.gif" border=0>
<TBODY>
<TR>
<TD vAlign=top width="80%">
<DIV align=center>
<FORM action="search.html" tppabs="http://www.linuxhero.com/docs/search.html" method=get>
</FORM>
<TABLE cellSpacing=0 cellPadding=0 width="95%"
border=0><TBODY>
<TR>
<TD background="images/bgi.gif" tppabs="http://www.linuxhero.com/docs/images/bgi.gif"
height=30></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=3 width="95%"
align=center border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%"
border=0>
<TBODY>
<TR>
<TD vAlign=top>
<p><FONT class=normalfont><B><font color=blue>小组开发环境搭建备忘: apache+ftp+cvs+samba</font></B></FONT><BR><FONT class=smallfont color=#ff9900>2004-04-23 15:18 pm</FONT><BR><FONT class=normalfont>作者:车东 chedong@bigfoot.com<br>来自:Linux知识宝库<br>联系方式:无名<br><br>关键词:linux develop environment cvs version contral gnats bug tracking samba dhcpd wget </p>
<p>内容摘要:本文主要介绍一些小组开发环境搭建中经常会遇到一些服务器服务设置,这些服务很多都是鉴于大部分的开发客户端仍然是Windows设置的,每个服务都提供了简单的基本配置示范。包括:</p>
<ul>
<li>IP管理(DHCP):服务器IP地址的管理和解析(结合SAMBA的WINS服务),开发客户端的IP管理;</li>
<li>WEB服务(APACHE):文档共享,CVS的WEB界面浏览,论坛工具等;</li>
<li>FTP服务(FTP):用于文件下载/共享;</li>
<li>版本控制(CVS):程序源代码和文档的版本控制;</li>
<li>文件共享(SAMBA):基于NETBIOS的文件共享,方便WINDOWS客户端的访问(比如一些工具的安装等);</li>
<li>数据库服务器(MYSQL):一些应用的后台数据库服务;</li>
<li>备份机制(wget + rsync):备份</li>
</ul>
<p>很多设置是缺省按照在bash环境中,在tcsh环境中,有一些设置不太一直。</p>
<p>服务器规划如下:</p>
<pre> 主服务器 (Main) 备份服务器(Backup)<br> __________________ _______________<br>|APACHE WEB SERVER | | File Backup | <br>|SAMBA SHARE | | |<br>|DHCP SERVER | | DHCP Backup |<br>|CVS SERVER | | MySQL server |<br>|WIKI/BLOG SERVER | <=Backup=> | |<br>|Database backup | | |<br> ------------------ --------------- </pre>
<p><b>硬件准备:至少要2台服务器</b></p>
<ol>
<li>从理论上说,任何系统的崩溃只是时间问题,而且谁也不能保证开发者不犯错误</li>
<li>解决的办法只有:备份,备份,备份……</li>
</ol>
<p><b>操作系统准备</b></p>
<p>FreeBSD或GNU/Linux,系统安装时,本文的配置主要以在RedHat
8上运行为例。注意:安装时要将“开发工具”大类选上,后面的很多工具都需要使用GCC进行编译,有的应用脚本运行用到了PERL。2台主服务器分别使用IP地址192.168.0.200和192.168.0.201。</p>
<p><b>2台机器上都安装的服务:SSH FTP DHCP服务</b></p>
<p>SSH: 基本的登陆服务,对于内部分开发来说一般用缺省的就可以了,但是建议将/etc/ssh/sshd_config中的:<br>
PermitRootLogin yes改成PermitRootLogin no</p>
<p>FTP: <br>
建议用proftpd代替原有的ftp服务:<a href="javascript:if(confirm('http://www.proftpd.org/ This file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. Do you want to open it from the server?'))window.location='http://www.proftpd.org/'" tppabs="http://www.proftpd.org/">http://www.proftpd.org/</a>
当然如果是vsftpd就不用换了<br>
安装:tar zxf proftpd-version.tar.gz; cd proftpd-version/; ./configure;
make; make install<br>
缺省配置/usr/local/etc/proftpd.conf</p>
<pre>ServerName "ProFTPD"<br>ServerType standalone<br>DefaultServer on<br>AllowOverwrite on<br>Port 21<br>Umask 022<br><br>UseReverseDNS off<br>MaxInstances 30<br>User ftp<br>Group ftp<br><br></pre>
<ol>
<li>不反相解析登陆机器的域名 UseReverseDNS off</li>
<li>使用了系统缺省的apache用户/组运行服务</li>
<li>使用AuthUserFile把一些虚拟用户映射成系统帐户是一种更安全的方式,可以把多个只需要FTP权限的开发者用虚拟帐号映射成一个系统用户。这些虚拟用户的认证密码在ftpd.passwd中设置,从而实现了于系统认证的分离:<br>
ftpasswd --passwd --name=test --uid=501 --gid=501 --home=/home/test
--shell=/sbin/nologin --file=/etc/ftpd.passwd<br>
然后在proftpd.conf配置中增加:DefaultRoot ~ 让用户只能在自己的目录下工作,不能通过cd ..转向更上级目录进行操作<br>
AuthUserFile /etc/ftpd.passwd<br>
DefaultRoot ~<br>
</li>
</ol>
<p>DHCP服务:为了更方便的管理在同一个局域网中开发者的IP地址和服务器的IP地址,最好将服务器安排在一定范围内的静态IP内(比如192.168.0.200以上),将(192.168.0.10-200)范围内为开发机客户端提供动态IP。假设我们的主服务器(192.168.0.200)和辅助开发服务器(192.168.0.201)使用静态IP,同时为网段内提供192.168.0.10-200动态IP分配服务。DHCP服务在2台服务器上都安装,一个做主DHCP服务,用于给子网IP池提供70%的IP,另外一台做备份,拥有IP池的30%。在例子中:200负责10-100,201负责110-150。缺省dhcpd没有安装的话,从安装盘上找到DHCP软件包安装或者从<a
href="javascript:if(confirm('http://www.isc.org/ This file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. Do you want to open it from the server?'))window.location='http://www.isc.org/'" tppabs="http://www.isc.org/">http://www.isc.org</a>下载源文件编译即可(安装位置和配置文件可能有所不同)。</p>
<p>缺省配置:主服务器上</p>
<pre>ddns-update-style none;<br>default-lease-time 120000; <br>max-lease-time 920000; <br>option subnet-mask 255.255.255.0; <br>option broadcast-address 192.168.0.255; <br>option netbios-name-servers 192.168.0.200;<br>option routers 192.168.0.1; <br>option domain-name-servers 202.106.196.115,202.96.199.133; <br>option domain-name "example.com"; <br><br>subnet 192.168.0.0 netmask 255.255.255.0{<br> range 192.168.0.10 192.168.0.100; <br>}</pre>
<p>说明:<br>
缺省每个IP租期2天: default-lease-time 120000; <br>
最长租期: max-lease-time 920000; <br>
缺省子网掩码:option subnet-mask 255.255.255.0; <br>
缺省广播地址:option broadcast-address 192.168.0.255; <br>
让192.168.0.200上的samba服务启用WINS服务:用于内部域名解析 <br>
option netbios-name-servers 192.168.0.200;<br>
缺省网关 option routers 192.168.0.1; <br>
缺省域名服务器 option domain-name-servers 202.106.196.115,202.96.199.133; <br>
缺省域名 option domain-name "example.com"; <br>
<br>
#一个缺省的子网设置:<br>
subnet 192.168.0.0 netmask 255.255.255.0{<br>
#为子网动态分配0.10-100的IP<br>
range 192.168.0.10 192.168.0.100; <br>
} </p>
<p>辅DHCP服务器上唯一不同的地方是:为子网动态分配0.110-150的IP,主DHCP和附DHCP服务器的IP池不能相互重叠 </p>
<pre>subnet 192.168.0.0 netmask 255.255.255.0{ <br> range 192.168.0.110 192.168.0.150; <br>}</pre>
<p>主服务器上的应用安装:</p>
<p><b>SAMBA服务:用于文件的共享和内部WINS解析</b></p>
<p>这里只做一个只读共享的简单配置,</p>
<pre>[global]<br> #别人会通过"网上邻居"看到WORKGROUP组里名为的Linux机器,注释是:My Samba Server<br> workgroup = WORKGROUP<br> netbios name = Linux<br> server string = My Samba Server<br><br> #日志设置<br> log file = /var/log/samba/%m.log<br> max log size = 50<br><br> #安全设置<br> security = share<br><br> #用SAMBA的WINS服务支持,并且用/etc/hosts做内部域名解析<br> wins support = yes<br> name resolve order = hosts lmhosts wins bcast<br> dns proxy = yes<br><br>[public]<br> #一个共享设置<br> comment = Public Stuff <br> path = /home/share<br> public = yes<br> guest ok = yes<br> read only = yes<br> writable = no<br> printable = no<br> <br>[docs]<br> #一个需要密码验证的设置,密码通过#smbpasswd -a user password增加<br> comment = Public Stuff<br> security = user<br> encrypt passwords = yes <br> smb passwd file = /etc/samba/smbpasswd <br> path = /home/docs<br> public = yes<br> guest ok = no<br> read only = yes<br> writable = no<br><br></pre>
<p>在这里为了让大家能够在内部使用dev.example.com访问主服务器(192.168.0.200),我用DHCP设置主服务器(192.168.0.200)同时也是是内部的WINS服务器,而在200的SAMBA服务中,启用了WINS支持,并设置WINS用可以利用DNS做NETBIOS名称解析。这样如果DNS读取的是/etc/hosts文件中的设置的话,hosts文件就可以当作WINS域名配置文件了,在/etc/hosts里设置了:<br>
192.168.0.200 dev.example.com bbs.example.com dev bbs<br>
192.168.0.201 bak.example.com backup<br>
后,通过DHCP获得IP的内网客户端就可以直接通过: dev.example.com访问开发服务器了。</p>
<p><i>所有的机器名前缀我都使用了缩写:dev, bbs
bak之类的,原因是samba的NMBD实际上是NETBIOS名称的解析,名称长度是16个字符(实际是15个)有限制的。因此,虽然192.168.0.202
username.example.com虽然是一个合法的DNS名称解析,但由于username.example.com长度超过了16个字符,所以通过SAMBA的WINS服务解析仍然无法找到。dev.chedong.com相当于dev.chedong.com这样的一台机器。当初用SAMBA的WINS解析在客户端总是ping不通testing.chedong.com这个问题困扰了我好一阵。</i></p>
<p><b>WEB服务:APACHE + php + resin</b></p>
<p>主要用作文件的WEB共享和一些应用的前端浏览(CVSWEB GNATSWEB
PHPMYADMIN等),Apache,这里仍然使用了1.3,因为很多应用,比如PHP在2.0上运行还不是完整。 </p>
<p>安装: <a href="javascript:if(confirm('http://httpd.apache.org/ This file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. Do you want to open it from the server?'))window.location='http://httpd.apache.org/'" tppabs="http://httpd.apache.org/">http://httpd.apache.org</a>下载最新版本:</p>
<p>编译选项:这样可以让所有的模块都通过配置文件动态加载,方便后面其他应用模块的添加删除:<br>
./configure --prefix=/home/apache --enable-shared=max
--enable-module=most<br>
更多安装说明可以参考: <a href="apache_install.html" tppabs="http://www.chedong.com/tech/apache_install.html">APACHE安装笔记</a> </p>
<p><br>
apache<br>
./configure --prefix=/home/apache --enable-shared=max <br>
make <br>
make install<br>
删除过多的注释:<br>
grep -v "#" httpd.conf.default >httpd.conf<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -