yum install 安装失败

[b]问题1[/b]:今天运行oracle11g enabler的sh脚本时, 遇到error说can't run .../*.sh, 可经过check, 这些sh脚本明明已经被解压到指定path下了, 执行脚本的user和group也都实现创建好了, 没有问题。于是手动去运行一个sh试试, 终于发现了问题, 报错如下:

[b][oracle11g@sf-redhat-64-4 bin]$ ./startup.sh
bash: ./startup.sh: /bin/sh^M: bad interpreter: No such file or directory[/b]

原来是enabler是在windows上从git clone下来, 然后运行maven做成的zip, 结果在windows上用notepad打开过, 文本被转换成了windows格式。具体原因如下:

DOS-based text files use a pair of carriage return (CR) and line feed (LF) as a new-line delimiter. On the other hand, UNIX-based text files simply use LFs to terminate each line. In order to convert a text file from DOS format to UNIX format, you can use a command-line tool called dos2unix.

[b]解决办法[/b]:可以去去[url]http://pkgs.org/centos-6-rhel-6/centos-rhel-x86_64/dos2unix-3.1-37.el6.x86_64.rpm.html[/url]上下载dos2unix, 运行dos2unix [FILES], 重新转换即可.

有时候在windows下编写的python脚本在linux下也不能运行,也是因为^M的原因,因为windows下行结束符是/r/n,而linux只需要/n. 我们可以使用cat –v来显示一个文本文件中的^M符号,或者如果有非improved的vi版本的话(注意是非improved版本, 否则也显示不出来),也可以直接vi查看。

除了以上用dos2unix工具, 还有个简单的办法替换掉文本中的^M,通常这类文件在vi或vim中下面都会显示dos模式,那么我们直接设置为unix模式就会自动清楚了。方法是:

1. :set fileformat=unix
2. 保存退出


[b]问题2[/b]: 下了一个dos2unix的rpm安装包, 可安装时说没有public key

# yum install dos2unix-3.1-37.el6.x86_64.rpm Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Examining dos2unix-3.1-37.el6.x86_64.rpm: dos2unix-3.1-37.el6.x86_64
Marking dos2unix-3.1-37.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package dos2unix.x86_64 0:3.1-37.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
dos2unix x86_64 3.1-37.el6 /dos2unix-3.1-37.el6.x86_64 18 k

Transaction Summary
================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total size: 18 k
Installed size: 18 k
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY


Public key for dos2unix-3.1-37.el6.x86_64.rpm is not installed


[b]解决办法[/b]:加上忽略参数[b]--nogpgcheck[/b]

# yum install dos2unix-3.1-37.el6.x86_64.rpm [b]--nogpgcheck[/b]
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Examining dos2unix-3.1-37.el6.x86_64.rpm: dos2unix-3.1-37.el6.x86_64
Marking dos2unix-3.1-37.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package dos2unix.x86_64 0:3.1-37.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
dos2unix x86_64 3.1-37.el6 /dos2unix-3.1-37.el6.x86_64 18 k

Transaction Summary
================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total size: 18 k
Installed size: 18 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : dos2unix-3.1-37.el6.x86_64 1/1

Installed:
dos2unix.x86_64 0:3.1-37.el6

Complete!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值