|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
欢迎大家来到仓酷云论坛!1、在CentOS6.4情况下编译Bandwidthd和Postgrsql必要注重按次
(1)下载Postgrsql
wgethttp://ftp.postgresql.org/pub/source/v8.4.2/postgresql-8.4.2.tar.gz
最好下载在/根目次下
tar-zxvfpostgresql-8.4.2.tar.gz解紧缩
(2)下载Bandwidthd
wgethttp://nchc.dl.sourceforge.net/project/bandwidthd/bandwidthd/bandwidthd%202.0.1/bandwidthd-2.0.1.tgz
tar-zxvfbandwidthd-2.0.1.tgz
(3)装置编译必要的软件包
编译Postgresql必要
yuminstallgcccppglibcglibc-develgcc-c++make
编译Bandwidthd必要
yuminstalllibpcaplibpcap-devellibpnglibpng-develgdgd-devel
(4)进进postgres目次,入手下手编译postgres
./configure
实行后,看看有无毛病- [root@bwdpostgresql-8.4.2]#./configurecheckingbuildsystemtype...x86_64-unknown-linux-gnucheckinghostsystemtype...x86_64-unknown-linux-gnucheckingwhichtemplatetouse...linuxcheckingwhethertobuildwith64-bitintegerdate/timesupport...yescheckingwhetherNLSiswanted...nocheckingfordefaultportnumber...5432checkingforblocksize...8kBcheckingforsegmentsize...1GBcheckingforWALblocksize...8kBcheckingforWALsegmentsize...16MBcheckingforgcc...gcccheckingforCcompilerdefaultoutputfilename...a.outcheckingwhethertheCcompilerworks...yescheckingwhetherwearecrosscompiling...nocheckingforsuffixofexecutables...checkingforsuffixofobjectfiles...ocheckingwhetherweareusingtheGNUCcompiler...yescheckingwhethergccaccepts-g...yescheckingforgccoptiontoacceptISOC89...noneneededcheckingifgccsupports-Wdeclaration-after-statement...yescheckingifgccsupports-Wendif-labels...yescheckingifgccsupports-fno-strict-aliasing...yescheckingifgccsupports-fwrapv...yescheckingwhethertheCcompilerstillworks...yescheckinghowtoruntheCpreprocessor...gcc-Echeckingallowthread-safeclientlibraries...nocheckingwhethertobuildwithTcl...nocheckingwhethertobuildPerlmodules...nocheckingwhethertobuildPythonmodules...nocheckingwhethertobuildwithGSSAPIsupport...nocheckingwhethertobuildwithKerberos5support...nocheckingwhethertobuildwithPAMsupport...nocheckingwhethertobuildwithLDAPsupport...nocheckingwhethertobuildwithBonjoursupport...nocheckingwhethertobuildwithOpenSSLsupport...nocheckingforgrepthathandleslonglinesand-e.../bin/grepcheckingforegrep.../bin/grep-EcheckingforldusedbyGCC.../usr/bin/ldcheckingifthelinker(/usr/bin/ld)isGNUld...yescheckingforranlib...ranlibcheckingforstrip...stripcheckingwhetheritispossibletostriplibraries...yescheckingforar...archeckingfortar.../bin/tarcheckingwhetherln-sworks...yescheckingforgawk...gawkcheckingforbison...noconfigure:WARNING:***WithoutBisonyouwillnotbeabletobuildPostgreSQLfromCVSnor***changeanyoftheparserdefinitionfiles.YoucanobtainBisonfrom***aGNUmirrorsite.(Ifyouareusingtheofficialdistributionof***PostgreSQLthenyoudonotneedtoworryaboutthis,becausetheBison***outputispre-generated.)checkingforflex...noconfigure:WARNING:***WithoutFlexyouwillnotbeabletobuildPostgreSQLfromCVSor***changeanyofthescannerdefinitionfiles.YoucanobtainFlexfrom***aGNUmirrorsite.(Ifyouareusingtheofficialdistributionof***PostgreSQLthenyoudonotneedtoworryaboutthisbecausetheFlex***outputispre-generated.)checkingforperl.../usr/bin/perlcheckingformainin-lm...yescheckingforlibrarycontainingsetproctitle...nocheckingforlibrarycontainingdlopen...-ldlcheckingforlibrarycontainingsocket...nonerequiredcheckingforlibrarycontainingshl_load...nocheckingforlibrarycontaininggetopt_long...nonerequiredcheckingforlibrarycontainingcrypt...-lcryptcheckingforlibrarycontainingfdatasync...nonerequiredcheckingforlibrarycontaininggethostbyname_r...nonerequiredcheckingforlibrarycontainingshmget...nonerequiredcheckingfor-lreadline...yes(-lreadline)checkingforinflatein-lz...yescheckingforANSICheaderfiles...yescheckingforsys/types.h...yescheckingforsys/stat.h...yescheckingforstdlib.h...yescheckingforstring.h...yescheckingformemory.h...yescheckingforstrings.h...yescheckingforinttypes.h...yescheckingforstdint.h...yescheckingforunistd.h...yescheckingcrypt.husability...yescheckingcrypt.hpresence...yescheckingforcrypt.h...yescheckingdld.husability...nocheckingdld.hpresence...nocheckingfordld.h...nocheckingfp_class.husability...nocheckingfp_class.hpresence...nocheckingforfp_class.h...nocheckinggetopt.husability...yescheckinggetopt.hpresence...yescheckingforgetopt.h...yescheckingieeefp.husability...nocheckingieeefp.hpresence...nocheckingforieeefp.h...nocheckinglanginfo.husability...yescheckinglanginfo.hpresence...yescheckingforlanginfo.h...yescheckingpoll.husability...yescheckingpoll.hpresence...yescheckingforpoll.h...yescheckingpwd.husability...yescheckingpwd.hpresence...yescheckingforpwd.h...yescheckingsys/ipc.husability...yescheckingsys/ipc.hpresence...yescheckingforsys/ipc.h...yescheckingsys/poll.husability...yescheckingsys/poll.hpresence...yescheckingforsys/poll.h...yescheckingsys/pstat.husability...nocheckingsys/pstat.hpresence...nocheckingforsys/pstat.h...nocheckingsys/resource.husability...yescheckingsys/resource.hpresence...yescheckingforsys/resource.h...yescheckingsys/select.husability...yescheckingsys/select.hpresence...yescheckingforsys/select.h...yescheckingsys/sem.husability...yescheckingsys/sem.hpresence...yescheckingforsys/sem.h...yescheckingsys/socket.husability...yescheckingsys/socket.hpresence...yescheckingforsys/socket.h...yescheckingsys/shm.husability...yescheckingsys/shm.hpresence...yescheckingforsys/shm.h...yescheckingsys/tas.husability...nocheckingsys/tas.hpresence...nocheckingforsys/tas.h...nocheckingsys/time.husability...yescheckingsys/time.hpresence...yescheckingforsys/time.h...yescheckingsys/un.husability...yescheckingsys/un.hpresence...yescheckingforsys/un.h...yescheckingtermios.husability...yescheckingtermios.hpresence...yescheckingfortermios.h...yescheckingucred.husability...nocheckingucred.hpresence...nocheckingforucred.h...nocheckingutime.husability...yescheckingutime.hpresence...yescheckingforutime.h...yescheckingwchar.husability...yescheckingwchar.hpresence...yescheckingforwchar.h...yescheckingwctype.husability...yescheckingwctype.hpresence...yescheckingforwctype.h...yescheckingkernel/OS.husability...nocheckingkernel/OS.hpresence...nocheckingforkernel/OS.h...nocheckingkernel/image.husability...nocheckingkernel/image.hpresence...nocheckingforkernel/image.h...nocheckingSupportDefs.husability...nocheckingSupportDefs.hpresence...nocheckingforSupportDefs.h...nocheckingnetinet/in.husability...yescheckingnetinet/in.hpresence...yescheckingfornetinet/in.h...yescheckingfornetinet/tcp.h...yescheckingreadline/readline.husability...yescheckingreadline/readline.hpresence...yescheckingforreadline/readline.h...yescheckingreadline/history.husability...yescheckingreadline/history.hpresence...yescheckingforreadline/history.h...yescheckingzlib.husability...yescheckingzlib.hpresence...yescheckingforzlib.h...yescheckingwhetherbyteorderingisbigendian...nocheckingforanANSIC-conformingconst...yescheckingforinline...inlinecheckingforpreprocessorstringizingoperator...yescheckingforsignedtypes...yescheckingforworkingvolatile...yescheckingfor__func__...yescheckingwhetherstructtmisinsys/time.hortime.h...time.hcheckingforstructtm.tm_zone...yescheckingfortzname...yescheckingforunionsemun...nocheckingforstructsockaddr_un...yescheckingforstructsockaddr_storage...yescheckingforstructsockaddr_storage.ss_family...yescheckingforstructsockaddr_storage.__ss_family...nocheckingforstructsockaddr_storage.ss_len...nocheckingforstructsockaddr_storage.__ss_len...nocheckingforstructsockaddr.sa_len...nocheckingforstructaddrinfo...yescheckingforstructcmsgcred...nocheckingforstructfcred...nocheckingforstructsockcred...nocheckingforstructoption...yescheckingforz_streamp...yescheckingforinttimezone...yescheckingtypesofargumentsforaccept()...int,int,structsockaddr*,socklen_t*checkingwhethergettimeofdaytakesonlyoneargument...nocheckingforcbrt...yescheckingfordlopen...yescheckingforfcvt...yescheckingforfdatasync...yescheckingforgetpeereid...nocheckingforgetpeerucred...nocheckingforgetrlimit...yescheckingformemmove...yescheckingforpoll...yescheckingforpstat...nocheckingforreadlink...yescheckingforsetproctitle...nocheckingforsetsid...yescheckingforsigprocmask...yescheckingforsymlink...yescheckingforsysconf...yescheckingfortowlower...yescheckingforutime...yescheckingforutimes...yescheckingforwaitpid...yescheckingforwcstombs...yescheckingforposix_fadvise...yescheckingwhetherposix_fadviseisdeclared...yescheckingwhetherfdatasyncisdeclared...yescheckingwhetherstrlcatisdeclared...nocheckingwhetherstrlcpyisdeclared...nocheckingwhetherF_FULLFSYNCisdeclared...nocheckingforstructsockaddr_in6...yescheckingforPS_STRINGS...nocheckingforsnprintf...yescheckingforvsnprintf...yescheckingwhethersnprintfisdeclared...yescheckingwhethervsnprintfisdeclared...yescheckingforisinf...yescheckingforcrypt...yescheckingforgetopt...yescheckingforgetrusage...yescheckingforinet_aton...yescheckingforrandom...yescheckingforrint...yescheckingforsrandom...yescheckingforstrdup...yescheckingforstrerror...yescheckingforstrlcat...nocheckingforstrlcpy...nocheckingforstrtol...yescheckingforstrtoul...yescheckingforunsetenv...yescheckingforgetaddrinfo...yescheckingforgetopt_long...yescheckingforrl_completion_append_character...yescheckingforrl_completion_matches...yescheckingforrl_filename_completion_function...yescheckingforreplace_history_entry...yescheckingforsigsetjmp...yescheckingwhethersys_siglistisdeclared...yescheckingforsyslog...yescheckingsyslog.husability...yescheckingsyslog.hpresence...yescheckingforsyslog.h...yescheckingforopterr...yescheckingforoptreset...nocheckingforstrtoll...yescheckingforstrtoull...yescheckingforatexit...yescheckingforfseeko...yescheckingfor_LARGEFILE_SOURCEvalueneededforlargefiles...nocheckingtestprogram...okcheckingwhetherlongintis64bits...yescheckingforunsignedlong...yescheckingsizeofunsignedlong...8checkingforvoid*...yescheckingsizeofvoid*...8checkingforsize_t...yescheckingsizeofsize_t...8checkingwhethertobuildwithfloat4passedbyvalue...yescheckingwhethertobuildwithfloat8passedbyvalue...yescheckingforshort...yescheckingalignmentofshort...2checkingforint...yescheckingalignmentofint...4checkingforlong...yescheckingalignmentoflong...8checkingfordouble...yescheckingalignmentofdouble...8checkingforint8...nocheckingforuint8...nocheckingforint64...nocheckingforuint64...nocheckingforsig_atomic_t...yescheckingforPOSIXsignalinte***ce...yescheckingforspecialCcompileroptionsneededforlargefiles...nocheckingfor_FILE_OFFSET_BITSvalueneededforlargefiles...nocheckingforoff_t...yescheckingsizeofoff_t...8checkingforworkingmemcmp...yescheckingforonsgmls...nocheckingfornsgmls...nocheckingforopenjade...nocheckingforjade...nocheckingforDocBookV4.2...nocheckingforDocBookstylesheets...nocheckingforcollateindex.pl...nocheckingforsgmlspl...nocheckingfordocbook2man...checkingifgccsupports-Wl,--as-needed...yesconfigure:usingCFLAGS=-O2-Wall-Wmissing-prototypes-Wpointer-arith-Wdeclaration-after-statement-Wendif-labels-fno-strict-aliasing-fwrapvconfigure:usingCPPFLAGS=-D_GNU_SOURCEconfigure:usingLDFLAGS=-Wl,--as-neededconfigure:creating./config.statusconfig.status:creatingGNUmakefileconfig.status:creatingsrc/Makefile.globalconfig.status:creatingsrc/include/pg_config.hconfig.status:src/include/pg_config.hisunchangedconfig.status:creatingsrc/inte***ces/ecpg/include/ecpg_config.hconfig.status:src/inte***ces/ecpg/include/ecpg_config.hisunchangedconfig.status:linking./src/backend/port/tas/dummy.stosrc/backend/port/tas.sconfig.status:linking./src/backend/port/dynloader/linux.ctosrc/backend/port/dynloader.cconfig.status:linking./src/backend/port/sysv_sema.ctosrc/backend/port/pg_sema.cconfig.status:linking./src/backend/port/sysv_shmem.ctosrc/backend/port/pg_shmem.cconfig.status:linking./src/backend/port/dynloader/linux.htosrc/include/dynloader.hconfig.status:linking./src/include/port/linux.htosrc/include/pg_config_os.hconfig.status:linking./src/makefiles/Makefile.linuxtosrc/Makefile.port[root@bwdpostgresql-8.4.2]#
复制代码 然后实行gmake- rm-rf./testtablespacemkdir./testtablespacegmake[2]:Leavingdirectory`/postgresql-8.4.2/src/test/regressgmake[1]:Leavingdirectory`/postgresql-8.4.2/srcgmake-Cconfigallgmake[1]:Enteringdirectory`/postgresql-8.4.2/configgmake[1]:Nothingtobedonefor`all.gmake[1]:Leavingdirectory`/postgresql-8.4.2/configAllofPostgreSQLsuccessfullymade.Readytoinstall.
复制代码 看到readytoinstal基础就乐成了
等编译完成后,没有毛病,再实行gmakeinstall
具体申明,能够看
(5)编译Bandwidthd
在编译Bandwithd前,请反省/usr/local/pgsql/下是不是已有bandwidthd必要的库和头文件了。
进进bandwidthd目次
./configure
实行configure后,看看是不是有毛病。注重,假如Postgresq编译有成绩化,Bandwidthd编译出来的步伐是不会撑持Postgresql的。
make
能够经由过程步伐文件巨细判别
假如不带Postgresq撑持的是11***x的巨细。
这2个中央必需是yes,才干编译出撑持Postgrsql的步伐.
makeinstall后,步伐的设置文件在/usr/local/bandwidthd/etc目次- #####################################################Bandwidthd.conf##Commentedoutoptionsareheretoprovide#documentationandrepresentdefaults#Subnetstocollectstatisticson.Trafficthat#matchesnoneofthesesubnetswillbeignored.#SyntaxiseitherIPSubnetMaskorCIDR#subnet10.0.0.0255.0.0.0#subnet192.168.0.0/16#subnet172.16.0.0/12subnet10.0.0.0255.255.0.0subnet10.1.0.0255.255.0.0subnet10.2.0.0255.255.0.0subnet10.3.0.0255.255.0.0subnet10.4.0.0255.255.0.0subnet10.5.0.0255.255.0.0subnet192.168.0.0/16subnet172.16.25.0/24subnet172.16.10.0/24subnet172.16.11.0/24subnet172.16.12.0/24subnet172.16.13.0/24subnet172.16.14.0/24subnet172.16.15.0/24subnet172.16.16.0/24subnet172.16.17.0/24subnet172.16.18.0/24subnet172.16.19.0/24subnet172.16.20.0/24subnet172.16.31.0/24subnet172.16.32.0/24subnet172.16.33.0/24subnet172.16.34.0/24subnet172.16.35.0/24subnet172.16.36.0/24pgsql_connect_string"user=postgresdbname=bandwidthdhost=127.0.0.1"sensor_id"sensor1.cn"#Devicetolistenon#Bandwidthdlistensonthefirstdeviceitdetects#bydefault.Run"bandwidthd-l"foralistof#devices.dev"eth1"####################################################Optionsthatdontusuallygetchanged#Anintervalis2.5minutes,thisishowmany#intervalstoskipbeforedoingagraphingrun#skip_intervals150#Graphcutoffishowmanykmustbetransferedbyan#ipbeforewebothertographitgraph_cutoff1024#Putinte***ceinpromiscuousmodetoscoretotraffic#thatmaynotberoutingthroughthehostmachine.promiscuoustrue#Logdatatocdffilehtdocs/log.cdfoutput_cdftrue#Readbackthecdffileonstartuprecover_cdffalse#Libpcapformatfilterstringusedtocontrolwhatbandwidthdsees#Pleasealwaysinclude"ip"inthestringtoavoidstrangeproblemsfilter"ip"#DrawGraphs-Thisdefaulttotruetographthetrafficbandwidthdisrecording#Usuallysetthistofalseifyouonlywantcdfoutputor#youareusingthedatabaseoutputoption.Bandwidthdwilluseverylittle#ramandcpuifthisissettofalse.graphfalse#SetMETAREFRESHseconds(default150,use0todisable).meta_refresh150
复制代码 2、假如要能乐成运转Bandwidthd,还必要创立数据库
在Bandwidthd目次下,有个schema.postgresql剧本,要起首将他导进数据库- su-postgrespsqlcreatedatabasebandwidthd;[postgres@bwdbandwidthd-2.0.1]$psqlbandwidthdpostgres<schema.postgresqlCREATETABLECREATEINDEXCREATEINDEXCREATETABLECREATEINDEXCREATEINDEXCREATETABLECREATEINDEXCREATETABLECREATEINDEXNOTICE:CREATETABLEwillcreateimplicitsequence"sensors_sensor_id_seq"forserialcolumn"sensors.sensor_id"NOTICE:CREATETABLE/PRIMARYKEYwillcreateimplicitindex"sensors_pkey"fortable"sensors"CREATETABLE[postgres@bwdbandwidthd-2.0.1]$
复制代码 重启bandwidthd后postgresql数据库,2分钟后,数据库里就无数据了。
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的小伙伴们! |
|