16

注:此文备录 相关信息来自网络 记录备用下并时刻更新
操作系统环境:VM虚拟机下的Ubuntu8.04 Server 只安装OpenSSH服务
KBS BBS: kbs svn上最新的源代码
Apache:apache1.3.41.tar.gz (下载:http://www.apache.org
PHP:php5.2.6.tar.gz(下载:http://www.php.net
代码目录:/home/bbs/src/

安装前准备工作:更新安装时可能所需要的包:

# apt-get install automake1.9
# apt-get install php5-dev
# apt-get install libmysqlclient15-dev
# apt-get install sendmail
# apt-get install libesmtp5
# apt-get install byacc
# apt-get install libgmp3-dev
# apt-get install flex
# apt-get install libxml2-dev
# apt-get install libjpeg62-dev
# apt-get install libpng12-dev
# apt-get install libfreetype6-dev
# apt-get install subversion

创建bbs用户:

    # adduser bbs

安装apache服务:

# tar xvf apache_1.3.41.tar.gz
# cd apache_1.3.41
# CC="gcc" OPTIM="-O2" ./configure --prefix=/home/bbs/www --enable-module=so
# make
# make install

编辑apache的配置文件,User和Group都改成bbs,Port改成想要的端口。

# cd /home/bbs/www/conf
# vim httpd.conf

安装PHP

# tar xvf php-5.2.6.tar.gz
# cd php-5.2.6
# ./configure --with-mysql --with-apxs=/home/bbs/www/bin/apxs \\
--with-gd --with-png-dir --with-iconv --with-jpeg-dir \\
--with-zlib --with-ttf --with-freetype-dir --enable-gd-native-ttf
# make
# make install

编辑apache的配置文件/home/bbs/www/conf/httpd.conf,在里面加入这样一行:

AddType application/x-httpd-php .php

下载安装KBS
从kbs的svn服务器上下载最新的kbs源代码。

# cd /home/bbs/src
# svn co http://svn.kcn.cn/repos/kbs/trunk/kbs_bbs
# svn co http://svn.kcn.cn/repos/kbs/trunk/www2

查看bbs用户的gid和uid是多少。

# cat /etc/passwd | grep bbs

到kbs的站点定义目录下,建造一份自己的站点的定义文件,比如站点叫做Yousri。尤其要修改Yousri.h中的BBSUID和BBSGID为刚才看到的bbs用户的编号。

# cd /home/bbs/src/kbs_bbs/site
# cp fb2k-v2.h yousri.h
# cp fb2k-v2.c yousri.c
# vim yousri.h
运行autogen.sh。
<pre lang="bash">
# cd /home/bbs/src/kbs_bbs
# ./autogen.sh
# cd sshbbsd
# ./autogen.sh

编译安装kbs。

# cd /home/bbs/src/kbs_bbs
# ./configure --prefix=/home/bbs --enable-site=yousri \\
--with-php --with-mysql --enable-ssh --enable-ssl \\
--with-openssl=/usr --with-libesmtp --enable-innbbsd CFLAGS="-O3 -g"
# make
# make install

如果是新建的bbs站点,还需要安装默认的站点文件。

# make install-home

给sshbbsd生成钥匙。

# cd /home/bbs/etc
# touch sshd_config
# ssh-keygen -t rsa1 -f ssh_host_key

从php源码目录复制来一个php的配置文件,并编辑之。

# cd /usr/local/lib
# cp /home/bbs/src/php-5.2.6/php.ini-dist php.ini
# vim php.ini

修改extension_dir一行为:

extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613/"

然后加入下面一行:

extension=libphpbbslib.so

把www2符号连接到apache的网页目录来。

# cd /home/bbs/www/
# mv htdocs htdocs.default
# ln -s ../src/www2 htdocs

因为之前很多操作需要用root执行,可能bbs的很多文件的owner和group不对,所以一并搞掉。

# chown -R bbs:bbs /home/bbs

启动BBS:

# cd /home/bbs/bin
# ./miscd daemon
# ./bbslogd
# ./bbsd -p 23
# ./sshbbsd -p 22
# cd ../www/bin
# ./apachectl start

如果要停止bbs的话按如下操作:

# cd /home/bbs/www/bin
# ./apachectl stop
# cd ../../bin
# killall sshbbsd
# killall bbsd
# killall bbslogd
# ./miscd flush
# killall miscd

其中期间遇到过两个比较莫名其妙的小问题
到最后启动bbs的时候 执行

root@yousri:/home/bbs/bin# ./miscd daemon
Bus error

这一步的时候出现如此的错误提示
还有就是启动后 telnet 127.0.0.1 进入要注册出现无法注册的现象如注册SYSOP账号却提示
“由于某些系统原因, 无法注册新的帐号.”
然后要再次连接 telnet 127.0.0.1 就无法连接了

“root@yousri:/home/bbs# telnet 127.0.0.1
  Trying 127.0.0.1...
  Connected to 127.0.0.1.
  Escape character is '^]'.
  Connection closed by foreign host.”

至于执行./miscd daemon报错的问题 后来又重新编译安装了下kbs代码 倒是可行了。。。
对于无法注册账号的 貌似要杀掉有关miscd及bbslogd的进程 然后重新创建才可以 即:

killall miscd
killall bbslogd

终于正常了。。。。
其他系统使用待更新。。。。

written by Yousri \\ tags: , ,

20

       先前曾经简单介绍过在CentOS5.2下搭建实现DNS服务器,可查看这里

       现在就再简单大致记录介绍三款常用于检查测试调试DNS服务器搭建是否成功的工具吧~即Dig、Host、Nslookup,介绍:

      
Shell方式可以使用3种工具来查询DNS数据库:nslookup、dig和host,在BIND的软件发布中包括nslookup和dig。
Nslookup是这三个工具中最老的,而且总是随同BIND一起发布;dig是域信息的探索程序,最初由SteveHotz编写,后来
MichaelSawy针对BIND 9将它重新编写,它也和BIND一起发布;host由Eric
Wassenaar编写,是另一个开放源代码的工具,其特点是输出对用户很友好,功能是可检查区文件的语法。另外三者使用的解析器库不同:dig和
host使用BIND的解析器,而nslookup有其自身的解析器。

       (1)、Dig命令

Usage:  dig [@global-server] [domain] [q-type] [q-class] {q-opt}
            {global-d-opt} host [@local-server] {local-d-opt}
            [ host [@local-server] {local-d-opt} [...]]

      
以上是关于dig用法参数列表,可以通过man dig 或者 dig –h | more 查看其命令相应的帮助信息~ 参数可接IP
address或domain name来获得name server所提供的相关讯息,提供不同资料记录型态,例如A、MX…等等

      (2)、Host命令

[root@yanqx ~]$ host -h              
host: illegal option — h
Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]
            [-R number] hostname [server]
       -a is equivalent to -v -t *
       -c specifies query class for non-IN data
       -C compares SOA records on authoritative nameservers
       -d is equivalent to -v
       -l lists all hosts in a domain, using AXFR
       -i IP6.INT reverse lookups
       -N changes the number of dots allowed before root lookup is done
       -r disables recursive processing
       -R specifies number of retries for UDP packets
       -t specifies the query type
       -T enables TCP/IP mode
       -v enables verbose output
       -w specifies to wait forever for a reply
       -W specifies how long to wait for a reply
       -4 use IPv4 query transport only
       -6 use IPv6 query transport only

       默认情况下,只是简单使用host+欲查询域名得到只是简单一些A记录或MX记录等,想了解全部信息需加上 –a 参数查看 如:

[root@yanqx ~]$ host qingxianyan.cn
qingxianyan.cn has address 74.220.219.76
qingxianyan.cn mail is handled by 0 qingxianyan.cn.

   (3)、Nslookup命令

       在linux或win下
入nslookup命令后,会看到 > 提示符号,之后就可输入查询指令。一般会输入IP address或是domain
name来做反向及正向的解析。而nslookup不仅提供上述2种解析,亦像dig提供DNS中其它的资料记录型态,例如A、MX、NS…等等,可在提
示符号直接输入”?”来获得所有可以使用的参数或资料型态。

Commands:   (identifiers are shown in uppercase, [] means optional)
NAME            – print info about the host/domain NAME using default server
NAME1 NAME2     – as above, but use NAME2 as server
help or ?       – print info on common commands
set OPTION      – set an option
    all                 – print options, current server and host
    [no]debug           – print debugging information
    [no]d2              – print exhaustive debugging information
    [no]defname         – append domain name to each query
    [no]recurse         – ask for recursive answer to query
    [no]search          – use domain search list
    [no]vc              – always use a virtual circuit
    domain=NAME         – set default domain name to NAME
    srchlist=N1[/N2/.../N6] – set domain to N1 and search list to N1,N2, etc.
    root=NAME           – set root server to NAME
    retry=X             – set number of retries to X
    timeout=X           – set initial time-out interval to X seconds
    type=X              – set query type (ex. A,ANY,CNAME,MX,NS,PTR,SOA,SRV)
    querytype=X         – same as type
    class=X             – set query class (ex. IN (Internet), ANY)
    [no]msxfr           – use MS fast zone transfer
    ixfrver=X           – current version to use in IXFR transfer request
server NAME     – set default server to NAME, using current default server
lserver NAME    – set default server to NAME, using initial server
finger [USER]   – finger the optional NAME at the current default host
root            – set current default server to the root
ls [opt] DOMAIN [> FILE] – list addresses in DOMAIN (optional: output to FILE)
    -a          -  list canonical names and aliases
    -d          -  list all records
    -t TYPE     -  list records of the given type (e.g. A,CNAME,MX,NS,PTR etc.)
view FILE           – sort an ‘ls’ output file and view it with pg
exit            – exit the program

     参考资料:http://docsrv.sco.com/NET_tcpip/dnsC.nslook.html

written by Yousri \\ tags: , , , ,

26

        介绍推荐两款命令系统工具:硬件配置信息查看工具lshw及查看打开的文件和套接字工具lsof
        lshw硬件查看工具,它全称叫:HardWare LiSter,实现的原理应该可以说是获取使用/proc里面读取到的数据来显示相关的信息
        下载地址:http://ezix.org/software/files/lshw-B.02.14.tar.gz
        解压安装:tar -zxvf lshw-B.02.14.tar.gz && make && make install 即可
        可以先了解查看解压后目录下的README文件信息:

    1 lshw: HardWare LiSter for Linux
    2 ===============================
    4 lshw is a small tool to provide detailed information on the hardware confi-
    5 guration of the machine. It can report exact memory configuration, firmware
    6 version, mainboard configuration, CPU version and speed, cache configuration,
    7 bus speed, etc. on DMI-capable x86 or EFI (IA-64) systems and on some PowerPC
    8 machines (PowerMac G4 is known to work).
    10 Information can be output in plain text, XML or HTML.
    12 It currently supports DMI (x86 and EFI only), OpenFirmware device tree
    13 (PowerPC only), PCI/AGP, ISA PnP (x86), CPUID (x86), IDE/ATA/ATAPI, PCMCIA
    14 (only tested on x86), USB and SCSI.
    16  * Requirements
    17     . Linux 2.4.x or 2.6.x (2.2.x might work, though)
    18     . a PA-RISC, Alpha, IA-64 (Itanium), PowerPC or x86 based machine
    19     . an ANSI (or close enough to ANSI compliance) C++ compiler
    20     (tested with g++ 2.95.4 and 3.2.2)
    21     . for the (optional) GTK+ graphical user interface, you will need a
    22     complete GTK+ 2.4 development environment (gtk2-devel on RedHat/Fedora
    23     derivatives)
    25  * To compile it, just use:
    27     $ make
    29  * If you want to build the optional GUI, do:
    31     $ make
    32     $ make gui
    34  * the lshw home page is http://lshw.org/
    35  * send bug reports, requests for help, feature requests, comments, etc. to
    36    bugs@ezix.org.  The author can be contacted directly (lyonel@ezix.org)
    37    Please make sure you include enough information in your bug report:
    XML  38    output from lshw is preferred over text or HTML, indicate the affected
    39    version of lshw, your platform (i386, x86-64, PA-RISC, PowerPC, etc.) and 40
    your distribution.
    and so on。。。

        可以使用html格式输出这些信息 通过web浏览查看 如:

    #lshw -html &gt;/var/www/pcinfo.html

        然后网页 http://yourdomain/pcinfo.html 查看
        还有更多的相关lshw参数可以使用 也支持图形界面的查看,详见

    #lshw –X    //图形界面
    #man lshw   // 查看lshw工具更多参数用法

        lsof轻松查看正在运行的进程可打开哪些文、目录及套接字等信息,了解应用程序打开了哪些文件或者哪个应用程序打开了特定的文件,进而了解更多关于系统的信息。
        快速查出哪个进程在使用某个特定目录(如:/root/install) ,此有助于umount(卸载)或rm(删除)某些文件系统或目录前进行确认,可尝试使用lsof工具:

    [root@yanqx ~]# lsof /root/install/
    COMMAND   PID USER   FD   TYPE DEVICE SIZE      NODE NAME
    bash    18041 root  cwd    DIR   0,29 4096 188088470 /root/install/

        可见得,显然是root进入到了/root/install目录中。。。。
        同样,lsof也可列举出与特地进程相关联到的文件、目录、库等等信息,如要显示与指定PI进程相关联的文件可使用-p选项:

    [root@yanqx ~]# lsof -p 9554
    COMMAND  PID USER   FD   TYPE   DEVICE    SIZE      NODE NAME
    sshd    9554 root  cwd    DIR     0,29    4096 187957388 /
    sshd    9554 root  rtd    DIR     0,29    4096 187957388 /
    sshd    9554 root  txt    REG     0,29  409560 187988270 /usr/sbin/sshd
    sshd    9554 root  mem    REG     0,29  132304 187973604 /lib64/ld-2.5.so
    sshd    9554 root  mem    REG     0,29   44472 187973606 /lib64/libpam.so.0.81.5
    sshd    9554 root  mem    REG     0,29   20424 187973386 /lib64/libdl-2.5.so
    sshd    9554 root  mem    REG     0,29 1750504 190255826 /usr/local/ssl/lib/libcrypto.so.0.9.8
    sshd    9554 root  mem    REG     0,29   15280 187973406 /lib64/libutil-2.5.so
    sshd    9554 root  mem    REG     0,29   83344 187959026 /usr/lib64/libz.so.1.2.3
    sshd    9554 root  mem    REG     0,29  111480 187973548 /lib64/libnsl-2.5.so
    sshd    9554 root  mem    REG     0,29   45728 187973602 /lib64/libcrypt-2.5.so
    sshd    9554 root  mem    REG     0,29   89800 187972006 /lib64/libresolv-2.5.so
    sshd    9554 root  mem    REG     0,29 1698672 187973486 /lib64/libc-2.5.so
    sshd    9554 root  mem    REG     0,29   84400 187973582 /lib64/libaudit.so.0.0.0
    sshd    9554 root  mem    REG     0,29   53880 187973574 /lib64/libnss_files-2.5.so
    sshd    9554 root    0u   CHR      1,3          12392555 /dev/null
    sshd    9554 root    1u   CHR      1,3          12392555 /dev/null
    sshd    9554 root    2u   CHR      1,3          12392555 /dev/null
    sshd    9554 root    3u  IPv6 12393000               TCP *:ssh (LISTEN)
    sshd    9554 root    4u  IPv4 12393002               TCP *:ssh (LISTEN)

        或也可以通过使用-c参数选项,来通过进程名称来指定的进程查看:

    [root@yanqx ~]# lsof -c init
    COMMAND PID USER   FD   TYPE DEVICE    SIZE      NODE NAME
    init      1 root  cwd    DIR   0,29    4096 187957388 /
    init      1 root  rtd    DIR   0,29    4096 187957388 /
    init      1 root  txt    REG   0,29   40968 187988546 /sbin/init
    init      1 root  mem    REG   0,29          96280139 /sbin/init (path inode=187988546)
    init      1 root  mem    REG   0,29  132304 187973604 /lib64/ld-2.5.so
    init      1 root  mem    REG   0,29  245264 187973608 /lib64/libsepol.so.1
    init      1 root  mem    REG   0,29   92960 187973474 /lib64/libselinux.so.1
    init      1 root  mem    REG   0,29 1698672 187973486 /lib64/libc-2.5.so
    init      1 root  mem    REG   0,29   20424 187973386 /lib64/libdl-2.5.so
    init      1 root   10u  FIFO   0,48          12392766 /dev/initctl

        关于lsof这工具还可以通过相当多的不同参数进行实现不同功能 这里就不一一列举。。可自己查看工具命令帮助文档了解 嗯
        对此两工具就简单介绍分享推荐到此////

written by Yousri \\ tags: ,