安装netcat(-bash: netcat: command not found)

安装netcat

在用swoole UDP服务器可以使用netcat -u 来连接测试时,报错-bash: netcat: command not found,是因为centos7未安装netcat。

1、下载安装

下载页面:https://sourceforge.net/projects/netcat/files/netcat/0.7.1/

wget https://ncu.dl.sourceforge.net/project/netcat/netcat/0.7.1/netcat-0.7.1.tar.gz (这步可能下载不了,建议用上面网址下载)
tar -zxvf netcat-0.7.1.tar.gz
cd ./netcat-0.7.1/
./configure --prefix=/opt/netcat
make && make install

2、配置

vi /etc/profile

在文件中添加
NETCAT_HOME=/opt/netcat
PATH=$PATH:$NETCAT_HOME/bin
export PATH

再执行
source /etc/profile

这时候,netcat -help,若出现相关命令参数提示,则说明安装成功

 
参考:https://my.oschina.net/benergy/blog/1807176

猜你喜欢

转载自www.cnblogs.com/clubs/p/10633623.html