??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲综合国产精品第一页,亚洲国产成人久久精品app,亚洲国产成人乱码精品女人久久久不卡 http://m.tkk7.com/dongbule/category/46251.html建造高性能门户|?/description>zh-cnWed, 06 Apr 2011 09:25:52 GMTWed, 06 Apr 2011 09:25:52 GMT60在debian安装nfs-server出现的bug处理http://m.tkk7.com/dongbule/archive/2011/04/06/347718.html陈于?/dc:creator>陈于?/author>Wed, 06 Apr 2011 09:13:00 GMThttp://m.tkk7.com/dongbule/archive/2011/04/06/347718.htmlhttp://m.tkk7.com/dongbule/comments/347718.htmlhttp://m.tkk7.com/dongbule/archive/2011/04/06/347718.html#Feedback0http://m.tkk7.com/dongbule/comments/commentRss/347718.htmlhttp://m.tkk7.com/dongbule/services/trackbacks/347718.html nfs安装与配|(debianQ?/a>
好吧Q这个错误浪费了我今天几个小时的旉Q必L它记录下来?br /> 问题是这LQ在启动更新了portmapQexportfsQ一些没问题后,在做/etc/init.d/nfs-kernel-server restart 出现

/etc/init.d/nfs-kernel-server start
Exporting directories for NFS kernel daemonexportfs: /etc/exports 
[1]:
Neither 'subtree_check' or 'no_subtree_check' specified for export
"foobar".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 
1.0.x

.
Starting NFS kernel daemon: nfsd
Not starting: portmap daemon is not running (warning).


警告提示portmap is not running

好吧Q检查一下portmap

/home/mnt/index# ps aux | grep portmap
daemon   
31478  0.0  0.0   2052   624 ?        Ss   13:59   0:00 /sbin/portmap


portmap的状态已l是runningQ在googling后,发现|上有h说是
This is the problem, portmap is not actually running, causing rpc.statd

看来问题q是出现rpc上,最主要的进Erpc.mountd无法启动

好吧Q接下来打开/etc/init.d/nfs-kernel-serverq个启动脚本q行查看

                 # See if portmap or rpcbind are running
                 (cat </dev/null >/dev/tcp/localhost/
1112>/dev/null
                 RET
=$?
                 if 
[ $RET != 0 ]; then
                     echo
                     log_warning_msg 
"Not starting: portmap daemon is not running"
                     exit 
0
                 fi


看来问题出来这个,什么叫“/dev/tcp/localhost/111”Q还是googlingQ网上有

I find that this is a bashism, but the init-script is marked as a bash script at the
top:
!/bin/bash
再man BashQ发?br /> Bash, as packaged for Debian, does not support using the /dev/tcp and /dev/udp files

应该很清楚了Q如果按照这里的分析Q那么我们需要对上面的这个启动脚本进行一下修改就可以完成我们的目的,最直接的就是把exit 0注释掉,另外说一点,q个脚本也有些写得不大合理,既然是log_warning_msgQ一个warningQ就不应该直接的exit 0




]]>
nfs安装与配|(debianQ?/title><link>http://m.tkk7.com/dongbule/archive/2011/04/06/347716.html</link><dc:creator>陈于?/dc:creator><author>陈于?/author><pubDate>Wed, 06 Apr 2011 09:09:00 GMT</pubDate><guid>http://m.tkk7.com/dongbule/archive/2011/04/06/347716.html</guid><wfw:comment>http://m.tkk7.com/dongbule/comments/347716.html</wfw:comment><comments>http://m.tkk7.com/dongbule/archive/2011/04/06/347716.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/dongbule/comments/commentRss/347716.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/dongbule/services/trackbacks/347716.html</trackback:ping><description><![CDATA[<br /> <br /> <strong>NFS服务器端</strong><br /> apt-get install nfs-kernel-server nfs-common portmap<br /> <br /> vi /etc/hosts.allow<br /> portmapQ?192.168.0.<br /> lockdQ?nbsp;  192.168.0.<br /> rquotadQ?192.168.0.<br /> mountdQ?nbsp; 192.168.0.<br /> statdQ?nbsp;  192.168.0.<br /> <br /> vi /etc/hosts.deny<br /> portmap:ALL<br /> lockd:ALL<br /> mountd:ALL<br /> rquotad:ALL<br /> statd:ALL<br /> <br /> vi /etc/default/portmap<br /> ?-i 127.0.0.1 注释?br /> <br /> /etc/init.d/portmap restart   重启portmap daemon<br /> <br /> vi /etc/exports<br /> /home/zp/share  220.181.8.*(rw,sync,no_root_squash)   若更改了/etc/exportsQ?q行 $sudo exportfs -r 更新<br /> <br /> /etc/init.d/nfs-kernel-server restart  <br /> Q可以到/var/log/messages里面查看是否正确Ȁz)<br /> <br /> showmount -e ip  查看NFS server的export list. <br /> <br /> <strong>NFS客户?/strong><br /> apt-get install nfs-common portmap nfs-client<br /> <br /> mount 192.168.86.111:/home/mnt/share /home/mnt 挂v<br /> 如果出现<br /> mount.nfs: rpc.statd is not running but is required for remote locking.<br /> mount.nfs: Either use '-o nolock' to keep locks local, or start statd.<br /> mount.nfs: an incorrect mount option was specified<br /> <br /> 那么<br /> mount 192.168.86.111:/home/mnt/share /home/mnt -o nolock  挂v<br /> <br /> umount /home/mnt 撤销 <img src ="http://m.tkk7.com/dongbule/aggbug/347716.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/dongbule/" target="_blank">陈于?/a> 2011-04-06 17:09 <a href="http://m.tkk7.com/dongbule/archive/2011/04/06/347716.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux命opd《进E管理?/title><link>http://m.tkk7.com/dongbule/archive/2011/01/21/343344.html</link><dc:creator>陈于?/dc:creator><author>陈于?/author><pubDate>Fri, 21 Jan 2011 09:56:00 GMT</pubDate><guid>http://m.tkk7.com/dongbule/archive/2011/01/21/343344.html</guid><wfw:comment>http://m.tkk7.com/dongbule/comments/343344.html</wfw:comment><comments>http://m.tkk7.com/dongbule/archive/2011/01/21/343344.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/dongbule/comments/commentRss/343344.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/dongbule/services/trackbacks/343344.html</trackback:ping><description><![CDATA[对于q程理工具qx大多用的是psQkillQtopQsleep{等q些命oQ^时linux的一些指令我都会做一些记录,本着好记性不如烂博客的精,也把q程理的命令做一点系l性的记录Q参考资料基本是鸟哥q有|上的一些文章?br /> <br /> <strong>ps</strong><br /> ps命o主要是查看系l进E的状态,qx最常用的命令是ps auxQ然后再使用道导向到grep查找特定的进E,然后q此特定q程q行操作?br /> 要对q程q行操作必须先了解到当前q程的情况,ps命o体现了现实当前运行进E的快照Qps和top和相|但ps提供了更多的信息Q可以确定哪些进E正在运行,哪些q程被挂Pq行了多长时_以及q行使用的资源和q程的优先Q这些信息对我们都有很重要的作用Q当我们使用ps aux可以获得l端所有用L有关q程信息?br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/linux/ps.png" alt="" width="668" border="0" height="444" /><br /> <br /> 逐列记录Q?br /> USER   表示启动q程的用?br /> PID    表示q程标志?br /> %CPU   表示该进E占用CPU的时间和q程总运行时间比?br /> %MEM   表示该进E占用内存的旉和进E总运行时间比?br /> VSZ    表示占用虚拟内存的大?br /> RSS    表示占用物理内存的大?br /> TTY    表示对应的终端号Q其?#8220;Q?#8221;表示不占用终?br /> STAT   表示q程的几U运行状态,DQ不可中断uninterruptible sleepQRQ运行runnableQSQ睡眠sleeping QTQ停止traced or stoppedQZQ僵死a defunct (”zombie”) processQWQ没有够的内存q行分配Q?lt;Q高优先序的q程QNQ低优先序的q程QLQ实时系l或I/O<br /> START  表示开始时?br /> TIME   表示q行了多时?br /> COMMAND表示所执行的指?br /> <br /> 分n一些常用的ps指o<br /> 查看chenyz用户名所q行的进E?br /> root@tech163:/home/chenyz# ps -U chenyz -u chenyz u<br /> <br /> 查看nginx的进E?br /> root@tech163:/home/chenyz# ps aux | grep nginx<br /> <br /> 查看使用内存最多的?0个进E?br /> root@tech163:/home/chenyz# ps auxf | sort -nr -k 4 | head -10<br /> <br /> 查看使用CPU最多的?0个进E?br /> root@tech163:/home/chenyz# ps auxf | sort -nr -k 3 | head -10<br /> <br /> <strong>pstree</strong><br /> ps能够得到_的数据,但是数据庞大Q这对于掌握pȝ整体的概括来说不是很Ҏ。pstree刚好可以弥补q个~憾Q进E启动的时候可能会产生自己的一个子q程Q用pstreep够将当前的程序以树Şl构呈现?br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/linux/pstree.png" alt="" border="0" /><br /> <br /> <br /> <strong>kill</strong><br /> kill的工作原理是Q想linuxpȝ的内核发送一个系l操作信号和某个E序的进E标识号Q然后系l内核就可以对进E标识号指定的进E进行操作,当需要终端一个前台进E的时候,可以使用ctrl+Cq行l束Q但对于一个后台进E,一个组合键是无法进行中断的Q这个时候就必须使用kill命o?br /> 当我们启动一个后端程?br /> <br /> root@tech163:/home/chenyz# nohup ./hello.sh &<br /> [1] 15100<br /> <br /> 可以使用ps来查看该q程<br /> <br /> root@tech163:/home/chenyz# ps aux | grep hello<br /> root     15100  0.0  0.0   1840   540 pts/0    S    14:57   0:00 /bin/sh ./hello.sh<br /> <br /> 使用kill %1 或?kill 15100 来终止该q程?br /> 如果一个程序已l彻底死掉,如果kill pid也没法终止,则需要加上信号强度,最好的办法是加上信号强?-9 直接杀ȝq程?br /> 跟kill相关的还有killallQkillall通过E序名来直接杀L有进E?br /> <br /> <strong>top</strong><br /> 与ps提供的快照不同的是,top提供了一个当前运行系l实时动态的视图Q也是正在q行的进E,在默认情况下Q显C系l中CPU使用率最高的dQƈ?U刷Cơ?br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/linux/top.png" alt="" border="0" /><br /> <br /> W一行显CZ当前旉Q登录的用户敎ͼq_负蝲<br /> W二行显CZ所有进E数Q运行(runningQ,挂vQsleepingQ,停止QstoppedQ,无用QzombieQ的q程?br /> W三行显CZCPU的用情况,用户占得癑ֈ比,pȝ占得癑ֈ比,I闲的百分比<br /> W四行显CZ物理内存的用情况,包括可以使用内存Q已使用内存Q空闲内存,~冲区内?br /> W五行显CZ交换区的使用情况Q包括了ȝ交换区,使用的,I闲的,用于高速缓存的交换?br /> W六行重启一D再解释<br /> <br /> PID    表示q程标识?br /> USER    表示该进E的用户?br /> PR      表示q程的优先<br /> NI      表示q程的优先别数?br /> VIRT    表示q程占用的虚拟内?br /> RES    表示q程占用的物理内?br /> SHR    表示q程使用的共享内存?br /> S    表示q程的状态,q行QrunningQ,挂vQsleepingQ,停止QstoppedQ,无用QzombieQ?br /> %CPU    表示占用CPU的用率<br /> %MEM    表示占用物理内存的用率<br /> TIME+    表示该进E占用CPU的L?br /> COMMAND 表示q程的命名名U?br /> <br /> top是功能非常强大的监控pȝQ但是它的缺Ҏ消耗很多的pȝ资源Q在pȝ负蝲q高的时候查看进E尽量避免用top?br /> <br /> <strong>jobs</strong><br /> 如果你想知道有多进E在后台q行中,那就用jobs的指令吧Q如果想知道q程的pid那就是用job -l<br /> 先一个进E运行在后台<br /> root@tech163:/home/chenyz#./hello.sh &<br /> [1] 17299<br /> root@tech163:/home/chenyz# jobs -l<br /> [1]+ 17299 Running                 ./hello.sh &<br /> 因ؓ当前只有一个后CQ务在q行Q所以后CQ务的L是[1],如果有第二个dq入后端执行Q那么[1]会跟着动态变化?br /> <br /> <strong>fg</strong><br /> 刚刚我们?/hello.sh &q程攑օ后端执行Q如果想要将后端的进E拿到前端来可以使用fg来处?br /> <br /> root@tech163:/home/chenyz# jobs -l<br /> [1]+ 17299 Running   <br /> root@tech163:/home/chenyz# fg %1<br /> ./hello.sh<br /> <br /> <strong>bg</strong><br /> 与fg相反的是bgQ如果想看到后端E序的运行情况,可以使用fg命o把它调到前台Q,bg可以使得多个q程攑ֈ后台中执行?br /> 启动一个进E,然后使用ctrl+z暂停Q然后用bg该q程攑օ后台执行<br /> <br /> root@tech163:/home/chenyz#  ./hello.sh <br /> ^Z   //{ctrl+z}暂停<br /> [1]+  Stopped                 ./hello.sh<br /> root@tech163:/home/chenyz# jobs;bg %1<br /> [1]+  Stopped                 ./hello.sh<br /> [1]+ ./hello.sh &<br /> root@tech163:/home/chenyz# jobs<br /> [1]+  Running                 ./hello.sh &<br /> <br /> 跟进E管理相关的命oq有很多如nohupQsleepQniceQrenice...后箋再记?br /> <br /> <br /> <img src ="http://m.tkk7.com/dongbule/aggbug/343344.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/dongbule/" target="_blank">陈于?/a> 2011-01-21 17:56 <a href="http://m.tkk7.com/dongbule/archive/2011/01/21/343344.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[收藏] 100个常见的linux守护q程http://m.tkk7.com/dongbule/archive/2011/01/21/343312.html陈于?/dc:creator>陈于?/author>Fri, 21 Jan 2011 04:34:00 GMThttp://m.tkk7.com/dongbule/archive/2011/01/21/343312.htmlhttp://m.tkk7.com/dongbule/comments/343312.htmlhttp://m.tkk7.com/dongbule/archive/2011/01/21/343312.html#Feedback0http://m.tkk7.com/dongbule/comments/commentRss/343312.htmlhttp://m.tkk7.com/dongbule/services/trackbacks/343312.html1QalsasoundQAlsa声卡驱动守护E序。Alsa声卡驱动E序本来是ؓ了一U声卡Gravis UltraSoundQGUS)而写的,该程序被证明很优UQ于是作者就开始ؓ一般的声卡写驱动程序。Alsa和OSS/Free及OSS/Linux兼容Q但是有自己的接口,甚至比OSS优秀?br />
2QacpidQacpidQAdvanced Configuration and Power InterfaceQ是为替代传l的APM甉|理标准而推出的新型甉|理标准。通常W记本电脑需要启动电源进行管理?br />
3QatalkQAppleTalk|络守护q程。注意不要在后台q行该程序,该程序的数据l构必须在运行其他进E前先花一定时间初始化?br />
4QamdQ自动安装NFS守护q程?br />
5QanacronQ一个自动化q行d守护q程。Red Hat Linux随带四个自动化Q务的工具Qcron、anacron、at和batc。当你的Linux服务器ƈ不是全天q行Ӟq个anacron可以帮你执行在"crontab"讑֮的时间内没有执行的工作?br />
6QapmdQapmdQAdvanced Power ManagementQ是高甉|理。传l的甉|理标准Q对于笔记本电脑比较有用Q可以了解系l的甉|电量信息。ƈ相关信息通过syslogd写入日志。也可以用来在电源不xx?br />
7Qarptables_jfQؓarptables|络的用h制过滤的守护q程?br />
8QarpwatchQ记录日志ƈ构徏一个在LAN接口上看到的以太|地址和IP地址Ҏ据库?br />
9QatdQat和batch命o守护q程Q用Lat命o调度的Q务。batch用于在系l负h较低时运行批处理d?br />
10QautofsQ自动安装管理进EautomountQ与NFS相关Q依赖于NIS服务器?br />
11QbootparamdQ引导参数服务器QؓLAN上的无盘工作站提供引导所需的相关信息?br />
12QbluetoochQ蓝牙服务器守护q程?br />
13QcrondQcron是UNIX下的一个传l程序,该程序周期性地q行用户调度的Q务。比起传l的UNIX版本QLinux版本d了不属性,而且更安全,配置更简单。类g计划d?br />
14QchargenQ用tcp协议的chargen serverQchargenQCharacter Generator ProtocolQ是一U网l服务,主要功能是提供类gq程打字的功能?br />
15Qchargen-udpQ用UDP协议的chargen server?br />
16QcpuspeedQ监系l空闲百分比Q降低或加快CPU旉速度和电压,从而在pȝI闲时将能源消耗降为最,而在pȝJ忙时最大化加快pȝ执行速度?br />
17QdhcpdQ动态主机控制协议(Dynamic Host Control ProtocolQ的服务守护q程?br />
18QcupsQcups(Common UNIX Printing System)是通用UNIX打印守护q程QؓLinux提供W三代打印功能?br />
19QcupsQconfigQdaemonsQcups打印pȝ切换守护q程?br />
20Qcups-lpdQcups行打印守护进E?br />
21QdaytimeQ用TCP协议的Daytime守护q程Q该协议为客h实现从远E服务器获取日期和时间的功能。预讄口:13?br />
22Qdaytime-udpQ用UDP协议的Daytime守护q程?br />
23Qdc_serverQ用SSL安全套接字的代理服务器守护进E?br />
24Qdc_clientQ用SSL安全套接字的客户端守护进E?br />
25QdiskdumpQ服务器盘备䆾守护q程?br />
26QechoQ服务器回显客户数据服务守护q程?br />
27Qecho-udpQ用UDP协议的服务器回显客户数据服务守护q程?br />
28QekloginQ接受rlogin会话鉴证和用kerberos5加密的一U服务的守护q程?br />
29QgatedQ网兌\由守护进E。它支持各种路由协议Q包括RIP版本1?、DCN HELLO协议、OSPF版本2Q以及EGP版本2??br />
30QgpmQgpmQGeneral Purpose Mouse DaemonQ守护进Eؓ文本模式下的LinuxE序如mc(Midnight Commander)提供了鼠标的支持。它也支持控制台下鼠标的复制、粘贴操作,以及弹出式菜单?br />
31QgssftpQ用kerberos 5认证的FTP守护q程?br />
32QhttpdQWeb服务器Apache守护q程Q可用来提供HTML文g及CGI动态内Ҏ务?br />
33QinetdQ因特网操作守护E序。监控网l对各种它管理的服务的需求,q在必要的时候启动相应的服务E序。在Redhat和Mandrake linux中被xinetd代替。DebianQSlackwareQSuSE仍然使用?br />
34QinndQUsenet新闻服务器守护进E?br />
35QiiimQ中文输入法服务器守护进E?br />
36QiptablesQiptables防火墙守护进E?br />
37QirdaQ红外端口守护进E?br />
38QisdnQisdn启动和中止服务守护进E?br />
39Qkrb5QtelnetQ用kerberos 5认证的Telnet守护q程?br />
40QkloginQ远E登录守护进E?br />
41QkeytableQ该q程的功能是转蝲?etc/sysconfig/keyboards里定义的键盘映射表,该表可以通过kbdconfig工具q行选择。你应该使该E序处于Ȁzȝ态?br />
42QirqbalanceQ对多个pȝ处理器环境下的系l中断请求进行负载^衡的守护E序。如果你只安装了一个CPUQ就不需要加载这个守护程序?br />
43QkshellQkshell守护q程?br />
44QkudzuQ硬件自动检程序,会自动检硬件是否发生变动,q相应进行硬件的d、删除工作。当pȝ启动Ӟkudzu会对当前的硬件进行检,q且和存储在/etc/sysconfig/hwconf中的g信息q行对照Q如果某个硬件从pȝ中被d或者删除时Q那么kudzu׃察觉刎ͼq且通知用户是否q行相关配置Q然后修改etc/sysconfig/hwconfQɼg资料与系l保持同步。如?etc/sysconfig /hwconfq个文g不存在,那么kudzu会?etc/modprobe.confQ?etc/sysconfig/network- scripts/和etc/X11/XF86Config中探已l存在的g。如果你不打增加新gQ那么就可以关闭q个启动服务Q以加快pȝ启动旉?br />
45QldapQldapQLightweight Directory Access ProtocolQ目录访问协议服务器守护q程?br />
46Qlm_seroemsQ检主板工作情况守护进E?br />
47QlpdQlpd是老式打印守护E序Q负责将lpr{程序提交给打印作业?br />
48QmdmonitorQRAID相关讑֤的守护程序?br />
49QmessagebusQD-BUS是一个库Qؓ两个或两个以上的应用E序提供一对一的通信。dbus-daemon-1是一个应用程序,它用这个库来实现messagebus守护E序。多个应用程序通过q接messagebus守护E序可以实现与其他程序交换信息?br />
50Qmicrocode_ctlQ可~码及发送新的微代码到内总更新Intel IA32pd处理器守护进E?br />
51QmysqldQ一个快速、高效、可靠的dSQL数据库引擎守护进E?br />
52QnamedQDNSQBINDQ服务器守护q程?br />
53QnetplugdQnetplugdQnetwork cable hotplug management daemonQ守护程序,用于监控一个或多个|络接口的状态,当某些事件触发时q行一个外部脚本程序?br />
54QnetdumpQ远E网l备份服务器守护q程?br />
55QnetfsQNetwork Filesystem MounterQ该q程安装和卸载NFS、SAMBA和NCP|络文gpȝ?br />
56QnfsQ网l文件系l守护进E?br />
57QnfslockQNFS是一个流行的通过TCP/IP|络׃n文g的协议,此守护进E提供了NFS文g锁定功能?br />
58QntpdQNetwork Time Protocol DaemonQ网l时间校正协议)。ntpd是用来ɾpȝ和一个精的旉源保持时间同步的协议守护q程?br />
59QnetworkQ激z?关闭启动时的各个|络接口守护q程?br />
60QpsacctQ该守护q程包括几个工具用来监控q程zd的工P包括acQlastcommQaccton和sa?br />
61QpcmciaQ主要用于支持笔记本电脑接口守护q程?br />
62QportmapQ该守护q程用来支持RPCq接QRPC被用于NFS及NIS{服务?br />
63QpostgresqlQpostgreSQL关系数据库引擎?br />
64QpostfixQpostfix是邮件传输代理的守护q程?br />
65QproftpdQproftpd是UNIX下的一个配|灵zȝFTP服务器的守护E序?br />
66QpppoeQADSLq接守护q程?br />
67QrandomQ保存和恢复pȝ的高质量随机数生成器Q这些随机数是系l一些随为提供的?br />
68QrawdevicesQ在使用集群文gpȝ时用于加载raw讑֤的守护进E?br />
69Qreadahead、readahead_earlyQreadahead和readahead_early是在Fedora core 2中最新推出的两个后台q行的守护程序。其作用是在启动pȝ期间Q将启动pȝ所要用到的文g首先d到内存中Q然后在内存中执行,以加快系l的启动速度?br />
70QrhnsdQRed Hat|络服务守护q程。通知官方的安全信息及为系l打补丁?br />
71QroutedQ该守护E序支持RIP协议的自动IP路由表维护。RIP主要使用在小型网l上Q大一点的|络需要复杂一点的协议?br />
72QrsyncQremote syncq程数据备䆾守护q程?br />
73QrshQ远E主Z启动一个shellQƈ执行用户命o?br />
74QrwhodQ允许远E用戯得运行rwho守护E序的机器上所有已d用户的列表?br />
75QrstatdQ一个ؓLAN上的其他机器攉和提供系l信息的守候进E?br />
76QruserdQ远E用户定位服务,q是一个基于RPC的服务,它提供关于当前记录到LAN上一个机器日志中的用户信?br />
77QrwalldQ激zrpc.rwall服务q程Q这是一基于RPC的服务,允许用户l每个注册到LAN机器上的其他l端写消息?br />
78QrwhodQ激zrwhod服务q程Q它支持LAN的rwho和ruptime服务?br />
79QsaslauthdQ用SASL的认证守护进E?br />
80QsendmailQ邮件服务器sendmail守护q程?br />
81QsmbQSamba文g׃n/打印服务守护q程?br />
82QsnmpdQ本地简单网l管理守护进E?br />
83QsquidQ代理服务器squid守护q程?br />
84QsshdQOpenSSH服务器守护进E。Secure Shell Protocol可以实现安全地远E管理主机?br />
85QsmartdQSelf Monitor Analysis and Reporting Technology SystemQ监控你的硬盘是否出现故障?br />
86QsyslogQ一个让pȝ引导时启动syslog和klogdpȝ日志守候进E的脚本?br />
87QtimeQ该守护q程从远E主取时间和日期Q采用TCP协议?br />
88Qtime-udpQ该守护q程从远E主取时间和日期Q采用UDP协议?br />
89QtuxQ在Linux内核中运行Apache服务器的守护q程?br />
90QvsftpdQvsftpd服务器的守护q程?br />
91QvncserverQVNCQVirtual Network ComputingQ虚拟网l计)Q它提供了一U在本地pȝ上显CE计机整个"桌面"的轻量型协议?br />
92QvtunQVPN守护q程?br />
93QxfsQX Window字型服务器守护进E,为本地和q程X服务器提供字型集?br />
94QxinetdQ支持多U网l服务的核心守护q程?br />
95QypbindQؓNISQ网l信息系l)客户机激zypbind服务q程?br />
96QyppasswddQNIS密码服务器守护进E?br />
97QypservQNISL务器守护q程?br />
98QyumQRPM操作pȝ自动升和Y件包理守护q程?br />
99QypxfrdQ更快地传输NIS地图?br />
100QzebraQ\q理守护进E?

]]>
让linux定时执行Udhttp://m.tkk7.com/dongbule/archive/2011/01/19/343227.html陈于?/dc:creator>陈于?/author>Wed, 19 Jan 2011 09:47:00 GMThttp://m.tkk7.com/dongbule/archive/2011/01/19/343227.htmlhttp://m.tkk7.com/dongbule/comments/343227.htmlhttp://m.tkk7.com/dongbule/archive/2011/01/19/343227.html#Feedback0http://m.tkk7.com/dongbule/comments/commentRss/343227.htmlhttp://m.tkk7.com/dongbule/services/trackbacks/343227.html 问题是这LQ有个脚本需?0U钟执行一ơ,脚本具体功能׃l说Q定时Q务自焉用crontabQ但是crontab最的执行旉为分钟,最后决定选用d@环进行实现?br />
脚本
vi hello.sh
#!/bin/sh
while :
do
echo `date` 
>> /home/chenyz/1      //q里是Q务的实现
sleep 10
done

q里的程序运行时间间隔是10sQ小心咯Q如果没有加sleep 10Q你的机器很快就会耗尽资源Q负载会狂飙?br />
接着需要把脚本用后台守护进E来q行Q避免用户退导致脚本失?br />
nohup sh hello.sh &

btwQnohup是no hang upQ不挂vQ?br />
最后检查一下执行用户退出后相应的进E是否l在q行

root@tech163:/home/chenyz# ps -aux | grep hello
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
root     
17275  0.0  0.1   1840   544 pts/1    S    17:33   0:00 /bin/sh ./hello.sh

root
@tech163:/home/chenyz#  vi 1
Wed Jan 19 17:09:02 CST 2011
Wed Jan 
19 17:09:12 CST 2011
Wed Jan 
19 17:09:22 CST 2011
Wed Jan 
19 17:09:32 CST 2011
Wed Jan 
19 17:09:42 CST 2011
Wed Jan 
19 17:09:52 CST 2011


如果有更好的办法和想法,虚心hQ欢q讨?br />

]]>
linux命opd《用户与用户l管理?/title><link>http://m.tkk7.com/dongbule/archive/2011/01/19/343214.html</link><dc:creator>陈于?/dc:creator><author>陈于?/author><pubDate>Wed, 19 Jan 2011 07:36:00 GMT</pubDate><guid>http://m.tkk7.com/dongbule/archive/2011/01/19/343214.html</guid><wfw:comment>http://m.tkk7.com/dongbule/comments/343214.html</wfw:comment><comments>http://m.tkk7.com/dongbule/archive/2011/01/19/343214.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/dongbule/comments/commentRss/343214.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/dongbule/services/trackbacks/343214.html</trackback:ping><description><![CDATA[对于用户理工具qx大多用的是groupaddQuseraddQusermod{等q些命oQ^时linux的一些指令我都会做一些记录,本着好记性不如烂博客的精,也把用户理的命令做一点系l性的记录Q参考资料基本是鸟哥q有|上的一些文章?br /> <br /> <strong>用户l的理</strong><br /> linux可以对一个用L中的所有用戯行集中的理Q用L的管理包括用LdQ删除修改,实际上这些操作就是对/etc/group文g作出修改?br /> <br /> <strong>groupadd 新增一个用L</strong><br /> groupadd [-g gid [-o]] [-r] [-f] group<br /> -g 其中gid是指定新用户l的标识P除非配合使用-o参数Q不然该值必L唯一?br /> -o 标识新用Lgid可以和系l中原有的用L的gid值相?br /> 实例Q?br /> <u>groupadd chenyuzhe1<br /> groupadd -g 789 chenyuzhe2</u><br /> <strong><br /> groupdel 删除用户l?/strong><br /> 实例Q?br /> <u>groupdel chenyuzhe1</u><br /> <br /> <strong>groupmod 修改用户l?/strong><br /> 实例Q?br /> <u>groupmod -g 1000 chenyuzhe2<br /> groupmod -g 1000 -n chenyuzhe2 chenyuzhe3</u><br /> 其中 -n 原来的用户l进行重命名<br /> <br /> <strong>用户的管?/strong><br /> 用户理主要包括了用戯̎LdQ修改和删除?br /> <br /> <strong>useradd d用户账号</strong><br /> d用户账号的操作包括了l它创徏用户名,用户l,ȝ录和dshell资源{等?br /> adduser [-u uid][-g group][-G other_group][-d home][-s shell]<br /> -u 指定用户userID<br /> -g 指定指定用户所属的用户l?br /> -d 直接根目录建立在已l存在的目录?br /> -s 定义shell<br /> -G 指定用户所属的附加l?br /> 实例Q?br /> <u>useradd -d /home/chenyz chenyz<br /> useradd -s /bin/bash -d /home/chenyz -g chenyuzhe3 -G root chenyz</u><br /> d用户实际上就是在/etc/passwdd一条用戯录,如有指定其他的信息同时也?etc/group,/etc/shadow文g中进行了相应的更新?br /> <br /> <strong>userdel 删除用户账号</strong><br /> 实例:<br /> <u>userdel chenyz<br /> userdel -r chenyz</u><br /> -r q同ȝ录一q删?br /> <br /> <strong>usermod 修改用户账号</strong><br /> 操作基本与useradd差不?br /> 实例Q?br /> <u>usermod -l chenyz chenyz1</u><br /> <br /> <strong>相关的配|文?/strong><br /> /etc/paswd 用户账号的配|文?br /> /etc/shadow 用户口o文g<br /> /etc/group 用户l的配置文g<br /> /etc/gshadow 用户l的口o文g<br /> <br /> <strong>有效用户和实际用?/strong><br /> 在上面我们已lؓpȝ创徏了一个chenyz的̎Pq行d后我们执行以?条指?br /> <u>$ whoami<br /> chenyz<br /> $ who am i<br /> chenyz   pts/2        Jan 19 15:24 (218.107.55.254)</u><br /> 无论是whoami或是who am i用户名都是一致的Q当我们使用su - q行用户切换后再执行上面两条指o<br /> <u>gzhouse:~# whoami<br /> root<br /> gzhouse:~# who am i<br /> chenyz   pts/0        2011-01-19 12:16 (113.108.224.230)</u><br /> 可以说who am i 昄的是切换用户前的实际登陆的用户ID,whoami是切换后的有效的用户IDQ此时此l端h切换后用L讉K权限?br /> <br /> <br /> <img src ="http://m.tkk7.com/dongbule/aggbug/343214.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/dongbule/" target="_blank">陈于?/a> 2011-01-19 15:36 <a href="http://m.tkk7.com/dongbule/archive/2011/01/19/343214.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux命opd《磁盘管?du df)?/title><link>http://m.tkk7.com/dongbule/archive/2011/01/19/343198.html</link><dc:creator>陈于?/dc:creator><author>陈于?/author><pubDate>Wed, 19 Jan 2011 05:08:00 GMT</pubDate><guid>http://m.tkk7.com/dongbule/archive/2011/01/19/343198.html</guid><wfw:comment>http://m.tkk7.com/dongbule/comments/343198.html</wfw:comment><comments>http://m.tkk7.com/dongbule/archive/2011/01/19/343198.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/dongbule/comments/commentRss/343198.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/dongbule/services/trackbacks/343198.html</trackback:ping><description><![CDATA[对于盘理工具qx大多用的是dfQduq些命oQ^时linux的一些指令我都会做一些记录,本着好记性不如烂博客的精,先把盘理的命令做一点系l性的记录?br /> <br /> <strong>du</strong><br /> du的英文ؓ:disk usage,含义是磁盘空间用情况,功能是逐q入指定目录的每一个子目录q显C目录占用文gpȝ数据块的情况Q如果没有指定目录,则对当前的目录进行统计?br /> du的命令各个选项含义如下Q?br /> <br /> aQ显C全部目录和其次目录下的每个档案所占的盘I间<br /> sQ只昄各档案大的d <br /> bQ大用bytes来表C?br /> xQ蟩q在不同文gpȝ上的目录不予l计<br /> aQ递归地显C指定目录中各文件及子孙目录中各文g占用的数据块?br /> ...<br /> 使用duq行查看<br /> root@tech163:/home/htmlfile# du<br /> 16      ./test<br /> 60      ./bbb<br /> 84      .<br /> <br /> 其中W一列是以块为单位计的磁盘空间容量,W二列列出目录中使用q些I间的目录名U?br /> <br /> <strong>1)查看当前目录包含子目录的大小</strong><br /> root@tech163:/home/htmlfile# du -sm .<br /> 1       .<br /> 其中的du -sm . ?#8220;.”是代表当前目录?br /> <br /> <strong>2)查看当前目录以及子目录的大小</strong><br /> root@tech163:/home/htmlfile# du -h<br /> 16K     ./test<br /> 60K     ./bbb<br /> 84K     .<br /> 其中 -h 表示使用KQMQG的h性化形式昄?br /> <br /> <strong>3)看到当前目录下的bbb目录大小Q但不想查看其他目录以及子目?/strong><br /> root@tech163:/home/htmlfile# du -ch bbb | tail -n 1<br /> 60K     total<br /> 使用了管道包含了du和tail两个命oQ?c表示最后计出所列目录的大小之和?br /> <br /> <strong>4)列出当前目录下所有目录和文g的大?/strong><br /> root@tech163:/home/htmlfile# du -ah bbb<br /> 4.0K    bbb/mysql.php<br /> 4.0K    bbb/index.htm<br /> 4.0K    bbb/p.php<br /> 28K     bbb/memcache.php<br /> 12K     bbb/.session.php.swp<br /> 4.0K    bbb/hello.html<br /> 60K     bbb<br /> 其中-a表示包含目录和文?br /> <br /> <strong>5)不换行列出目录以及子目录大小的信?/strong><br /> root@tech163:/home/htmlfile# du -0h<br /> 16K     ./test60K       ./bbb84K        .root@tech163:/home/htmlfile# <br /> 其中 -0 表示列出一条信息后不换行,接着输出W二条信息?br /> <br /> <strong>df</strong><br /> 于du不同的是Qdu是面向文件的命oQ只计算被文件占用的I间。不计算文gpȝmetadata 占用的空间。df则是Z文gpȝM来计,通过文gpȝ中未分配I间来确定系l中已经分配I间的大。df命o可以获取盘占用了多空_q剩下多空_它也可以昄所有文件系l对i节点和磁盘块的用情c?br /> <br /> df命o各个选择的含义如下:<br /> <br /> aQ显C全部的档案pȝ和各分割区的盘使用情Ş<br /> iQ显Ci -nodes的用量<br /> kQ大用k来表C?(默认?<br /> tQ显C某一个档案系l的所有分割区盘使用?br /> xQ显CZ是某一个档案系l的所有分割区盘使用?br /> TQ显C每个分割区所属的档案pȝ名称 <br /> ....<br /> <br /> 使用dfq行查看<br /> <br /> Filesystem           1K-blocks      Used Available Use% Mounted on<br /> /dev/cciss/c0d0p1      2068156    611572   1351528  32% /<br /> tmpfs                  1038080         4   1038076   1% /lib/init/rw<br /> udev                     10240        64     10176   1% /dev<br /> tmpfs                  1038080         4   1038076   1% /dev/shm<br /> /dev/cciss/c0d0p9    130700120  44034236  86665884  34% /home<br /> /dev/cciss/c0d0p7      2068156     68932   1999224   4% /tmp<br /> /dev/cciss/c0d0p8      4132372   1760620   2161840  45% /usr<br /> /dev/cciss/c0d0p6      2068156    330104   1632996  17% /var<br /> <br /> W一行是文gpȝ对应的硬盘分?br /> W二行是分区包含的数据块的数?1数据库ؓ1024字节)<br /> W三四行是已用和未用的数据块数组<br /> W五行是普通用L间用的癑ֈ?br /> W六行是文gpȝ的安装点<br /> <br /> 其中W三四行已用和未用数据块相加q不{于W二行L据块Q这是因为分区留了少量空间提供给<br /> <br /> pȝ理员用?br /> <br /> <strong>1)</strong><br /> chenyz@gzhouse:~$ df -h<br /> 文gpȝ              定w  已用 可用 已用% 挂蝲?br /> /dev/cciss/c0d0p1     2.0G  598M  1.3G  32% /<br /> tmpfs                1014M  4.0K 1014M   1% /lib/init/rw<br /> udev                   10M   64K   10M   1% /dev<br /> tmpfs                1014M  4.0K 1014M   1% /dev/shm<br /> /dev/cciss/c0d0p9     125G   42G   83G  34% /home<br /> /dev/cciss/c0d0p7     2.0G   68M  2.0G   4% /tmp<br /> /dev/cciss/c0d0p8     4.0G  1.7G  2.1G  45% /usr<br /> /dev/cciss/c0d0p6     2.0G  333M  1.6G  18% /var<br /> 其中 -h 表示使用KQMQG的h性化形式昄?br /> <br /> <strong>2)</strong><br /> chenyz@gzhouse:~$ df -ia<br /> 文gpȝ               Inode (I)已用 (I)可用 (I)已用% 挂蝲?br /> /dev/cciss/c0d0p1     262752   60150  202602   23% /<br /> tmpfs                 224142      10  224132    1% /lib/init/rw<br /> proc                       0       0       0    -  /proc<br /> sysfs                      0       0       0    -  /sys<br /> procbususb                 0       0       0    -  /proc/bus/usb<br /> udev                  224142     770  223372    1% /dev<br /> tmpfs                 224142       3  224139    1% /dev/shm<br /> devpts                     0       0       0    -  /dev/pts<br /> /dev/cciss/c0d0p9    130763968 1972907 128791061    2% /home<br /> /dev/cciss/c0d0p7     262752      54  262698    1% /tmp<br /> /dev/cciss/c0d0p8     524832   35743  489089    7% /usr<br /> /dev/cciss/c0d0p6     262752    4896  257856    2% /var<br /> 所谓的 inode 是用来存放档案及目录的基本信?包含旉、档名、用者及组{。在分割扇区Ӟpȝ会先做出一?inode 以供以后使用Qinode 的数量关pȝpȝ中可以徏立的档案及目录L。如果要存的档案大部分都很小Q则同样大小的硬盘中会有较多的档案,也就是说需要较多的 inode 来挂档案及目?br /> <br /> <br /> <img src ="http://m.tkk7.com/dongbule/aggbug/343198.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/dongbule/" target="_blank">陈于?/a> 2011-01-19 13:08 <a href="http://m.tkk7.com/dongbule/archive/2011/01/19/343198.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[收藏]ssh: permission denied (publickey)http://m.tkk7.com/dongbule/archive/2011/01/04/342275.html陈于?/dc:creator>陈于?/author>Tue, 04 Jan 2011 06:10:00 GMThttp://m.tkk7.com/dongbule/archive/2011/01/04/342275.htmlhttp://m.tkk7.com/dongbule/comments/342275.htmlhttp://m.tkk7.com/dongbule/archive/2011/01/04/342275.html#Feedback0http://m.tkk7.com/dongbule/comments/commentRss/342275.htmlhttp://m.tkk7.com/dongbule/services/trackbacks/342275.htmlssh出现permission denied (publickey)问题:
修改/etc/ssh/sshd-config文g.
其中的PermitRootLogin no修改为yes
PubkeyAuthentication yes修改为no
AuthorizedKeysFile .ssh/authorized_keys前面加上#屏蔽掉,
PasswordAuthentication no修改为yes可以了?br />

vi /
etc/ssh/sshd-config (详细说说sshd-config的配|解?
Subsystem       sftp    /usr/libexec/openssh/sftp-server
Port 22
Protocol 2
PermitRootLogin no
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
#CACertificateFile  /etc/ssh/ca/ca.cert
PasswordAuthentication no
PermitEmptyPasswords no
PrintMotd no
ChallengeResponseAuthentication no
UseDNS no
ClientAliveInterval 60


Port 22 # SSH 预设使用 22 q个 portQ您也可以用多?port Q亦即重复?port q个讑֮目卛_Q?br />
Protocol 2 # 选择?SSH 协议版本Q可以是 1 也可以是 2 Q如果要同时支持两者,必要使用 2,1 q个分隔?br />
PermitRootLogin no
# 是否允许 root dQ预设是允许的,但是讑֮?noQ?br />
PubkeyAuthentication yes # 是否允许 Public Key

AuthorizedKeysFile .ssh/authorized_keys # 上面q个在设定若要用不需要密码登入的账号Ӟ那么那个账号的存放档案所在档名!

PasswordAuthentication no # 是否需要密码的验证

PermitEmptyPasswords no # 若上面那一如果设定ؓ yes 的话Q这一就最好设定ؓ no Q这个项目在是否允许以空的密码登入!当然不许Q?br />
PrintMotd no # d后是否显C出一些信息呢Q例如上ơ登入的旉、地点等

ChallengeResponseAuthentication no # 是否启用其它?PAM 模块Q启用这个模块将会导?PasswordAuthentication 讑֮失效Q?br />
UseDNS no

ClientAliveInterval 60









]]>
apache日志分析?/title><link>http://m.tkk7.com/dongbule/archive/2010/12/10/340288.html</link><dc:creator>陈于?/dc:creator><author>陈于?/author><pubDate>Fri, 10 Dec 2010 09:52:00 GMT</pubDate><guid>http://m.tkk7.com/dongbule/archive/2010/12/10/340288.html</guid><wfw:comment>http://m.tkk7.com/dongbule/comments/340288.html</wfw:comment><comments>http://m.tkk7.com/dongbule/archive/2010/12/10/340288.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/dongbule/comments/commentRss/340288.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/dongbule/services/trackbacks/340288.html</trackback:ping><description><![CDATA[上次因工作的需求对一台apache的log做了一ơ整体的分析,所以顺便也对apache的日志分析做下简单的介绍,主要参考apache官网的Log Files,手册参照 http://httpd.apache.org/docs/2.2/logs.html<br /> <br /> <strong>一.日志分析</strong><br /> 如果apache的安装时采用默认的配|?那么?logs目录下就会生成两个文?分别是access_log和error_log<br /> <strong>1.access_log</strong><br /> access_log问日?记录所有对apache服务器进行请求的讉K,它的位置和内容由CustomLog指o控制,LogFormat指o可以用来化该日志的内容和格式<br /> 例如,我的其中一台服务器配置如下<br /> <br /> CustomLog "| /usr/sbin/rotatelogs /var/log/apache2/%Y_%m_%d_other_vhosts_access.log 86400 480" vhost_combined<br /> <br /> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><span style="color: #000000;">-rw-r--r-- 1 root root 22310750 12-05 23:59 2010_12_05_other_vhosts_access.log<br /> -rw-r--r-- 1 root root 26873180 12-06 23:59 2010_12_06_other_vhosts_access.log<br /> -rw-r--r-- 1 root root 26810003 12-07 23:59 2010_12_07_other_vhosts_access.log<br /> -rw-r--r-- 1 root root 24530219 12-08 23:59 2010_12_08_other_vhosts_access.log<br /> -rw-r--r-- 1 root root 24536681 12-09 23:59 2010_12_09_other_vhosts_access.log<br /> -rw-r--r-- 1 root root 14003409 12-10 14:57 2010_12_10_other_vhosts_access.log</span></div> <br /> <br /> 通过CustomLog指o,每天一天生成一个独立的日志文g,同时也写了定时器一周前的日志文件全部清?q样可以昑־更清?既可以分L一天的日志又可以清除一定时间以前的日志通过?LogFormat定义日志的记录格?br /> <br /> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><span style="color: #000000;">LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined<br /> LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedproxy<br /> LogFormat "%h %l %u %t \"%r\" %>s %b" common<br /> LogFormat "%{Referer}i -> %U" referer<br /> LogFormat "%{User-agent}i" agent</span></div> <br /> 随意的tail一个access_log文g,下面是一条经典的讉K记录<br /> <br /> 218.19.140.242 - - [10/Dec/2010:09:31:17 +0800] "GET /query/trendxml/district/todayreturn/month/2009-12-14/2010-12-09/haizhu_tianhe.xml HTTP/1.1" 200 1933 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)"<br /> <br /> 一共是??他们一一拆开<br /> <br /> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><span style="color: #000000;">218.19.140.242<br /> -<br /> -<br /> [10/Dec/2010:09:31:17 +0800]<br /> "GET /query/trendxml/district/todayreturn/month/2009-12-14/2010-12-09/haizhu_tianhe.xml HTTP/1.1"<br /> 200<br /> 1933<br /> "-"<br /> "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)"</span></div> <br /> <strong>1)</strong> <strong>218.19.140.242</strong> q是一个请求到apache服务器的客户端ip,默认的情况下,W一信息只是远E主机的ip地址,但我们如果需要apache查出L的名?可以? HostnameLookups讄为on,但这U做法是不推荐?因ؓ它大大的减缓了服务器.另外q里的ip地址不一定就是客户主机的ip地址,如果 客户端用了代理服务?那么q里的ip是代理服务器的地址,而不是原?<br /> <br /> <strong>2) -</strong> q一ҎI白,使用"-"来代?q个位置是用于标注访问者的标示,q个信息是由identd的客L存在,除非IdentityCheck为on,非则apache是不会去获取该部分的信息(ps:不太理解,基本上这一w是ؓI?奉上原文)<br /> The "hyphen" in the output indicates that the requested piece of information is not available. In this case, the information that is not available is the RFC 1413 identity of the client determined by identd on the clients machine. This information is highly unreliable and should almost never be used except on tightly controlled internal networks. Apache httpd will not even attempt to determine this information unless IdentityCheck is set to On.<br /> <br /> <strong>3) -</strong> q一又是ؓI白,不过q项是用戯录用户HTTP的n份验?如果某些|站要求用户q行w䆾雁阵,那么q一就是记录用Lw䆾信息<br /> <br /> <strong>4) [10/Dec/2010:09:31:17 +0800]</strong> W四Ҏ记录h的时?格式为[day/month/year:hour:minute:second zone],最后的+0800表示服务器所处的时区Z八区<br /> <br /> <strong>5) "GET /..haizhu_tianhe.xml HTTP/1.1"</strong> q一Ҏ个记录中最有用的信?首先,它告诉我们的服务器收到的是一个GETh,其次,是客Lh的资源\?W三,客户端用的协议时HTTP/1.1,整个格式?%m %U%q %H",?hҎ/讉K路径/协议"<br /> <br /> <strong>6) 200</strong> q是一个状态码,由服务器端发送回客户?它告诉我们客L的请求是否成?或者是重定?或者是到了什么样的错?q项gؓ200Q表C服务器已经? 功的响应了客L的请?一般来?q项g2开头的表示h成功,?开头的表示重定??开头的标示客户端存在某些的错误,?开头的标示服务器端 存在某些错误,详细的可以参?HTTP specification (RFC2616 section 10).[http://www.w3.org/Protocols/rfc2616/rfc2616.txt]<br /> <br /> <strong>7) 1933</strong> q项表示服务器向客户端发送了多少的字?在日志分析统计的时侯,把这些字节加h可以得知服务器在某Ҏ间内ȝ发送数据量是多?br /> <br /> <strong>8) -</strong> 暂不?br /> <br /> <strong>9) "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)"</strong> q项主要记录客户端的览器信?br /> <br /> <br /> <br /> <br /> <br /> <strong>2.error_log</strong><br /> error_log为错误日?记录下Q何错误的处理h,它的位置和内容由ErrorLog指o控制,通常服务器出C么错?首先对它q行查阅,是一个最重要的日志文?br /> <br /> tail error_log,随意摘取一个记?br /> <br /> [Fri Dec 10 15:03:59 2010] [error] [client 218.19.140.242] File does not exist: /home/htmlfile/tradedata/favicon.ico<br /> <br /> 同样也是分ؓ几个?br /> <br /> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><span style="color: #000000;">[Fri Dec 10 15:03:59 2010]<br /> [error]<br /> [client 218.19.140.242]<br /> File does not exist: /home/htmlfile/tradedata/favicon.ico</span></div> <br /> <strong>1) [Fri Dec 10 15:03:59 2010]</strong> 记录错误发生的时?注意,它跟我们上面access_log记录的时间格式是不同?br /> <br /> <strong>2) [error]</strong> q一ؓ错误的?ҎLogLevel指o来控刉误的cd,上面?04是属于errorU别<br /> <br /> <strong>3) [client 218.19.140.242]</strong> 记录客户端的ip地址<br /> <br /> <strong>4) File does not exist: /home/htmlfile/tradedata/favicon.ico</strong> q一w先对错误q行了描q?例如客户端访问一个不存在或\径错误的文g,׃l出404的提C错?br /> <br /> <br /> <br /> <strong>?实用的日志分析脚?/strong><br /> 了解日志的各U定义后,q里分n一下从|上淘来的一些对日志分析的脚?br /> <br /> 1.查看apache的进E数<br /> ps -aux | grep httpd | wc -l<br /> <br /> 2.分析日志查看当天的ipq接?br /> cat default-access_log | grep "10/Dec/2010" | awk '{print $2}' | sort | uniq -c | sort -nr<br /> <br /> 3.查看指定的ip在当天究竟访问了什么url<br /> cat default-access_log | grep "10/Dec/2010" | grep "218.19.140.242" | awk '{print $7}' | sort | uniq -c | sort -nr<br /> <br /> 4.查看当天讉K排行?0的url<br /> cat default-access_log | grep "10/Dec/2010" | awk '{print $7}' | sort | uniq -c | sort -nr | head -n 10<br /> <br /> 5.看到指定的ipI竟q了什?br /> cat default-access_log | grep 218.19.140.242 | awk '{print $1"\t"$8}' | sort | uniq -c | sort -nr | less<br /> <br /> 6.查看讉Kơ数最多的几个分钟(扑ֈ热点)<br /> awk '{print $4}' default-access_log |cut -c 14-18|sort|uniq -c|sort -nr|head<br /> <br /> <br /> <br /> <strong>?使用awstats自动分析日志</strong><br /> 当然?如果x单和最直观的分析日志还是用工具,现在|上较流行的工具是awstats,一个基于perl的web日志分析工具,功能很强大也支持IIS{服务器<br /> 下蝲地址 http://awstats.sourceforge.net<br /> 安装配置?<<a></a><a href="http://m.tkk7.com/dongbule/archive/2010/12/10/340281.html"></a><a>安装配置整理?awstats</a>><br /> <br /> 单的界面<br /> <br /> <img alt="" src="http://m.tkk7.com/images/blogjava_net/dongbule/a2.png" width="1056" height="663" /><br /> <br /> <br /> <br /> <br /> ----------------------------------------<br /> <br /> by 陈于?<br /> QQ:34174409<br /> Mail: dongbule@163.com<br /> <br /> <br /> <img src ="http://m.tkk7.com/dongbule/aggbug/340288.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/dongbule/" target="_blank">陈于?/a> 2010-12-10 17:52 <a href="http://m.tkk7.com/dongbule/archive/2010/12/10/340288.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>安装配置整理?awstatshttp://m.tkk7.com/dongbule/archive/2010/12/10/340281.html陈于?/dc:creator>陈于?/author>Fri, 10 Dec 2010 09:28:00 GMThttp://m.tkk7.com/dongbule/archive/2010/12/10/340281.htmlhttp://m.tkk7.com/dongbule/comments/340281.htmlhttp://m.tkk7.com/dongbule/archive/2010/12/10/340281.html#Feedback0http://m.tkk7.com/dongbule/comments/commentRss/340281.htmlhttp://m.tkk7.com/dongbule/services/trackbacks/340281.html 下蝲最新版?

安装
cd /home/download
wget http://awstats.sourceforge.net/files/awstats-7.0.tar.gz
tar zxf awstats-7.0.tar.gz
mv awstats-7.0 awstats
perl awstats_configure.pl

在[y/n]选择?输入y
接着输入你要分析的域?输入tech163
一路Enter

配置
vi /etc/awstats/awstats.tech163.com

LogFile="/home/apache/logs/access_logs"
DirCgi="/home/awstats/wwwroot/cgi-bin"
AllowToUpdateStatsFromBrowser=1


vi /home/apache/conf/httpd.conf

<VirtualHost *>
  ServerName awstats.163.com
  DocumentRoot "/home/awstats/awstats/wwwroot"
</VirtualHost>

Alias /awstatsclasses "/home/awstats/awstats/wwwroot/classes/"
Alias /awstatscss "/home/awstats/awstats/wwwroot/css/"
Alias /awstatsicons "/home/awstats/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/home/awstats/awstats/wwwroot/cgi-bin/"


cd /home/awstats/wwwroot/cgi-bin
perl awstats.pl -config=tech163 -update -lang=cn
perl awstats.pl -config=tech163 -output -staticlinks -lang=cn>awstats.tech163.html


http://awstats.163.com/awstats/awstats.pl?config=tech163.com

host指定 awstats.163.com ?配置的机器ip


]]>
安装配置整理?memcachedhttp://m.tkk7.com/dongbule/archive/2010/12/07/339995.html陈于?/dc:creator>陈于?/author>Tue, 07 Dec 2010 08:34:00 GMThttp://m.tkk7.com/dongbule/archive/2010/12/07/339995.htmlhttp://m.tkk7.com/dongbule/comments/339995.htmlhttp://m.tkk7.com/dongbule/archive/2010/12/07/339995.html#Feedback0http://m.tkk7.com/dongbule/comments/commentRss/339995.htmlhttp://m.tkk7.com/dongbule/services/trackbacks/339995.html gcc
libevent
glibc-devel

下蝲
cd /home/download
wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
wget http://www.danga.com/memcached/dist/memcached-1.4.0.tar.gz

安装
tar -zxvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure --prefix=/usr/local/libevent
make && make install

tar -zxvf memcached-1.4.0.tar.gz
cd memcached-1.4.0
./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent
make && make install

启动
/usr/local/memcached/bin/memcached -d -m 64 -u root -p 11211 -c 1024 -P /var/memcached.pid
-d 为守护进E?br /> -m 为分配的内存?br /> -u q行memcached的用?br /> -p 监听的端?br /> -c 最大的q发q接?br /> -P 保存pid文g

q有很多的启动选项,通过帮助查看
/usr/local/memcached/bin/memcached -h


在windows开启命令行
telnet 192.168.1.100 11211
用telnet试一下以下命?br /> stats 查询状?br /> version 查询版本
quit 退?br /> flush_all 清空~存数据

l束q程
kill cat /var/memcached.pid




]]>
安装配置整理?PHP-FPMhttp://m.tkk7.com/dongbule/archive/2010/11/30/339425.html陈于?/dc:creator>陈于?/author>Tue, 30 Nov 2010 10:44:00 GMThttp://m.tkk7.com/dongbule/archive/2010/11/30/339425.htmlhttp://m.tkk7.com/dongbule/comments/339425.htmlhttp://m.tkk7.com/dongbule/archive/2010/11/30/339425.html#Feedback0http://m.tkk7.com/dongbule/comments/commentRss/339425.htmlhttp://m.tkk7.com/dongbule/services/trackbacks/339425.htmlPHP-FPM ?一个PHP FastCGIq程理?br />
FastCGI是一个可伸羃的,高速地在web server和脚本语a间交互的接口。FastCGI的主要优Ҏ把动态语a和web server分离开来。这U技术允许把web server和动态语aq行在不同的L上,以大规模扩展和改q安全性而不损失生效率?br />
php-fpm可以和Q何支持远端FastCGI的web server工作

安装

php-5.2.13.tar.gz
php-5.2.13-fpm-0.5.14.diff.gz

tar zxvf php-5.2.13.tar.gz
gunzip php-5.2.13-fpm-0.5.14.diff.gz

patch -d php-5.2.13 -p1 < php-5.2.13-fpm-0.5.14.diff (lphp源码打fpm补丁)

cd php-5.2.13

./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --enable-fastcgi --enable-fpm --with-config-file-path=/usr/local/php/etc --enable-force-cgi-redirect 

make && make install

查安装的情况

cd /usr/local/php/bin

./php -v

PHP 5.2.13 (cli) (built: Nov 30 2010 16:59:45
Copyright (c) 
1997-2010 The PHP Group
Zend Engine v2
.2.0, Copyright (c) 1998-2010 Zend Technologies
##出现上面的显C明安装正?br />
cp /home/download/php-5.2.13/php.ini-dist /usr/local/php/etc/php.ini

vi /usr/local/php/etc/php-fpm.conf

去除下列两行的注?br /> <value name="user">nobody</value> 
<value name="group">nobody</value>

启动php-fpm
/usr/local/php/sbin/php-fpm start

配置nginx(配置nginx?安装配置整理?nginx)

server {
listen       
80;
server_name  www.test.com;
root   /home/htmlfile/test;

location ~ .*\.(php|php5)?$ {
root           html
;
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  /home/htmlfile/test$fastcgi_script_name;
include        fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$  {
expires      30d
;
}
location ~ .*\.(js|css)?$  {
expires      1h
;
}
#access_log  /var/logs/access.log  access
;
}
## server部分为PHP虚拟L127.0.0.1Q?000为fastcgi的主?br />
重启nginx

?home/htmlfile/test目录下新建test.php
内容?lt;?php phpinfo(); ?>

既通过www.test.com/test.phpq行讉K,出现php的信息页,则安装成?br />


]]>
安装配置整理?mysqlhttp://m.tkk7.com/dongbule/archive/2010/11/30/339394.html陈于?/dc:creator>陈于?/author>Tue, 30 Nov 2010 07:21:00 GMThttp://m.tkk7.com/dongbule/archive/2010/11/30/339394.htmlhttp://m.tkk7.com/dongbule/comments/339394.htmlhttp://m.tkk7.com/dongbule/archive/2010/11/30/339394.html#Feedback0http://m.tkk7.com/dongbule/comments/commentRss/339394.htmlhttp://m.tkk7.com/dongbule/services/trackbacks/339394.html
tar zxvf mysql-5.1.50.tar.gz

cd mysql-5.1.50

./configure --prefix=/usr/local/mysql --with-charset=gbk --with-extra-charset=all --enable-hread-safe-client
--enable-local-infile --with-low-memory 

make && make install

chmod +w /usr/local/mysql

chown -R mysql:mysql /usr/local/mysql

cp support-files/my-medium.cnf /etc/my.cnf

/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql

/bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf


]]>
安装配置整理?nginxhttp://m.tkk7.com/dongbule/archive/2010/11/30/nginx.html陈于?/dc:creator>陈于?/author>Tue, 30 Nov 2010 04:45:00 GMThttp://m.tkk7.com/dongbule/archive/2010/11/30/nginx.htmlhttp://m.tkk7.com/dongbule/comments/339377.htmlhttp://m.tkk7.com/dongbule/archive/2010/11/30/nginx.html#Feedback0http://m.tkk7.com/dongbule/comments/commentRss/339377.htmlhttp://m.tkk7.com/dongbule/services/trackbacks/339377.html
Nginx ("engine x") 是一个高性能?HTTP ?反向代理 服务器,也是一?IMAP/POP3/SMTP 代理服务器?Nginx 是由 Igor Sysoev Z|斯讉K量第二的 Rambler.ru 站点开发的Q它已经在该站点q行过两年半了。Igor 源代码以类BSD许可证的形式发布。尽还是测试版Q但是,Nginx 已经因ؓ它的E_性、丰富的功能集、示例配|文件和低系l资源的消耗而闻名了?br />
nginx的特?/strong>
1.目前官方 Nginx q不支持Windows,您只能在包括Linux,UNIX,BSDpȝ下安装和使用
2.Nginx 本n只是一个HTTP和反向代理服务器Q它无法像Apache一样通过安装各种模块来支持不同的面脚本Q例如PHP、CGI{?br /> 3.Nginx 支持单的负蝲均衡和容?br /> 4.支持作ؓ基本 HTTP 服务器的功能Q例如日志、压~、Byte ranges、Chunked responses、SSL、虚拟主机等{,应有有

安装
安装nginx前需要确保系l中已经安装PCRE?PCRE libraryq个是HTTP Rewrite模块,也即是url静态化的包,到http://www.pcre.org下蝲最新的PCRE源码?

或直接用yum install pcre,apt-get instll pcreq行安装

d http://www.nginx.org/en/download.html 下蝲最新的版本

wget http://www.nginx.org/download/nginx-0.8.53.tar.gz

tar zxvf nginx-0.8.53.tar.gz

cd nginx-0.8.53

./configure --prefix=/usr/local/nginx --with-pcre=/home/download/pcre-8.01  --with-http_ssl_module --with-openssl=/home/download/openssl-1.0.0a --with-http_stub_status_module 

##指定pcre目录和启动ssl,https模块

make

make install

##Z么Nginx的性能要比Apache高得?q得益于Nginx使用了最新的epoll(Linux 2.6内核)和kqueue(freebsd)|络I/O模型Q而Apache则用的是传l的select模型。目前Linux下能够承受高q发讉K?Squid、Memcached都采用的是epoll|络I/O模型,处理大量的连接的dQApache所采用的select|络I/O模型非常低效

配置
~辑vi /usr/local/nginx/conf/nginx.conf,其中/usr/local/nginx为安装\?span style="color: #000000;">

##指定nginx的用户名和用L
user  nobody;

##启动q程?/span>
worker_processes  8;
worker_rlimit_nofile 
10240;

##指定PID文g
pid        logs/nginx.pid;

##指定工作模式和链接上?/span>
events {
    
use epoll;
    worker_connections  
10240;
}

##http服务?/span>
http {
include       mime.types;
default_type  text
/html;

##指定日志格式
log_format  main  '$http_x_forwarded_for - $remote_user [$time_local] $request '
                  
'"$status" $body_bytes_sent "$http_referer" '
                  
'"$http_user_agent" "$http_x_forwarded_for"';

##指定accesslog
access_log logs/nginx.log main;

##指定时
keepalive_timeout  300;

##开启gzip模块
gzip  on;
gzip_min_length  
1000;
gzip_buffers     
4 8k;
gzip_types       text
/*;
gzip_http_version 
1.0;
output_buffers   
1 32k;
postpone_output  
1460;
gzip_proxied     any;
gzip_vary        on;

##指定h的缓?/span>
client_header_timeout   5m;
client_body_timeout     5m;
send_timeout            5m;
sendfile                on;
tcp_nopush              on;
tcp_nodelay             off;
client_header_buffer_size 16k;
large_client_header_buffers 
4 64k;
server_names_hash_bucket_size 
128;
ssi on;
ssi_silent_errors on;
ssi_types text
/shtml;

##指定虚拟L
server {
listen      
80;
server_name _;
server_name_in_redirect  off;

location 
/ {
 root 
/dev/null;
}

}

##指定include文g
include servers/*.com;

}


新徏proxy.conf

proxy_set_header X-Forwarded-For $remote_addr;    ##讑֮header
proxy_set_header RealIP $remote_addr;
proxy_set_header Accept-Encoding ' ';
proxy_hide_header Vary;    ##隐藏header
add_header via_up $upstream_addr;
proxy_connect_timeout   2m;    ##代理q接时
proxy_send_timeout      2m;    ##代理发送超?/span>
proxy_read_timeout      2m;    ##代理发送超?/span>
proxy_temp_file_write_size 2048m;##讑֮~存文g夹大?/span>
proxy_buffer_size               256k; 
proxy_buffers                   4 256k; 
proxy_busy_buffers_size 512k; 

proxy_ignore_client_abort off
;

proxy_next_upstream error timeout invalid_header
;

新徏目录/conf/servers,q新建配|文件test.com

server {
        listen   
80;
        server_name  245.test.com;
        root /home/htmlfile/test;

        location 
= / {
            proxy_temp_path /var/www/cache
;
            index index.html index.htm;
        }


}

修改配置文g?通过以下命o查配|是否正?br />
/usr/local/nginx/sbin/nginx -t 

the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful

启动命o
/usr/local/nginx/sbin/nginx 
停止命o
/usr/local/nginx/sbin/nginx  -s stop
qx重新加蝲配置文g
kill -HUP `cat /usr/local/nginx/logs/nginx.pid
d到自启动
echo "/usr/local/nginx/sbin/nginx" >> /etc/rc.local



]]>
安装配置整理?软g卸蝲http://m.tkk7.com/dongbule/archive/2010/11/29/linux.html陈于?/dc:creator>陈于?/author>Mon, 29 Nov 2010 07:14:00 GMThttp://m.tkk7.com/dongbule/archive/2010/11/29/linux.htmlhttp://m.tkk7.com/dongbule/comments/339318.htmlhttp://m.tkk7.com/dongbule/archive/2010/11/29/linux.html#Feedback0http://m.tkk7.com/dongbule/comments/commentRss/339318.htmlhttp://m.tkk7.com/dongbule/services/trackbacks/339318.html 通过 rpm -qa | grep httpd 搜烦?br />
httpd-2.2.3-43.el5.centos.3

?br />
rpm -e httpd-2.2.3-43.el5.centos.3

如果出现提示有其他相兛_依赖此rpm,可以选择强制卸蝲

2.yum ?apt-get 卸蝲

yum -y remove httpd
yum -y remove httpd* 卸蝲多个相识的Y?br />
3.卸蝲自编译包
make uninstall ?手动删除


]]>
安装配置整理?net-snmphttp://m.tkk7.com/dongbule/archive/2010/11/29/net-snmp.html陈于?/dc:creator>陈于?/author>Mon, 29 Nov 2010 03:34:00 GMThttp://m.tkk7.com/dongbule/archive/2010/11/29/net-snmp.htmlhttp://m.tkk7.com/dongbule/comments/339299.htmlhttp://m.tkk7.com/dongbule/archive/2010/11/29/net-snmp.html#Feedback0http://m.tkk7.com/dongbule/comments/commentRss/339299.htmlhttp://m.tkk7.com/dongbule/services/trackbacks/339299.html 先阅M下官|的一点说?详细见官|?
Simple Network Management Protocol (SNMP) is a widely used protocol for monitoring the health and welfare of network equipment (eg.routers), computer equipment and even devices like UPSs. Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6
...

安装

在http://www.net-snmp.org/download.html选择最新版本进行下?br />
wget http://sourceforge.net/projects/net-snmp/files/net-snmp/5.6/net-snmp-5.6.tar.gz

tar -xvf net-snmp-5.6.tar.gz

cd net-snmp-5.6

./configure --prefix=/usr/local/net-snmp --with-default-snmp-version="2" --with-logfile=/usr/local/net-snmp/log/snmplog.log --with-persistent-directory=/var/net-snmp

?br /> --prefix 安装的\?br /> --with-default-snmp-version 默认的版?br /> --with-logfile 日志文g的\?br /> --with-persistent-directory 固定数据存储目录

make && make install

cp EXAPLE.conf /usr/local/net-snmp/share/snmp/snmpd.conf

vi snmpd.conf

60 #       sec.name  source          community
61 com2sec local     localhost       COMMUNITY
62 com2sec mynetwork NETWORK/24      COMMUNITY


修改?nbsp;  

60 #       sec.name  source          community
61 com2sec local     localhost       public
62 com2sec mynetwork NETWORK/24      public


?etc/rc.localq加
/usr/local/net-snmp/sbin/snmpd -c /usr/local/net-snmp/share/snmp/snmpd.conf

?etc/profile文g的export命o前追?br /> PATH=/usr/local/net-snmp/bin:/usr/local/net-snmp/sbin:$PATH

?/strong>

使用 ps -aux | grep snmpd查看snmpd的进E是否启?br />
使用如下命o从本机检查snmp是否得到pȝ数据

snmpwalk -v 2c -c public localhost

如果q回的不是Time out,而是pȝ信息p明net-snmp安装成功



]]>
vi/vim的一炚w?/title><link>http://m.tkk7.com/dongbule/archive/2010/11/22/338694.html</link><dc:creator>陈于?/dc:creator><author>陈于?/author><pubDate>Mon, 22 Nov 2010 06:57:00 GMT</pubDate><guid>http://m.tkk7.com/dongbule/archive/2010/11/22/338694.html</guid><wfw:comment>http://m.tkk7.com/dongbule/comments/338694.html</wfw:comment><comments>http://m.tkk7.com/dongbule/archive/2010/11/22/338694.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/dongbule/comments/commentRss/338694.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/dongbule/services/trackbacks/338694.html</trackback:ping><description><![CDATA[刚在一台新安装ubuntu的机器上q行vi,出现<br /> -bash: vi: command not found<br /> 使用vim则可以正常的操作,当然q个应该是vi/vim没安装好的原?重新执行命o<br /> yun -y install vim*<br /> 完整的安装完毕后则可以正怋用vi/vim<br /> <br /> 以前只知道vim是vi的升U版,大部分时候也只用vi,至于vim和vi的一些区别上q真的不知道,以下为在|上查找整理的内?br /> <br /> vim,意ؓ<strong>VI iMproved</strong>,主要的优势体现在以下几个斚wQ?br /> <br /> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #000000;">1</span><span style="color: #000000;">、多U撤?br /> 我们知道在vi里,?nbsp;u只能撤消上次命oQ而在vim里可以无限制的撤消?br /> </span><span style="color: #000000;">2</span><span style="color: #000000;">、易用?br /> vi只能q行于unix中,而vim不仅可以q行于unix,windows ,mac{多操作q_?br /> </span><span style="color: #000000;">3</span><span style="color: #000000;">、语法加?br /> vim可以用不同的颜色来加亮你的代码?br /> </span><span style="color: #000000;">4</span><span style="color: #000000;">、可视化操作<br /> 是说vim不仅可以在终端运行,也可以运行于x window?nbsp;mac os?nbsp;windows?br /> </span><span style="color: #000000;">5</span><span style="color: #000000;">、对vi的完全兼?br /> 某些情况下,你可以把vim当成vi来用?/span></div> <br /> 有一点值得提出的是,<strong>vim是ؓ了程序员方便~写E序而开发的~辑?/strong><br /> 其中代码高亮Q文本折叠,上下文关联补完这些都是针对开发而设|的,q且可以逐行Ҏ本文件进行比?同事q排昄两个版本的文?br /> 比较两个文g不同之处,可以用diffget和diffput命oҎ一处不同进行双向同?也可以在比较不同时对内容q行其他~辑<br /> vim有她自己的脚本语aQ用脚本语a写成的宏可以实现自动执行复杂的操作。用 -s 选项启动vim,或者直接切换到宏所在目录?':source' 命o都可以执行vim脚本<br /> <br /> 不过需要指出的是vim也有它本w的一?strong>~点</strong><br /> d大文件很?br /> 文g不打,但有非常长的行处理v来也会很?br /> vim自得脚本语言q于复杂,~Z自动执行和窗口管理的命o<br /> 存在cMCtrl-1{不能被映射的键<br /> <br /> 最后推荐一个插?strong>Vrapper</strong>,q个工具是在eclipse中用vim,下蝲地址?http://vrapper.sourceforge.net/home/ ,下蝲完毕后再eclipse的工h上就会新增一个图?按下可以进行vim~辑<br /> <br /> <img alt="" src="../../images/blogjava_net/dongbule/vim.png" width="119" height="48" /><br /> <br /> <img src ="http://m.tkk7.com/dongbule/aggbug/338694.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/dongbule/" target="_blank">陈于?/a> 2010-11-22 14:57 <a href="http://m.tkk7.com/dongbule/archive/2010/11/22/338694.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cacti的简介与应用http://m.tkk7.com/dongbule/archive/2010/11/02/336829.html陈于?/dc:creator>陈于?/author>Tue, 02 Nov 2010 09:28:00 GMThttp://m.tkk7.com/dongbule/archive/2010/11/02/336829.htmlhttp://m.tkk7.com/dongbule/comments/336829.htmlhttp://m.tkk7.com/dongbule/archive/2010/11/02/336829.html#Feedback0http://m.tkk7.com/dongbule/comments/commentRss/336829.htmlhttp://m.tkk7.com/dongbule/services/trackbacks/336829.html
cacti的结?/strong>
在广义上来说cacti是一套网l流量监图形分析工?但从狭义来说cacti只是由php语言实现的一个Y?

它需要PHP,apache,Mysql,SNMP,RRDTool{工L支持


从上囑֏以很明确看出cacti的三层架构之间的关系
W一层是数据采集,通过snmp单网l协?和一批自定义的脚本进行采?br /> W二层是数据存储,分别通过mysql存储cacti的模板和一些一定的信息,RRDTool用来存储所监控到的性能文g,后缀?rrd
W三层是数据展现,cacti的web方式展现



cacti主要功能是用snmp服务获取数据,然后用rrdtool储存和更新数?当用户需要查看数据的时?rrdtool生成图表呈现l用戗因? snmp和rrdtool是cacti的关?snmp关系着数据的收集,rrdtool关系着数据存储和图表的生成.


snmp抓到数据不是存储在mysql中而是存在rrdtool生成的rrd文g?rrdtoolҎ据的更新和存储就是对rrd文g的处?rrd 文g是大固定的档案文g,它能够存储的数据W数在创建时已经定义.
Mysql配合PHPE序存储一些变量数据ƈ对变量数据进行调?如:L名、主?ip,snmp 团体名、端口号、模板信息等变量?br />
*.SNMP协议
SNMP(单网l管理协?前n是简单网关监控协?SGMP), 用来寚w信U\q行理

加入W合Internet定义?strong>SMI和MIB
q行体系整合

单网l管理协?SNMP)是Internetl织用来理Internet的网l协?br />
*.MIB & SMI
MIB, 理信息库,ql管理协议访问的理对象数据库,它包括SNMP可以通过|络讑֤的SNMP理代理q行讄的变?br /> SMI,理信息l构Q用于定义通过|络理协议可访问的对象的规则。SMI定义在MIB中用的数据cd及网l资源在MIB中的名称或表C?br />
*.SNMP的网l模?/strong>

使用SNMPq行|络理需要下面几个重要部分:理基站Q管理代理,理信息库和|络理工具。管理基站通常是一个独立的讑֤Q它用作|络理者进行网 l管理的用户接口。基站上必须装备有管理YӞ理员可以用的用户接口和从MIB取得信息的数据库Q同时ؓ了进行网l管理它应该具备管理命令发出基站的能力

?关于MIB介绍可以?lt;SNMP MIB完整手册>

*.net-snmp
NET-SNMP是一个代理SNMP协议的Y?q提供管理端的查询工?支持多种扩展方式
在被监测和监机器进行安?br /> http://www.net-snmp.org/download.html
配置
/etc/snmp/snmpd.conf




讄自启?br /> /usr/sbin/snmpd -c /usr/local/net-snmp/snmpd.conf &

snmpwalk -v 2c -c public 127.0.0.1
snmpwalk -v 1 -c public 127.0.0.1 .1.3.6.1.4.1.2021.10 (负蝲?

*.RRDTool
RRDTool使用RRDQRound Robin DatabaseQ作为存储格式,Round robin是一U处理定量数据、以及当前元素指针的技术。RRDTool主要用来跟踪对象的变化情况,生成q些变化的走势图
RRDTool的存储特?br />
存储数据的数据库I间看成一个圆
指针会随着数据的读写操作在圆的d上自动移?br /> 圆没有v点和l点
当所有的I间都存满了数据Q就又从头开始存?br /> RRDtool 所使用的数据库文g的后~名是'.rrd'



*.Cacti的安?/strong>

需要安装以下Y?br />
1)安装Apache,Mysql,PHP
2)安装RRDTool
(cgilib-0.5.tar.gz,zlib-1.2.3.tar.gz,libpng-1.2.18.tar.gz,freetype-2.3.5.tar.gz,libart_lgpl-2.3.17.tar.gz,rrdtool-1.2.23.tar.gz)
3)安装net-snmp
4)安装cacti

*.Cacti的配|?/strong>
修改cacti的config.php


新增crontab定时?br />


接下来就可以讉K



*.q入cacti的设|?/strong>



配置SNMP版本,rrdtoolcd,和net-snmp的工兯\?br />






具体的安装配|和应用׃演示,下面是ppt附g,安装和配|有什么问题可以同我联p?br />
--------------------------------

补充
有朋友对rrdtools提了一炚w?

RRDTool保存数据是@环的Q而且大小不变。那是不是说Q他只能保存一定数量活一D|据,然后保持更新?br /> 比如QRRD只有6个刻度,用来保存一个小时内Q每10分钟的流量。从10?0分开始的话,?1点就满了Q那么就开始@环刷C?br /> 11?0分的数据p盖了10?0分的数据?br /> 可是如果我分析的没错的话Q那数据不就丢失了么Q如果想查看历史怎么办呢Q?br />

因ؓrrd整个存储I间的大就是一个固定的?在一D|间后,当所有空间都存满数据?׃从头开始存?所以这涉及到rrdtool的前期规?以下是截取了http://www.rrdtool.org的说?br />
    When monitoring the state of a system, it is convenient to have the data available at a constant time interval. Unfortunately, you may not always be able to fetch data at exactly the time you want to. Therefore RRDtool lets you update the log file at any time you want. It will automatically interpolate the value of the data-source (DS) at the latest official time-slot (interval) and write this interpolated value to the log. The original value you have supplied is stored as well and is also taken into account when interpolating the next log entry.
Consolidation
    You may log data at a 1 minute interval, but you might also be interested to know the development of the data over the last year. You could do this by simply storing the data in 1 minute intervals for the whole year. While this would take considerable disk space it would also take a lot of time to analyze the data when you wanted to create a graph covering the whole year. RRDtool offers a solution to this problem through its data consolidation feature. When setting up an Round Robin Database (RRD), you can define at which interval this consolidation should occur, and what consolidation function (CF) (average, minimum, maximum, total, last) should be used to build the consolidated values (see rrdcreate). You can define any number of different consolidation setups within one RRD. They will all be maintained on the fly when new data is loaded into the RRD.
Round Robin Archives
    Data values of the same consolidation setup are stored into Round Robin Archives (RRA). This is a very efficient manner to store data for a certain amount of time, while using a known and constant amount of storage space.
    It works like this: If you want to store 1'000 values in 5 minute interval, RRDtool will allocate space for 1'000 data values and a header area. In the header it will store a pointer telling which slots (value) in the storage area was last written to. New values are written to the Round Robin Archive in, you guessed it, a round robin manner. This automatically limits the history to the last 1'000 values (in our example). Because you can define several RRAs within a single RRD, you can setup another one, for storing 750 data values at a 2 hour interval, for example, and thus keep a log for the last two months at a lower resolution.
    The use of RRAs guarantees that the RRD does not grow over time and that old data is automatically eliminated. By using the consolidation feature, you can still keep data for a very long time, while gradually reducing the resolution of the data along the time axis.
    Using different consolidation functions (CF) allows you to store exactly the type of information that actually interests you: the maximum one minute traffic on the LAN, the minimum temperature of your wine cellar, the total minutes of down time, etc.

----------------------------------------

by 陈于?
QQ:34174409
Mail: dongbule@163.com






]]>
VPS之openVPN的安装配|?/title><link>http://m.tkk7.com/dongbule/archive/2010/11/01/336714.html</link><dc:creator>陈于?/dc:creator><author>陈于?/author><pubDate>Mon, 01 Nov 2010 09:35:00 GMT</pubDate><guid>http://m.tkk7.com/dongbule/archive/2010/11/01/336714.html</guid><wfw:comment>http://m.tkk7.com/dongbule/comments/336714.html</wfw:comment><comments>http://m.tkk7.com/dongbule/archive/2010/11/01/336714.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://m.tkk7.com/dongbule/comments/commentRss/336714.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/dongbule/services/trackbacks/336714.html</trackback:ping><description><![CDATA[上次写的<<a href="http://m.tkk7.com/dongbule/archive/2010/10/12/334650.html">VPS的购买和使用</a>>中提CopenVPNQ也做了一点点单的介绍Q有朋友也问了一些关于vpn的问?br /> 首先Q我所购买的vps是基于OpenVZcdQ无法配|标准的VPN(无测试过),部分手机可能无法支持,但OpenVZ支持pptp和openVPN<br /> <br /> L录OPENVPN官网查阅最新资?lt;http://openvpn.net/><br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/21.png" alt="" width="230" border="0" height="77" /><br /> <br /> ok!在安装之前请认一下你购买的vps是否开启了tun/tap的支持,burst vps默认是不开启tun/tap的,可以使用cat /dev/net/tun q行?br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/2.png" alt="" border="0" /><br /> <br /> 如果是没有权限的话可以发个ticket要求客服Z开启tun/tap<br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/3.png" alt="" border="0" /><br /> <br /> 出现File descriptor in bad state说明tun/tap已经开启,可以开始进行openVPN的安装配|?br /> <br /> 我的vps安装的系lؓCentOS release 5.5 (Final)Q下面一pd安装和配|都在此vps上进?Ҏ <<a >OpenVPN服务器配|(转蝲Q?/a>>配置<br /> <br /> <strong>一.服务端安?/strong><br /> <br /> 现在开始在vps上安装和配置openVPNQ需要的有下列的软g<br /> gcc g++ [gcc g++为系l需要的~译工具]<br /> lzo?nbsp;  [Lzo库的功能是对虚拟链\q行压羃]<br /> openssl [囊括了主要的密码法、常用的密钥和证书封装管理功能以及SSL协议]<br /> openvpn <br /> <br /> <strong>1.安装~译工具gcc g++</strong><br /> <br /> <div style="background-color: rgb(238, 238, 238); font-size: 13px; border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 0);"># yum install gcc<br /> # yum install gcc-c++</span></div> <br /> <br /> <strong>2.安装lzo?/strong><br /> <br /> <div style="background-color: rgb(238, 238, 238); font-size: 13px; border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 0);"># cd /home/download/<br /> # wget http://www.oberhumer.com/opensource/lzo/download/lzo-</span><span style="color: rgb(0, 0, 0);">2.03</span><span style="color: rgb(0, 0, 0);">.tar.gz<br /> # tar -xvzf lzo-</span><span style="color: rgb(0, 0, 0);">2.03</span><span style="color: rgb(0, 0, 0);">.tar.gz<br /> # cd lzo-</span><span style="color: rgb(0, 0, 0);">2.03</span><span style="color: rgb(0, 0, 0);"><br /> # ./configure -prefix</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">/usr/local/lzo && make && make install<br /> # vi /etc/ld.so.conf</span></div> <br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/4.png" alt="" border="0" /><br /> <br /> ~辑完ld.so.conf,执行<br /> <br /> # ldconfig<br /> <br /> 使动态库生效<br /> <br /> <strong>3.安装openssl</strong><br /> <br /> <div style="background-color: rgb(238, 238, 238); font-size: 13px; border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 0);"># cd /home/download/<br /> # wget http://www.openssl.org/source/openssl-</span><span style="color: rgb(0, 0, 0);">0.9.8</span><span style="color: rgb(0, 0, 0);">.tar.gz<br /> # tar -xvzf openssl-</span><span style="color: rgb(0, 0, 0);">0.9.8</span><span style="color: rgb(0, 0, 0);">.tar.gz<br /> # ./config -prefix</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">/usr/local/openssl && make && make install</span></div> <br /> <br /> <strong>4.安装openvpn</strong><br /> <br /> <div style="background-color: rgb(238, 238, 238); font-size: 13px; border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 0);"># cd /home/download/<br /> # wget http://www.openvpn.net/release/openvpn-</span><span style="color: rgb(0, 0, 0);">2.0.9</span><span style="color: rgb(0, 0, 0);">.tar.gz<br /> # tar -xvzf openvpn-</span><span style="color: rgb(0, 0, 0);">2.0.9</span><span style="color: rgb(0, 0, 0);">.tar.gz<br /> # cd openvpn-</span><span style="color: rgb(0, 0, 0);">2.0.9</span><span style="color: rgb(0, 0, 0);"><br /> # ./configure -prefix</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">/usr/local/openvpn && make && make install</span></div> <br /> <br /> <strong>?配置</strong><br /> <br /> <strong>1.创徏配置环境</strong><br /> <br /> <br /> <div style="background-color: rgb(238, 238, 238); font-size: 13px; border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 0);"> </span># mkdir /etc/openvpn<br /> # cp -R /home/download/openvpn-2.0.9/easy-rsa/ /etc/openvpn<br /> # cd /etc/openvpn/easy-rsa/2.0/<br /> # ls<br /> <span style="color: rgb(0, 0, 0);"> total </span><span style="color: rgb(0, 0, 0);">112</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">121</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> build</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">ca<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">354</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> build</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">dh<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">190</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> build</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">inter<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">165</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> build</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">key<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">159</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> build</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">key</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">pass<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">251</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> build</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">key</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">pkcs12<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">270</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> build</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">key</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">server<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">215</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> build</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">req<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">160</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> build</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">req</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">pass<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">430</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> clean</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">all<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root  </span><span style="color: rgb(0, 0, 0);">1459</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> inherit</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">inter<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">297</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> list</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">crl<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rw</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">r</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">r</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">422</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> Makefile<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root  </span><span style="color: rgb(0, 0, 0);">7768</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> openssl</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">0.9</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">6</span><span style="color: rgb(0, 0, 0);">.cnf<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root  </span><span style="color: rgb(0, 0, 0);">8230</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> openssl.cnf<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root </span><span style="color: rgb(0, 0, 0);">12068</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> pkitool<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rw</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">r</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">r</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root  </span><span style="color: rgb(0, 0, 0);">8864</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> README<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">894</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> revoke</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">full<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">180</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> sign</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">req<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root  </span><span style="color: rgb(0, 0, 0);">1602</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> vars<br /> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">rwxr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xr</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">x </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">190</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">26</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">03</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">14</span><span style="color: rgb(0, 0, 0);"> whichopensslcnf</span></div> <br /> <br /> l果是程序以及脚本,q个要的说明一?br /> <br /> vars         脚本Q是用来创徏环境变量Q设|所需要的变量的脚?br /> clean-all    脚本Q是创徏生成CA证书及密?文g所需要的文g和目?br /> build-ca     脚本Q生成CA证书(交互)<br /> build-dh     脚本Q生成Diffie-Hellman文g(交互)<br /> build-key-server 脚本Q生成服务器端密?交互)<br /> build-key    脚本Q生成客L密钥(交互)<br /> pkitool      脚本Q直接用vars的环境变量设|直接生成证?非交?<br /> <br /> <strong>2.生成CA证书及密?/strong><br /> <br /> <div style="background-color: rgb(238, 238, 238); font-size: 13px; border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 0);"># cd /etc/openvpn/easy-rsa/</span><span style="color: rgb(0, 0, 0);">2.0</span><span style="color: rgb(0, 0, 0);">/<br /> # ./vars<br /> NOTE: If you run ./clean-all</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);"> I will be doing a rm -rf on /etc/openvpn/easy-rsa/</span><span style="color: rgb(0, 0, 0);">2.0</span><span style="color: rgb(0, 0, 0);">/keys</span></div> <br /> ?如果你执行了./clean-all,pȝ删?etc/openvpn/easy-rsa/2.0/keys下的文g<br /> <br /> 修改vars文g<br /> # vi vars<br /> <br /> export KEY_COUNTRY="CN"<br /> export KEY_PROVINCE="GZ"<br /> export KEY_CITY="guangzhou"<br /> export KEY_ORG="NCS"<br /> export KEY_EMAIL="dongbule@163.com"<br /> <br /> # ./vars <br /> <br /> <strong>3.初始化keys文g?/strong><br /> <br /> <div style="background-color: rgb(238, 238, 238); font-size: 13px; border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 0);"># ./clean-all #</span><span style="color: rgb(128, 0, 0); font-weight: bold;">[</span><span style="color: rgb(128, 0, 0);">?删除/etc/openvpn/easy-rsa/2.0/keys下的文g</span><span style="color: rgb(128, 0, 0); font-weight: bold;">]</span><span style="color: rgb(0, 0, 0);"><br /> # ./build-ca  #</span><span style="color: rgb(128, 0, 0); font-weight: bold;">[</span><span style="color: rgb(128, 0, 0);">?生成一个a 1024 bit RSA的密?writing new private key to 'ca.key'</span><span style="color: rgb(128, 0, 0); font-weight: bold;">]</span></div> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/5.png" alt="" border="0" /><br /> <br /> 一路按回R可?br /> <br /> <div style="background-color: rgb(238, 238, 238); font-size: 13px; border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 0);"># cd keys<br /> # ls<br /> ca.crt  ca.key  index.txt  serial</span></div> <br /> <br /> 可以看到生成的ca.crt  ca.key文g<br /> <br /> <strong>4.生成Diffie-Hellman文g</strong><br /> <br /> <div style="background-color: rgb(238, 238, 238); font-size: 13px; border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 0);"># cd ..<br /> # ./build-dh #</span><span style="color: rgb(128, 0, 0); font-weight: bold;">[</span><span style="color: rgb(128, 0, 0);">?Generating DH parameters, 1024 bit long safe prime</span><span style="color: rgb(128, 0, 0); font-weight: bold;">]</span><span style="color: rgb(0, 0, 0);"><br /> # ls  keys<br /> ca.crt  ca.key  dh1024.pem  index.txt  serial</span></div> <br /> ?可以看到生成?024为的Diffie-Hellman文g<br /> <br /> <strong>5.生成服务器用的VPN server ca证书</strong><br /> <br /> # ./build-key-server chenyz #[?其中chenyz是CA证书的一个名字]<br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/6.png" alt="" border="0" /><br /> <br /> 一路回?Sign the certificate? [y/n]:y 选择y<br /> <br /> 然后把刚才生成的CA证书和密钥copy?etc/openvpn/?br /> <br /> # cd keys<br /> # cp ca.crt ca.key chenyz.crt chenyz.key dh1024.pem /etc/openvpn/<br /> <br /> <strong>6.生成客户端CA证书及密?/strong><br /> <br /> # ./build-key client-chenyz<br /> 一路回?Sign the certificate? [y/n]:y 选择y<br /> <br /> 在keys目录下生成了client-chenyz.crt client-chenyz.csr client-chenyz.key三个客户端证?br /> q且ca.crt ca.key client-chenyz.crt client-chenyz.csr client-chenyz.key 五个文g打包,以便客户端vpn<br /> <br /> 使用<br /> <br /> <div style="background-color: rgb(238, 238, 238); font-size: 13px; border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 0);"># cd keys<br /> # mkdir userkey<br /> # cp ca.crt ca.key client-chenyz.crt client-chenyz.csr client-chenyz.key userkey/<br /> # tar -zcvf userkey.tar.gz userkey/<br /> userkey/<br /> userkey/ca.crt<br /> userkey/client-chenyz.csr<br /> userkey/ca.key<br /> userkey/client-chenyz.key<br /> userkey/client-chenyz.crt<br /> <br /> # sz userkey.tar.gz<br /> Starting zmodem transfer.  Press Ctrl+C to cancel.<br /> Transferring userkey.tar.gz<img src="http://m.tkk7.com/Images/dot.gif" alt="" /><br />   </span><span style="color: rgb(0, 0, 0);">100</span><span style="color: rgb(0, 0, 0);">%       </span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);"> KB    </span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);"> KB/s </span><span style="color: rgb(0, 0, 0);">00</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">00</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">01</span><span style="color: rgb(0, 0, 0);">       </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"> Errors</span></div> <br /> <br /> 使用sz其下蝲到windows客户?br /> <br /> <strong>7.openvpn配置文g</strong><br /> <br /> # cp /home/download/openvpn-2.0.9/sample-config-files/server.conf  /etc/openvpn/openvpn.conf<br /> vpenvpn的原始样例文件复制到/etc/openvpn?q改名ؓopenvpn.conf,我们在样例文g上进行修?br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/777.png" alt="" width="426" border="0" height="153" /><br /> 使用的端口,默认1194<br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/7.png" alt="" border="0" /><br /> 使用的协议,默认使用UDPQ如果用HTTP proxyQ必M用TCP协议<br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/8.png" alt="" border="0" /><br /> ca:使用build-ca生成的,用于验证客户是证书是否合?br /> cert:使用build-key-server,Server使用的证书对应的key,注意安全,防止被盗<br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/9.png" alt="" border="0" /><br /> dh:生成的加密文?br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/10.png" alt="" border="0" /><br /> 通过VPN Server往Client push路由Qclient通过pull指o获得Server push的所有选项q应?br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/11.png" alt="" border="0" /><br /> 可以让客L之间怺讉K直接通过openvpnE序转发<br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/12.png" alt="" border="0" /><br /> 如果Client使用的CA的Common Name有重复了Q或者说客户都用相同的CA #和keysq接VPNQ一定要打开q个选项Q否则只允许一个hq接VPN<br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/122.png" alt="" border="0" /><br /> Ҏ据进行压~?br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/13.png" alt="" border="0" /><br /> 定义用户<br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/14.png" alt="" border="0" /><br /> openvpn状态log<br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/15.png" alt="" border="0" /><br /> 每次重新启动openvpn后保留原有的log信息Q新信息q加到文件最?br /> <br /> <strong>8.启动OpenVPN</strong><br /> <br /> 修改完毕?卛_以启动vpn,--daemon为后台守护进E模型启?br /> /usr/local/openvpn/sbin/openvpn --daemon --config /etc/openvpn/openvpn.conf<br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/16.png" alt="" border="0" /><br /> <br /> 使用netstat -ln 查看1194openvpn的端口是否已lv?br /> <br /> <strong>?win客户端的安装和配|?/strong><br /> <br /> 下蝲openvpn客户?http://www.openvpn.net/release/openvpn-2.0.9-install.exe 安装完毕<br /> 把刚刚打包的userkey.tar.gz下蝲解压?C:\Program Files\OpenVPN\config 目录?br /> ?home/download/openvpn-2.0.9/sample-config-files/client.conf 也下载到 C:\Program Files\OpenVPN\config 目录?br /> <br /> 接着是配|这个client.conf客户端配|文?br /> <br /> 主要修改有以下几个地?br /> <br /> dev tun<br /> proto tcp<br /> remote 你的vpn地址 1194<br /> user nobody<br /> group nogroup<br /> ca ca.crt<br /> cert client-chenyz.crt<br /> key client-chenyz.key   ##?文g名和路径必须对应<br /> comp-lzo<br /> redirect-gateway def1<br /> <br /> 保与服务端的配|对?然后client.conf修改文g名ؓclient.ovpn,右键点击client.ovpn,选择"Start OpenVPN on this config file"<br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/18.png" alt="" border="0" /><br /> 可以看到q接已经成功,q且创徏?[本地q接 6] 一条新的链?br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/19.png" alt="" border="0" /><br /> <br /> <img src="http://m.tkk7.com/images/blogjava_net/dongbule/openvpn/20.png" alt="" border="0" /><br /> <br /> 或者你也可以打开C:\Program Files\OpenVPN\bin\openvpn-gui-1.0.3.exeq行q接,双击后会在Q务栏里有个小q接图标,变成l色的话p明你q接成功<br /> <br /> openvpn的参数配|?感觉不算很多,也比较容易理?中文的资料也很齐?大概q个东西在国内还是广泛应?d^_^)<br /> <br /> 如果只是单的应用,配置倒真的很?不过如果真的是要用v?|段讄和访问控制各U问题真的不?入是否配|dhcp,是否分配dns,vpn如何和内|通讯,很多很多,因ؓ我只是拿来做代理q里׃l说?br /> <br /> <br /> ----------------------------------------<br /> <br /> by 陈于?<br /> QQ:34174409<br /> Mail: dongbule@163.com<br /> <br /> <br /> <br /> <img src ="http://m.tkk7.com/dongbule/aggbug/336714.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/dongbule/" target="_blank">陈于?/a> 2010-11-01 17:35 <a href="http://m.tkk7.com/dongbule/archive/2010/11/01/336714.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VPS的购买和使用http://m.tkk7.com/dongbule/archive/2010/10/12/334650.html陈于?/dc:creator>陈于?/author>Tue, 12 Oct 2010 07:17:00 GMThttp://m.tkk7.com/dongbule/archive/2010/10/12/334650.htmlhttp://m.tkk7.com/dongbule/comments/334650.htmlhttp://m.tkk7.com/dongbule/archive/2010/10/12/334650.html#Feedback4http://m.tkk7.com/dongbule/comments/commentRss/334650.htmlhttp://m.tkk7.com/dongbule/services/trackbacks/334650.html 先介l一下VPS,下面是一些讲座的W记,部分内容直接摘自梁员外的ppt

What is VPS

VPS是Virtual Private Servers的简U?也就是我们说的虚拟专用服务器,在一台物理服务器上创建多个相互隔ȝ虚拟专用服务器。这些虚拟服务器以最大化的效率共享硬件、Y件许可证以及理资源。对其用户和应用E序来讲Q每一个VPSq_的运行和理都与一台独立主机完全相 同,因ؓ每一个VPS均可独立q行重启q拥有自qroot讉K权限、用戗IP地址、内存、过E、文件、应用程序、系l函数库以及配置文g?br />
国外的主VPScd

国外的主VPScd主要是OpenVZ和XEN,先介l一下OpenVZ

OpenVZ(Virtuozzo)
SWsoft公司的商用版虚拟化技术,而OpenVZ 则是ZVirtuozzo的开源项目。多个虚拟服务器在一个内怸q行Q具有高性能和出色管理等优点.
OpenVZ所创造的虚拟机都使用工作在同一个kernel下?br /> OpenVZ不提供硬件仿真机Ӟ不过q也让它的扩展性远胜于其他虚拟化品,每个物理L可望提供几百个虚拟服务器?br /> 当然,OpenVZ的共享主计意味着Q运行在 特定服务器上的每个VPS在操作系l内核方面肯定有着同样的基本配|?br />
q样的好处是Q?br /> 1、性能?br /> 坏处Q?br /> 1、Q何一个kernel bug都会危及所有的虚拟?因kernel bug所crash的可能性大大增加?br /> 2、他需要对内核作很多的改动

XEN
XEN是采用了准虚拟化QparavirtualizationQ?q项技术是指,l过改动的操作系l把Ҏ操作指o重定向至功能薄薄?#8220;hypervisor”层,而不是直接把它们发送到CPU。特权操作指令是裸机?码,负责调整虚拟内存以及与设备之间进行通信
客户虚拟机可以用专用的驱动器或者阵列、现有驱动器上的专用分区Q或者安 装在L上的其中一个文件系l上的磁盘镜像文?br />
如果有兴了解OpenVZ和XEN的各U性能试可以看这?lt;谈VPSQXen与OpenVZ性能试

Linux下性能上的区别(|上摘录)
1. Cpu 性能QXEN表现最好,其次是virtuozoo,而vmware 表现一般,virtual server则最?br /> 2. 内存性能Qvirtuozzo表现H出Q其ơ是XENQvmware则一?br /> 3. 盘IO性能QVirtuozzo表现优秀
4. |卡性能Qvirtual server表现较差其他都比较不?br />
在用上的区?/strong>
1. XEN VPS有swap区,OpenVZ VPS没有swap区?br /> 2. OpenVZ更容易在同一CZ虚拟出大量虚拟主机(可能跟swap有关p)Q相对XEN更容易被“售”Q反q来_XEN的搭建成本更高,售h更贵?br /> 3. 在同样多的虚拟主机的情况下OpenVZQVIRTUOZZOQ的l合性能应该更好些。但׃XEN 的虚拟子机数目较,所以用上会觉得XEN性能更好?br /> 4. OpenVZ不能做到|络讑֤的完全虚拟,但XEN可以?br />
购买VPS的步骤基本如?/strong>
1. 首先有一张国际信用卡(visa)
2. 开通一个Paypal帐号
3. 选择一个VPS供应商,选择VPS机型、操作系l,用Paypal付款
4. {待开?br />
Paypal信用卡认?/strong>
往PayPal帐号中添加信用卡ӞPayPal需要对信用卡进行认证,以解除支付限额限Ӟ
1.PayPal会先在信用卡中扣?1.95元
2.用户在信用卡账单中查询该W消费的交易~号
3.用户该~号中的指定4位数字填入PayPal的认证框?br /> 4.PayPal认后完成认证,?1.95元划回你的PayPal账户?br />
下面以我购买的VPSZ,我选择的是burst的Linux VPS (http://www.burst.net)



我选择$5.95/MONTHq款,CPU 1000MHZ,内存512MB,盘?0GB,q算Z宜吧



接下来是buy now,可以选择os,和Panel,一般是默认,其他的需要钱



好了,接下来提交完信息q?4时内开通了,如果是美国的工作旉很快可以开?如果是美国的休息旉那就{等?br />
我的{待大概接近24时,l于收到开通的邮g



收到的邮件有帐号,密码,ip地址{信?br /> 立即使用VPS Control Panel URL (SSL)的地址q行d,d后可以看到vePortal面板



你可以在此面板进行电源开?重启,重装pȝ,修复pty/tty,sshl端,q程理,文g理{操作等{?下面q有各种查询

使用Console,可以q行sshl端的操?方便?br />


一般在开通时已经q行了os安装,q里我们q是使用SSH来登录VPS,推荐putty或SecureCRTd,地址端口,帐号和密码在刚才那封邮g?br />


open



好了,d完毕,接下来做几个单的讄

让机器支持中文编?/strong>

修改 /etc/default/locale
LANG=zh_CN.UTF-8
LANGUAGE=zh_CN.UTF-8
LC_ALL=zh_CN.UTF-8

把美国时区改成中国的

dpkg-reconfigure tzdata
选择相应的地区,比如Asia->Shanghai

架设代理

ssh tunnels
购买VPS的初L用来d,q里也粗略介l一下翻墙的技?br /> 使用putty的ssh tunnels隧道,览器通过q条加密的通道q接C在国外的VPS?然后通过你的VPS再访问整个互联网,在putty上配|tunnel,目标讄为Dynamic,d一个端?端口随意,别冲H就?,再Add,一个动态{发端口就实现?接下来你要做的就是把你的览器代理ؓ 127.0.0.1:端口?br />


OpenVPN

当然,我自己是配置了一个vpn作ؓ代理,选择的是openVPN,目前被广泛应用的VPN实现中有三个LQSSL、IPSec及PPTP,OpenVPN是一个SSL VPN
openVPN的配|有点复?{以后有旉再写一文来讲qopenVPN的过E和到的一些问?基本上OpenVPN的原理是通过使用工业标准SSL/TLS协议实现了OSI 2层及3层安全网l扩展,支持灉|的基于证书、智能卡的客L认证ҎQ允讔R过在VPN虚拟接口上应用防火墙规则实现用户及组讉K控制{略?br />
有兴请?lt;vps之openvpn的安装和配置>

l?/strong>
好了,以上是单的说了说购买VPS的流E和一些应?安装完毕它就是一台普通的linux服务?只不q它的机房在国,可以用来做代理访?br />
----------------------------------------

----------------------------------------

by 陈于?
QQ:34174409
Mail: chenyz@corp.netease.com




]]>
使用rsync实现windows和linux两系l的文g同步http://m.tkk7.com/dongbule/archive/2010/09/06/331237.html陈于?/dc:creator>陈于?/author>Mon, 06 Sep 2010 10:44:00 GMThttp://m.tkk7.com/dongbule/archive/2010/09/06/331237.htmlhttp://m.tkk7.com/dongbule/comments/331237.htmlhttp://m.tkk7.com/dongbule/archive/2010/09/06/331237.html#Feedback0http://m.tkk7.com/dongbule/comments/commentRss/331237.htmlhttp://m.tkk7.com/dongbule/services/trackbacks/331237.html 其实我的需求倒是挺简单的,是要同步家里和公司两台电脑的一些指定的文g?H然惛_每天都在使用的rsync,自己配一个吧,反正服务器是现有?只不q是linux,两台需要同步的电脑都是windows,下面分享一个rsync如何在windows和linux两个pȝ中进行文件同?

linux服务?/strong>
按照rsync工具
采用yum install rsync ?apt-get install rsync安装,因ؓ方便?br /> 安装完毕?br />
vi /etc/rsyncd.conf

pid file = /var/run/rsyncd.pid
uid 
= nobody
gid 
= nobody
max connections 
= 36000
log file 
= /var/log/rsync.log
transfer logging 
= yes
log format 
= %t %a %m %f %b
syslog facility 
= local3
syslog facility 
= local5

[test]
path 
= /home/html
comment 
= test
list 
= no
read only 
= false
use chroot 
= no
hosts allow 
= *
hosts deny 
= *
#auth users 
= root
#secrets file 
= /etc/rsync_root.pas

上面是全局讄,下面是徏立了一个[test]模块,模块下面包含了个性配|?path指定模块的\?hosts allow可以指定授权讉K的ip,其中auth users参数可以讄讉K的用户列?如果不指?则表C无需密码也可以访问同?secrets file来用指定密码文g

vi /etc/rsync_root.pas

root:123

当配|完毕后我们启动rsync

rsync --daemon --config /etc/rsyncd.conf

window客户?/strong>

首先安装cwRsync工具,cwRsync_2.0.10_Installer.zip

安装完毕?我们写个批处理来实现下蝲和上传的功能

上传:

@ECHO OFF
d:
cd 
"Program Files\cwRsyncServer\bin"
rsync -vzrtopg --progress --delete /cygdrive/e/synchro root@
184.82.19.165::test

其中/cygdrive/e/表示的是windows的E?br />
下蝲:

@ECHO OFF
d:
cd 
"Program Files\cwRsyncServer\bin"
rsync -vzrtopg --progress --delete root@
184.82.19.165::test /cygdrive/e/synchro

好了,写好两个批处理后,把这两个批处理文件放到桌面上?q样可以随旉地的同步公司和家里两台电脑的文g,虽然很山寨吧,但用了几天感觉还是挺良好?br />
----------------------------------------

by 陈于?
Mail: chenyz@corp.netease.com





]]>
վ֩ģ壺 Ƶ| Ƶ69| ҹ| ޴߶רһ| һ234 | ɫ|| þֹۺ޾Ʒ| ޹Ƶþ| ޾ƷľþĻ| ޵һۺר| Ʒר| һ߹ۿ| һһ| ˳Ƶ߲Ų| ߾Ʒۿѹۿ| ѹۿĹƵ| ޾ƷƵ| һ| Ұһ| һ| žƷƵվ| 㻨߹ۿѹۿͼƬ| ĻѹۿƵ| ҹ˾ѿƬ| ¸Ļ| պ޹ۺϸ| һAVٸӰ| avһۿ| ۺ͵Ļ| rhгijվ| ˽ȥŮˬƵ| **aaaaaëƬ| Ʒѹһ| Ʒ޳ɦɦ߹ۿ | ް鵺̳| Ƶ| лGAYƬվWWW| ĻƵ߹ۿ| 182tvѹۿƵ| ëƬֻ߿| |