yinian 发表于 2018-11-17 11:39:42

手工编译安装apache-tianlm的博客

  一、实验环境
  在Linux系统中安装apache并测试
  二、操作脚本
  1.光盘挂载
  cd /mnt
  ls
  mount /dev/sr0 /mnt
  2.建立yum仓库
  cd /etc/yum.repos.d
  vim aaa.repo
  ---
  ---name=test
  ---baseurl=file:///mnt
  ---enabled=1
  ---gpgcheck=0
  ls
  rm -rf
  yum list
  3.文件共享挂载
  smbclient -L //192.168.119.2/
  mkdir /bbb
  mount.cifs //192.168.119.2/john /bbb
  4.压缩包的解压缩
  cd /bbb
  ls
  tar xzvf httpd-2.4.2.tar.gz -C /opt
  tar xzvf apr-1.4.6.tar.gz -C /opt
  tar xzvf apr-util-1.4.1.tar.gz -C /opt
  5.递归复制
  cd /opt
  cp -Rapr-1.4.6 /opt/httpd-2.4.2/srclib/apr
  cp -Rapr-util-1.4.1 /opt/httpd-2.4.2/srclib/apr-util
  6.安装环境包
  yum install gcc gcc-c++ make pcre-devel -y
  7.执行手工编译安装配置
  cd /opt/httpd-2.4.2
  ./configure \   --prefix=/usr/local/apache \ \
  --enable-so \ \
  --enable-rewrite \ \
  --enable-mods-shared=most \ \
  --with-mpm=worker \ \
  --disable-cgid \ \
  --disable-cgi
  make
  make install
  8.启用手工编译安装脚本文件
  grep -v "#" /usr/local/apache/bin/apachectl > /etc/init.d/httpd
  vim /etc/init.d/httpd
  > #!/bin/sh
  > > ##### # chkconfig:2345 85 15
  > > ##### # description:Apache is a World Wide Web server.
  9.增加 /etc/init.d/httpd 的执行权限
  chmod +x /etc/init.d/httpd
  10.添加httpd服务并开启
  chkconfig --add httpd
  chkconfig --list httpd
  chkconfig --level 35 httpd on
  11.建立软连接便于管理
  ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf
  12.进入/etc/httpd.conf配置文件编辑
  vim /etc/httpd.conf
  > Listen 192.168.119.101:80
  > ######Listen 80
  > ServerName www.benet.com:80
  13.开启httpd服务
  service httpd start
  14.关闭防火墙和增强性安全功能
  service iptables stop
  setenforce 0
  15.查看主页存放内容
  vim /usr/local/apache/htdocs/index.html
  16.用360浏览器访问虚拟机(Linux)
  http://192.168.119.101
  三、实验步骤示图

















  四、实验结果
  结果表明:手工编译安装apache成功,如下图


页: [1]
查看完整版本: 手工编译安装apache-tianlm的博客