Note for AIX

1.     AIX系统                  #smitty 进入系统管理界面   #smit
#bootinfo -y 可以查看操作系统的位数
                                #oslevel 可以查看操作系统版本
                                #oslevel -r 可以查看操作系统小版本号  #lslpp -h bos.rte
                                            oslevel -s   系统上安装了什么 SP (Service Pack)
                                #prtconf 查看硬件信息
                                #bootinfo -r  查看内存 
                                #lsvg -p rootvg 
                                #lsattr -l rmt0 -E 列出磁带设备 rmt0 的当前属性值
                                #lsattr -l rmt0 -D 列出磁带设备 rmt0 的缺省属性值
                                #lsattr -l tty0 -a login -R   列出 TTY 设备 tty0 的可能登录属性值
                                #lscfg | grep proc   显示您系统上的处理器数量
                                #lspv    显示系统上的硬盘数量
                                #lspv hdisk1   有关 hdisk1 的详细信息      
                               lspv :查看系统硬盘
lspv hdisk# :查看硬盘hdisk#的空间分配情况
lsvg :查看系统VG
lsvg vg_name : 查看VG的空间分配情况
lsvg -l vg_name: 查看VG中LV分配情况以及对应的文件系统
df -k :查看文件系统使用情况。
du 命令并不是显示磁盘的空闲空间,而是显示磁盘使用情况的信息。du 工具用于确定文件和目录的磁盘使用情况。 
$ find . -user mc -type f -exec du -k {} \  某个用户所使用的磁盘空间,在使用 find 命令的同时,
需要结合使用 du 命令以仅报告特定用户的磁盘使用情况。  
-user 选项允许您指定 find 将仅报告属于特定用户的文件
-type 选项强制 find 仅返回特定类型(在本示例中是文件)项目的路径,
         这样可以防止 du 包含目录,因为这些目录可能属于某个用户,
         但其中却包含了许多用户的文件。然后,对于查找到的每个路径,
         执行 du 命令以报告磁盘使用情况。   
$ find . -user mc -type f -exec du -k {} \;|awk '{ s = 
     s+$1 } END { print "Total used: ",s }'
Total used:   123721      要获得摘要信息,即某个特定用户所使用的总空间,可以使用 awk 对该信息进行总计,并打印出最后的值: 
$ find . -group mcslp -type f -exec du -k {} \;|awk '{ s = s+$1 } END { print
"Total used: ",s }'
"Total used: ",s }'
Total used:   542485        对于组,可以根据相同的原则对 find 使用 -group 选项:       
                                                                       
         
                                #lscfg   获得系统的详细配置
                                #lscfg -vl rmt0  显示有关磁带驱动器 rmt0 的详细信息
                                #uname命令可以提供关于系统的详细信息。
uname -p 显示系统的芯片类型。例如,PowerPC。 
uname -r 显示操作系统的版本号。 
uname -s 显示系统名称。例如,AIX。 
uname -n 显示节点名称。 
uname -a 显示系统名称、节点名称、版本、计算机 ID。 
uname -M 显示系统型号名称。例如,IBM, 9114-275。 
uname -v 显示操作系统版本。 
uname -m 显示运行系统的硬件的计算机 ID 编号。 
uname -u 显示系统 ID 编号。
 
2.     IBM pSeries服务器AIX系统的常用命令
                移动文件         a) # mv intro manual/chap1 将 intro 文件移动到 manual/chap1 目录。
                                 b) # mv chap3 manual       将 chap3 移动到 manual/chap3.
                                 c) # mv appendix apndx.a   将 appendix 文件重命名为 apndx.a
                移动文件夹       d) # mvdir book manual     如果 manual 目录在系统中已经存在,则上面的命令会将 book 目录移动到名为 manual 的目录下面。
                                 e) # mvdir book3 proj4/manual  将 book3 目录移动到名为 proj4 的目录下面,并且会将 proj4 目录重新命名为 manual
                                                                                                                (如果 manual 目录事先在系统中不存在)。
                清空并去除目录   f) # rm mydir/* mydir/.*    # rmdir mydir     
                                                         rm mydir/* mydir/.* 首先除去名字不以圆点开头的文件,然后除去那些名字以圆点开头的文件
                                 g) # cd /tmp # rmdir -p jones/demo/mydir    将 jones/demo/mydir 目录从 /tmp 目录中除去。
                                                                             如果目录非空,或者没有写权限,则命令以适当的出错消息终止。
                                 h) # rm myfile    删除名为 myfile 的文件
                                 i) # rm -i mydir/*  依次删除 mydir 目录中的所有文件
                排序             j) # sort names
                                    # sort names states
                文件系统         k) # crfs -v jfs -g testvg -a size=10M -m /fs1   将在卷组 testvg 中创建一个大小为 10MB、安装点为 /fs1 的 jfs 文件系统
                                    # crfs -v jfs2 -g testvg -a size=10M -p ro -m /fs2     将在卷组 testvg 中创建一个大小为 10MB、安装点为 /fs2 并具有
                                                                                           只读权限的 jfs2 文件系统 
                                    chfs -a size=+1000000 /usr   将/usr文件系统的大小增加 1000000 个 512 字节的块
                                    mount -V cdrfs -o ro /dev/cd0 /cdrom   安装 CD
                                    mount /dev/fslv02 /test   将在 /test 目录中安装文件系统 /dev/fslv02
                                    mount {-a|all} 将安装所有缺省文件系统 (/etc/filesystems 文件中标记有 mount=true 属性的所有标准文件系统)
                                    umount /test  卸载 /test 文件系统
                                    mount   显示有关所有当前已安装的文件系统的信息
                                    rmfs /test   删除 /test 文件系统
                                    defragfs /home    对文件系统 /home 进行碎片整理
                                    lslpp -l   显示有关系统上已安装文件集的信息
                                    which_fileset svmon   显示bos.perf.tools包含/usr/bin/svmon
                                    lslpp -w /usr/bin/vmstat    显示/usr/bin/vmstat包含bos.acct
                                    instfix -i | grep ML  系统上是否安装了所有维护级文件集
                                    instfix -ik IY24043   确定是否安装了 IY24043
                                    instfix -k IY73748 -d /dev/cd0    从/dev/cd0安装 APAR IY73748
                                    lppchk -v   验证文件集是否有必需的先决条件和是否已完全安装
                                    dump -Htv  获得符号表示中的 loader 节头和符号条目的转储
                                    lsps -a   确定已分配和使用的分页空间量
                                    chps -s 3 hd6   将 hd6 的大小增加 3 个逻辑分区
                                    chps -d 4 hd6   将 hd6 的大小减少四个逻辑分区
              同步多线程(Simultaneous Multi-threading,SMT)  AIX 5L Version 5.3 的基于 POWER5 的系统,则它就能使用 SMT
                                  l) #smtctl  将告诉您是否启用了 SMT   32 位和 64 位内核都支持 SMT
                                     smtctl [ -m off | on [ -w boot | now]]   启用或禁用 SMT                                  
-m off 将 SMT 模式设置为禁用。 
-m on 将 SMT 模式设置为启用。 
-w boot  如果在下一次系统重新启动前运行bosboot命令,则此选项使 SMT 模式更改在下一次和后续重新启动时生效。 
-w now 使 SMT 模式更改立即生效,但不会延续到下一次重新启动以后。 
如果既没有指定-w boot 也没有指定-w now 选项,则模式更改立即生效。
如果在下一次系统重新启动前运行bosboot命令,所做的更改将延续到后续重新启动以后。
            分区的信息和统计信息
                                  m)#lparstat   提供分区信息和利用率统计信息报告。此命令还可以显示 Hypervisor 信息。
                                     lsvg      显示系统中的卷组,查看 MAX PVs 的值。该值为 32 表示常规、128 表示大容量、1024 表示可扩展的卷组
                                     lsvg rootvg   显示rootvg的所有特征
                                  mkvg -y name_of_volume_group -s partition_size list_of_hard_disks 
                                                s partition_size 设置每个物理分区中的兆字节 (MB) 数,并且 partition_size 是以 MB 为单位、
                                                从 1 到 1024 的值(对于 AIX 5.3 是从 1 到 131072)。partition_size 变量必须等于 2 的幂
                                                (例如:1、2、4、8)。标准和大容量卷组的缺省值是保持在“每个物理卷最多只能有 1016 个物理分区”限制内的最低值。
                                                可扩展卷组的缺省值为每个物理卷容纳 2040 个物理分区的最低值。   
                                 chvg   更改卷组的特征
                                 mklv -y name_of_logical_volume name_of_volume_group number_of_partition  创建逻辑卷
                                 extendlv lv05 3  将 lv05 目录所表示的逻辑卷增加三个逻辑分区
                                 lsvg -l rootvg   显示属于 rootvg 的所有逻辑卷
                                 lslv lv1         显示有关逻辑卷 lv1 的信息
                                 rmlv lv7         删除逻辑卷 lv7  仅删除逻辑卷,但不删除其他实体,例如使用该逻辑卷的文件系统或分页空间
                                 mklvcopy LogicalVolumeName Numberofcopies 
                                 syncvg VolumeGroupName   镜像逻辑卷
                                 rmlvcopy  删除逻辑卷的逻辑分区副本
                                 rmlvcopy testlv 2   减少属于逻辑卷 testlv 的每个逻辑分区的副本数量,现在该逻辑卷中每个逻辑分区最多只有两个物理分区。
                                 lsvg -p rootvg   显示rootvg所使用的磁盘
                                 extendvg   VolumeGroupName   hdisk0 hdisk1 ... hdiskn   将磁盘添加到卷组   
                                 /usr/sbin/lquerypv -M hdisk0  hdisk0 的 LTG 大小为 256 KB  带-M标志使用lquerypv命令,输出给出以 KB 为单位的 LTG 大小。
                                                        硬盘所支持的最大逻辑磁道组 (LTG)
                                 syncvg -p hdisk4 hdisk5   同步位于物理卷 hdisk6 和 hdisk7 上的物理分区
                                 syncvg -v testvg    要同步卷组 testvg 中的所有物理分区 
                                 替换某个磁盘:
extendvg VolumeGroupName hdisk_new 
migratepv hdisk_bad hdisk_new 
reducevg -d VolumeGroupName hdisk_bad
                               alt_disk_copy -d hdisk1     将 rootvg 克隆到 hdisk1
             网络              #no 置或显示网络优化参数的当前或下一次启动时的值
                               ifconfig -ahost Fully_Qualified_Host_Name   获得计算机的 IP 地址
                               lsdev -Cc if   显示网络接口
                               ifconfig -a    显示网络接口
                               ifconfig tr0   有关某个特定网络接口(例如,tr0)的信息
                               ifconfig tr0 up   激活网络接口 tr0 
                               ifconfig tr0 down 禁用网络接口 tr0
            配额               n) 当用户创建一个超过其软限制的文件时,他们将会得到下面的警告:
                                  quota_ufs: Warning: over disk limit (pid 1738, uid 101, inum 94, fs /export/home)
                                  留给用户 7 天的时间更正该问题,可以使用 edquota -t 来更改这个期限
                                  如果用户试图创建超过硬限制的文件,那么系统将终止写进程并根据相应的限制来截断该文件:
                                  $ mkfile 210000k overlimit
quota_ufs: over hard disk limit (pid 1843, uid 101, inum 130, fs
/export/home)
overlimit: initialized 191873024 of 215040000 bytes: Disc quota exceeded
通过运行 quota 命令,任何用户都可以检查他们自己的配额限制和磁盘使用情况:
$ quota
Over disk quota on /export/home, remove 199993K within 7.0 days
使用 quota 命令,系统管理员可以检查任何用户的配额,您应该使用 -v 命令行选项以提供关于文件系统、使用情况和限制信息的完整报告
$ quota -v mc
Disk quotas for mc (uid 101):
Filesystem      usage   quota   limit     timeleft   files   quota   limit   
timeleft
/export/home   399993 200000 400000     6.9 days     151       0       0
                                 要获得某个文件系统中详细描述所有用户的磁盘和配额使用情况的报告,可以使用 repquota 命令,并指定要报告的文件系统
                                 $ repquota -v /export/home 
/dev/dsk/c0t0d0s7 (/export/home):
                      Block limits                   File limits
User            used    soft    hard   timeleft   used    soft    hard timeleft
mc         +- 399993 200000 400000   6.9 days    151       0       0   
要确保配额信息保持最新,应该使用 quotacheck 命令。这将利用用来报告配额信息的配额信息对文件存储数据进行验证。
应该使用 cron 来自动地运行这项任务,每天一次比较合适(因为这个过程是比较耗时的)。 
文件系统: df -k
设备: lsdev -C
磁盘(物理卷): lspv
paging space: lsps -a
配置: lscfg -vp
软件: lslpp -l
用户: who
处理器个数: lsdev -C|grep proc
内存大小: lsattr -El mem0  
有很多的标准工具可以关机,但它们的关机顺序都相同
关机 shutdown、 init、 halt
建议使用:
shutdown
使用wall命令提醒用户1分钟后关机
shutdown +2
2分钟后关机
shutdown -Fr
-r = 关机后重新启动     
所有的AIX错误都记录在一个记录文件中 
显示错误
errpt
显示详细的错误信息
errpt -a
最好用more或 pg命令分页显示
清空错误记录信息
errclear 0
类型TYPE T:错误的类型,或者说严重的程度,分为6个: 
    PEND 设备或功能组件可能丢失 简写P 
    PERF 性能严重下降 P 
    PERM 硬件设备或软件模块损坏,确诊了的 P 
    TEMP 临时性错误,经过重试后已经恢复正常 T 
    INFO 一般消息,不是错误 I UNKN 不能确定错误的严重性 U 
    种类CLASS C:指出错误源 H 硬件或介质故障 
    S 软件故障 O 人为错误 U 不能确定
   
   $HOME/smit.log
记录了所访问的所有菜单、对话内容,所执行的命令和输出结果
在SMIT会话中出现的所有错误也会被记录
$HOME/smit.script
记录了所有通过SMIT菜单执行的AIX命令
$HOME/smit.transaction
记录了所有通过SMIT菜单执行的AIX命令,及命令的说明
smitty tape
smitty user
smitty tcpip
smitty nfs
smitty jfs
smitty lvm


若想改变网络选项,请使用:
no
标准 UNIX命令
no -a
输出当前的设置
no -o xyz=值
设置新值,立即生效,直到下次重新启动
在/etc/rc.net中加入 no 命令设置永久性的参数改变。
对于性能监视,使用:
netstat
nfsstat
netpmon
      AIX 常用命令汇总


       http://www.ibm.com/developerworks/cn/aix/library/au-dutta_cmds.html


 


 


我们先SSH 到AIX 系统:


*******************************************************************************


*                                                                             *


*                                                                             *


*  Welcome to AIX Version 5.3!                                                *


*                                                                             *


*                                                                             *


*  Please see the README file in /usr/lpp/bos for information pertinent to    *


*  this release of the AIX Operating System.                                  *


*                                                                             *


*                                                                             *


*******************************************************************************


-bash-3.00$


 


 


AIX的命令格式: 


  $command option(s) argument(s)


     command: 命令


    option(s): 命令选项,均以'-'号开始


    argument(s): 参数 


 


查看某个命令的使用方法,可以使用man 命令,如:
       -bash-3.00$ man lsdev


 


                               Commands Reference, Volume 3, i - m


 


lsdev Command


Purpose


       Displays devices in the system and their characteristics.


Syntax


       lsdev [ -C ][ -c Class ] [ -s Subclass ] [ -t Type ] [ -f File ] [ -F Format | -r


       ColumnName ] [ -h ] [ -H ] [ -l  { Name | - } ] [ -p Parent ] [ -S State ]


       lsdev -P [ -c Class ] [ -s Subclass ] [ -t Type ] [ -f File ] [ -F Format | -r ColumnName ]


       [ -h ] [ -H ]


Description


       The lsdev command displays information about devices in the Device Configuration database.


       You can display information about all devices in the Customized Devices object class using


       the -C flag. Any combination of the -c Class, -s Subclass, -t Type, -l Name, -p Parent, and


       -S State flags selects a subset of the customized devices. You can display information


       about all devices in the Predefined Devices object class using the -P flag. Any combination


       of the -c Class, -s Subclass, and -t Type flags selects a subset of the predefined devices.


       You can display the default output one of the following ways:


       *    From the Customized Devices object class using the -C flag


       *    From the Predefined Devices object class using the -P flag


       To override these two default outputs, use the -F Format flag to display the output in a format that you specify using the Format parameter. The Format parameter is a quoted list of column names separated and possibly ended by non-alphanumeric characters or white space.


-bash-3.00$ 


 


一些常用的系统命令:
clear 清屏


mkdir 创建目录


rmdir 删除目录


cp 拷贝文件


mv 文件/目录改名,转移


rm 删除文件/目录, 如:rm -fr ora*


rmdir 删除目录,如: rmdir oracle


df -k 显示文件系统的信息


du 磁盘使用信息汇总


du /u05 | sort -r -n 查询文件或目录所占用的磁盘块数


cd: 改变路径


ls: 列出文件


ls -aF 列出隐含文件,并适当分类


ls -l 列出文件的详细信息


ls -ltr


more: 输出文件内容到屏幕


more /etc/passwd|grep zhxx 查找静态字符"zhxx"


cat 显示文本文件内容/合并文件, cat file1 >> file2 合并file1到file2


pg 分页显示文件内容,回车后下一页


file 显示文件属性(可执行/ASCII/等)


uname 显示操作系统信息


oslevel 系统版本


man 帮助文件


 


mount 显示已经挂装的文件系统的信息或挂装文件系统


umount 卸载某个文件系统


 


fuser -kxuc /dev/cd0 当光驱不能正常释放时


env 输出用户环境变量到屏幕


id 察看用户的属性


whoami 察看当前用户名


who 查看已经登录的用户


who -r 查看目前系统的运行级别


users 用单独的一行打印出当前登录的用户,每个显示的用户名对应一个登录会话,如果一个用户有不止一个登录会话,那他的用户名将显示相同的次数


w 显示当前系统中每个用户和它所运行的进程信息


/var/adm/wtmp,/etc/utmp 用who命令查看登录记录


 


last 此命令往回搜索wtmp来显示自从文件第一次创建以来登录过的用户


last root |pg root用户登录记录


last reboot | pg 重启记录;


 


whereis 命令的绝对路径


passwd 设置用户密码


su 改变/切换用户id


lsuser ALL 列出所有已经创建的用户


lsgroup ALL 列出所有已经创建的组


 


mkuser 创建新用户,创建用户的缺省属性值于文件:/usr/lib/security/mkuser.default,只能由root修改


mkgroup 创建新组


chfn 改变用户详细信息


jobs 查看后台任务/进程


fg 把后台进程调到前台


bg 把当前进程调到后台运行


grep 查找匹配字符/字符串


 


fsck /u05 检查u05文件系统


xclock 时钟,可用于检查环境是否正常


rsh zzyc2_sev 在其他机器上登录某主机


dgmgrl 类似SVRMGRL(9i)


 


/usr/sbin/cluster/clstat & 显示双机热备状态图


qprt filename1,filename2... 打印文件


qchk 查看打印队列


qcan 取消打印作业


set 查看已定义的变量;


echo $name 查看某个变量的值;


  xxx=value 定义变量


unset xxx 删除变量


''把''之间的内容作为一个命令,返回命令结果; 如$now='date'  $echo $now


  '' 直接显示''间的内容,不予解释;


  "" 解释""间的$,'',等字符的特殊含义;


  忽略后的特殊字符的特殊含义;


  $$ 表示当前进程的ID


  $0 当前shell程序的名称


  $# 传给当前shell Script的参数个数;


  $* 传给当前shell Script的第*个参数,$1-$9,${10}......


  $? 最近一个命令的返回值;


  $! 最近一个后台进程的ID号;


 


#command 前台进程


#command & 后台进程


nice/renice 增加/再增加nice的值,从而降低进程优先级;


nohup command & 使用户的后台进程在用户退出时仍然运行


alias alias=string 赋命令别名


unalias aliasname 取消命令别名


history 显示最后的16条命令


cal 2003/cal 2 2003 日历


finger [oracle] 显示用户信息


mail 接收,发出,查看电子邮件


wc filename 统计指定文件的行数,词数,字节数


head filename 显示文件头


tail filename 显示文件尾


tail -f /tmp/hacmp.out 显示HACMP启动情况


[^+C]/[^+d]/[^+s]/[^+q]/[^+u] 终止/结束文件传输/暂停屏幕输出/继续屏幕输出/删除当前输入行


alog -o -t boot 查看引导日志


  chtz 设置新时区


  /etc/profile


  /etc/environment


  $HOME/.profile 系统设置用户环境的主要文件;


/etc/motd 用户登录时显示的信息,可直接编辑,但如果用户主目录下$HOME/.hushlogin存在,motd不显示;


wall ***** 向各登录用户发出*****消息,用户终端上将马上显示;


/var/adm/sulog su命令执行记录


/var/adm/sulog 这些文件增长很快,要定期清理,可用cat /dev/null > filename方式清理


 


/etc/passwd 合法用户(不含密码)


/etc/group


/etc/security 普通用户不能访问的安全性文件目录


 


AIX支持的三种文件系统:jfs/Cdrfs/Nfs    


/var/spool/*/*


/smit.log


/etc/securibty/failedlogin


hostname 显示机器名


/etc/rc.tcpip 系统启动时自动执行,进而执行以下子进程:


   -syslogd :错误信息日志


   -portmap :端口查找


   -inetd :Internet服务的主守护进程


   -named :域名服务器


   -lpd :打印服务器


   -routed or gated :动态路由


   -sendmail :邮件系统


   -timed :时间服务器


   -rwhod :远程用户信息


   -snmpd :SNMP代理进程


host 机器名/IP 实现IP与机器名的转换


lscfg 显示机器配置信息


/etc/default/login 加上CONSOLE=/dev/console 后,可防止root用户telnet;


 


SSL工具代替telnet等,增加安全性


  /etc/passwd .../bin/sh 对应 .profile


  /etc/passwd .../bin/csh对应 .login


  系统正常从桌面登录执行 .dtprofile


  su - username执行 .profile


/etc/vfstab 磁盘目录规划


 


patchadd -d 补丁文件名 打补丁-p 显示已打的补丁信息


sysdef -i


share -F nfs -o ro /etc


hare -F nfs -o rw=usera:userb /export


unshare /etc


dfshares


/usr/dt/bin/dtconfig -d 这将告知系统在下一次重新引导时不启动登录服务器。


/etc/ftpusers,/etc/default/login SOLARIS8下的FTP和TELNET缺省是关着,看看这两个文件.


sys-unconfig solaris重新设置


kdmconfig 配置显示器


eject 弹出CD-ROM或软驱;


 


umask 显示文件创建掩码,即新建文件或目录的缺省权限,如#umask 664


find path expression 查找文件,expression的值有:


  -name/-type/-size/-mtime(修改时间)/-perm(权限)/-usr/-o(或)


 


/usr/sbin/cluster/clstat & 显示cluster信息


 


errpt|pg 创建/显示错误文件


errclear 0 清除错误日志文件内容


instfix -iv|grep AIX_ML 安装的文件集


 


errclear 清除error log


/ect/services 查看端口


/etc/hosts 机器名IP对照表


/etc/inittab 相当于DOS的AUTOEXEC.BAT文件


/etc/filesystems 记录所有的文件系统设置


ftp://root@10.188.12.250/ 在客户端登录AIX(用IE)


 


ln -s 源目录 目标目录 链接


./fielname 运行filename文件


.filename 表示filename文件(目录)为隐藏;


# 表示ROOT用户;


$ 表示一般用户;


shutdown -fr 快速重启;


lsfs 列出所有文件系统


 


drwxrwxrwx d表示目录,-表示普通文件,r表示链接; d421421421 777全部权限


  -rwxrwxrwx 第2-4:属主用户,5-7:同组用户,8-10所有用户


date 0217142590 This sets the date and time to Sat Feb 17 14:25:00 CST 1990.


当root不能在其终端上登录时 修改/etc/hosts文件,查看其IP地址对应的主机名;


当其他用户不能在其终端上登录时 删除用户,并删除/home下对应的目录,重建;


 


crontab 创建计划任务(crontab -l 查看已有任务, crontab -e 编辑或增加,删除任务)


 


prtconf:显示系统的各项主要配置


svmon -G: 查看内存(4k)


iostat 2 查看磁盘读写情况(每2秒刷新);


set -o vi: 调用缓冲区 k,j,x,h,l 向上下翻,Esc


format 查看磁盘物理信息


swap [-l|s|d|a] 操作swap交换空间


mpstat 查询CPU情况


#pstat -a|grep aios|wc -l 查看aio的值是否常达到MAX,IF 增加MIN, MAX aio;


       当任何用户都不能登录图形界面时, 有可能根结点充满,在登录窗口用字符方式登录,加大根结点空间即可;


sar [-u|-c|-a|-q|-r] [-p] 1 10 查询系统负载情况


ps -ef | grep cluster 查找包含"cluster"的进程


pe -f 进程查看,如:# ps -f


ps aux 查询内存使用情况


ps -ef |grep oracle |pg 查看oracle用户的所有进程


kill -9 14206 杀14206#进程


kill -l 显示KILL命令可以用的信号量


killall signal 删除除发送外的其他所有进程


 


 


defragfs -q /u01 报告文件系统的当前状态


defragfs -r /u01 得到碎片连续化操作后和前后对比情况


defragfs /u01 执行碎片连续化操作


 


 


netstat -i 显示网络连接信息及统计信息


netstat -rn 显示核心路由表


netstat -I 网络设置名 端口号 监视端口情况


netstat -m 网络使用的内存空间情况


 netstat -in 查看所有网卡IP地址
netstat -r  查看所有路由
ifconfig -a 查看所有网络配置信息
netstat -D  查看所有通讯包的统计
netstat -s -f inet 查看每种协议传输的数据量统计
netstat -v         查看每块网卡传输的数据量和状态统计


traceroute 10.188.182.1 跟踪IP


netpmon 可以监控关于网络行为的系统事件和性能以及网络行为对CPU的消耗。


netpmon -v 物理/逻辑资源的详细报告


ping 10.188.12.252 -l 17000 -t 以17000 bytes/包 ping 目标


增加并配置端口


  route ADD 0 10.188.12.1


  route add default 192.168.0.1 设置网关(或在/etc/defaultrouter文件中加入网关地址,重起机器就行)


arp -a 查看解析协议ARP表


 


 


lsdev -Cc disk 系统设备信息(磁盘)


lsdev -Cc pdisk 显示阵列里的磁盘信息


lsdev -P 列出所有的设备, lsdev -Pc disk


lsdev -C -c if 显示网络接口描述


lsdev -C -c adapetr 显示适配描述


lsdev -C|grep Process|wc -l 显示CPU数量


lsdev -C           列出所有系统设备(包括所有状态:Undefined,Defined,Available)
lsdev -Cc adapter  列出系统现有设备
lsdev -PH          列出系统所有支持的设备
lsdev -P -r class  列出系统所有支持的设备分类(例如:swap,sys,tape,tty,printer,mouse,memory,lvm等)
lsdev -P -c disk -r subclass 列出系统所有支持的设备分类(磁盘)的子类(例如:SCSI,DAR,IDE,ISCSI等)
lsdev -P -c tape             列出所有支持的磁带设备
lsdev -l hdi*                列出所有系统的SCSI Disk Drive


 


 


SMIT t(system management interface Tool) 综合管理工具


smitty user 管理用户


smitty group 管理组


smitty clstart | clstop 起用|关闭HA


smitty hamcp


smitty chinet 改变网卡的配置信息


smitty cluster 配置cluster


smitty hacmp 配置hacmp


smitty aio 调整aioservers


smitty tcpip tcp/ip配置


smitty devices 设备管理


smitty crjfs 创建结点; 


smitty jfs


smitty lv 增加逻辑盘


smitty lvm 管理逻辑卷


smitty vg 管理卷组


smitty mklv 创建裸设备(字符型设备);


smitty rmlv 删除裸设备(字符型设备);


smitty chvg 


smit reogvg 重组卷组


smit importvg 导出卷组,卷组必须是不活动的;
smit pv          进行PV物理卷的管理
smitty mkvg      新建VG
smit mklv        添加一个LV
smit mklvcopy    添加一个LV镜像
smit rmlv        删除一个LV
smit pv          管理物理卷
smit extendvg    增加一个PV到VG


lsps -a 查询交换空间,如use超过70%,则要增加


swapon /dev/paging01 激活交换空间


chps -a paging01 删除交换空间


rmps paging01 删除不活动的交换空间


smit mkps 增加交换空间


smit chps 修改交换空间


varyonvg 激活卷组 如:varyonvg datavg 将datavg激活


varyoffvg 关闭卷组


说明:smit 是 smitty的简写
 


 


lspv             列出物理卷
lspv hdisk2      查看该PV的信息
lspv -l hdisk2   查看该PV的详细信息
lsvg -o          查看正在使用的vg
lsvg -l rootvg   查看该VG详细信息
lslv hd5         查看该LV的信息
lslv -l hd5      查看该LV的详细信息


lsvg -p rootvg 列出物理卷信息


lsvg datavg 可查询空闲物理分区数


lspv hdisk0 显示物理卷


lspv -l hdisk0 逻辑卷映射


lspv -p hdisk0 物理卷映射


 


 


lsattr -l rmt0 -E            查看磁带设备rmt0的属性信息
lsattr -l scsi0 -a bus_intr_lvl -E 查看SCSI卡适配器scsi0的bus_intr_lvl属性信息


lsattr -l tty0 -a login -R
lsattr -E -l sys0                  列出所有系统属性(包括物理内存)
lsattr -E -l sys0 -a realmem       列出系统物理内存大小


 


 


 


vi 文件编辑器
  动作字符:


  a 在当前字符后添加文字; x 删除单个字符;


  A 在当前行最后添加文字; dw 删除至当前词尾;


  i 在当前字符前添加文字; d$ 删除至当前行尾;


  I 在当前行开始处添加文字; d0 删除至当前行首;


  o 在当前行后添加新行; dd 删除当前行;


  O 在当前行前添加新行; :20,40d 删除20行至40行;


  /text 向后查询 ?text 向前查询


  r 修改当前字符 R 覆盖字符,直至按下[ESC]


  s 删除当前字符,并可添加字符直至按[ESC]


  S 删除当前行,并可添加字符直至按[ESC]


  yy 将当前行存入缓冲区


  dd


 


expr shell下的四则运算:
  * 乘; /除; % 求余数; +,- 如:expr (3+3)*(4-2)


command1 && command2 如果第一个命令执行成功,则运行第二个命令;


command1 || command2 如果第一个命令执行失败,则运行第二个命令;


  


test 表达式 测试条件表达式,主要有:


  -f filename 文件是否存在;


  -d dirctory 目录是否存在;


  -r filename 文件存在,且能被当前进程读;


  -w filename 文件存在,且能被当前进程写;


  -x filename 文件存在,且能被当前进程运行;


  -n string 字符STRING长度非零;


  -z string 字符STRING长度零;


  string1=string2 两个字符串相同;


 


integer1 -eq integer2 两个变量相等;(ne:不等 gt:大于 lt:小于 le:小于等于 ge:大于等于)









                        
fatal: [192.168.5.158]: FAILED! => {"changed": true, "cmd": "cd /usr/src/php-5.3.28/ && ./configure --prefix=/usr/local/php5 --with-gd --with-zlib --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php5 --enable-mbstring --enable-fpm --with-jpeg-dir=/usr/lib && make && make install", "delta": "0:00:07.761196", "end": "2025-06-26 15:07:53.247233", "msg": "non-zero return code", "rc": 1, "start": "2025-06-26 15:07:45.486037", "stderr": "configure: warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.6 2.6.1 2.6.2 2.6.4 (found: none).\nconfigure: warning: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.\nconfigure: error: Cannot find MySQL header files under /usr/local/mysql.\nNote that the MySQL client library is not bundled anymore!", "stderr_lines": ["configure: warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.6 2.6.1 2.6.2 2.6.4 (found: none).", "configure: warning: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.", "configure: error: Cannot find MySQL header files under /usr/local/mysql.", "Note that the MySQL client library is not bundled anymore!"], "stdout": "creating cache ./config.cache\nchecking for Cygwin environment... no\nchecking for mingw32 environment... no\nchecking for egrep... grep -E\nchecking for a sed that does not truncate output... /usr/bin/sed\nchecking host system type... x86_64-unknown-linux-gnu\nchecking target system type... x86_64-unknown-linux-gnu\nchecking for gcc... gcc\nchecking whether the C compiler (gcc ) works... yes\nchecking whether the C compiler (gcc ) is a cross-compiler... no\nchecking whether we are using GNU C... yes\nchecking whether gcc accepts -g... yes\nchecking how to run the C preprocessor... gcc -E\nchecking for icc... no\nchecking for suncc... no\nchecking whether gcc and cc understand -c and -o together... yes\nchecking how to run the C preprocessor... gcc -E\nchecking for AIX... no\nchecking whether ln -s works... yes\nchecking for system library directory... lib\nchecking whether to enable runpaths... yes\nchecking if compiler supports -R... no\nchecking if compiler supports -Wl,-rpath,... yes\nchecking for gawk... gawk\nchecking for bison... no\nchecking for byacc... no\nchecking for bison version... invalid\nchecking for re2c... no\nchecking whether to enable computed goto gcc extension with re2c... no\nchecking whether to force non-PIC code in shared modules... no\nchecking whether /dev/urandom exists... yes\nchecking for pthreads_cflags... -pthread\nchecking for pthreads_lib... \n\n\u001b[1mConfiguring SAPI modules\u001b[m\nchecking for AOLserver support... no\nchecking for Apache 1.x module support via DSO through APXS... no\nchecking for Apache 1.x module support... no\nchecking whether to enable Apache charset compatibility option... no\nchecking for Apache 2.0 filter-module support via DSO through APXS... no\nchecking for Apache 2.0 handler-module support via DSO through APXS... no\nchecking for Apache 1.x (hooks) module support via DSO through APXS... no\nchecking for Apache 1.x (hooks) module support... no\nchecking whether to enable Apache charset compatibility option... no\nchecking for Caudium support... no\nchecking for CLI build... yes\nchecking for Continuity support... no\nchecking for embedded SAPI library support... no\nchecking for FPM build... yes\nchecking for setenv... yes\nchecking for clearenv... yes\nchecking for setproctitle... no\nchecking for library containing socket... none required\nchecking for library containing inet_addr... none required\nchecking for errno.h... yes\nchecking for fcntl.h... yes\nchecking for stdio.h... yes\nchecking for stdlib.h... yes\nchecking for unistd.h... yes\nchecking for sys/uio.h... yes\nchecking for sys/select.h... yes\nchecking for sys/socket.h... yes\nchecking for sys/time.h... yes\nchecking for arpa/inet.h... yes\nchecking for netinet/in.h... yes\nchecking for sysexits.h... yes\nchecking for prctl... yes\nchecking for clock_gettime... yes\nchecking for ptrace... yes\nchecking whether ptrace works... yes\nchecking for proc mem file... mem\nchecking if gcc supports __sync_bool_compare_and_swap... yes\nchecking for TCP_INFO... yes\nchecking for sysconf... yes\nchecking for times... yes\nchecking for kqueue... no\nchecking for port framework... no\nchecking for /dev/poll... no\nchecking for epoll... yes\nchecking for poll... yes\nchecking for select... yes\nchecking for Zeus ISAPI support... no\nchecking for LiteSpeed support... no\nchecking for Milter support... no\nchecking for NSAPI support... no\nchecking for PHTTPD support... no\nchecking for Pi3Web support... no\nchecking whether Roxen module is build using ZTS... no\nchecking for Roxen/Pike support... \nchecking for thttpd... no\nchecking for TUX... no\nchecking for webjames... no\nchecking for chosen SAPI module... fpm\n\n\u001b[1mRunning system checks\u001b[m\nchecking for sendmail... no\nchecking whether system uses EBCDIC... no\nchecking whether byte ordering is bigendian... no\nchecking whether writing to stdout works... This is the test message -- yes\nchecking for socket... yes\nchecking for socketpair... yes\nchecking for htonl... yes\nchecking for gethostname... yes\nchecking for gethostbyaddr... yes\nchecking for yp_get_default_domain... no\nchecking for __yp_get_default_domain... no\nchecking for yp_get_default_domain in -lnsl... no\nchecking for __yp_get_default_domain in -lnsl... no\nchecking for dlopen... no\nchecking for __dlopen... no\nchecking for dlopen in -ldl... yes\nchecking for sin in -lm... yes\nchecking for inet_aton... yes\nchecking for ANSI C header files... yes\nchecking for dirent.h that defines DIR... yes\nchecking for opendir in -ldir... no\nchecking for inttypes.h... yes\nchecking for stdint.h... yes\nchecking for dirent.h... yes\nchecking for ApplicationServices/ApplicationServices.h... no\nchecking for sys/param.h... yes\nchecking for sys/types.h... yes\nchecking for sys/time.h... (cached) yes\nchecking for netinet/in.h... (cached) yes\nchecking for alloca.h... yes\nchecking for arpa/inet.h... (cached) yes\nchecking for arpa/nameser.h... yes\nchecking for assert.h... yes\nchecking for crypt.h... yes\nchecking for dns.h... no\nchecking for fcntl.h... (cached) yes\nchecking for grp.h... yes\nchecking for ieeefp.h... no\nchecking for langinfo.h... yes\nchecking for limits.h... yes\nchecking for locale.h... yes\nchecking for monetary.h... yes\nchecking for netdb.h... yes\nchecking for pwd.h... yes\nchecking for resolv.h... yes\nchecking for signal.h... yes\nchecking for stdarg.h... yes\nchecking for stdlib.h... (cached) yes\nchecking for string.h... yes\nchecking for syslog.h... yes\nchecking for sysexits.h... (cached) yes\nchecking for sys/ioctl.h... yes\nchecking for sys/file.h... yes\nchecking for sys/mman.h... yes\nchecking for sys/mount.h... yes\nchecking for sys/poll.h... yes\nchecking for sys/resource.h... yes\nchecking for sys/select.h... (cached) yes\nchecking for sys/socket.h... (cached) yes\nchecking for sys/stat.h... yes\nchecking for sys/statfs.h... yes\nchecking for sys/statvfs.h... yes\nchecking for sys/vfs.h... yes\nchecking for sys/sysexits.h... no\nchecking for sys/varargs.h... no\nchecking for sys/wait.h... yes\nchecking for sys/loadavg.h... no\nchecking for termios.h... yes\nchecking for unistd.h... (cached) yes\nchecking for unix.h... no\nchecking for utime.h... yes\nchecking for sys/utsname.h... yes\nchecking for sys/ipc.h... yes\nchecking for dlfcn.h... yes\nchecking for assert.h... (cached) yes\nchecking for fopencookie... yes\nchecking for broken getcwd... no\nchecking for broken libc stdio... yes\nchecking whether struct tm is in sys/time.h or time.h... time.h\nchecking for tm_zone in struct tm... yes\nchecking for missing declarations of reentrant functions... done\nchecking for fclose declaration... ok\nchecking for tm_gmtoff in struct tm... yes\nchecking for struct flock... yes\nchecking for socklen_t... yes\nchecking size of size_t... 8\nchecking size of long long... 8\nchecking size of long long int... 8\nchecking size of long... 8\nchecking size of int... 4\nchecking size of intmax_t... 8\nchecking size of ssize_t... 8\nchecking size of ptrdiff_t... 8\nchecking for st_blksize in struct stat... yes\nchecking for st_blocks in struct stat... yes\nchecking for st_rdev in struct stat... yes\nchecking for size_t... yes\nchecking for uid_t in sys/types.h... yes\nchecking for struct sockaddr_storage... yes\nchecking for field sa_len in struct sockaddr... no\nchecking for IPv6 support... yes\nchecking for vprintf... yes\nchecking for alphasort... yes\nchecking for asctime_r... yes\nchecking for chroot... yes\nchecking for ctime_r... yes\nchecking for cuserid... yes\nchecking for crypt... no\nchecking for flock... yes\nchecking for ftok... yes\nchecking for funopen... no\nchecking for gai_strerror... yes\nchecking for gcvt... yes\nchecking for getloadavg... yes\nchecking for getlogin... yes\nchecking for getprotobyname... yes\nchecking for getprotobynumber... yes\nchecking for getservbyname... yes\nchecking for getservbyport... yes\nchecking for gethostname... (cached) yes\nchecking for getrusage... yes\nchecking for gettimeofday... yes\nchecking for gmtime_r... yes\nchecking for getpwnam_r... yes\nchecking for getgrnam_r... yes\nchecking for getpwuid_r... yes\nchecking for grantpt... yes\nchecking for inet_ntoa... yes\nchecking for inet_ntop... yes\nchecking for inet_pton... yes\nchecking for isascii... yes\nchecking for link... yes\nchecking for localtime_r... yes\nchecking for lockf... yes\nchecking for lchown... yes\nchecking for lrand48... yes\nchecking for memcpy... yes\nchecking for memmove... yes\nchecking for mkstemp... yes\nchecking for mmap... yes\nchecking for nl_langinfo... yes\nchecking for perror... yes\nchecking for poll... yes\nchecking for ptsname... yes\nchecking for putenv... yes\nchecking for realpath... yes\nchecking for random... yes\nchecking for rand_r... yes\nchecking for scandir... yes\nchecking for setitimer... yes\nchecking for setlocale... yes\nchecking for localeconv... yes\nchecking for setenv... (cached) yes\nchecking for setpgid... yes\nchecking for setsockopt... yes\nchecking for setvbuf... yes\nchecking for shutdown... yes\nchecking for sin... yes\nchecking for snprintf... yes\nchecking for srand48... yes\nchecking for srandom... yes\nchecking for statfs... yes\nchecking for statvfs... yes\nchecking for std_syslog... no\nchecking for strcasecmp... yes\nchecking for strcoll... yes\nchecking for strdup... yes\nchecking for strerror... yes\nchecking for strftime... yes\nchecking for strnlen... yes\nchecking for strptime... yes\nchecking for strstr... yes\nchecking for strtok_r... yes\nchecking for symlink... yes\nchecking for tempnam... yes\nchecking for tzset... yes\nchecking for unlockpt... yes\nchecking for unsetenv... yes\nchecking for usleep... yes\nchecking for utime... yes\nchecking for vsnprintf... yes\nchecking for vasprintf... yes\nchecking for asprintf... yes\nchecking for nanosleep... yes\nchecking for nanosleep in -lrt... yes\nchecking for getaddrinfo... yes\nchecking for __sync_fetch_and_add... yes\nchecking for strlcat... no\nchecking for strlcpy... no\nchecking for getopt... yes\nchecking whether utime accepts a null argument... yes\nchecking for working alloca.h... (cached) yes\nchecking for alloca... yes\nchecking for declared timezone... yes\nchecking for type of reentrant time-related functions... POSIX\nchecking for readdir_r... yes\nchecking for type of readdir_r... POSIX\nchecking for in_addr_t... yes\nchecking for crypt_r... no\n\n\u001b[1mGeneral settings\u001b[m\nchecking whether to include gcov symbols... no\nchecking whether to include debugging symbols... no\nchecking layout of installed files... PHP\nchecking path to configuration file... /usr/local/php5\nchecking where to scan for configuration files... \nchecking whether to enable safe mode by default... no\nchecking for safe mode exec dir... /usr/local/php/bin\nchecking whether to enable PHP's own SIGCHLD handler... no\nchecking whether to enable magic quotes by default... no\nchecking whether to explicitly link against libgcc... no\nchecking whether to enable short tags by default... yes\nchecking whether to enable dmalloc... no\nchecking whether to enable IPv6 support... yes\nchecking how big to make fd sets... using system default\n\n\u001b[1mConfiguring extensions\u001b[m\nchecking size of long... (cached) 8\nchecking size of int... (cached) 4\nchecking for int32_t... yes\nchecking for uint32_t... yes\nchecking for sys/types.h... (cached) yes\nchecking for inttypes.h... (cached) yes\nchecking for stdint.h... (cached) yes\nchecking for string.h... (cached) yes\nchecking for stdlib.h... (cached) yes\nchecking for strtoll... yes\nchecking for atoll... yes\nchecking for strftime... (cached) yes\nchecking which regex library to use... php\nchecking whether to enable LIBXML support... yes\nchecking libxml2 install dir... no\nchecking for xml2-config path... /usr/bin/xml2-config\nchecking whether libxml build works... yes\nchecking for OpenSSL support... no\nchecking for Kerberos support... no\nchecking for PCRE library to use... bundled\nchecking whether to enable the SQLite3 extension... yes\nchecking bundled sqlite3 library... yes\nchecking for ZLIB support... yes\nchecking if the location of ZLIB install directory is defined... no\nchecking for gzgets in -lz... yes\nchecking whether to enable bc style precision math functions... no\nchecking for BZip2 support... no\nchecking whether to enable calendar conversion support... no\nchecking whether to enable ctype functions... yes\nchecking for cURL support... no\nchecking if we should use cURL for url streams... no\nchecking for QDBM support... no\nchecking for GDBM support... no\nchecking for NDBM support... no\nchecking for Berkeley DB4 support... no\nchecking for Berkeley DB3 support... no\nchecking for Berkeley DB2 support... no\nchecking for DB1 support... no\nchecking for DBM support... no\nchecking for CDB support... no\nchecking for INI File support... no\nchecking for FlatFile support... no\nchecking whether to enable DBA interface... no\nchecking whether to enable DOM support... yes\nchecking for xml2-config path... (cached) /usr/bin/xml2-config\nchecking whether libxml build works... (cached) yes\nchecking for ENCHANT support... no\nchecking whether to enable EXIF (metadata from images) support... no\nchecking for fileinfo support... yes\nchecking for utimes... yes\nchecking for strndup... yes\nchecking whether to enable input filter support... yes\nchecking pcre install prefix... no\nchecking whether to enable FTP support... no\nchecking OpenSSL dir for FTP... no\nchecking for GD support... yes\nchecking for the location of libjpeg... /usr/lib\nchecking for the location of libpng... no\nchecking for the location of libXpm... no\nchecking for FreeType 2... no\nchecking for T1lib support... no\nchecking whether to enable truetype string function in GD... no\nchecking whether to enable JIS-mapped Japanese font support in GD... no\nchecking for fabsf... yes\nchecking for floorf... yes\nchecking for jpeg_read_header in -ljpeg... yes\nchecking for png_write_image in -lpng... yes\nIf configure fails try --with-xpm-dir=<DIR>\nIf configure fails try --with-freetype-dir=<DIR>\nchecking for GNU gettext support... no\nchecking for GNU MP support... no\nchecking for mhash support... no\nchecking whether to enable hash support... yes\nchecking whether byte ordering is bigendian... (cached) no\nchecking size of short... 2\nchecking size of int... (cached) 4\nchecking size of long... (cached) 8\nchecking size of long long... (cached) 8\nchecking for iconv support... yes\nchecking for iconv... yes\nchecking if iconv is glibc's... yes\nchecking if iconv supports errno... yes\nchecking if your cpp allows macro usage in include lines... yes\nchecking for IMAP support... no\nchecking for IMAP Kerberos support... no\nchecking for IMAP SSL support... no\nchecking for InterBase support... no\nchecking whether to enable internationalization support... no\nchecking whether to enable JavaScript Object Serialization support... yes\nchecking for ANSI C header files... (cached) yes\nchecking for LDAP support... no\nchecking for LDAP Cyrus SASL support... no\nchecking whether to enable multibyte string support... yes\nchecking whether to enable multibyte regex support... yes\nchecking whether to check multibyte regex backtrack... yes\nchecking for external libmbfl... no\nchecking for external oniguruma... no\nchecking for variable length prototypes and stdarg.h... yes\nchecking for stdlib.h... (cached) yes\nchecking for string.h... (cached) yes\nchecking for strings.h... yes\nchecking for unistd.h... (cached) yes\nchecking for sys/time.h... (cached) yes\nchecking for sys/times.h... yes\nchecking for stdarg.h... (cached) yes\nchecking size of int... (cached) 4\nchecking size of short... (cached) 2\nchecking size of long... (cached) 8\nchecking for working const... yes\nchecking whether time.h and sys/time.h may both be included... yes\nchecking for working alloca.h... (cached) yes\nchecking for alloca... (cached) yes\nchecking for 8-bit clean memcmp... yes\nchecking for stdarg.h... (cached) yes\nchecking for mcrypt support... no\nchecking for MSSQL support via FreeTDS... no\nchecking for MySQL support... yes\nchecking for specified location of the MySQL UNIX socket... no", "stdout_lines": ["creating cache ./config.cache", "checking for Cygwin environment... no", "checking for mingw32 environment... no", "checking for egrep... grep -E", "checking for a sed that does not truncate output... /usr/bin/sed", "checking host system type... x86_64-unknown-linux-gnu", "checking target system type... x86_64-unknown-linux-gnu", "checking for gcc... gcc", "checking whether the C compiler (gcc ) works... yes", "checking whether the C compiler (gcc ) is a cross-compiler... no", "checking whether we are using GNU C... yes", "checking whether gcc accepts -g... yes", "checking how to run the C preprocessor... gcc -E", "checking for icc... no", "checking for suncc... no", "checking whether gcc and cc understand -c and -o together... yes", "checking how to run the C preprocessor... gcc -E", "checking for AIX... no", "checking whether ln -s works... yes", "checking for system library directory... lib", "checking whether to enable runpaths... yes", "checking if compiler supports -R... no", "checking if compiler supports -Wl,-rpath,... yes", "checking for gawk... gawk", "checking for bison... no", "checking for byacc... no", "checking for bison version... invalid", "checking for re2c... no", "checking whether to enable computed goto gcc extension with re2c... no", "checking whether to force non-PIC code in shared modules... no", "checking whether /dev/urandom exists... yes", "checking for pthreads_cflags... -pthread", "checking for pthreads_lib... ", "", "\u001b[1mConfiguring SAPI modules\u001b[m", "checking for AOLserver support... no", "checking for Apache 1.x module support via DSO through APXS... no", "checking for Apache 1.x module support... no", "checking whether to enable Apache charset compatibility option... no", "checking for Apache 2.0 filter-module support via DSO through APXS... no", "checking for Apache 2.0 handler-module support via DSO through APXS... no", "checking for Apache 1.x (hooks) module support via DSO through APXS... no", "checking for Apache 1.x (hooks) module support... no", "checking whether to enable Apache charset compatibility option... no", "checking for Caudium support... no", "checking for CLI build... yes", "checking for Continuity support... no", "checking for embedded SAPI library support... no", "checking for FPM build... yes", "checking for setenv... yes", "checking for clearenv... yes", "checking for setproctitle... no", "checking for library containing socket... none required", "checking for library containing inet_addr... none required", "checking for errno.h... yes", "checking for fcntl.h... yes", "checking for stdio.h... yes", "checking for stdlib.h... yes", "checking for unistd.h... yes", "checking for sys/uio.h... yes", "checking for sys/select.h... yes", "checking for sys/socket.h... yes", "checking for sys/time.h... yes", "checking for arpa/inet.h... yes", "checking for netinet/in.h... yes", "checking for sysexits.h... yes", "checking for prctl... yes", "checking for clock_gettime... yes", "checking for ptrace... yes", "checking whether ptrace works... yes", "checking for proc mem file... mem", "checking if gcc supports __sync_bool_compare_and_swap... yes", "checking for TCP_INFO... yes", "checking for sysconf... yes", "checking for times... yes", "checking for kqueue... no", "checking for port framework... no", "checking for /dev/poll... no", "checking for epoll... yes", "checking for poll... yes", "checking for select... yes", "checking for Zeus ISAPI support... no", "checking for LiteSpeed support... no", "checking for Milter support... no", "checking for NSAPI support... no", "checking for PHTTPD support... no", "checking for Pi3Web support... no", "checking whether Roxen module is build using ZTS... no", "checking for Roxen/Pike support... ", "checking for thttpd... no", "checking for TUX... no", "checking for webjames... no", "checking for chosen SAPI module... fpm", "", "\u001b[1mRunning system checks\u001b[m", "checking for sendmail... no", "checking whether system uses EBCDIC... no", "checking whether byte ordering is bigendian... no", "checking whether writing to stdout works... This is the test message -- yes", "checking for socket... yes", "checking for socketpair... yes", "checking for htonl... yes", "checking for gethostname... yes", "checking for gethostbyaddr... yes", "checking for yp_get_default_domain... no", "checking for __yp_get_default_domain... no", "checking for yp_get_default_domain in -lnsl... no", "checking for __yp_get_default_domain in -lnsl... no", "checking for dlopen... no", "checking for __dlopen... no", "checking for dlopen in -ldl... yes", "checking for sin in -lm... yes", "checking for inet_aton... yes", "checking for ANSI C header files... yes", "checking for dirent.h that defines DIR... yes", "checking for opendir in -ldir... no", "checking for inttypes.h... yes", "checking for stdint.h... yes", "checking for dirent.h... yes", "checking for ApplicationServices/ApplicationServices.h... no", "checking for sys/param.h... yes", "checking for sys/types.h... yes", "checking for sys/time.h... (cached) yes", "checking for netinet/in.h... (cached) yes", "checking for alloca.h... yes", "checking for arpa/inet.h... (cached) yes", "checking for arpa/nameser.h... yes", "checking for assert.h... yes", "checking for crypt.h... yes", "checking for dns.h... no", "checking for fcntl.h... (cached) yes", "checking for grp.h... yes", "checking for ieeefp.h... no", "checking for langinfo.h... yes", "checking for limits.h... yes", "checking for locale.h... yes", "checking for monetary.h... yes", "checking for netdb.h... yes", "checking for pwd.h... yes", "checking for resolv.h... yes", "checking for signal.h... yes", "checking for stdarg.h... yes", "checking for stdlib.h... (cached) yes", "checking for string.h... yes", "checking for syslog.h... yes", "checking for sysexits.h... (cached) yes", "checking for sys/ioctl.h... yes", "checking for sys/file.h... yes", "checking for sys/mman.h... yes", "checking for sys/mount.h... yes", "checking for sys/poll.h... yes", "checking for sys/resource.h... yes", "checking for sys/select.h... (cached) yes", "checking for sys/socket.h... (cached) yes", "checking for sys/stat.h... yes", "checking for sys/statfs.h... yes", "checking for sys/statvfs.h... yes", "checking for sys/vfs.h... yes", "checking for sys/sysexits.h... no", "checking for sys/varargs.h... no", "checking for sys/wait.h... yes", "checking for sys/loadavg.h... no", "checking for termios.h... yes", "checking for unistd.h... (cached) yes", "checking for unix.h... no", "checking for utime.h... yes", "checking for sys/utsname.h... yes", "checking for sys/ipc.h... yes", "checking for dlfcn.h... yes", "checking for assert.h... (cached) yes", "checking for fopencookie... yes", "checking for broken getcwd... no", "checking for broken libc stdio... yes", "checking whether struct tm is in sys/time.h or time.h... time.h", "checking for tm_zone in struct tm... yes", "checking for missing declarations of reentrant functions... done", "checking for fclose declaration... ok", "checking for tm_gmtoff in struct tm... yes", "checking for struct flock... yes", "checking for socklen_t... yes", "checking size of size_t... 8", "checking size of long long... 8", "checking size of long long int... 8", "checking size of long... 8", "checking size of int... 4", "checking size of intmax_t... 8", "checking size of ssize_t... 8", "checking size of ptrdiff_t... 8", "checking for st_blksize in struct stat... yes", "checking for st_blocks in struct stat... yes", "checking for st_rdev in struct stat... yes", "checking for size_t... yes", "checking for uid_t in sys/types.h... yes", "checking for struct sockaddr_storage... yes", "checking for field sa_len in struct sockaddr... no", "checking for IPv6 support... yes", "checking for vprintf... yes", "checking for alphasort... yes", "checking for asctime_r... yes", "checking for chroot... yes", "checking for ctime_r... yes", "checking for cuserid... yes", "checking for crypt... no", "checking for flock... yes", "checking for ftok... yes", "checking for funopen... no", "checking for gai_strerror... yes", "checking for gcvt... yes", "checking for getloadavg... yes", "checking for getlogin... yes", "checking for getprotobyname... yes", "checking for getprotobynumber... yes", "checking for getservbyname... yes", "checking for getservbyport... yes", "checking for gethostname... (cached) yes", "checking for getrusage... yes", "checking for gettimeofday... yes", "checking for gmtime_r... yes", "checking for getpwnam_r... yes", "checking for getgrnam_r... yes", "checking for getpwuid_r... yes", "checking for grantpt... yes", "checking for inet_ntoa... yes", "checking for inet_ntop... yes", "checking for inet_pton... yes", "checking for isascii... yes", "checking for link... yes", "checking for localtime_r... yes", "checking for lockf... yes", "checking for lchown... yes", "checking for lrand48... yes", "checking for memcpy... yes", "checking for memmove... yes", "checking for mkstemp... yes", "checking for mmap... yes", "checking for nl_langinfo... yes", "checking for perror... yes", "checking for poll... yes", "checking for ptsname... yes", "checking for putenv... yes", "checking for realpath... yes", "checking for random... yes", "checking for rand_r... yes", "checking for scandir... yes", "checking for setitimer... yes", "checking for setlocale... yes", "checking for localeconv... yes", "checking for setenv... (cached) yes", "checking for setpgid... yes", "checking for setsockopt... yes", "checking for setvbuf... yes", "checking for shutdown... yes", "checking for sin... yes", "checking for snprintf... yes", "checking for srand48... yes", "checking for srandom... yes", "checking for statfs... yes", "checking for statvfs... yes", "checking for std_syslog... no", "checking for strcasecmp... yes", "checking for strcoll... yes", "checking for strdup... yes", "checking for strerror... yes", "checking for strftime... yes", "checking for strnlen... yes", "checking for strptime... yes", "checking for strstr... yes", "checking for strtok_r... yes", "checking for symlink... yes", "checking for tempnam... yes", "checking for tzset... yes", "checking for unlockpt... yes", "checking for unsetenv... yes", "checking for usleep... yes", "checking for utime... yes", "checking for vsnprintf... yes", "checking for vasprintf... yes", "checking for asprintf... yes", "checking for nanosleep... yes", "checking for nanosleep in -lrt... yes", "checking for getaddrinfo... yes", "checking for __sync_fetch_and_add... yes", "checking for strlcat... no", "checking for strlcpy... no", "checking for getopt... yes", "checking whether utime accepts a null argument... yes", "checking for working alloca.h... (cached) yes", "checking for alloca... yes", "checking for declared timezone... yes", "checking for type of reentrant time-related functions... POSIX", "checking for readdir_r... yes", "checking for type of readdir_r... POSIX", "checking for in_addr_t... yes", "checking for crypt_r... no", "", "\u001b[1mGeneral settings\u001b[m", "checking whether to include gcov symbols... no", "checking whether to include debugging symbols... no", "checking layout of installed files... PHP", "checking path to configuration file... /usr/local/php5", "checking where to scan for configuration files... ", "checking whether to enable safe mode by default... no", "checking for safe mode exec dir... /usr/local/php/bin", "checking whether to enable PHP's own SIGCHLD handler... no", "checking whether to enable magic quotes by default... no", "checking whether to explicitly link against libgcc... no", "checking whether to enable short tags by default... yes", "checking whether to enable dmalloc... no", "checking whether to enable IPv6 support... yes", "checking how big to make fd sets... using system default", "", "\u001b[1mConfiguring extensions\u001b[m", "checking size of long... (cached) 8", "checking size of int... (cached) 4", "checking for int32_t... yes", "checking for uint32_t... yes", "checking for sys/types.h... (cached) yes", "checking for inttypes.h... (cached) yes", "checking for stdint.h... (cached) yes", "checking for string.h... (cached) yes", "checking for stdlib.h... (cached) yes", "checking for strtoll... yes", "checking for atoll... yes", "checking for strftime... (cached) yes", "checking which regex library to use... php", "checking whether to enable LIBXML support... yes", "checking libxml2 install dir... no", "checking for xml2-config path... /usr/bin/xml2-config", "checking whether libxml build works... yes", "checking for OpenSSL support... no", "checking for Kerberos support... no", "checking for PCRE library to use... bundled", "checking whether to enable the SQLite3 extension... yes", "checking bundled sqlite3 library... yes", "checking for ZLIB support... yes", "checking if the location of ZLIB install directory is defined... no", "checking for gzgets in -lz... yes", "checking whether to enable bc style precision math functions... no", "checking for BZip2 support... no", "checking whether to enable calendar conversion support... no", "checking whether to enable ctype functions... yes", "checking for cURL support... no", "checking if we should use cURL for url streams... no", "checking for QDBM support... no", "checking for GDBM support... no", "checking for NDBM support... no", "checking for Berkeley DB4 support... no", "checking for Berkeley DB3 support... no", "checking for Berkeley DB2 support... no", "checking for DB1 support... no", "checking for DBM support... no", "checking for CDB support... no", "checking for INI File support... no", "checking for FlatFile support... no", "checking whether to enable DBA interface... no", "checking whether to enable DOM support... yes", "checking for xml2-config path... (cached) /usr/bin/xml2-config", "checking whether libxml build works... (cached) yes", "checking for ENCHANT support... no", "checking whether to enable EXIF (metadata from images) support... no", "checking for fileinfo support... yes", "checking for utimes... yes", "checking for strndup... yes", "checking whether to enable input filter support... yes", "checking pcre install prefix... no", "checking whether to enable FTP support... no", "checking OpenSSL dir for FTP... no", "checking for GD support... yes", "checking for the location of libjpeg... /usr/lib", "checking for the location of libpng... no", "checking for the location of libXpm... no", "checking for FreeType 2... no", "checking for T1lib support... no", "checking whether to enable truetype string function in GD... no", "checking whether to enable JIS-mapped Japanese font support in GD... no", "checking for fabsf... yes", "checking for floorf... yes", "checking for jpeg_read_header in -ljpeg... yes", "checking for png_write_image in -lpng... yes", "If configure fails try --with-xpm-dir=<DIR>", "If configure fails try --with-freetype-dir=<DIR>", "checking for GNU gettext support... no", "checking for GNU MP support... no", "checking for mhash support... no", "checking whether to enable hash support... yes", "checking whether byte ordering is bigendian... (cached) no", "checking size of short... 2", "checking size of int... (cached) 4", "checking size of long... (cached) 8", "checking size of long long... (cached) 8", "checking for iconv support... yes", "checking for iconv... yes", "checking if iconv is glibc's... yes", "checking if iconv supports errno... yes", "checking if your cpp allows macro usage in include lines... yes", "checking for IMAP support... no", "checking for IMAP Kerberos support... no", "checking for IMAP SSL support... no", "checking for InterBase support... no", "checking whether to enable internationalization support... no", "checking whether to enable JavaScript Object Serialization support... yes", "checking for ANSI C header files... (cached) yes", "checking for LDAP support... no", "checking for LDAP Cyrus SASL support... no", "checking whether to enable multibyte string support... yes", "checking whether to enable multibyte regex support... yes", "checking whether to check multibyte regex backtrack... yes", "checking for external libmbfl... no", "checking for external oniguruma... no", "checking for variable length prototypes and stdarg.h... yes", "checking for stdlib.h... (cached) yes", "checking for string.h... (cached) yes", "checking for strings.h... yes", "checking for unistd.h... (cached) yes", "checking for sys/time.h... (cached) yes", "checking for sys/times.h... yes", "checking for stdarg.h... (cached) yes", "checking size of int... (cached) 4", "checking size of short... (cached) 2", "checking size of long... (cached) 8", "checking for working const... yes", "checking whether time.h and sys/time.h may both be included... yes", "checking for working alloca.h... (cached) yes", "checking for alloca... (cached) yes", "checking for 8-bit clean memcmp... yes", "checking for stdarg.h... (cached) yes", "checking for mcrypt support... no", "checking for MSSQL support via FreeTDS... no", "checking for MySQL support... yes", "checking for specified location of the MySQL UNIX socket... no"]}
最新发布
06-27
<think>我们正在处理用户关于编译PHP时出现的错误:configureerror:CannotfindMySQLheaderfilesunder/usr/local/mysql根据引用,这个错误是因为找不到MySQL的头文件(headerfiles)。用户可能在配置PHP时指定了MySQL路径,但路径不正确或者缺少必要的开发包。解决思路:1.确认系统中是否安装了MySQL的开发包(通常是libmysqlclient-dev或mysql-devel等,取决于系统)。2.检查MySQL头文件的实际路径,并确保配置时指定的路径正确。3.在配置PHP时使用正确的参数指定MySQL路径。根据引用[1]:错误信息明确说明在/usr/local/mysql下找不到MySQL头文件,并且提示MySQL客户端库不再捆绑。因此,我们需要确保已经安装了MySQL开发包,并且路径正确。引用[2]和[3]提供了一些配置参数的建议:-使用`--with-mysql`(让系统自动查找)-或者指定为`--with-mysql=/usr`(如果MySQL是RPM安装的,通常头文件在/usr/include/mysql下)-使用`--with-mysqli=/usr/bin/mysql_config`来指定mysqli的配置文件位置但是用户当前指定的路径是`/usr/local/mysql`,而错误信息显示在这个路径下找不到头文件。因此,我们需要检查这个路径下是否存在头文件(如mysql.h)。具体步骤:步骤1:检查MySQL头文件是否存在在终端中执行:ls/usr/local/mysql/include查看是否有mysql.h等头文件。步骤2:如果不存在,可能需要安装MySQL开发包或调整路径。例如,在Ubuntu/Debian系统上,可以安装:sudoapt-getinstalllibmysqlclient-dev在CentOS/RHEL系统上,可以安装:sudoyuminstallmysql-devel安装后,头文件通常会出现在标准路径(如/usr/include/mysql)下。步骤3:调整PHP的configure参数如果头文件在标准路径,可以尝试:--with-mysql--with-mysqli=mysql_config(如果mysql_config在PATH中,或者使用完整路径如/usr/bin/mysql_config)或者如果头文件在非标准路径,比如在/usr/local/mysql/include,那么可以指定:--with-mysql=/usr/local/mysql注意:如果使用自定义安装的MySQL(比如安装在/usr/local/mysql),那么需要确保在配置时指定的是MySQL的安装目录(即包含include和lib的目录),而不是直接指定include目录。步骤4:在重新配置前,建议先清理之前的配置(如果之前已经尝试过配置)makeclean根据引用[3]的建议,如果之前配置失败,重新配置前先执行`makeclean`。总结可能的解决方案:方案一:安装MySQL开发包(如果尚未安装)对于Ubuntu/Debian:sudoapt-getupdatesudoapt-getinstalllibmysqlclient-dev对于CentOS/RHEL:sudoyuminstallmysql-devel然后重新配置PHP,使用:./configure--with-mysql--with-mysqli方案二:如果MySQL已经安装在自定义路径(如/usr/local/mysql),但头文件确实存在(比如在/usr/local/mysql/include),那么确保配置参数正确:./configure--with-mysql=/usr/local/mysql...(其他参数)方案三:如果MySQL头文件实际在/usr/include/mysql,那么可以尝试指定为/usr,或者使用自动查找:./configure--with-mysql=/usr...(其他参数)或者./configure--with-mysql...(其他参数)方案四:同时指定mysqli的mysql_config路径(如果知道mysql_config的位置):./configure--with-mysqli=/usr/bin/mysql_config...(其他参数)注意:用户的具体配置参数可能还包括其他选项(如prefix等),需要保留。因此,针对用户的错误信息,我们首先需要确认MySQL头文件的位置,然后根据实际情况调整配置参数。生成相关问题:1.如何检查MySQL头文件是否已经安装?2.在不同Linux发行版上如何安装MySQL开发包?3.如何确定mysql_config的位置?4.重新配置PHP之前为什么要执行`makeclean`?5.如何查看PHP配置参数的正确写法?</think>### 解决PHP编译错误:MySQL头文件缺失 #### 错误分析 当编译PHP 5.3.28时出现 `configure: error: Cannot find MySQL header files under /usr/local/mysql` 错误,表明**配置脚本在指定路径下找不到MySQL开发头文件(如`mysql.h`)**。这些文件是编译PHP的MySQL扩展所必需的,通常包含在MySQL开发包中。 #### 解决方案 ##### ✅ 方法1:安装MySQL开发包(推荐) **根本原因是缺少MySQL开发文件**。根据系统类型安装对应开发包: ```bash # Debian/Ubuntu sudo apt-get install libmysqlclient-dev # CentOS/RHEL sudo yum install mysql-devel ``` 安装后重新运行 `./configure`(无需指定路径),系统会自动查找头文件[^1][^3]。 ##### ✅ 方法2:修正配置路径 如果MySQL已安装但路径错误: ```bash # 移除错误路径参数 ./configure \ --prefix=/usr/local/php-5.3.28 \ --with-mysql \ # 自动查找 --with-mysqli \ # 自动查找 [其他参数] ``` 或尝试指定标准路径: ```bash --with-mysql=/usr \ # CentOS/RHEL的默认路径 --with-mysql=/usr/include/mysql # Debian/Ubuntu的默认路径 ``` ##### ✅ 方法3:验证头文件存在性 手动检查头文件位置: ```bash # 查找mysql.h find /usr -name mysql.h 2>/dev/null # 典型路径示例: # /usr/include/mysql/mysql.h (Debian) # /usr/include/mysql/mysql.h (RHEL) # /usr/local/mysql/include/mysql.h (自定义安装) ``` 找到后使用 `--with-mysql=/实际路径` 配置。 ##### ✅ 清理构建环境 每次修改配置后执行: ```bash make clean # 清理旧编译文件 ./config.status --recheck # 重新检查配置 ``` #### 完整配置示例 ```bash ./configure \ --prefix=/usr/local/php-5.3.28 \ --with-config-file-path=/usr/local/php-5.3.28/etc \ --with-mysql \ --with-mysqli \ --enable-fpm \ [其他必要参数] ``` #### 📌 关键注意事项 1. **开发包 ≠ 客户端**:已安装`mysql-client`不代表有开发头文件,必须安装`libmysqlclient-dev`或`mysql-devel`[^1][^3]。 2. **路径一致性**:若MySQL通过源码安装,确保`--with-mysql`路径指向包含`include/`和`lib/`的目录。 3. **版本兼容性**:PHP 5.3需配合MySQL 5.1/5.5,高版本MySQL可能导致兼容问题。 --- ### 相关问题 1. **如何检查系统中是否已安装MySQL开发包?** `dpkg -l | grep libmysqlclient-dev` (Debian) 或 `rpm -q mysql-devel` (RHEL) 2. **源码编译MySQL后如何让PHP正确识别路径?** 需通过 `--with-mysql=/mysql/install/path` 指定完整安装路径,并确认路径下有`include/mysql.h`。 3. **出现`undefined reference to 'mysql_init'`错误如何解决?** 此问题通常因链接库路径错误,需在PHP配置中添加 `--with-libdir=lib64`(64位系统)或检查`ldconfig`配置[^2]。 4. **PHP 5.3是否兼容MySQL 8.0?** 不兼容。PHP 5.3最高支持MySQL 5.5,需升级PHP版本或降级MySQL[^3]。 [^1]: 缺失MySQL开发包导致的头文件查找失败,需安装`libmysqlclient-dev`或`mysql-devel`。 [^2]: 配置参数`--with-mysqli=/usr/bin/mysql_config`可辅助定位库文件路径。 [^3]: 路径参数需指向MySQL基础目录(含`include/`),非直接指向`include/mysql`子目录。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值