

From:http://help.zzy.cn/info.asp?id=30
A (Address) 记录
是用来指定主机名(或域名)对应的IP地址记录。用户可以将该域名下的网站服务器指向到自己的web server上。同时也可以设置您域名的二级域名。
别名记录(CNAME)
也被称为规范名字。这种记录允许您将多个名字映射到同一台计算机。
通常用于同时提供WWW和MAIL服务的计算机。例如,有一台计算机名为“host.mydomain.com”(A记录)。
它同时提供WWW和MAIL服务,为了便于用户访问服务。可以为该计算机设置两个别名(CNAME):WWW和MAIL。
这两个别名的全称就是“www.mydomain.com”和“mail.mydomain.com”。实际上他们都指向
“host.mydomain.com”。
同样的方法可以用于当您拥有多个域名需要指向同一服务器IP,此时您就可以将一个域名做A记录指向服务器IP然后将其他的域名做别名到之前做A记录的域名
上,那么当您的服务器IP地址变更时您就可以不必麻烦的一个一个域名更改指向了
只需要更改做A记录的那个域名其他做别名的那些域名的指向也将自动更改到新的IP地址上了。
MX(Mail Exchanger)记录
是邮件交换记录,它指向一个邮件服务器,用于电子邮件系统发邮件时根据
收信人的地址后缀来定位邮件服务器。例如,当Internet上的某用户要发一封信给 user@mydomain.com
时,该用户的邮件系统通过DNS查找mydomain.com这个域名的MX记录,如果MX记录存在,
用户计算机就将邮件发送到MX记录所指定的邮件服务器上。
简单技巧:同时也可使用 nsloolup -qt=mx zzy.cn 这样的命令来查询zzy.cn的MX记录。
附:中资源企业邮局MX记录做法
单线企业邮局(电信单线路):mx1.cnm.cn.
双线企业邮局(电信+网通同时具有线路):mx2.cnm.cn.
NS(Name Server)记录
是域名服务器记录,用来指定该域名由哪个DNS服务器来进行解析。
• | TCP/IP 协议必须安装在运行 Nslookup.exe 的计算机上。 |
• | 在 Microsoft TCP/IP 属性页的 DNS 选项卡的“DNS 服务搜索顺序”字段中必须至少指定一个 DNS 服务器。 |
• | Nslookup 一直从当前上下文中的名称中抽去后缀。如果无法进行完全合格的名称查询(即,使用尾随点),那么查询将被附加到当前上下文中。例如,当前 DNS 设置是 att.com,并且在 www.microsoft.com 中执行查询,那么第一个查询将作为 www.microsoft.com.att.com 而失败,因为查询是不合格的。 这种方式与其他供应商的 Nslookup 方式可能不一致,本文的目的在于阐明 Microsoft Windows NT Nslookup.exe 的处理方式。 |
• | 如果已经使用 Microsoft TCP/IP 属性页 DNS 选项卡上定义的“域后缀搜索顺序”(Domain Suffix Search Order )中的搜索列表,将不会发生抽取操作。查询将被附加到列表中指定的域后缀中。要避免使用搜索列表,请始终使用“完全合格的域名称”(即,在名称中添加尾随点)。 |
nslookup [-option] [hostname] [server]
C:> nslookup
Default Server: nameserver1.domain.com
Address: 10.0.0.1
>
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,
and so on
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 (for example, A, ANY, CNAME, MX,
NS, PTR, SOA, SRV)
querytype=X - same as type
class=X - set query class (for example, 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 (for example, A, CNAME,
MX, NS, PTR, and so on)
view FILE - sort an 'ls' output file and view it with pg
exit - exit the program
C:> nslookup
Default Server: ns1.domain.com
Address: 10.0.0.1
> set q=mx
> mailhost
Server: ns1.domain.com
Address: 10.0.0.1
mailhost.domain.com MX preference = 0, mail exchanger =
mailhost.domain.com
mailhost.domain.com internet address = 10.0.0.5
>
C:> nslookup
Default Server: nameserver1.domain.com
Address: 10.0.0.1
> server 10.0.0.2
Default Server: nameserver2.domain.com
Address: 10.0.0.2
>
ls [- a | d | t type] domain [> filename]
>ls domain.com
[nameserver1.domain.com]
nameserver1.domain.com. NS server = ns1.domain.com
nameserver2.domain.com NS server = ns2.domain.com
nameserver1 A 10.0.0.1
nameserver2 A 10.0.0.2
>
From:http://turtle.ee.ncku.edu.tw/~tung/dns/nslookup.html:
有些時候, user 可能會想要手動查詢 DNS 上一些資料, 或者是要看看 DNS 是否有問題,
此時我們最常用的工具就是 nslookup 了, 基本上 nslookup 會根據 /etc/resolv.conf
的內容去找到所要使用的 local DNS server.
使用說明
打入 nslookup 命令後, 會看到 > 提示符號, 此時打 ? 就會出現 nslookup
說明
Default Server: sun4.ee.ncku.edu.tw
Address: 140.116.72.14
>?
$Id: nslookup.help,v 8.4 1996/10/25 18:09:41 vixie
Exp $
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; see nslookup(1) for details
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]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
querytype=X - set query type,
e.g., A,ANY,CNAME,HINFO,MX,PX,NS,PTR,SOA,TXT,WKS,SRV,NAPTR
port=X
- set port number to send query on
type=X
- synonym for querytype
class=X
- set query class to one of IN (Internet), CHAOS, HESIOD or ANY
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
USER 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
-h
- list HINFO (CPU type and operating system)
-s
- list well-known services
-d
- list all records
-t TYPE
- list records of the given type (e.g., A,CNAME,MX, etc.)
view FILE
- sort an 'ls' output file and view it with more
exit
- exit the program, ^D also exits
>^D
Interactive/Noninteractive (交談式/非交談式)
執行 nslookup 時可以直接在後面跟著我們要查詢的資料, 那麼 nslookup 會直接把結果傳回來
如果只打入 nslookup [enter], 則進入交談模式, 出現提示符號 >, 此時 nslookup
會等待 user input command.
tung@traveler:~> nslookup
www.yohoo.com
Server: sun4.ee.ncku.edu.tw
Address: 140.116.72.14
Non-authoritative answer:
Name: yohoo.com
Address: 216.116.98.143
Aliases: www.yohoo.com
tung@traveler:~> nslookup
Default Server: sun4.ee.ncku.edu.tw
Address: 140.116.72.14
> www.yohoo.com
Server: sun4.ee.ncku.edu.tw
Address: 140.116.72.14
Non-authoritative answer:
Name: yohoo.com
Address: 216.116.98.143
Aliases: www.yohoo.com
Authoritative/Non-Authoritative
在查詢時有時會出現 Non-authoritative answer, 代表這個答案是由 local
DNS 的 cache 中直接讀出來的, 而不是 local DNS 向真正負責這個 domain 的
name server 問來的.
常用的一些 option/command
1. set all
可以得知目前 nslookup 的一些 default 設定值
tung@traveler:~>
nslookup
Default Server: sun4.ee.ncku.edu.tw
Address: 140.116.72.14
> set all
Default Server: sun4.ee.ncku.edu.tw
Address: 140.116.72.14
Set options:
nodebug
defname search
recurse
nod2
novc
noignoretc port=53
querytype=A class=IN
timeout=5 retry=4
root=a.root-servers.net.
domain=ee.ncku.edu.tw
srchlist=ee.ncku.edu.tw
2. server dns_server_ip
表示將內定的 local DNS 換成另一部 server
Ex: server 140.116.2.6
3. set type=any
表示在查詢某個 domain name 時, 將和這個 domain name 的一些相關資料一併顯示出來
> set type=any
> www.yohoo.com
Server: sun4.ee.ncku.edu.tw
Address: 140.116.72.14
Non-authoritative answer:
www.yohoo.com canonical name = yohoo.com
Authoritative answers can be found from:
yohoo.com
nameserver = ns1.netgateway.net
yohoo.com
nameserver = ns2.netgateway.net
ns1.netgateway.net
internet address = 216.116.98.7
ns2.netgateway.net
internet address = 216.116.98.8
在上面的這個例子, 我們除了知道 www.yohoo.com 的 IP 外, 我們還得知了
yohoo.com 是由哪部 name server 在負責的. 因此如果想要知道 www.yohoo.com
真正在 yohoo.com 上的記錄是如何, 而不要有 local DNS cache 中傳回的資料,
我們可以配合使用 server 這個 command 將 default local DNS 改為負責 yohoo.com
的 DNS, 然後再查詢一次
> server 216.116.98.7
Default Server: ns1.netgateway.net
Address: 216.116.98.7
> www.yohoo.com
Server: ns1.netgateway.net
Address: 216.116.98.7
Name: yohoo.com
Address: 216.116.98.143
Aliases: www.yohoo.com
4. set type=ptr
本來要由 IP 反查 domain name時, 在直接打 IP 就行了, 但如果已經下了
type=any 的話, 要由 IP 反查時就沒那麼方便了, 此時 IP 4 個數字要倒著寫,
最後還要加上 in-addr.arpa. 以查 140.116.72.219 為例, 要輸入的就是 219.72.116.140.in-addr.arpa
tung@traveler:~> nslookup
Default Server: sun4.ee.ncku.edu.tw
Address: 140.116.72.14
> 140.116.72.219
Server: sun4.ee.ncku.edu.tw
Address: 140.116.72.14
Name: garfield.ee.ncku.edu.tw
Address: 140.116.72.219
> set type=any
> 140.116.72.219
Server: sun4.ee.ncku.edu.tw
Address: 140.116.72.14
*** sun4.ee.ncku.edu.tw can't find 140.116.72.219:
Non-existent host/domain
> 219.72.116.140.in-addr.arpa
Server: sun4.ee.ncku.edu.tw
Address: 140.116.72.14
219.72.116.140.in-addr.arpa
name = garfield.ee.ncku.edu.tw
72.116.140.IN-ADDR.ARPA nameserver = sun4.ee.ncku.edu.tw
sun4.ee.ncku.edu.tw internet
address = 140.116.72.14
另外一個辦法就是先下 set type=ptr 或 set type=a 命令, 脫離 type=any
模式, 再進行 IP 反查 domain name 的 command
> set typr=ptr
> 140.116.72.219
Server: sun4.ee.ncku.edu.tw
Address: 140.116.72.14
219.72.116.140.in-addr.arpa
name = garfield.ee.ncku.edu.tw
72.116.140.IN-ADDR.ARPA nameserver = sun4.ee.ncku.edu.tw
sun4.ee.ncku.edu.tw internet
address = 140.116.72.14
5. ls domain
這個命令是要求 name server 將其負責的 zone 內容
show 出來, 這個動作相當於 name server 的整份記錄從 server 端傳回給 nslookup
這個程式, 這種傳回整個 zone 的動作叫作 zone transfer
> set type=any
> ee.ncku.edu.tw
Server: cs.ncku.edu.tw
Address: 140.116.2.6
ee.ncku.edu.tw nameserver = sun4.ee.ncku.edu.tw
ee.ncku.edu.tw preference = 1, mail exchanger
= eembox.ee.ncku.edu.tw
ee.ncku.edu.tw internet address = 140.116.72.15
ee.ncku.edu.tw
origin
= sun4.ee.ncku.edu.tw
mail
addr = root.sun4.ee.ncku.edu.tw
serial
= 1999033001
refresh
= 3600 (1H)
retry
= 900 (15M)
expire
= 3600000 (5w6d16h)
minimum
ttl = 3600 (1H)
ee.ncku.edu.tw nameserver = sun4.ee.ncku.edu.tw
sun4.ee.ncku.edu.tw internet
address = 140.116.72.14
eembox.ee.ncku.edu.tw internet address
= 140.116.72.15
> ls ee.ncku.edu.tw
Default Server: cs.ncku.edu.tw
Address: 140.116.2.6
> [sun4.ee.ncku.edu.tw]
$ORIGIN ee.ncku.edu.tw.
@
1H IN A 140.116.72.15
hdlib4
1H IN A 140.116.72.4
ds114
1H IN A 140.116.72.114
hdlib5
1H IN A 140.116.72.5
ds115
1H IN A 140.116.72.115
yokoyama1
1H IN A 140.116.227.217
hdlib6
1H IN A 140.116.72.6
ds116
1H IN A 140.116.72.116
yokoyama2
1H IN A 140.116.227.218
ds117
1H IN A 140.116.72.117
ds120
1H IN A 140.116.72.120
ds118
1H IN A 140.116.72.118
ds121
1H IN A 140.116.72.121
ds119
1H IN A 140.116.72.119
ds122
1H IN A 140.116.72.122
ds123
1H IN A 140.116.72.123
intelab01
1H IN A 140.116.227.39
.....
NSLOOKUP(8) NSLOOKUP(8)
NAME
nslookup - query Internet name servers interactively
SYNOPSIS
nslookup [ -option ... ] [ host-to-find | - [ server ]]
DESCRIPTION
Nslookup is a program to query Internet domain name
servers. Nslookup has two modes: interactive and non-
interactive. Interactive mode allows the user to query
name servers for information about various hosts and
domains or to print a list of hosts in a domain. Non-
interactive mode is used to print just the name and
requested information for a host or domain.
ARGUMENTS
Interactive mode is entered in the following cases:
a) when no arguments are given (the default name server
will be used),
b) when the first argument is a hyphen (-) and the second
argument is the host name or Internet address of a
name server.
Non-interactive mode is used when the name or Internet
address of the host to be looked up is given as the first
argument. The optional second argument specifies the host
name or address of a name server.
The options listed under the ``set'' command below can be
specified in the .nslookuprc file in the user's home
directory if they are listed one per line. Options can
also be specified on the command line if they precede the
arguments and are prefixed with a hyphen. For example, to
change the default query type to host information, and the
initial timeout to 10 seconds, type:
nslookup -query=hinfo -timeout=10
INTERACTIVE COMMANDS
Commands may be interrupted at any time by typing a con-
trol-C. To exit, type a control-D (EOF) or type exit.
The command line length must be less than 256 characters.
To treat a built-in command as a host name, precede it
with an escape character (). N.B. an unrecognized com-
mand will be interpreted as a host name.
host [server]
Look up information for host using the current
default server or using server if specified. If
host is an Internet address and the query type is A
or PTR, the name of the host is returned. If host
is a name and does not have a trailing period, the
default domain name is appended to the name. (This
behavior depends on the state of the set options
domain, srchlist, defname, and search). To look up
a host not in the current domain, append a period
to the name.
server domain
lserver domain
Change the default server to domain. Lserver uses
the initial server to look up information about
domain while server uses the current default
server. If an authoritative answer can't be found,
the names of servers that might have the answer are
returned.
root Changes the default server to the server for the
root of the domain name space. Currently, the host
ns.internic.net is used. (This command is a syn-
onym for lserver ns.internic.net.) The name of the
root server can be changed with the set root com-
mand.
finger [name] [> filename]
finger [name] [>> filename]
Connects with the finger server on the current
host. The current host is defined when a previous
lookup for a host was successful and returned
address information (see the set querytype=A com-
mand). Name is optional. > and >> can be used to
redirect output in the usual manner.
ls [option] domain [> filename]
ls [option] domain [>> filename]
List the information available for domain, option-
ally creating or appending to filename. The
default output contains host names and their Inter-
net addresses. Option can be one of the following:
-t querytype
lists all records of the specified type (see
querytype below).
-a lists aliases of hosts in the domain. synonym
for -t CNAME.
-d lists all records for the domain. synonym for
-t ANY.
-h lists CPU and operating system information for
the domain. synonym for -t HINFO.
-s lists well-known services of hosts in the
domain. synonym for -t WKS.
When output is directed to a file, hash marks are
printed for every 50 records received from the
server.
view filename
Sorts and lists the output of previous ls com-
mand(s) with more(1).
help
? Prints a brief summary of commands.
exit Exits the program.
set keyword[=value]
This command is used to change state information
that affects the lookups. Valid keywords are:
all Prints the current values of the frequently-
used options to set. Information about the
current default server and host is also
printed.
class=value
Change the query class to one of:
IN the Internet class.
CHAOS the Chaos class.
HESIOD the MIT Athena Hesiod class.
ANY wildcard (any of the above).
The class specifies the protocol group of
the information.
(Default = IN, abbreviation = cl)
[no]debug
Turn debugging mode on. A lot more informa-
tion is printed about the packet sent to the
server and the resulting answer.
(Default = nodebug, abbreviation = [no]deb)
[no]d2 Turn exhaustive debugging mode on. Essen-
tially all fields of every packet are
printed.
(Default = nod2)
domain=name
Change the default domain name to name. The
default domain name is appended to a lookup
request depending on the state of the def-
name and search options. The domain search
list contains the parents of the default
domain if it has at least two components in
its name. For example, if the default
domain is CC.Berkeley.EDU, the search list
is CC.Berkeley.EDU and Berkeley.EDU. Use
the set srchlist command to specify a dif-
ferent list. Use the set all command to
display the list.
(Default = value from hostname,
/etc/resolv.conf or LOCALDOMAIN, abbrevia-
tion = do)
srchlist=name1/name2/...
Change the default domain name to name1 and
the domain search list to name1, name2, etc.
A maximum of 6 names separated by slashes
(/) can be specified. For example,
set srch-
list=lcs.MIT.EDU/ai.MIT.EDU/MIT.EDU
sets the domain to lcs.MIT.EDU and the
search list to the three names. This com-
mand overrides the default domain name and
search list of the set domain command. Use
the set all command to display the list.
(Default = value based on hostname,
/etc/resolv.conf or LOCALDOMAIN, abbrevia-
tion = srchl)
[no]defname
If set, append the default domain name to a
single-component lookup request (i.e., one
that does not contain a period).
(Default = defname, abbreviation = [no]def)
[no]search
If the lookup request contains at least one
period but doesn't end with a trailing
period, append the domain names in the
domain search list to the request until an
answer is received.
(Default = search, abbreviation = [no]sea)
port=value
Change the default TCP/UDP name server port
to value.
(Default = 53, abbreviation = po)
querytype=value
type=value
Change the type of information query to one
of:
A the host's Internet address.
CNAME the canonical name for an alias.
HINFO the host CPU and operating system
type.
MINFO the mailbox or mail list informa-
tion.
MX the mail exchanger.
NS the name server for the named
zone.
PTR the host name if the query is an
Internet address, otherwise the
pointer to other information.
SOA the domain's ``start-of-author-
ity'' information.
TXT the text information.
UINFO the user information.
WKS the supported well-known services.
Other types (ANY, AXFR, MB, MD, MF, NULL)
are described in the RFC-1035 document.
(Default = A, abbreviations = q, ty)
[no]recurse
Tell the name server to query other servers
if it does not have the information.
(Default = recurse, abbreviation = [no]rec)
retry=number
Set the number of retries to number. When a
reply to a request is not received within a
certain amount of time (changed with set
timeout), the timeout period is doubled and
the request is resent. The retry value con-
trols how many times a request is resent
before giving up.
(Default = 4, abbreviation = ret)
root=host
Change the name of the root server to host.
This affects the root command.
(Default = ns.internic.net., abbreviation =
ro)
timeout=number
Change the initial timeout interval for
waiting for a reply to number seconds. Each
retry doubles the timeout period.
(Default = 5 seconds, abbreviation = ti)
[no]vc Always use a virtual circuit when sending
requests to the server.
(Default = novc, abbreviation = [no]v)
[no]ignoretc
Ignore packet truncation errors.
(Default = noignoretc, abbreviation =
[no]ig)
DIAGNOSTICS
If the lookup request was not successful, an error message
is printed. Possible errors are:
Timed out
The server did not respond to a request after a cer-
tain amount of time (changed with set timeout=value)
and a certain number of retries (changed with set
retry=value).
No response from server
No name server is running on the server machine.
No records
The server does not have resource records of the cur-
rent query type for the host, although the host name
is valid. The query type is specified with the set
querytype command.
Non-existent domain
The host or domain name does not exist.
Connection refused
Network is unreachable
The connection to the name or finger server could not
be made at the current time. This error commonly
occurs with ls and finger requests.
Server failure
The name server found an internal inconsistency in
its database and could not return a valid answer.
Refused
The name server refused to service the request.
Format error
The name server found that the request packet was not
in the proper format. It may indicate an error in
nslookup.
FILES
/etc/resolv.conf initial domain name and
name server addresses.
$HOME/.nslookuprc user's initial options.
/usr/share/misc/nslookup.help summary of commands.
ENVIRONMENT
HOSTALIASES file containing host aliases.
LOCALDOMAIN overrides default domain.
SEE ALSO
resolver(3), resolver(5), named(8),
RFC-1034 ``Domain Names - Concepts and Facilities''
RFC-1035 ``Domain Names - Implementation and Specifica-
tion''
AUTHOR
Andrew Cherenson
from: http://linuxtoy.org/archives/terminal-based-tools.html
就算 Linux 没有 GUI(图形用户界面),我们在 CLI(命令行界面)中依然能够应付自如。从浏览网络到联络朋友,从获取资源到音影娱乐,从编辑文本到观看图片……在 GUI 中能做的,CLI 也同样可以办到。我想这即是 Linux 的魅力了。
[参考]
- A day without X
- More terminal programs you should be using … like a pro
DB2 is one of the few industrial strength, fully featured database
systems that has a community edition available for free use. It
supports stored-procedures, and all the standard MySQL-esque features,
in addition to triggers and all sorts of data partitioning. And it even
ships with a full set of administrative GUI tools. Unfortunately,
nobody has taken the time to document the process of getting DB2
installed on Ubuntu Dapper (6.06 LTS). This is my attempt to do so and
save others some of the confusion that I went though getting it to work.
If you’re feeling adventurous, you can read the official DB2 9.1 documentation and the many, many DB2 Manuals available on IBMs site.
Getting DB2
There are a number of verions of DB2 available from IBM. Unless you
have usage requirements that demand advanced data replication,
partitioning, and clusteriing, the freely distributed Express-C
community version of DB2 should suffice. The only notable limitation
imposed by this version is a 2CPU/4GB Ram hardware constraint on the
physical host on which the software is installed. More information on
the varying DB2 versions, their features, and their constraints can be
found on the official IBM DB2 page. You can get DB2 Express-C at the IBM downloads page.
Installing DB2
The DB2 installation package is rpm-based, so we’ll need to install an
rpm-compatible installer for Ubuntu. For this, we apt-get alien, an rpm
package installer:
$ sudo apt-get install alien
Now we may db2_install installation script that is bundled with DB2. This needs to be done as root:
$ tar xzvf db2exc_91_LNX_x86.tar.gz
$ sudo exp/disk1/db2_install
This should take a few minutes to install. At the time of this
writing, the installation procedure had approximately ten steps and
lasted about three to five minutes. Note that depending on the version
of gcc that you have installed (if at all), you may need to install libstdc++5, as it is required for successful installation. This is easily obtained:
$ sudo apt-get install libstdc++5
Setting Up Groups/Users
Now that we have DB2 installed, we need to configure it for use. We
start by creating the standard DB2 user groups: instance owners, fenced
users, and administrators. (Note that these commands need to be run as
root — the sudo is dropped here for notational simplicity and a # is added in its place for clarity).
# groupadd -g 999 db2iadm1
# groupadd -g 998 db2fadm1
# groupadd -g 997 dasadm1
Now we’ll create a default user for each group:
# useradd -u 1002 -g dasadm1 -m -d /home/dasusr1 dasusr1 -p password2
# useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1 -p password3
# useradd -u 1004 -g db2iadm1 -m -d /home/db2inst1 db2inst1 -p password4
Creating the Adminstrative Database
Now we need to create a DB2 Administration Server to administer all instances of DB2 under the purview of this installation:
# /opt/ibm/db2/V9.1/instance/dascrt -u dasusr1
Note here that dasusr1 may be any user that is a member of the dasadm1 group we set up earlier.
DB2 Instance Semantics. Creating an Instance.
A DB2 instance is an environment that acts as a logical container for a
collection of databases. It’s an abstraction that allows the creation
and usage of multiple independent DB2 environments using the same
physical resources.
We need an instance to hold all of our databases. We’l create a default instance using the db2inst1 user we just created as its owner:
# /opt/ibm/db2/V9.1/instance/db2icrt -u db2fenc1 db2inst1
As we noted, db2inst1 is the instance owner, while db2fenc1 credentials are used to execute fenced stored procedures and executables.
Starting and Stopping an Instance
A DB2 instance is an environment that acts as a logical container for a
collection of In order to start and stop the DB2 instance (remember, we
may have multiple instances for a given installation on a physical
host), we log in as the owner and call db2start after inializing the
DB2 environment:
$ su db2inst1
$. ~/sqllib/db2profile
$db2start
Stopping the environment is just as simple: we’d call db2stop instead of db2start.
You may enable (or disable) automatic DB2 instance start/stop on system start-up/shut-down by calling:
$ db2iauto -on db2inst1
where db2inst1 is the login name of the instance. Replacing the -on flag with -off disables this feature.
The Sample Database
If you wish to build the sample database bundled with DB2 in
order to play around, call db2sampl while logged into a DB2 instance
owner account:
$ su db2inst1
$ . ~/sqllib/db2profile
$ db2sampl
That’s It.
This concludes the bare-minimum needed to set up a working
DB2 environment on Ubuntu. Note that this configuration does not allow
for external connections over TCP/IP. We’d need to start a separate
service
References
[1] Official DB2 9.1 documentation
[2] DB2 Manuals
//很多时候这是很必要的
1) lsb_release -a ,即可列出所有版本信息,适用于所有的linux,例如:
ox0spy@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 6.06.1 LTS
Release: 6.06
Codename: dapper
ox0spy@ubuntu:~$
2) cat /etc/redhat-release ,
这种方式下可以直接看到具体的版本号,比如 AS4 Update 1
3)rpm -q redhat-release ,
这种方式下可看到一个所谓的release号,比如上边的例子是2.4
这个release号和实际的版本之间存在一定的对应关系,如下:
redhat-release-3AS-1 -> Redhat Enterprise Linux AS 3
redhat-release-3AS-7.4 -> Redhat Enterprise Linux AS 3 Update 4
redhat-release-4AS-2 -> Redhat Enterprise Linux AS 4
redhat-release-4AS-2.4 -> Redhat Enterprise Linux AS 4 Update 1
redhat-release-4AS-3 -> Redhat Enterprise Linux AS 4 Update 2
redhat-release-4AS-4.1 -> Redhat Enterprise Linux AS 4 Update 3
redhat-release-4AS-5.5 -> Redhat Enterprise Linux AS 4 Update 4
4) cat /etc/issue
Fedora Core release 4 (Stentz)
Kernel r on an m
5) 内核版本,cat /proc/version,例如:
ox0spy@ubuntu:~$ cat /proc/version
Linux version 2.6.15-26-server (buildd@terranova) (gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)) #1 SMP Thu Aug 3 04:09:15 UTC 2006
注意:第(2)(3)两种方法只对Redhat Linux有效