如何在OSX小牛上安装db2 Express-C 10.1 [英] How do I install db2 Express-C 10.1 on OSX Mavericks
问题描述
我试图在OSX小牛上安装db2 Express-C 10.1,但是我收到错误列在这里:
用于Mac的db2安装程序
以下是我将db2 express C安装到Mac OSX小牛。
注意:我做了所有的命令登录到我自己的用户;当我需要以不同的用户身份运行时,我使用sudo。
步骤:
-
从这里下载DB2 express C:
https://www14.software.ibm.com/webapp/iwm/web/reg/download.do?source = swg-db2expressc& S_PKG = dlmacosx& S_TACT = 100KG31W& lang = en_US& cp = UTF-8& dlmethod = http -
双击下载的文件解压缩并解压缩。
-
使用此命令修改系统参数:
code> sudo vi /etc/sysctl.conf
并填充以下信息:
kern.sysv.shmmax = 1073741824
kern.sysv.shmmin = 1
kern.sysv.shmmni = 4096
kern。 sysv.shmseg = 32
kern.sysv.shmall = 1179648
kern.maxfilesperproc = 65536
kern.maxfiles = 65536
-
重新启动计算机#非常伤心我添加了该指令。
-
使用以下命令开始安装过程: >
cd〜/ Downloads / expc; sudo ./db2_install
-
接受默认路径'/opt/IBM/db2/V10.1'
-
等待三分钟左右脚本运行。
-
请注意,执行成功完成。
-
使用mac gui(系统偏好设置 - >用户和组)创建db2inst1用户。使用标准(非管理员)权限。
-
使用以下命令创建实例:
cd /opt/IBM/db2/V10.1/实例sudo ./db2icrt -u db2inst1 db2inst1
-
使用此命令修改您的个人资料:
vim〜/ .bash_profile
并添加这些行(大概在文件末尾):
PATH = $ PATH:/opt/IBM/db2/V10.1/bin
如果[[-f〜db2inst1 / sqllib / db2profile]]
then
source〜db2inst1 / sqllib / db2profile
fi -
登录新的终端窗口,从.bash_profile获取新的设置。
退出旧窗口以避免混淆。 -
使用以下命令初始化示例数据库:
db2sampl
-
使用以下命令启动数据库:
sudo -u db2inst1 db2start
-
使用以下命令测试示例数据库:
db2 connect to SAMPLE
db2 list tables
如果您需要从远程计算机连接到此数据库,或者希望使用Java连接到此数据库,其中连接需要主机和端口号,请按照说明启用删除连接。您可以推迟运行这些说明,直到您确实需要以这种方式连接。没有运行这些说明,您可以使用db2命令行进行连接,运行这些说明后,您将能够连接任何需要主机和端口号的工具。
启用远程连接的步骤:
-
更新db2以允许使用以下命令的远程服务:
cd〜db2inst1
sudo -u db2inst1 db2 update dbm cfg使用svcename db2c_db2inst1
cd是必需的,因为命令需要写入当前目录。
-
使用以下命令添加服务端口:
sudo vim / etc / services
,并将此行添加到文件的最后一行。实际的位置并不重要。
db2c_db2inst1 50000 / tcp
-
设置db2应该使用tcp / ip使用以下命令:
sudo -u db2inst1 db2set DB2COMM = TCPIP
-
使用以下命令停止并启动数据库:
sudo -u db2inst1 db2stop force
sudo -u db2inst1 db2start
/ p>
请注意stop命令中的
force
。这将删除任何现有的连接。如果您想对连接的用户友善,请不要使用强制,只有在要求用户断开连接后才继续重试该命令。我在默认说明中包含了这个强制,因为有可能遵循这些说明的人是数据库中唯一的用户。
< h2>参考文献:
- http://programmingzen.com/2009/01/20/installing-db2-on-mac-os-x/
- https://www.ibm.com/developerworks/cn社区/论坛/ html / topic?id = 77777777-0000-0000-0000-000014927797
如果您确定改进对这些说明请发表评论。我将收到通知并进行更改。
I have attempted to install db2 Express-C 10.1 on OSX Mavericks, but I get the error listed here: db2 setup for Mac
Here are the steps I did to install db2 express C on Mac OSX Mavericks.
Note: I did all the commands logged into my own user; when I needed to run as a different user, I used sudo.
Steps:
Download DB2 express C from here: https://www14.software.ibm.com/webapp/iwm/web/reg/download.do?source=swg-db2expressc&S_PKG=dlmacosx&S_TACT=100KG31W&lang=en_US&cp=UTF-8&dlmethod=http
Double click the downloaded file to untar and unzip it.
Modify system parameters with this command:
sudo vi /etc/sysctl.conf
and populate with this information:
kern.sysv.shmmax=1073741824 kern.sysv.shmmin=1 kern.sysv.shmmni=4096 kern.sysv.shmseg=32 kern.sysv.shmall=1179648 kern.maxfilesperproc=65536 kern.maxfiles=65536
reboot computer # with great sadness I added that instruction.
Begin the install process with these commands:
cd ~/Downloads/expc ; sudo ./db2_install
Accept the default path of '/opt/IBM/db2/V10.1'
Wait about three minutes for the script to run.
Note that a successful run ends in 'The execution completed successfully.'
create db2inst1 user using mac gui (System Preferences -> Users & Groups). Use Standard (Non-Admin) privileges.
Create the instance with these commands:
cd /opt/IBM/db2/V10.1/instance ; sudo ./db2icrt -u db2inst1 db2inst1
Modify your profile with this command:
vim ~/.bash_profile
and add these lines (probably at the end of the file):
PATH=$PATH:/opt/IBM/db2/V10.1/bin
if [[ -f ~db2inst1/sqllib/db2profile ]]
then
source ~db2inst1/sqllib/db2profile
fiLog into new terminal window to get new settings from .bash_profile. Exit old windows to avoid confusion.
Initialize the sample database using this command:
db2sampl
Start the database using this command:
sudo -u db2inst1 db2start
Test the sample database using these commands:
db2 connect to SAMPLE
db2 list tables
If you need to connect to this database from a remote machine, or want to connect to this database using Java where the connection requires a host and port number, then follow the instructions to enable remove connections. You can defer running these instructions until you actually need to connect in this fashion. Without running these instructions you can connect using db2 command line, after running these instructions you will be able to connect with any number of tools that require a host and port number.
Steps to Enable Remote Connections:
Update db2 to allow remote services using these commands:
cd ~db2inst1
sudo -u db2inst1 db2 update dbm cfg using svcename db2c_db2inst1
The cd is necessary because the command needs to write to the current directory.
Add the service port using this command:
sudo vim /etc/services
and add this line as the last line in the file. The actual position is not important.
db2c_db2inst1 50000/tcp
Set that db2 should use tcp/ip using this command:
sudo -u db2inst1 db2set DB2COMM=TCPIP
Stop and start the database with these commands:
sudo -u db2inst1 db2stop force
sudo -u db2inst1 db2start
Note the
force
on the stop command. That will drop any existing connections. If you want to be kind to the users who are connected, do not use force and just keep retrying the command after asking the users to disconnect. I included the force in the default instructions because it is likely that anyone following these instructions is the only user on the database.
References:
- http://programmingzen.com/2009/01/20/installing-db2-on-mac-os-x/
- https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014927797
If you determine improvements to these instructions please post a comment. I will get notified and make the change.
这篇关于如何在OSX小牛上安装db2 Express-C 10.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!