lnmp 安装

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介: lnmp  安装     32.lnmp 安装(Linux+Apache+MySQL+PHP) 32.1 apache 安装 wget http://mirrors.hust.edu.

lnmp  安装

 

 

32.lnmp 安装(Linux+Apache+MySQL+PHP)
32.1 apache 安装
wget http://mirrors.hust.edu.cn/apache//apr/apr-1.5.2.tar.gz
wget http://mirrors.hust.edu.cn/apache//apr/apr-util-1.5.4.tar.gz

wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.2.32.tar.gz


yum -y install pcre-devel

【No recognized SSL/TLS toolkit detected】
yum install openssl openssl-devel

./configure --prefix=/usr/local/apr 
make && make install

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install

./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-rewirte --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make && make install


vim /etc/httpd/httpd.conf    
在ServerRoot下面添加一行
PidFile "/var/run/httpd.pid"

vim /etc/init.d/httpd

#!/bin/bash
#
# httpd        Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server.  It is used to serve \
#      HTML files and CGI.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid


# 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=/usr/local/apache/bin/apachectl
httpd=${HTTPD-/usr/local/apache/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0


start() {
        echo -n $"Starting $prog: "
        LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${lockfile}
        return $RETVAL
}


stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d 10 $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
    echo -n $"Reloading $prog: "
    if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
        RETVAL=$?
        echo $"not reloading due to configuration syntax error"
        failure $"not reloading $httpd due to configuration syntax error"
    else
        killproc -p ${pidfile} $httpd -HUP
        RETVAL=$?
    fi
    echo
}


# See how we were called.
case "$1" in
  start)
start
;;
  stop)
stop
;;
  status)
        status -p ${pidfile} $httpd
RETVAL=$?
;;
  restart)
stop
start
;;
  condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
  reload)
        reload
;;
  graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
  *)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac


exit $RETVAL


为此脚本赋予执行权限: chmod +x /etc/rc.d/init.d/httpd
加入服务列表: chkconfig --add httpd
给3,5启动 chkconfig --level  3  httpd on            chkconfig --level  5 httpd on
最后加路径  export PATH=$PATH:/usr/local/apache/bin
vim /etc/profile.d/httpd.sh完成后重新登录就可以了

httpd -k start 
httpd -k stop

/usr/local/apache/bin/apachectl start


32.2 mysql 安装 centos7 yum安装mysql
32.2.2 mysql 源码安装
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18.tar.gz
tar xf mysql-5.7.18.tar.gz
mv mysql-5.7.18 mysql

wget https://jaist.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz

 
cmake .  -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
 -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
 -DDEFAULT_CHARSET=utf8 \
 -DDEFAULT_COLLATION=utf8_general_ci \
 -DWITH_INNOBASE_STORAGE_engine=1 \
 -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
 -DMYSQL_DATADIR=/usr/local/mysql/data \
 -DMYSQL_TCP_PORT=3306 \
 -DWITH_BOOST=/usr/local/boost_1_59_0 \
 -DENABLE_DOWNLOADS=1 \
 -DCURSES_INCLUDE_PATH=/usr/include \
 -DCURSES_LIBRARY=/usr/lib64/libncurses.so  

cd /usr/local/mysql/bin
./mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data/ --basedir=/usr/local/mysql --socket=/usr/local/mysql/mysql.sock
cp -a support-files/mysql.server /etc/init.d/mysql
cp -a mysql.server /etc/init.d/mysql
vim /etc/my.cnf
[mysqld] 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

service mysql start
SET PASSWORD = PASSWORD('66666666');
use mysql
update user set host='%' where user='root' and host='localhost';
flush privileges; 
exit




32.3 php 安装
tar xf php-5.6.30.gz
mv php-5.6.30 ../soft/
cd ../soft/php-5.6.30/
yum install libxml2-devel
./configure --prefix=/usr/local/php  --with-apxs2=/usr/local/apache/bin/apxs  --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql  

make && make install

修改 apache2让支持php
vim /etc/httpd/httpd.conf 
添加
LoadModule php5_module     modules/libphp5.so
添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
添加 DirectoryIndex
<IfModule dir_module>  
    DirectoryIndex index.html index.php  
</IfModule> 

测试
在/usr/local/apache/htdocs/info.php 创建
<?php

phpinfo();

?>

http://172.23.24.180/info.php

 

 



 

 

 

 

 

 

 

 

捐助开发者 

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(支持支付宝和微信 以及扣扣群),没钱捧个人场,谢谢各位。

 

个人主页http://knight-black-bob.iteye.com/



 
 
 谢谢您的赞助,我会做的更好!

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
6月前
|
运维 Linux 数据安全/隐私保护
宝塔手把手教学-Linux面板安装LNMP & worldpress个人博客
宝塔手把手教学-Linux面板安装LNMP & worldpress个人博客
110 1
|
关系型数据库 MySQL Linux
一台新的Linux服务器什么都没安装,可以直接使用docker搭建LNMP环境吗?底层原理是什么?
一台新的Linux服务器什么都没安装,可以直接使用docker搭建LNMP环境吗?底层原理是什么?
171 0
|
缓存 Linux PHP
17.17 LNMP安装php扩展模块
我们已经知道 LNMP 一键安装包默认只安装了最基本的 Nginx+Mysql+PHP 环境,并没有安装扩展功能模块,如果需要安装扩展模块该怎么办?
199 0
17.17 LNMP安装php扩展模块
|
tengine NoSQL 关系型数据库
ezhttp一键安装配置lnmp lamp lnamp(nginx apache php mysql)环境
ezhttp一键安装配置lnmp lamp lnamp(nginx apache php mysql)环境
ezhttp一键安装配置lnmp lamp lnamp(nginx apache php mysql)环境
|
关系型数据库 MySQL Linux
17.15 LNMP安装的前期准备
下面,我们就使用一键安装包来搭建 LNMP 环境。不过在安装之前还是要做一些准备工作的。
156 0
17.15 LNMP安装的前期准备
|
关系型数据库 MySQL 应用服务中间件
LNMP架构——源码编译安装
1、编译安装nginx服务 2、编译安装mysql服务 3、编译安装php解析环境
LNMP架构——源码编译安装
|
运维 关系型数据库 应用服务中间件
【运维】源码编译安装 lnmp环境+wordpress部署
【运维】源码编译安装 lnmp环境+wordpress部署
444 0
【运维】源码编译安装 lnmp环境+wordpress部署
|
安全 Ubuntu 关系型数据库
Ubuntu/Deepin如何使用宝塔快速安装LNMP
首先安装宝塔客户端宝塔 Linux 面板安装,登录到云服务器,输入以下命令: wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh 安装成后,会出现如下界面: 宝塔默认登录端口为:8888,如果没有开通,需要在在安全组中开通8888端口,才能访问。
1700 0
Ubuntu/Deepin如何使用宝塔快速安装LNMP
|
关系型数据库 应用服务中间件 网络安全
阿里云ECS服务器安装纯净版centos7.4 LNMP教程
yum 安装依赖(很重要)yum -y install php-mcrypt libmcrypt-devel libxml2 libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel lib...