Apache2.4.25+mysql5.7+php7.13编译安装For Centos7


#!/bin/bash#此脚本适合新系统安装,一键安装脚本#安装环境#[root@localhost apache]# hostnamectl# Icon name: computer-vm# Chassis: vm# Virtualization: vmware# Operating System: CentOS Linux 7 (Core)# CPE OS Name: cpe:/o:centos:centos:7# Kernel: Linux 3.10.0-514.10.2.el7.x86_64# Architecture: x86-64#Author:sadoc.blog.51cto.com#Date:2017-04-08
. /etc/rc.d/init.d/functions
apache2=”httpd-2.4.25.tar.gz”apr152=”apr-1.5.2.tar.gz”aprutil=”apr-util-1.5.4.tar.gz”libiconv1=”libiconv-1.15.tar.gz”php173=”php-7.1.3.tar.gz”noarch=”mysql57-community-release-el7-9.noarch.rpm”pcre8=”pcre-8.40.tar.gz”appd=”/opt/app/”down=”/opt/download”xiezai=”httpd mysql php”
for rpme in $xiezaidorpm -qa | grep $rpme
if [ $? = 0 ];then yum remove $rpme -yfidone
if [ -d $appd/php7.1.3 ];then rm -rf $appd/php7.1.3fi
if [ -d $appd/apache2.4.25 ];then rm -rf $appd/apache2.4.25fi
if [ -d $appd/other_app ];then rm -rf -f $appd/other_appfi

yum install epel-release -y
packages=”libxml2-devel curl-devel openjpeg openjpeg-devel openjpeg-libs libjpeg libpng freetype cmake wget autoconf”apk=”libjpeg libpng-devel freetype-devel mcrypt php-mcrypt libmcrypt libmcrypt-devel zlib-devel net-tools libxml2-devel”apps=”openssl-devel gcc gcc-c++ zip unzip gzip krb5 krb5-devel glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl-devel”for app in $packages $apps $apkdorpm -qa | grep $app >/dev/null 2>&1if [ $? = 0 ];thenaction “$app :: success” /bin/trueelseaction “$app :: FAILED” /bin/falseyum install $app -y >/dev/null 2>&1fidone[ -d $appd ] || mkdir $appd -p[ -d $down ] || mkdir $down -p[ -d $appd/apache2.4.25 ] || mkdir $appd/apache2.4.25 -p[ -d $appd/other_app ] || mkdir $appd/other_app -p[ -d $appd/php7.1.3 ] || mkdir $appd/php7.1.3 -p
cd $down[ -f $apr152 ] || wget http://mirrors.hust.edu.cn/apache//apr/apr-1.5.2.tar.gz[ -f $aprutil ] || wget http://mirrors.hust.edu.cn/apache//apr/apr-util-1.5.4.tar.gz[ -f $libiconv1 ] || wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz[ -f $apache2 ] || wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.25.tar.gz[ -f $noarch ] || wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm[ -f $php173 ] || wget -t5 http://ca1.php.net/distributions/php-7.1.3.tar.gz[ -f $pcre8 ] || wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
yum install mysql-server -y
tar zxf $apr152 && cd apr-1.5.2./configure –prefix=/opt/app/other_app/aprif [ $? = 1 ];then exit 1elsemake && make installfi

cd $downtar zxf $aprutilcd apr-util-1.5.4./configure –prefix=/opt/app/other_app/apr_util –with-apr=/opt/app/other_app/aprif [ $? = 1 ];then exit 1elsemake && make installfi
cd $downtar zxf $libiconv1cd libiconv-1.15./configure –prefix=/opt/app/other_app/libiconv1.15if [ $? = 1 ];then exit 1elsemake && make installfi
cd $downtar zxf $pcre8cd pcre-8.40./configure –prefix=/opt/app/other_app/pcre8.4if [ $? = 1 ];then exit 1elsemake && make installfi
cd $downtar zxf $apache2cd httpd-2.4.25./configure –prefix=/opt/app/apache2.4.25 –with-apr=/opt/app/other_app/apr –with-apr-util=/opt/app/other_app/apr_util –with-pcre=/opt/app/other_app/pcre8.4 –enable-deflate –enable-expires –enable-headers –enable-modules=most –enable-so –with-mpm=worker -enable-rewrite –enable-zlib
if [ $? = 1 ];then exit 1elsemake && make installfi

cd
ln -s /opt/app/apache2.4.25 /opt/app/apache
cd $downtar zxf $php173cd php-7.1.3./configure –prefix=/opt/app/php7.1.3 –with-apxs2=/opt/app/apache/bin/apxs -enable-calendar –with-mhash –with-openssl –with-mysqli=mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-gd –with-iconv –with-zlib –enable-zip –enable-inline-optimization –disable-debug –disable-rpath –enable-shared –enable-xml –enable-bcmath –enable-shmop –enable-sysvsem –enable-mbregex –enable-mbstring –enable-ftp –enable-gd-native-ttf –enable-pcntl –enable-sockets –with-xmlrpc –enable-soap –without-pear –with-gettext –enable开发云主机域名-session –with-curl –with-jpeg –with-freetype –enable-opcache –without-gdbm –with-mcrypt –disable-fileinfo

if [ $? = 1 ];then exit 1elsemake && make installfi
exit 1#########End############################################################

#配置apache2vim /opt/app/apache/conf/httpd.conf 修改成如下
194 ServerName localhost:80
251 252 DirectoryIndex index.html index.php inex.phtml253
388 AddType application/x-compress .Z389 AddType application/x-gzip .gz .tgz390 AddType application/x-httpd-php .php391 AddType application/x-httpd-php-source .phps

#mysql5.7.11 root密码#https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html#启动服务#systemctl start mysqld.service#查看临时密码#grep ‘temporary password’ /var/log/mysqld.log#修改密码#mysql_secure_installation 安全初始化.测试书库就链接vim/opt/app/apache/htdocs/index.php
$servername = “127.0.0.1”;$username = “user”;$password = “Admin1379!”;
// 创建连接$conn = new mysqli($servername, $username, $password);
// 检测连接if ($conn->connect_error) { die(“连接失败: ” . $conn->connect_error);}echo “连接成功”;?>

相关推荐: Mysql密码重置方法介绍

本文主要给大家介绍Mysql密码重置方法,文章内容都是笔者用心摘选和编辑的,具有一定的针对性,对大家的参考意开发云主机域名义还是比较大的,下面跟笔者一起了解下Mysql密码重置方法吧。ok,五步,开始!/etc/init.d/mysql stop输出 Stop…

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

(0)
打赏 微信扫一扫 微信扫一扫
上一篇 06/09 17:27
下一篇 06/09 17:44

相关推荐