CentOS6.8编译安装LAMP
CentOS6.8编译安装Apache2.4.25、MySQL5.7.16、PHP5.6.29
初始化
#固定IP
vi /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes
BOOTPROTO=none
DNS1=202.96.209.133
IPADDR=192.168.159.68
PREFIX=24
GATEWAY=192.168.159.2
#基础库
yum groupinstall base
yum grouplist
yum groupinstall 'Development tools'
yum groupinstall 'Debugging Tools'
yum groupinstall 'Compatibility libraries'
安装Apache
#下载
mkdir /app/src -p
cd /app/src/
wget -c http://mirrors.aliyun.com/apache/apr/apr-1.5.2.tar.gz
wget -c http://mirrors.aliyun.com/apache/apr/apr-util-1.5.4.tar.gz
wget -c http://mirrors.aliyun.com/apache/httpd/httpd-2.4.25.tar.gz
tar xf apr-1.5.2.tar.gz
#安装apr
cd apr-1.5.2
./configure --prefix=/app/apr-1.5.2
make && make install
ln -sv /app/apr-1.5.2/ /app/apr
#安装apr-util
cd ..
tar xf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/app/apr-util-1.5.4 -
-with-apr=/app/apr-1.5.2/
make && make install
ln -sv /app/apr-util-1.5.4/ /app/apr-util
#安装httpd
yum install pcre-devel zlib-devel openssl-devel -y
cd ..
tar xf httpd-2.4.25.tar.gz
cd httpd-2.4.25
./configure --prefix=/app/httpd-2.4.25 --with-apr=/app/apr-1.5.2/ \
--with-apr-util=/app/apr-util-1.5.4/ --enable-so --enable-deflate --enable-expires \
--enable-headers --enable-ssl --enable-rewrite --enable-mpms-shared=all \
--with-mpm=prefork --enable-mods-shared=most
make
make install
ln -sv /app/httpd-2.4.25/ /app/httpd
vi /etc/profile.d/httpd.sh
export PATH=/app/httpd/bin:$PATH
. /etc/profile.d/httpd.sh
#查看所有模块
ls /app/httpd/modules/
#查看加载模块
apachectl -t -D DUMP_MODULES
vi /app/httpd/conf/httpd.conf
ServerName localhost:80
apachectl start
netstat -tunlp | grep httpd
cp ./httpd /etc/init.d/httpd
#修改pid和lock文件路径
vi /etc/init.d/httpd
apachectl=/app/httpd/bin/apachectl
httpd=${HTTPD-/app/httpd/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/app/httpd/logs/httpd.pid}
lockfile=${LOCKFILE-/app/httpd/logs/httpd}
apachectl stop
chmod +x /etc/init.d/httpd
/etc/init.d/httpd start
chkconfig --list | grep httpd
chkconfig --add httpd
chkconfig --list httpd
chkconfig httpd on
chkconfig --list httpd
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible \
# server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd/httpd.pid
#
### BEGIN INIT INFO
# Provides: httpd
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: distcache
# Short-Description: start and stop Apache HTTP Server
# Description: The Apache HTTP Server is an extensible server
# implementing the current HTTP standards.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}
# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/app/httpd/bin/apachectl
httpd=${HTTPD-/app/httpd/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/app/httpd/logs/httpd.pid}
lockfile=${LOCKFILE-/app/httpd/logs/httpd}
RETVAL=0
STOP_TIMEOUT=${STOP_TIMEOUT-10}
# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
# When stopping httpd, a delay (of default 10 second) is required
# before SIGKILLing the httpd parent; this gives enough time for the
# httpd parent to SIGKILL any errant children.
stop() {
status -p ${pidfile} $httpd > /dev/null
if [[ $? = 0 ]]; then
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
else
echo -n $"Stopping $prog: "
success
fi
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=6
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
# Force LSB behaviour from killproc
LSB=1 killproc -p ${pidfile} $httpd -HUP
RETVAL=$?
if [ $RETVAL -eq 7 ]; then
failure $"httpd shutdown"
fi
fi
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart|try-restart)
if status -p ${pidfile} $httpd >&/dev/null; then
stop
start
fi
;;
force-reload|reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"
RETVAL=2
esac
exit $RETVAL
安装MySQL
wget -c http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-boost-5.7.16.tar.gz
wget -c https://cmake.org/files/v3.7/cmake-3.7.1.tar.gz
tar xf cmake-3.7.1.tar.gz
cd cmake-3.7.1
less README.rst
./bootstrap --prefix=/app/cmake-3.7.1
gmake
gmake install
cd ..
ln -sv /app/cmake-3.7.1/ /app/cmake
export PATH=/app/cmake/bin:$PATH
tar xf mysql-boost-5.7.16.tar.gz
cd mysql-5.7.16/
yum install ncurses-devel
cmake . -DCMAKE_INSTALL_PREFIX=/app/mysql-5.7.16 -DMYSQL_DATADIR=/app/mysql-5.7.16/data \
-DWITH_BOOST=/app/src/mysql-5.7.16/boost/ -DENABLED_LOCAL_INFILE=1 -DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1
make
make install
#初始化权限
cd /app/mysql-5.7.16
mkdir data
useradd mysql -M -s /sbin/nologin
chown mysql.mysql /app/mysql-5.7.16/ -R
#移走系统自带的配置文件
mv /etc/my.cnf /etc/my.cnf.ori
bin/mysqld --initialize --user=mysql --basedir=/app/mysql-5.7.16/ --datadir=/app/mysql-5.7.16/data/
cp support-files/mysql.server /etc/init.d/mysqld
/etc/init.d/mysqld start
bin/mysql -uroot -p
ALTER USER root@localhost IDENTIFIED BY 'root';
安装PHP
cd /app/src
tar xf php-5.6.29.tar.gz
cd php-5.6.29
yum install libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum install libmcrypt-devel
./configure --prefix=/app/php-5.6.29 --with-apxs2=/app/httpd-2.4.25/bin/apxs \
--with-mysql --with-mysqli --enable-pdo --with-pdo-mysql --with-mysql-sock \
--enable-xml --with-libxml-dir --enable-sockets --with-curl \
--with-gd --enable-gd-native-ttf --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
--with-mcrypt --with-openssl --with-mhash --enable-zip --enable-mbstring --enable-mbregex \
--with-iconv --enable-static
make
make install
vi /app/httpd/conf/httpd.conf
DirectoryIndex index.php index.html
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
官方推荐使用Apache默认的MPM:prefork,每个请求使用单独的进程。
第二选择是FastCGI:PHP-fpm,编译加上–enable-fpm
第三选择才是Apache的worker或event,但要加上–enable-maintainer-zts
CentOS6.8编译安装LAMP的更多相关文章
- CentOS6.3 编译安装LAMP(1):准备工作
卸载yum或rpm安装的amp软件 #在编译安装lamp之前,首先先卸载已存在的rpm包. rpm -e httpd rpm -e mysql rpm -e php yum -y remove htt ...
- CentOS6.3 编译安装LAMP(2):编译安装 Apache2.2.25
所需源码包: /usr/local/src/Apache-2.2.25/httpd-2.2.25.tar.gz 编译安装 Apache2.2.25 #切换到源码目录 cd /usr/local/src ...
- CentOS6.3 编译安装LAMP(2):编译安装 Apache2.4.6
Apache官方说: 与Apache 2.2.x相比,Apache 2.4.x提供了很多性能方面的提升,包括支持更大流量.更好地支持云计算.利用更少的内存处理更多的并发等.除此之外,还包括性能提升.内 ...
- CentOS6.3 编译安装LAMP(3):编译安装 MySQL5.5.25
所需源码包: /usr/local/src/MySQL-5.5.25/cmake-2.8.8.tar.gz /usr/local/src/MySQL-5.5.25/mysql-5.5.25.tar.g ...
- CentOS6.3 编译安装LAMP(4):编译安装 PHP5.2.17
所需源码包: /usr/local/src/PHP-5.2.17/libmcrypt-2.5.8.tar.gz /usr/local/src/PHP-5.2.17/mhash-0.9.9.9.tar. ...
- CentOS6.3 编译安装LAMP(4):编译安装 PHP5.3.27
所需源码包: /usr/local/src/PHP-5.3.27/libmcrypt-2.5.8.tar.gz /usr/local/src/PHP-5.3.27/mhash-0.9.9.9.tar. ...
- centos6.5编译安装lamp开发环境
一.系统以及软件的准备 系统及编译安装包的下载地址:http://pan.baidu.com/s/1jIjqinc 密码:ghc2 说明:由于centos6.5是分卷压缩的,且压缩为三个压缩包,所 ...
- CentOS6.5下编译安装LAMP环境
LAMP(Linux-Apache-MySQL-PHP)网站架构是目前国际流行的Web框架.该框架能够满足大流量.大并发量的网站需求:当然.也可以直接使用高性能的服务器.高性能的负载均衡硬件以及CDN ...
- 在centos6上实现编译安装lamp和wordpress,并编译xcache
author:JevonWei 版权声明:原创作品 软件环境: centos6.9 httpd-2.4.27.tar.bz2 apr-1.5.2.tar.bz2 apr-util-1.5.4.tar. ...
随机推荐
- hdu 4679 Terrorist’s destroy 树的直径+dp
题意:给你一棵树,每条边都有值W,然后问你去掉一条边,令val = w*max(两颗新树的直径),求val最小值~ 做法,先求树的直径,然后算出直径上每个点的最长枝条长度.这样对于每一条边,假如是枝条 ...
- 基于Python的XSS测试工具XSStrike使用方法
基于Python的XSS测试工具XSStrike使用方法 简介 XSStrike 是一款用于探测并利用XSS漏洞的脚本 XSStrike目前所提供的产品特性: 对参数进行模糊测试之后构建合适的payl ...
- iptables详解(14):iptables小结之常用套路
不知不觉,已经总结了13篇iptables文章,这些文章中有一些需要注意的地方. 此处,我们对前文中的一些注意点进行总结,我们可以理解为对"常用套路"的总结. 记住这些套路,能让我 ...
- 【zznu-夏季队内积分赛3-G】2333
题目描述 “别人总说我瓜,其实我一点也不瓜,大多数时候我都机智的一批“ 宝儿姐考察你一道很简单的题目.给你一个数字串,你能判断有多少个连续子串能整除3吗? 输入 多实例输入,以EOF结尾,每行一个数字 ...
- java的简单入门,tomcat服务器
Tomcat是一款开源的处理动态非常牛逼的web服务器.是sun公司开发的,在丧尸危机之后被收购了. 安装Tomcat需要的支持安装包 JDK下载:http://www.oracle.com/tech ...
- 如何让history显示时间
linux和unix上都提供了history命令,可以查询以前执行的命令历史记录但是,这个记录并不包含时间项目因此只能看到命令,但是不知道什么时间执行的如何让history记录时间呢? 解决方案 注意 ...
- 团队项目:"Jarvis For Chat"
"Jarvis For Chat"项目简介 项目详情信息已经在上一篇博客中详细给出,详请查看博客 团队成员 姓名 学号 张扬(队长) 031602345 苏韫月 031602631 ...
- Python基础学习----字符串的常用方法
# Python字符串 # 大多数的语言定义字符串是双引号,Python既可以双引号,也可以单引号.但使用也有区别 # 单双引号的使用 My_name="bai-boy" Demo ...
- Getting command line access to PHP and MySQL running MAMP on OSX
建立自己profile路径应该在/Users/yourname/,最后要运行. ./.profile使文件生效,和windows中给添加环境变量是一个道理,还可以看出linux和UNIX默认运行路径为 ...
- css实现加载中的效果
那天闲着,学习了一下样式效果,自己实现了一个简单的加载中的效果 废话不多说,开始吧!! 一.实现一个圆环 要实现圆环,首先我们需要知道盒模型里面border的本质,先来看一个效果吧 从上面 ...