linux使用tcpkill 杀掉不释放的连接

当遇到TCP链接迟迟不能释放的情况,类似FIN_WAIT1、FIN_WAIT2的状态,释放时间不确定,而且对应的程序已经关闭,相应的端口也不再监听,无法通过杀进程来解决,这种情况下,为了快速恢复正常,不得不采用重启服务器的方法加以解决,Linux下可以借助dsniff包中含有tcpkill命令,该命令可以将上述状态的TCP链接加以清除

http://mirrors.zju.edu.cn/epel/6/x86_64/dsniff-2.4-0.17.b1.el6.x86_64.rpm

wget -S http://mirrors.zju.edu.cn/epel/6/x86_64/dsniff-2.4-0.17.b1.el6.x86_64.rpm

http://mirrors.zju.edu.cn/epel/6/x86_64/libnet-1.1.6-7.el6.x86_64.rpm

http://mirrors.zju.edu.cn/epel/6/x86_64/libnids-1.24-1.el6.x86_64.rpm

注意:OS环境中缺少的依赖包不一定只有libnet和libnids,根据实际情况可以去http://mirrors.zju.edu.cn/epel/6/x86_64/ 上找对应的包安装即可
 
也可以使用yum安装相关包:

yum search libp libICE libSM libXmu

[[email protected] app]# rpm -qpilf dsniff-2.4-0.17.b1.el6.x86_64.rpm
warning: dsniff-2.4-0.17.b1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Name        : dsniff                       Relocations: (not relocatable)
Version     : 2.4                               Vendor: Fedora Project
Release     : 0.17.b1.el6                   Build Date: 2013年12月21日 星期六 06时09分53秒
Install Date: (not installed)               Build Host: buildvm-25.phx2.fedoraproject.org
Group       : Applications/Internet         Source RPM: dsniff-2.4-0.17.b1.el6.src.rpm
Size        : 312776                           License: BSD
Signature   : RSA/8, 2013年12月22日 星期日 00时12分31秒, Key ID 3b49df2a0608b895
Packager    : Fedora Project
URL         : http://www.monkey.org/~dugsong/dsniff/
Summary     : Tools for network auditing and penetration testing
Description :
A collection of tools for network auditing and penetration testing. Dsniff,
filesnarf, mailsnarf, msgsnarf, urlsnarf and webspy allow to passively monitor
a network for interesting data (passwords, e-mail, files). Arpspoof, dnsspoof
and macof facilitate the interception of network traffic normally unavailable
to an attacker (e.g, due to layer-2 switching). Sshmitm and webmitm implement
active monkey-in-the-middle attacks against redirected SSH and HTTPS sessions
by exploiting weak bindings in ad-hoc PKI.
/etc/dsniff
/etc/dsniff/dnsspoof.hosts
/etc/dsniff/dsniff.magic
/etc/dsniff/dsniff.services
/usr/sbin/arpspoof
/usr/sbin/dnsspoof
/usr/sbin/dsniff
/usr/sbin/filesnarf
/usr/sbin/macof
/usr/sbin/mailsnarf
/usr/sbin/msgsnarf
/usr/sbin/sshmitm
/usr/sbin/sshow
/usr/sbin/tcpkill
/usr/sbin/tcpnice
/usr/sbin/urlsnarf
/usr/sbin/webmitm
/usr/sbin/webspy
/usr/share/doc/dsniff-2.4
/usr/share/doc/dsniff-2.4/CHANGES
/usr/share/doc/dsniff-2.4/LICENSE
/usr/share/doc/dsniff-2.4/README
/usr/share/doc/dsniff-2.4/TODO
/usr/share/man/man8/arpspoof.8.gz
/usr/share/man/man8/dnsspoof.8.gz
/usr/share/man/man8/dsniff.8.gz
/usr/share/man/man8/filesnarf.8.gz
/usr/share/man/man8/macof.8.gz
/usr/share/man/man8/mailsnarf.8.gz
/usr/share/man/man8/msgsnarf.8.gz
/usr/share/man/man8/sshmitm.8.gz
/usr/share/man/man8/sshow.8.gz
/usr/share/man/man8/tcpkill.8.gz
/usr/share/man/man8/tcpnice.8.gz
/usr/share/man/man8/urlsnarf.8.gz
/usr/share/man/man8/webmitm.8.gz
/usr/share/man/man8/webspy.8.gz
[[email protected] app]#

[[email protected] app]# cat /etc/redhat-release
CentOS release 6.6 (Final)
[[email protected] app]#

[[email protected] app]# rpm -ivh dsniff-2.4-0.17.b1.el6.x86_64.rpm
warning: dsniff-2.4-0.17.b1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
error: Failed dependencies:
        libICE.so.6()(64bit) is needed by dsniff-2.4-0.17.b1.el6.x86_64
        libSM.so.6()(64bit) is needed by dsniff-2.4-0.17.b1.el6.x86_64
        libXmu.so.6()(64bit) is needed by dsniff-2.4-0.17.b1.el6.x86_64
        libnet.so.1()(64bit) is needed by dsniff-2.4-0.17.b1.el6.x86_64
        libnids.so.1.24()(64bit) is needed by dsniff-2.4-0.17.b1.el6.x86_64
        libpcap.so.1()(64bit) is needed by dsniff-2.4-0.17.b1.el6.x86_64
[[email protected] app]#

[[email protected] app]# rpm -qpilf libnet-1.1.6-7.el6.x86_64.rpm
warning: libnet-1.1.6-7.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Name        : libnet                       Relocations: (not relocatable)
Version     : 1.1.6                             Vendor: Fedora Project
Release     : 7.el6                         Build Date: 2013年12月21日 星期六 07时21分45秒
Install Date: (not installed)               Build Host: buildvm-05.phx2.fedoraproject.org
Group       : System Environment/Libraries   Source RPM: libnet-1.1.6-7.el6.src.rpm
Size        : 144734                           License: BSD
Signature   : RSA/8, 2013年12月22日 星期日 00时12分25秒, Key ID 3b49df2a0608b895
Packager    : Fedora Project
URL         : http://www.sourceforge.net/projects/libnet-dev/
Summary     : C library for portable packet creation and injection
Description :
Libnet is an API to help with the construction and handling of network
packets. It provides a portable framework for low-level network packet
writing and handling (use libnet in conjunction with libpcap and you can
write some really cool stuff). Libnet includes packet creation at the IP
layer and at the link layer as well as a host of supplementary and
complementary functionality.
/lib64/libnet.so.1
/lib64/libnet.so.1.7.0
/usr/share/doc/libnet-1.1.6
/usr/share/doc/libnet-1.1.6/CHANGELOG
/usr/share/doc/libnet-1.1.6/CONTRIB
/usr/share/doc/libnet-1.1.6/COPYING
/usr/share/doc/libnet-1.1.6/README
[[email protected] app]#
[[email protected] app]# rpm -qpilf libnids-1.24-1.el6.x86_64.rpm
warning: libnids-1.24-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Name        : libnids                      Relocations: (not relocatable)
Version     : 1.24                              Vendor: Fedora Project
Release     : 1.el6                         Build Date: 2010年05月20日 星期四 04时53分15秒
Install Date: (not installed)               Build Host: x86-04.phx2.fedoraproject.org
Group       : System Environment/Libraries   Source RPM: libnids-1.24-1.el6.src.rpm
Size        : 74467                            License: GPLv2+
Signature   : RSA/8, 2010年05月20日 星期四 19时34分42秒, Key ID 3b49df2a0608b895
Packager    : Fedora Project
URL         : http://libnids.sourceforge.net/
Summary     : Implementation of an E-component of Network Intrusion Detection System
Description :
Libnids is an implementation of an E-component of Network Intrusion
Detection System. It emulates the IP stack of Linux 2.x and offers
IP defragmentation, TCP stream assembly and TCP port scan detection.

Using libnids, one has got a convenient access to data carried by a
TCP stream, no matter how artfully obscured by an attacker.
/usr/lib64/libnids.so.1.24
/usr/share/doc/libnids-1.24
/usr/share/doc/libnids-1.24/CHANGES
/usr/share/doc/libnids-1.24/COPYING
/usr/share/doc/libnids-1.24/CREDITS
/usr/share/doc/libnids-1.24/MISC
/usr/share/doc/libnids-1.24/README
[[email protected] app]#

[[email protected] app]# rpm -ivh libnet-1.1.6-7.el6.x86_64.rpm
warning: libnet-1.1.6-7.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:libnet                 ########################################### [100%]
[[email protected] app]# rpm -ivh libnids-1.24-1.el6.x86_64.rpm
warning: libnids-1.24-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
error: Failed dependencies:
        libpcap.so.1()(64bit) is needed by libnids-1.24-1.el6.x86_64
[[email protected] app]#

[[email protected] app]# yum install libpcap.x86_64 libICE.x86_64 libSM.x86_64 libXmu.x86_64
已加载插件:fastestmirror
设置安装进程
Loading mirror speeds from cached hostfile
解决依赖关系
--> 执行事务检查
---> Package libICE.x86_64 0:1.0.6-1.el6 will be 安装
---> Package libSM.x86_64 0:1.2.1-2.el6 will be 安装
---> Package libXmu.x86_64 0:1.1.1-2.el6 will be 安装
--> 处理依赖关系 libXt.so.6()(64bit),它被软件包 libXmu-1.1.1-2.el6.x86_64 需要
--> 处理依赖关系 libXext.so.6()(64bit),它被软件包 libXmu-1.1.1-2.el6.x86_64 需要
---> Package libpcap.x86_64 14:1.4.0-1.20130826git2dbcaa1.el6 will be 安装
--> 执行事务检查
---> Package libXext.x86_64 0:1.3.2-2.1.el6 will be 安装
---> Package libXt.x86_64 0:1.1.4-6.1.el6 will be 安装
--> 完成依赖关系计算

依赖关系解决

=============================================================================================================================================================================================================================================
 软件包                                             架构                                              版本                                                                          仓库                                                大小
=============================================================================================================================================================================================================================================
正在安装:
 libICE                                             x86_64                                            1.0.6-1.el6                                                                   gomeo2o                                             53 k
 libSM                                              x86_64                                            1.2.1-2.el6                                                                   gomeo2o                                             37 k
 libXmu                                             x86_64                                            1.1.1-2.el6                                                                   gomeo2o                                             66 k
 libpcap                                            x86_64                                            14:1.4.0-1.20130826git2dbcaa1.el6                                             gomeo2o                                            130 k
为依赖而安装:
 libXext                                            x86_64                                            1.3.2-2.1.el6                                                                 gomeo2o                                             35 k
 libXt                                              x86_64                                            1.1.4-6.1.el6                                                                 gomeo2o                                            165 k

事务概要
=============================================================================================================================================================================================================================================
Install       6 Package(s)

总下载量:485 k
Installed size: 1.1 M
确定吗?[y/N]:y
下载软件包:
(1/6): libICE-1.0.6-1.el6.x86_64.rpm                                                                                                                                                                                  |  53 kB     00:00     
(2/6): libSM-1.2.1-2.el6.x86_64.rpm                                                                                                                                                                                   |  37 kB     00:00     
(3/6): libXext-1.3.2-2.1.el6.x86_64.rpm                                                                                                                                                                               |  35 kB     00:00     
(4/6): libXmu-1.1.1-2.el6.x86_64.rpm                                                                                                                                                                                  |  66 kB     00:00     
(5/6): libXt-1.1.4-6.1.el6.x86_64.rpm                                                                                                                                                                                 | 165 kB     00:00     
(6/6): libpcap-1.4.0-1.20130826git2dbcaa1.el6.x86_64.rpm                                                                                                                                                              | 130 kB     00:00     
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                                                                         4.4 MB/s | 485 kB     00:00     
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
Warning: RPMDB altered outside of yum.
  正在安装   : libICE-1.0.6-1.el6.x86_64                                                                                                                                                                                                 1/6
  正在安装   : libSM-1.2.1-2.el6.x86_64                                                                                                                                                                                                  2/6
  正在安装   : libXt-1.1.4-6.1.el6.x86_64                                                                                                                                                                                                3/6
  正在安装   : libXext-1.3.2-2.1.el6.x86_64                                                                                                                                                                                              4/6
  正在安装   : libXmu-1.1.1-2.el6.x86_64                                                                                                                                                                                                 5/6
  正在安装   : 14:libpcap-1.4.0-1.20130826git2dbcaa1.el6.x86_64                                                                                                                                                                          6/6
  Verifying  : libXext-1.3.2-2.1.el6.x86_64                                                                                                                                                                                              1/6
  Verifying  : libXt-1.1.4-6.1.el6.x86_64                                                                                                                                                                                                2/6
  Verifying  : 14:libpcap-1.4.0-1.20130826git2dbcaa1.el6.x86_64                                                                                                                                                                          3/6
  Verifying  : libICE-1.0.6-1.el6.x86_64                                                                                                                                                                                                 4/6
  Verifying  : libSM-1.2.1-2.el6.x86_64                                                                                                                                                                                                  5/6
  Verifying  : libXmu-1.1.1-2.el6.x86_64                                                                                                                                                                                                 6/6

已安装:
  libICE.x86_64 0:1.0.6-1.el6                           libSM.x86_64 0:1.2.1-2.el6                           libXmu.x86_64 0:1.1.1-2.el6                           libpcap.x86_64 14:1.4.0-1.20130826git2dbcaa1.el6

作为依赖被安装:
  libXext.x86_64 0:1.3.2-2.1.el6                                                                                         libXt.x86_64 0:1.1.4-6.1.el6

完毕!
[[email protected] app]#

[[email protected] app]# rpm -ivh libnids-1.24-1.el6.x86_64.rpm
warning: libnids-1.24-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:libnids                ########################################### [100%]
[[email protected] app]#

[[email protected] app]# rpm -ivh dsniff-2.4-0.17.b1.el6.x86_64.rpm
warning: dsniff-2.4-0.17.b1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:dsniff                 ########################################### [100%]
[[email protected] app]#

服务端:

[[email protected] app]# python socketserver.py
get value  1
send welcome
get value  2
send refuse
get value  1
send welcome
^CTraceback (most recent call last):
  File "socketserver.py", line 12, in <module>
    buf = connection.recv(2048)
KeyboardInterrupt
[[email protected] app]# python socketserver.py
Traceback (most recent call last):
  File "socketserver.py", line 6, in <module>
    sock.bind((‘0.0.0.0‘,9999))
  File "<string>", line 1, in bind
socket.error: [Errno 98] Address already in use
[[email protected] app]#
[[email protected] app]# python socketserver.py

客户端:
[[email protected] app]# python socketclient.py
sock <socket._socketobject object at 0x7f620ae1fc90>
send to server with value: 1
sock.recv welcome to server !!!
sock <socket._socketobject object at 0x7f620ae1fd00>
send to server with value: 2
sock.recv please go away
sock <socket._socketobject object at 0x7f620ae1fc90>
send to server with value: 1
sock.recv welcome to server !!!
sock <socket._socketobject object at 0x7f620ae1fd00>
send to server with value: 2
sock.recv
[Errno 111] Connection refused
Failed to create socket. Error code: 111 , Error message : Connection refused
Traceback (most recent call last):
  File "socketclient.py", line 17, in <module>
    raise Exception(‘SOCKET ERROR:‘ + str(e))  
Exception: SOCKET ERROR:[Errno 111] Connection refused
[[email protected] app]#

连接监控记录:

当服务端被我强制关闭后连接变成了CLOSE_WAIT状态 立即启动服务端报:socket.error: [Errno 98] Address already in use
(不过我这里连接释放比较快没有使用到tcpkill)

[[email protected] app]# while true;do netstat  -alnpt|grep python|grep 9999;sleep 1;echo --------------------;done
tcp        0      0 0.0.0.0:9999                0.0.0.0:*                   LISTEN      15897/python        
--------------------
tcp        0      0 0.0.0.0:9999                0.0.0.0:*                   LISTEN      15897/python        
--------------------
tcp        0      0 0.0.0.0:9999                0.0.0.0:*                   LISTEN      15897/python        
--------------------
tcp        0      0 0.0.0.0:9999                0.0.0.0:*                   LISTEN      15897/python        
--------------------
tcp        0      0 0.0.0.0:9999                0.0.0.0:*                   LISTEN      15897/python        
--------------------
tcp        0      0 0.0.0.0:9999                0.0.0.0:*                   LISTEN      15897/python        
tcp        0      0 10.144.5.223:9999           10.144.5.223:37096          ESTABLISHED 15897/python        
tcp        0      0 10.144.5.223:37096          10.144.5.223:9999           ESTABLISHED 15922/python        
--------------------
tcp        0      0 0.0.0.0:9999                0.0.0.0:*                   LISTEN      15897/python        
tcp        0      0 10.144.5.223:9999           10.144.5.223:37096          ESTABLISHED 15897/python        
tcp        0      0 10.144.5.223:37096          10.144.5.223:9999           ESTABLISHED 15922/python        
--------------------
tcp        0      0 0.0.0.0:9999                0.0.0.0:*                   LISTEN      15897/python        
tcp        0      0 10.144.5.223:37097          10.144.5.223:9999           ESTABLISHED 15922/python        
tcp        0      0 10.144.5.223:9999           10.144.5.223:37097          ESTABLISHED 15897/python        
--------------------
tcp        0      0 0.0.0.0:9999                0.0.0.0:*                   LISTEN      15897/python        
tcp        0      0 10.144.5.223:37097          10.144.5.223:9999           ESTABLISHED 15922/python        
tcp        0      0 10.144.5.223:9999           10.144.5.223:37097          ESTABLISHED 15897/python        
--------------------
tcp        0      0 0.0.0.0:9999                0.0.0.0:*                   LISTEN      15897/python        
tcp        0      0 10.144.5.223:9999           10.144.5.223:37098          ESTABLISHED 15897/python        
tcp        0      0 10.144.5.223:37098          10.144.5.223:9999           ESTABLISHED 15922/python        
--------------------
tcp        0      0 0.0.0.0:9999                0.0.0.0:*                   LISTEN      15897/python        
tcp        0      0 10.144.5.223:9999           10.144.5.223:37098          ESTABLISHED 15897/python        
tcp        0      0 10.144.5.223:37098          10.144.5.223:9999           ESTABLISHED 15922/python        
--------------------
tcp        1      0 10.144.5.223:37099          10.144.5.223:9999           CLOSE_WAIT  15922/python        
--------------------
tcp        1      0 10.144.5.223:37099          10.144.5.223:9999           CLOSE_WAIT  15922/python        
--------------------
--------------------
tcp        0      0 0.0.0.0:9999                0.0.0.0:*                   LISTEN      15976/python        
--------------------
tcp        0      0 0.0.0.0:9999                0.0.0.0:*                   LISTEN      15976/python        
^C
[[email protected] app]#

时间: 2024-08-25 11:12:35

linux使用tcpkill 杀掉不释放的连接的相关文章

Windows和linux虚拟机之间联网实现SSH远程连接以及VMware的3种网络模式[NAT、桥接和Host-only]

Windows和linux虚拟机之间联网实现SSH远程连接以及VMware的3种网络模式[NAT.桥接和Host-only] 作者:天齐 一.Windows和linux虚拟机之间联网实现SSH远程连接 假如我们要给主机名为mini1的虚拟机配置ip地址,需要以下几个步骤: 在linux上查看ip地址,如果linux服务器有ip地址,让它的ip地址和windows的ip地址在同一个网段,它们之间才能联网.在linux上查看ip地址的命令为"ifconfig": 发现eth0网卡没有配置i

Linux下adb驱动问题Linux下使用手机USB调试模式连接ADB进行Android程序的调试

Linux 下adb 驱动问题 Linux下使用手机USB调试模式连接ADB进行Android程序的调试,配置驱动没有Windows来的直观. 具体步骤首先确认手机连接上电脑,lsusb查看下设备记录. [email protected]:~$ lsusb Bus 007 Device 009: ID 18d1:4e12 Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 006 Device 001: ID 1d

Linux系统下如何配置SSH_Centos7 ssh连接配置 CentOS7下安全配置

转自:http://www.linuxdown.net/install/config/2016/0611/5853.html Linux系统下如何配置SSH_Centos7 ssh连接配置 CentOS7下安全配置SSH 时间:2016-06-11 11:13来源:未知 作者:Linux先生 举报 点击:1804次 SSH 通常是我们进入新伺服器的第一个应用程式,它也取代了telnet 和rsh 成为管理伺服器的最主要介面. SSH 通常是我们进入新伺服器的第一个应用程式,它也取代了telnet

安装Linux教程和使用putty进行远程连接

安装Linux教程和使用putty进行远程连接 使用VMwareWorkstationPro创建新的虚拟机,如图所示:点击"创建新的虚拟机"进入到如下界面,选择自定义即可: 直接点击下一步即可:之后会进入到如下界面(可以直接选择安装程序光盘映像文件,这里是稍后安装,先用虚拟机创建一个空白硬盘): 因为这里是安装Linux系统,所以选择Linux(L)版本选择Red Hat Linux 6,因为这是面向企业用户的Linux操作系统接下来创建虚拟机名称(名字自定义即可)接下来设置处理器配置

linux下如何杀掉进程

1.linux下如何杀掉进程: 1)找到包名所占用的端口: ps aux | grep cbs_portal-1.0.1.jar(包名) 2)杀掉进程: kill 10942(端口号) PS: --color=auto 表示默认显示匹配到的字符串.也可以设置其他颜色,没有这个参数当然是默认的颜色了.(不用删除) ps -aux 显示所有包含其他使用者的行程 如图: 原文地址:https://www.cnblogs.com/wendyw/p/11458417.html

Linux 文件删除空间没有释放问题

最近阿里云频频告警.磁盘使用率飙升90%以上.遂查看磁盘使用情况 df -h 发现使用率却是很高 之后,通过du -h --max-depth=1 / 查看哪个目录下占用的资源较多并进行删除 后来发现: 未释放磁盘空间原因: 在Linux或者Unix系统中,通过rm或者文件管理器删除文件将会从文件系统的文件夹结构上解除链接(unlink).然而假设文件是被 打开的(有一个进程正在使用),那么进程将仍然能够读取该文件,磁盘空间也一直被占用. 查看已经被删除,但是还在占用资源的文件列表: [[ema

Linux内存机制以及手动释放swap和内存

哇,感觉好久没更新了,今天我们来谈谈Linux的内存机制. 首先我们理一下概念 一.什么是linux的内存机制? 我们知道,直接从物理内存读写数据要比从硬盘读写数据要快的多,因此,我们希望所有数据的读取和写入都在内存完成,而内存是有限的,这样就引出了物理内存与虚拟内存的概念. 物理内存就是系统硬件提供的内存大小,是真正的内存,相对于物理内存,在linux下还有一个虚拟内存的概念,虚拟内存就是为了满足物理内存的不足而提出的策略,它是利用磁盘空间虚拟出的一块逻辑内存,用作虚拟内存的磁盘空间被称为交换

linux内存管理及手动释放机制

inux系统中查看内存状态一般都会用到free linux的free命令中,cached和buffers的区别 Free Mem:表示物理内存统计 -/+ buffers/cached:表示物理内存的缓存统计 Swap:表示硬盘上交换分区的使用情况 系统的总物理内存:8098060 8Gb,但系统当前真正可用的内存并不是第一行free 标记的6054972Kb,它仅代表未被分配的内存. 我们使用total1.used1.free1.used2.free2 等名称来代表上面统计数据的各值,1.2

Linux 下建立 Git 与 GitHub 的连接

Git 是一款开源的分布式版本控制系统,而 GitHub 是依托 Git 的代码托管平台. GitHub 利用 Git 极其强大的克隆和分支功能,使得社区成员能够自由地参与到开源项目中去. 不过,在开始学习之前,你需要一个 GitHub 账号,以及一台能联网的 Linux 虚拟机. =================准备工作================== 一.安装 Git * 如果你已经安装好了 Git,可以忽略这一步 Ubuntu 安装 Git:  apt-get install git