バージョンの確認いろいろ

開発や運用管理業務をやっていると、使っている環境のバージョンを確認する必要も出てきます。

今回はいくつか集めてみました。


大体「v」とか「version」といったオプション付ければOK、というのが今回の結論だったりします。

httpd -v」か、「httpd -V」で。「-V」だとより詳細に出ます。
実行例は「httpd -V」の場合

# /usr/sbin/httpd -V
Server version: Apache/2.2.3
Server built:   Aug 30 2010 12:32:08
Server's Module Magic Number: 20051115:3
Server loaded:  APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture:   32-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

こちらも同様に「lighttpd -v」で。

# /usr/sbin/lighttpd -v
lighttpd/1.4.28 (ssl) - a light and fast webserver
Build-Date: Aug 22 2010 21:28:19

Linuxの場合、RPMパッケージなら起動スクリプトに引数「version」を与えてやればOK

# /etc/init.d/tomcat5 version
Server version: Apache Tomcat/5.5.23
Server built:   Aug 2 2010 05:41:50
Server number:  5.5.23.0
OS Name:        Linux
OS Version:     2.6.18-194.11.3.el5
Architecture:   i386
JVM Version:    1.6.0_21-b06
JVM Vendor:     Sun Microsystems Inc.

tarアーカイブなら、binディレクトリ以下に「version.sh」というスクリプトがあるので、
こいつを実行してやればOK

# sh /usr/local/apache-tomcat-5.5.31/bin/version.sh
Using CATALINA_BASE:   /usr/local/apache-tomcat-5.5.31
Using CATALINA_HOME:   /usr/local/apache-tomcat-5.5.31
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-5.5.31/temp
Using JRE_HOME:        /usr/java/jdk1.6.0_21
Using CLASSPATH:       /usr/local/apache-tomcat-5.5.31/bin/bootstrap.jar
Server version: Apache Tomcat/5.5.31
Server built:   Sep 4 2010 12:53:08
Server number:  5.5.31.0
OS Name:        Linux
OS Version:     2.6.18-194.11.3.el5
Architecture:   i386
JVM Version:    1.6.0_21-b06
JVM Vendor:     Sun Microsystems Inc.

DBサーバーにログイン後、「select version();」でOK

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.0.77    |
+-----------+
1 row in set (0.00 sec)

ちなみに「show variables;」という手もあります。

MySQL同様、DBサーバーにログイン後、「select version();」でOK

# select version();
                                                 version                                  
---------------------------------------------------------------------------------------------------------
 PostgreSQL 8.1.21 on i686-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)
(1 row)

sendmail -d0.1」でOK。確認後は「Ctrl + C」で。

# /usr/sbin/sendmail -d0.1
Version 8.13.8
 Compiled with: DNSMAP HESIOD HES_GETMAILHOST LDAPMAP LOG MAP_REGEX
                MATCHGECOS MILTER MIME7TO8 MIME8TO7 NAMED_BIND NETINET NETINET6
                NETUNIX NEWDB NIS PIPELINING SASLv2 SCANF SOCKETMAP STARTTLS
                TCPWRAPPERS USERDB USE_LDAP_INIT

「postconf」で「mail_version」の項目を確認

# /usr/sbin/postconf | grep mail_version
mail_version = 2.3.3

他同様「squid -v」で。いろいろ出てきますが、最初の行にバージョンが出力されます。

# /usr/sbin/squid -v
Squid Cache: Version 2.6.STABLE21
configure options:  '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--exec_prefix=/usr' '--bindir=/usr/sbin' '--libexecdir=/usr/lib/squid' '--localstatedir=/var' '--datadir=/usr/share' '--sysconfdir=/etc/squid' '--enable-arp-acl' '--enable-epoll' '--enable-snmp' '--enable-removal-policies=heap,lru' '--enable-storeio=aufs,coss,diskd,null,ufs' '--enable-ssl' '--with-openssl=/usr/kerberos' '--enable-delay-pools' '--enable-linux-netfilter' '--with-pthreads' '--enable-ntlm-auth-helpers=SMB,fakeauth' '--enable-external-acl-helpers=ip_user,ldap_group,unix_group,wbinfo_group' '--enable-auth=basic,digest,ntlm,negotiate' '--enable-negotiate-auth-helpers=squid_kerb_auth' '--enable-digest-auth-helpers=password' '--with-winbind-auth-challenge' '--enable-useragent-log' '--enable-referer-log' '--disable-dependency-tracking' '--enable-cachemgr-hostname=localhost' '--enable-underscores' '--enable-basic-auth-helpers=LDAP,MSNT,NCSA,PAM,SMB,YP,getpwnam,multi-domain-NTLM,SASL' '--enable-cache-digests' '--enable-ident-lookups' '--with-large-files' '--enable-follow-x-forwarded-for' '--enable-wccpv2' '--enable-fd-config' '--with-maxfd=16384' 'build_alias=i686-redhat-linux-gnu' 'host_alias=i686-redhat-linux-gnu' 'target_alias=i386-redhat-linux-gnu' 'CFLAGS=-D_FORTIFY_SOURCE=2 -fPIE -Os -g -pipe -fsigned-char' 'LDFLAGS=-pie'
  • DNSサーバー
    • BIND

素直に「named -v」でOK

# /usr/sbin/named -v
BIND 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2
  • 実行環境

「○○言語」の実行環境確認ということで。

java -version」で。

# /usr/java/jdk1.6.0_21/bin/java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Client VM (build 17.0-b16, mixed mode, sharing)

やっぱり「perl -v」です。

# /usr/bin/perl -v

This is perl, v5.8.8 built for i386-linux-thread-multi

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

こっちも「ruby -v」です。

# /usr/bin/ruby -v
ruby 1.8.5 (2006-08-25) [i386-linux]

php -v」でOKです。

# /usr/bin/php -v
PHP 5.1.6 (cli) (built: Mar 31 2010 02:44:37)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies


今日はこんな所で。