rlwrap工具安装
要解决光标灵活使用的问题
- 光标想要左移,行不通。
rwlrap包下载地址:
[]: https://fossies.org/linux/privat/rlwrap-0.45.2.tar.gz/
安装软件所需要的依赖包,通过yum安装,配置本地yum源
[root@localhost dmdba]# yum install -y gcc*
[root@localhost dmdba]# yum install -y libtermcap-devel
[root@localhost dmdba]# yum install -y readline
[root@localhost dmdba]# yum install -y readline-devel
[root@localhost dmdba]# yum install -y make
设置环境变量,进行软件功能测试
[root@localhost rlwrap-0.37]# su - dmdba
上一次登录:四 3月 24 14:54:45 CST 2022pts/1 上
[dmdba@localhost ~]$ vi .bash_profile
# .bash_profile
添加如下内容:
alias disql='rlwrap disql'
alias dmrman='rlwrap dmrman'
[dmdba@localhost ~]$ source .bash_profile
12345678
安装步骤
ip 192.168.175.70
上传安装包rlwrap-0.43.tar.gz至/opt目录下,执行以下安装步骤
解压安装包
[root@test-70 /opt]# tar -zxvf rlwrap-0.43.tar.gz
[root@test-70 /opt]# mv rlwrap-0.43 /usr/local/rlwrap
[root@test-70 /opt]# cd /usr/local/rlwrap/
编译安装
执行./configure -q
[root@test-70 /usr/local/rlwrap]# ./configure -q
configure: error: in `/usr/local/rlwrap':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
-
需要安装gcc
[root@test-70 /usr/local/rlwrap]# yum -y install gcc 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn 。 。 。 。 ---> 软件包 cpp.x86_64.0.4.8.5-44.el7 将被 安装 ---> 软件包 glibc-devel.x86_64.0.2.17-325.el7_9 将被 安装 --> 正在处理依赖关系 glibc-headers = 2.17-325.el7_9,它被软件包 glibc-devel-2.17-325.el7_9.x86_64 需要 --> 正在处理依赖关系 glibc = 2.17-325.el7_9,它被软件包 glibc-devel-2.17-325.el7_9.x86_64 需要 --> 正在处理依赖关系 glibc-headers,它被软件包 glibc-devel-2.17-325.el7_9.x86_64 需要 ---> 软件包 libgcc.x86_64.0.4.8.5-36.el7 将被 升级 ---> 软件包 libgcc.x86_64.0.4.8.5-44.el7 将被 更新 。。。。。。。 。。。。。。。 已安装: gcc.x86_64 0:4.8.5-44.el7 作为依赖被安装: cpp.x86_64 0:4.8.5-44.el7 glibc-devel.x86_64 0:2.17-325.el7_9 glibc-headers.x86_64 0:2.17-325.el7_9 kernel-headers.x86_64 0:3.10.0-1160.62.1.el7 作为依赖被升级: glibc.x86_64 0:2.17-325.el7_9 glibc-common.x86_64 0:2.17-325.el7_9 libgcc.x86_64 0:4.8.5-44.el7 libgomp.x86_64 0:4.8.5-44.el7 完毕!
安装gcc后,重新执行./configure -q
[root@test-70 /usr/local/rlwrap]# ./configure -q configure: WARNING: No termcap nor curses library found configure: error: You need the GNU readline library(ftp://ftp.gnu.org/gnu/readline/ ) to build this program! [root@test-70 /usr/local/rlwrap]#
需要安装readline相关工具
[root@test-70 /usr/local/rlwrap]# yum install -y readline [root@test-70 /usr/local/rlwrap]# yum install -y readline-devel
重装运行./configure -q
[root@test-70 /usr/local/rlwrap]# ./configure -q
Will rlwrap find command's working directory under /proc/<commands pid>/cwd? let's see...
Now do:
make (or gmake) to build rlwrap
make check for instructions how to test it
make install to install it
执行make && make install
[root@test-70 /usr/local/rlwrap]# make && make install
make all-recursive
make[1]: 进入目录“/usr/local/rlwrap”
Making all in doc
make[2]: 进入目录“/usr/local/rlwrap/doc”
sed -e 's#@DATADIR@#/usr/local/share#' rlwrap.man > rlwrap.1
make[2]: 离开目录“/usr/local/rlwrap/doc”
Making all in src
make[2]: 进入目录“/usr/local/rlwrap/src”
gcc -DHAVE_CONFIG_H -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c
mv -f .deps/main.Tpo .deps/main.Po
gcc -DHAVE_CONFIG_H -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -MT signals.o -MD -MP -MF .deps/signals.Tpo -c -o signals.o signals.c
mv -f .deps/signals.Tpo .deps/signals.Po
gcc -DHAVE_CONFIG_H -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -MT readline.o -MD -MP -MF .deps/readline.Tpo -c -o readline.o readline.c
mv -f .deps/readline.Tpo .deps/readline.Po
gcc -DHAVE_CONFIG_H -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -MT pty.o -MD -MP -MF .deps/pty.Tpo -c -o pty.o pty.c
mv -f .deps/pty.Tpo .deps/pty.Po
gcc -DHAVE_CONFIG_H -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -MT completion.o -MD -MP -MF .deps/completion.Tpo -c -o completion.o completion.c
mv -f .deps/completion.Tpo .deps/completion.Po
gcc -DHAVE_CONFIG_H -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -MT term.o -MD -MP -MF .deps/term.Tpo -c -o term.o term.c
mv -f .deps/term.Tpo .deps/term.Po
gcc -DHAVE_CONFIG_H -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -MT ptytty.o -MD -MP -MF .deps/ptytty.Tpo -c -o ptytty.o ptytty.c
mv -f .deps/ptytty.Tpo .deps/ptytty.Po
gcc -DHAVE_CONFIG_H -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -MT utils.o -MD -MP -MF .deps/utils.Tpo -c -o utils.o utils.c
mv -f .deps/utils.Tpo .deps/utils.Po
gcc -DHAVE_CONFIG_H -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -MT string_utils.o -MD -MP -MF .deps/string_utils.Tpo -c -o string_utils.o string_utils.c
mv -f .deps/string_utils.Tpo .deps/string_utils.Po
gcc -DHAVE_CONFIG_H -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -MT malloc_debug.o -MD -MP -MF .deps/malloc_debug.Tpo -c -o malloc_debug.o malloc_debug.c
mv -f .deps/malloc_debug.Tpo .deps/malloc_debug.Po
gcc -DHAVE_CONFIG_H -I. -I.. -DDATADIR=\"/usr/local/share\" -g -O2 -MT filter.o -MD -MP -MF .deps/filter.Tpo -c -o filter.o filter.c
mv -f .deps/filter.Tpo .deps/filter.Po
gcc -DDATADIR=\"/usr/local/share\" -g -O2 -o rlwrap main.o signals.o readline.o pty.o completion.o term.o ptytty.o utils.o string_utils.o malloc_debug.o filter.o -lutil -lreadline -ltinfo
make[2]: 离开目录“/usr/local/rlwrap/src”
Making all in filters
make[2]: 进入目录“/usr/local/rlwrap/filters”
make[2]: 对“all”无需做任何事。
make[2]: 离开目录“/usr/local/rlwrap/filters”
make[2]: 进入目录“/usr/local/rlwrap”
make[2]: 离开目录“/usr/local/rlwrap”
make[1]: 离开目录“/usr/local/rlwrap”
Making install in doc
make[1]: 进入目录“/usr/local/rlwrap/doc”
make[2]: 进入目录“/usr/local/rlwrap/doc”
make[2]: 对“install-exec-am”无需做任何事。
/usr/bin/mkdir -p '/usr/local/share/man/man1'
/usr/bin/install -c -m 644 rlwrap.1 '/usr/local/share/man/man1'
make[2]: 离开目录“/usr/local/rlwrap/doc”
make[1]: 离开目录“/usr/local/rlwrap/doc”
Making install in src
make[1]: 进入目录“/usr/local/rlwrap/src”
make[2]: 进入目录“/usr/local/rlwrap/src”
/usr/bin/mkdir -p '/usr/local/bin'
/usr/bin/install -c rlwrap '/usr/local/bin'
make[2]: 对“install-data-am”无需做任何事。
make[2]: 离开目录“/usr/local/rlwrap/src”
make[1]: 离开目录“/usr/local/rlwrap/src”
Making install in filters
make[1]: 进入目录“/usr/local/rlwrap/filters”
make[2]: 进入目录“/usr/local/rlwrap/filters”
make[2]: 对“install-exec-am”无需做任何事。
/usr/bin/mkdir -p '/usr/local/share/man/man3'
/usr/bin/install -c -m 644 RlwrapFilter.3pm '/usr/local/share/man/man3'
make[2]: 离开目录“/usr/local/rlwrap/filters”
make[1]: 离开目录“/usr/local/rlwrap/filters”
make[1]: 进入目录“/usr/local/rlwrap”
make[2]: 进入目录“/usr/local/rlwrap”
make[2]: 对“install-exec-am”无需做任何事。
/usr/bin/mkdir -p '/usr/local/share/rlwrap'
/usr/bin/mkdir -p '/usr/local/share/rlwrap/filters'
/usr/bin/install -c -m 644 filters/README filters/RlwrapFilter.pm filters/RlwrapFilter.3pm filters/count_in_prompt filters/pipeto filters/logger filters/null filters/unbackspace filters/pipeline filters/ftp_filter filters/handle_hotkeys filters/history_format filters/simple_macro filters/template filters/scrub_prompt filters/paint_prompt filters/censor_passwords filters/listing filters/paint_prompt.py filters/handle_hotkeys.py filters/logger.py filters/pipeto.py filters/rlwrapfilter.py filters/null.py filters/censor_passwords.py filters/count_in_prompt.py filters/ftp_filter.py '/usr/local/share/rlwrap/filters'
/usr/bin/mkdir -p '/usr/local/share/rlwrap/completions'
/usr/bin/install -c -m 644 completions/testclient completions/coqtop '/usr/local/share/rlwrap/completions'
make install-data-hook
make[3]: 进入目录“/usr/local/rlwrap”
chmod a+x /usr/local/share/rlwrap/filters/*
make[3]: 离开目录“/usr/local/rlwrap”
make[2]: 离开目录“/usr/local/rlwrap”
make[1]: 离开目录“/usr/local/rlwrap”
切换至dmdba用户添加环境变量,与别名
[dmdba@test-70 ~]$ cat .bashrc | grep disql
alias disql='rlwrap disql SYSDBA/SYSDBA'
[dmdba@test-70 ~]$ . .bashrc
[dmdba@test-70 ~]$ disql
服务器[LOCALHOST:5236]:处于主库打开状态
登录使用时间 : 182.901(ms)
disql V8
SQL> select * from v$instance;
行号 NAME INSTANCE_NAME INSTANCE_NUMBER HOST_NAME SVR_VERSION
---------- --------- ------------- --------------- --------- --------------------------
DB_VERSION START_TIME STATUS$ MODE$ OGUID DSC_SEQNO DSC_ROLE
------------------- ------------------- ------- ------- ----------- ----------- --------
1 DMSERVER2 DMSERVER2 1 test-71 DM Database Server x64 V8
DB Version: 0x7000c 2022-04-21 15:38:35 OPEN PRIMARY 453331 0 NULL
已用时间: 203.261(毫秒). 执行号:500.
SQL>