仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 476|回复: 8
打印 上一主题 下一主题

[CentOS(社区)] Linux教程之CentOS6.4下编译装置Bandwidthd和Postgrsql

[复制链接]
蒙在股里 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-14 20:43:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

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
实行后,看看有无毛病
  1. [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
  1. 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目次
  1. #####################################################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剧本,要起首将他导进数据库
  1. 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教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的小伙伴们!
只想知道 该用户已被删除
沙发
发表于 2015-1-16 21:55:32 来自手机 | 只看该作者

Linux教程之CentOS6.4下编译装置Bandwidthd和Postgrsql

学习Linux半年了~个人认为不会的多在网上找资料网上有很多资料可以搜索到,LS那位说放手去搞。
若相依 该用户已被删除
板凳
发表于 2015-1-25 23:52:00 | 只看该作者
眼看这个学期的Linux课程已经告一段落了,我觉得有必要写一遍心得体会来总结一下这学期对着门课程的学习。
深爱那片海 该用户已被删除
地板
发表于 2015-2-4 19:55:50 | 只看该作者
Windows?是图形界面的,Linux类似以前的?DOS,是文本界面的,如果你运行了图形界面程序X-WINDOWS后,Linux?也能显示图形界面,也有开始菜单、桌面、图标等。
海妖 该用户已被删除
5#
发表于 2015-2-10 06:56:15 | 只看该作者
眼看这个学期的Linux课程已经告一段落了,我觉得有必要写一遍心得体会来总结一下这学期对着门课程的学习。
兰色精灵 该用户已被删除
6#
发表于 2015-3-1 03:35:24 | 只看该作者
我们这一代90后,从小接触的是windows98,家里条件好的自己有电脑装的是2000,后来又有了XP,上大学时又有了win7。
老尸 该用户已被删除
7#
发表于 2015-3-10 15:11:39 | 只看该作者
对于英语不是很好的读者红旗 Linux、中标Linux这些中文版本比较适合。现在一些Linux网站有一些Linux版本的免费下载,这里要说的是并不适合Linux初学者。
不帅 该用户已被删除
8#
发表于 2015-3-17 11:08:23 | 只看该作者
为了更好的学习这门课程,我不仅课上认真听讲,课下也努力学习,为此还在自己的电脑上安装了Ubuntu系统。
莫相离 该用户已被删除
9#
发表于 2015-3-24 10:16:11 | 只看该作者
当然你不需搭建所有服务,可以慢慢来。自己多动手,不要非等着别人帮你解决问题。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-12-23 20:57

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表