Apache2的安装

  Apache2的安装

  1.执行:sudo apt-get install apache2。

  2.sudo vim /etc/apache2/apache2.conf在最后加上:ServerName localhost。

  3.sudo /etc/init.d/apache2 start启动apache服务。

  4.启动浏览器,并输入http://localhost即可看到安装成功界面。

  5.停止:sudo /etc/init.d/apache2 stop

  Apache2实现文件的下载:

  1.vim /etc/apache2/sites-available/000-default.conf,增加如下配置

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        <Directory /var/www>
                options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
       </Directory>

       ServerName localhost:80

  2.在/var/www/html下删除index.html,然后新建要下载的text.txt文件

  3.修改目录权限:sudo chmod 775 /var/www

  4.启动apache2:/etc/init.d/apache2 start

  5.打开本机浏览器,输入http://localhost,查看是存在text.txt文件

  6.记录apache2所在的机器的Ip地址为192.168.131.138,在同一局域网的另一台电脑cd /tmp/,然后执行wget http://192.168.131.138/text.txt

  使用tcpdump抓取记录并存入文件

  1.在/var/www/html下使用命令生成指定大小的文件:dd if=/dev/urandom of=/var/www/html/filename bs=1M count=1

  2.启动apache2服务器

  

  

  

  

  TcpDump的安装:

  1.http://www.tcpdump.org/下载tcpdump和libpcap压缩包并解压。

  2.安装c编译所需包:apt-get install build-essential

  3.安装libcap的前置包:apt-get install flex,apt-get install bison

  4.安装libcap:进入解压目录,

./configure
make
make install

  5.安装tcpdump:进入解压目录

./configure
make
make install

  6.测试是否安装成功,直接在命令行输入tcpdump

原文地址:https://www.cnblogs.com/BigJunOba/p/9703802.html