Linux 安装lamp

安装软件包编译器

gcc -v 查看是否存在

yum -y install gcc gcc-c++ mack

rpm -q httpd 查看是否安装http

rpm -e httpd --nodeps 卸载软件包和依赖关系

tar -zxf apr-1.5.1.tar.gz 解压apr软件包

cd apr-1.5.1

./configure --help 查看配置脚本的通用方法

./configure --prefix=/usr/local/apr  配置

make 编译

make install 安装

同样的方法 配置apr-util

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

编译安装 同上

同样的方法解压pcre

./configure --prefix=/usr/local/pcre

同样的方法安装 httpd

配置 

./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --enable-so(开启动态库的加载功能) --enable-ite(开启动态库重定向功能) --enable-charset-lite(字符集功能) --enable-cgi(cgi程序的功能)

ln -s /usr/local/httpd/bin/* /usr/local/bin 做软连接,这样可以直接输命令。

ls -l /usr/local/bin/httpd /usr/local/bin/apachectl 可以查看到命令指向的软连接

可以直接输入命令启动服务也可以加入到系统,利用service来控制服务

由于apach的脚本需要一个lynx的命令

yum -y install lynx

cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd

chmod 755 /etc/init.d/httpd

vi /etc/init.d/httpd

chkconfig --add httpd 用chkconfig命令吧httpd加入到服务当中

chkconfig --list httpd 查看httpd这个服务的状态

用setup命令配置一个IP地址  选择网络配置-设备配置 

service network restart 重启网络服务

ifconfig 

ifup eth0激活eth0网卡

vi /usr/local/httpd/conf/httpd.conf 编辑190行 :set nu 查看行数

/usr/local/httpd/bin/apachectl -t 检查配置文件的语法

netstat -anpt|grep httpd  查看服务是否启动

cat /usr/local/httpd/htdocs/index.html 查看测试网页的内容

vim /etc/hosts

lsof -i:80 查看端口是否开放

service httpd status 查看httpd状态
service httpd restart 重启

原文地址:https://www.cnblogs.com/milanmi/p/6536875.html