LAMP 环境搭建

安装版本

1、阿里云服务器

2、centos 6.8 64位

3、httpd 2.4.26

4、php 7.1.6

5、mysql 5.7.18

一、Linux常用命令

1、查看磁盘空间:df -h

2、查看内存、CPU使用情况:top

3、查看当前主机IP/MAC信息:ifconfig -a

4、查看系统版本:uname -a;查看CentOS发行版本:lsb_release -a

5、查看文件大小:du -ah --max-depth=1

6、查看文件路径:pwd

7、创建路径:mkdir -p **/**/**

8、创建文件夹:mkdir +文件夹名字

9、删除文件夹:rm -fr 删除文件,文件夹 -f强制删除 -r是递归

10、移动文件:mv [-fiv] source destination;移动当前目录所有文件至上级目录:mv * ..

11、拷贝文件:拷贝A文件夹到B目录:cp -rv A B;如果你正在B目录下,可以这样:cp -rv A ./

12、删除文件:rm [-fir] 文件或目录

13、解压*.tar.gz文件:tar -zxvf ***.tar.gz

14、远程连接:ssh root@192.168.0.1

15、linux服务器远程拷贝文件:scp /home/administrator/news.txt root@192.168.6.129:/etc/squid

16、查看软件安装信息:rpm -qa | grep gcc

17、查找文件:find / -name  '*xxx*'

18、查看环境变量:echo $PATH

19、增加环境变量:

  修改/etc/profile文件使其永久性生效,并对所有系统用户生效,在文件末尾加上如下两行代码
  PATH=$PATH:/usr/local/webserver/php/bin:/usr/local/webserver/mysql/bin
  export PATH
  执行 命令source /etc/profile

20、创建临时交换分区

  (1)dd if=/dev/zero of=/swapfile bs=1k count=2048000 --获取要增加的2G的SWAP文件块
  (2)mkswap /swapfile -- 创建SWAP文件
  (3)mkswap -f /swapfile --格式化分区
  (4)swapon /swapfile -- 激活SWAP文件
  (5)echo "/swapfile swap swap defaults 0 0" >> /etc/fstab -- 添加到fstab文件中让系统引导时自动启动

21、删除交换分区

  (1)swapoff /swapfile
  (2)rm -fr /swapfile

22、防火墙设置

  (1)vi /etc/sysconfig/iptables
  (2)配置iptables规则:
######################################
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3389 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
#####################################
  (3)service iptables start

23、安装telnet工具

  (1)service xinetd status
  (2)service xinetd restart
  (3)yum list telnet* --查看telnet相关的安装包
  (4)yum install telnet-server --安装telnet服务
  (5)yum install telnet.* --安装telnet客户端
  (6)vi /etc/xinetd.d/telnet --只需要将”disable= yes”改成” disable=no”
  (7)service xinetd restart

24、vi 编辑

  (1)查找:vi命令模式下键入“/”,后面跟要查找的字符串,再按回车。键入n跳到该串的下一个出现处,键入N跳到该串的上一个出现处。
  (2)显示行号:set nu
  (3)翻页:ctrl-f ctrl-b (f就是forword b就是backward)
  (4)移动到文首:G
  (5)移动到文末:gg
  (6)上下滚动:ctrl-e ctrl-y

25、修改主机名

  (1)hostname  --显示当前主机名

  (2)sudo hostname myECS  --【临时生效】设置当前主机名为myECS

  (3)vi /etc/sysconfig/network  --【重启永久生效】

26、创建用户

  (1)adduser testuser

  (2)passwd testuser

  (3)groupadd testgroup

  (4)usermod -G testgroup testuser

  (5)授权:

vi /etc/sudoers;

# Allow root to run any commands anywhere  下添加:testuser ALL=(ALL) ALL

修改完毕,现在可以用testuser帐号登录,然后用命令 sudo – ,即可获得root权限进行操作。

  (6)userdel mytest

  (7)groupdel peter

27、设置系统时间:date -s "2017-07-23 22:45:30"

二、安装插件

1、安装gcc-c++:yum install gcc-c++

2、安装expat:yum install expat-devel

3、安装cmake

  (1)tar -zxvf cmake-3.7.2.tar.gz
  (2)cd cmake-3.7.2
  (3)./bootstrap
  (4)gmake
  (5)gmake install

4、安装boost库:

  (1)tar -zxvf boost_1_59_0.tar.gz
  (2)cd boost_1_59_0
  (3)./bootstrap.sh
  (4)./b2
  (5)./b2 install
  (6)将/usr/local/include下的boost文件夹及里面的内容全部拷贝到/usr/include/下。将/usr/local/lib下的所有文件拷贝到/usr/lib下。

三、安装mysql

1、查看已有版本:rpm -qa|grep -i mysql

2、卸载:yum -y remove mysql-libs-5.1.73-7.el6.x86_64    (或者:rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64  删除不检查依赖)

3、搜索mysql yum repository,下载mysql57-community-release-el6-11.noarch.rpm;

4、wget http://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm

5、rpm -ivh mysql57-community-release-el6-11.noarch.rpm

6、yum install mysql-community-server

7、grep "password" /var/log/mysqld.log  --查看初始随机密码

8、set global validate_password_policy=0;set global validate_password_length=0;  (登录mysql,修改密码复杂度策略,查看密码策略:SHOW VARIABLES LIKE 'validate_password%';)

9、mysql_secure_installation  -- 修改mysql密码

10、GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "123456";flush privileges;(登录mysql,修改远程连接)

11、建库、用户、授权、建表

  (1)创建数据库:create database testDB;(drop database testDB;)
  (2)创建用户:CREATE USER 'test'@'%' IDENTIFIED BY '1234';(drop user 'test'@'%';)
  (3)授权:grant all privileges on testDB.* to 'test'@'%';flush privileges;
  (4)建表:
CREATE TABLE file (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
file_name varchar(255),
file_alias varchar(255),
file_type varchar(255),
file_size varchar(32),
file_logo varchar(255),
file_status varchar(32),
create_time varchar(32),
create_user_code varchar(32)
);

 四、安装httpd

1、下载

  (1)下载apr:http://apr.apache.org/
  (2)下载apr-util:http://apr.apache.org/
  (3)下载pcre:http://www.pcre.org/
  (4)下载httpd:http://httpd.apache.org/

 2、安装插件

  ----[0].yum

  (1)yum install gcc-c++ -y

  (2)yum install expat-devel -y

  (3)yum -y install pcre-devel

  (4)yum install openssl-devel -y

  (5)yum update openssl

  ----[1].安装apr

  (1)tar -zxvf  apr-1.6.2.tar.gz

  (2)cd apr-1.6.2

  (3)vi configure   -- 将RM='$RM'改为RM='$RM  -f',注意:$RM后面一定有一个空格

  (4)./configure --prefix=/usr/local/apr

  (5)make

  (6)make install

  ----[2].安装apr-util

  (1)tar -zxvf apr-util-1.6.0.tar.gz

  (2)cd apr-util-1.6.0

  (3)./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config

  (4)make

  (5)make install

  ----[3].安装pcre

  (1)tar -zxvf pcre-8.41.tar.gz

  (2)cd pcre-8.41

  (3)./configure --prefix=/usr/local/pcre

  (4)make

  (5)make install

3、安装httpd

  (1)tar -zvxf httpd-2.4.26.tar.gz

  (2)cd httpd-2.4.26

  (3)mkdir -p /usr/local/apache2

  (4)./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-ssl --enable-ssl --enable-module=so --enable-rewrite --enable-cgid --enable-cgi

  (5)make

  (6)make install

4、配置httpd.conf

  (1)vi /usr/local/apache2/conf/httpd.conf

  #ServerName www.example.com:80  -->  ServerName localhost:80

  DirectoryIndex index.html  -->  DirectoryIndex index.html index.php

  Options Indexes FollowSymLinks  -->  Options FollowSymLinks

  AllowOverride None  -->  AllowOverride All    --有两处

  LoadModule rewrite_module modules/mod_rewrite.so  -->  #取消前面的注释

5、添加环境变量

  (1)PATH=$PATH:/usr/local/apache2/bin
  (2)export PATH
  (3)source /etc/profile

6、更改目录权限

  (1)chown  daemon.daemon  -R /usr/local/apache2/htdocs

  (2)chmod   700 /usr/local/apache2/htdocs

7、添加系统启动

(1)cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd

(2)vi /etc/init.d/httpd  

  在#!/bin/sh下面添加以下两行
#chkconfig:2345 10 90
#description:Activates/Deactivates Apache Web Server

8、设置开机启动

  (1)chkconfig httpd on

9、启动与停止

  (1)service httpd start|stop|restart

  (2)netstat -an | grep 80

 五、安装PHP

 tar -xvf php7.tar.gz

cd php-7.0.4

 yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel

./configure
--prefix=/usr/local/php
--with-config-file-path=/usr/local/php/etc
--with-mysqli=shared,mysqlnd
--with-pdo-mysql=shared,mysqlnd
--with-libxml-dir
--with-gd
--with-jpeg-dir
--with-png-dir
--with-freetype-dir
--with-zlib-dir
--with-bz2
--with-openssl
--with-mcrypt
--enable-soap
--enable-gd-native-ttf
--enable-mbstring
--enable-sockets
--enable-exif

make && make install

cp php.ini-production /usr/local/php/etc/php.ini

整合

找到:

AddType application/x-gzip .gz .tgz

在该行下面添加:

AddType application/x-httpd-php .php

/usr/local/apache2/bin/apachectl -t
service httpd restart

vi /usr/local/apache2/htdocs/1.php

写入:

<?php
    echo "php解析正常";
    echo phpinfo();
?>

保存后,继续测试:

curl localhost/1.php

 六、LAMP-阿里云脚本

yum install gcc-c++ -y
yum install expat-devel -y
yum -y install pcre-devel
yum install openssl-devel -y
yum update openssl
tar -zxvf apr-1.6.2.tar.gz
cd apr-1.6.2
vi configure -- 将RM='$RM'改为RM='$RM -f',注意:$RM后面一定有一个空格

----------------------------------------------------------


./configure --prefix=/usr/local/apr
make
make install
cd ..
tar -zxvf apr-util-1.6.0.tar.gz
cd apr-util-1.6.0
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
make
make install
cd ..
tar -zxvf pcre-8.41.tar.gz
cd pcre-8.41
./configure --prefix=/usr/local/pcre
make
make install
cd ..
tar -zvxf httpd-2.4.26.tar.gz
cd httpd-2.4.26
mkdir -p /usr/local/apache2
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-ssl --enable-ssl --enable-module=so --enable-rewrite --enable-cgid --enable-cgi
make
make install
vi /usr/local/apache2/conf/httpd.conf

------------------------------------------------------------------
  #ServerName www.example.com:80 --> ServerName localhost:80

  DirectoryIndex index.html --> DirectoryIndex index.html index.php

  Options Indexes FollowSymLinks --> Options FollowSymLinks

  AllowOverride None --> AllowOverride All --有两处

  LoadModule rewrite_module modules/mod_rewrite.so --> #取消前面的注释

AddType application/x-gzip .gz .tgz --> 追加:AddType application/x-httpd-php .php
-------------------------------------------------------------------


PATH=$PATH:/usr/local/apache2/bin
export PATH
source /etc/profile
chown daemon.daemon -R /usr/local/apache2/htdocs
chmod 700 /usr/local/apache2/htdocs
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
chkconfig httpd on
service httpd start
cd ..
tar -zxvf php-7.1.6.tar.gz
cd php-7.1.6
yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel

./configure
--prefix=/usr/local/php
--with-config-file-path=/usr/local/php/etc
--with-mysqli=shared,mysqlnd
--with-pdo-mysql=shared,mysqlnd
--with-libxml-dir
--with-gd
--with-jpeg-dir
--with-png-dir
--with-freetype-dir
--with-zlib-dir
--with-bz2
--with-openssl
--with-mcrypt
--enable-soap
--enable-gd-native-ttf
--enable-mbstring
--enable-sockets
--enable-exif
make && make install
PATH=$PATH:/usr/local/php/bin
export PATH
source /etc/profile
cp php.ini-production /usr/local/php/etc/php.ini
/usr/local/apache2/bin/apachectl -t
service httpd restart
mv /usr/local/apache2/htdocs/index.html /usr/local/apache2/htdocs/index_bak.html
vi /usr/local/apache2/htdocs/index.php

 七、LAMP CentOS6.5-离线脚本

操作系统:CentOS-6.5-x86_64-minimal.iso

创建路径:#mkdir -p /vvonline/installpackage

将安装文件上传到/vvonline/installpackage/目录下

执行下面所有脚本

cd /vvonline/installpackage/rpm/

00########### 卸载mysql ###########
rpm -qa|grep -i mysql
yum -y remove mysql-libs-5.1.71-1.el6.x86_64
rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64


01########### 离线安装gcc-c++ ###########
rpm -Uvh mpfr-2.4.1-6.el6.x86_64.rpm
rpm -Uvh ppl-0.10.2-11.el6.x86_64.rpm
rpm -Uvh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm
rpm -Uvh cpp-4.4.7-4.el6.x86_64.rpm
rpm -Uvh kernel-headers-2.6.32-431.el6.x86_64.rpm
rpm -Uvh glibc-headers-2.12-1.132.el6.x86_64.rpm
rpm -Uvh glibc-devel-2.12-1.132.el6.x86_64.rpm
rpm -Uvh libgomp-4.4.7-4.el6.x86_64.rpm
rpm -Uvh gcc-4.4.7-4.el6.x86_64.rpm
rpm -Uvh libstdc++-devel-4.4.7-4.el6.x86_64.rpm
rpm -Uvh gcc-c++-4.4.7-4.el6.x86_64.rpm


02########### 离线安装expat-devel ###########
rpm -Uvh expat-devel-2.0.1-11.el6_2.x86_64.rpm


03########### 离线安装pcre-devel ###########
rpm -Uvh pcre-devel-7.8-6.el6.x86_64.rpm


04########### 离线安装openssl-devel ###########
rpm -Uvh keyutils-libs-devel-1.4-4.el6.x86_64.rpm
rpm -Uvh libcom_err-devel-1.41.12-18.el6.x86_64.rpm
rpm -Uvh libsepol-devel-2.0.41-4.el6.x86_64.rpm
rpm -Uvh libselinux-devel-2.0.94-5.3.el6_4.1.x86_64.rpm
rpm -Uvh krb5-devel-1.10.3-10.el6_4.6.x86_64.rpm
rpm -Uvh zlib-devel-1.2.3-29.el6.x86_64.rpm
rpm -Uvh openssl-devel-1.0.1e-15.el6.x86_64.rpm


05########### 离线安装libxml2 ###########
rpm -Uvh libxml2-2.7.6-14.el6.x86_64.rpm
rpm -Uvh libxml2-devel-2.7.6-14.el6.x86_64.rpm


06########### 离线安装bzip2 ###########
rpm -Uvh bzip2-1.0.5-7.el6_0.x86_64.rpm
rpm -Uvh bzip2-devel-1.0.5-7.el6_0.x86_64.rpm


07########### 离线安装libcurl ###########
rpm -Uvh libcurl-7.19.7-37.el6_4.x86_64.rpm


08########### 离线安装libjpeg-turbo ###########
rpm -Uvh libjpeg-turbo-1.2.1-1.el6.x86_64.rpm
rpm -Uvh libjpeg-turbo-devel-1.2.1-1.el6.x86_64.rpm


09########### 离线安装libjpeg-turbo ###########
rpm -Uvh libpng-1.2.49-1.el6_2.x86_64.rpm
rpm -Uvh libpng-devel-1.2.49-1.el6_2.x86_64.rpm


10########### 离线安装freetype ###########
rpm -Uvh freetype-2.3.11-14.el6_3.1.x86_64.rpm
rpm -Uvh freetype-devel-2.3.11-14.el6_3.1.x86_64.rpm


11########### 离线安装gmp ###########
rpm -Uvh gmp-4.3.1-7.el6_2.2.x86_64.rpm
rpm -Uvh gmp-devel-4.3.1-7.el6_2.2.x86_64.rpm


12########### 离线安装readline ###########
rpm -Uvh readline-6.0-4.el6.x86_64.rpm
rpm -Uvh ncurses-devel-5.7-3.20090208.el6.x86_64.rpm
rpm -Uvh readline-devel-6.0-4.el6.x86_64.rpm


13########### 离线安装libxslt ###########
rpm -Uvh libxslt-1.1.26-2.el6_3.1.x86_64.rpm
rpm -Uvh libgpg-error-devel-1.7-4.el6.x86_64.rpm
rpm -Uvh libgcrypt-devel-1.4.5-11.el6_4.x86_64.rpm
rpm -Uvh libxslt-devel-1.1.26-2.el6_3.1.x86_64.rpm


14########### 离线安装libmcrypt ###########
rpm -Uvh libmcrypt-2.5.7-5.el6.art.x86_64.rpm
rpm -Uvh libmcrypt-devel-2.5.7-5.el6.art.x86_64.rpm


15########### 离线安装perl ###########
rpm -Uvh perl-5.10.1-136.el6.x86_64.rpm perl-libs-5.10.1-136.el6.x86_64.rpm perl-Module-Pluggable-3.90-136.el6.x86_64.rpm perl-Pod-Simple-3.13-136.el6.x86_64.rpm perl-version-0.77-136.el6.x86_64.rpm perl-Pod-Escapes-1.04-136.el6.x86_64.rpm


16########### 离线安装mysql ###########
rpm -Uvh numactl-2.0.7-8.el6.x86_64.rpm
rpm -Uvh numactl-devel-2.0.7-8.el6.x86_64.rpm
rpm -Uvh libaio-0.3.107-10.el6.x86_64.rpm
rpm -Uvh libaio-devel-0.3.107-10.el6.x86_64.rpm

rpm -Uvh mysql-community-common-5.7.19-1.el6.x86_64.rpm
rpm -Uvh mysql-community-libs-5.7.19-1.el6.x86_64.rpm
rpm -Uvh mysql-community-client-5.7.19-1.el6.x86_64.rpm
rpm -Uvh mysql-community-devel-5.7.19-1.el6.x86_64.rpm
rpm -Uvh mysql-community-server-5.7.19-1.el6.x86_64.rpm


cd ..

tar -zxvf apr-1.6.2.tar.gz
cd apr-1.6.2
rm -fr /vvonline/installpackage/apr-1.6.2/configure
cp -rv /vvonline/installpackage/conf/configure /vvonline/installpackage/apr-1.6.2/
chmod +x ./configure
./configure --prefix=/usr/local/apr
make
make install
cd ..

tar -zxvf apr-util-1.6.0.tar.gz
cd apr-util-1.6.0
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
make
make install
cd ..

tar -zxvf pcre-8.41.tar.gz
cd pcre-8.41
./configure --prefix=/usr/local/pcre
make
make install
cd ..

tar -zvxf httpd-2.4.26.tar.gz
cd httpd-2.4.26
mkdir -p /usr/local/apache2
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-ssl --enable-ssl --enable-module=so --enable-rewrite --enable-cgid --enable-cgi
make
make install

rm -fr /usr/local/apache2/conf/httpd.conf
cp -rv /vvonline/installpackage/conf/httpd.conf /usr/local/apache2/conf/
chmod +x /usr/local/apache2/conf/httpd.conf
PATH=$PATH:/usr/local/apache2/bin
export PATH
source /etc/profile
chown daemon.daemon -R /usr/local/apache2/htdocs
chmod 700 /usr/local/apache2/htdocs
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
chkconfig httpd on
service httpd start

cd ..

rm -fr /usr/local/apache2/bin/apxs
cp -rv /vvonline/installpackage/conf/apxs /usr/local/apache2/bin/apxs
chmod +x /usr/local/apache2/bin/apxs

tar -zxvf php-7.1.6.tar.gz
cd php-7.1.6

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-mysqli

make && make install

PATH=$PATH:/usr/local/php/bin

export PATH
source /etc/profile
cp php.ini-production /usr/local/php/etc/php.ini
/usr/local/apache2/bin/apachectl -t
service httpd restart
mv /usr/local/apache2/htdocs/index.html /usr/local/apache2/htdocs/index_bak.html
cp -rv /vvonline/installpackage/conf/index.php /usr/local/apache2/htdocs/
chmod +x /usr/local/apache2/htdocs/index.php
service httpd restart

 八、LAMP CentOS6.8-离线脚本

操作系统:CentOS-6.8-x86_64-minimal.iso
创建路径:#mkdir -p /vvonline/installpackage
将安装文件上传到/vvonline/installpackage/目录下

执行下面所有脚本:

cd /vvonline/installpackage/rpm/

rpm -Uvh ppl-0.10.2-11.el6.x86_64.rpm
rpm -Uvh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm
rpm -Uvh mpfr-2.4.1-6.el6.x86_64.rpm
rpm -Uvh cpp-4.4.7-17.el6.x86_64.rpm
rpm -Uvh kernel-headers-2.6.32-642.el6.x86_64.rpm
rpm -Uvh glibc-headers-2.12-1.192.el6.x86_64.rpm
rpm -Uvh glibc-devel-2.12-1.192.el6.x86_64.rpm
rpm -Uvh libgomp-4.4.7-17.el6.x86_64.rpm
rpm -Uvh gcc-4.4.7-17.el6.x86_64.rpm

rpm -Uvh expat-devel-2.0.1-11.el6_2.x86_64.rpm
rpm -Uvh libstdc++-devel-4.4.7-17.el6.x86_64.rpm
rpm -Uvh gcc-c++-4.4.7-17.el6.x86_64.rpm

rpm -Uvh pcre-devel-7.8-7.el6.x86_64.rpm

rpm -Uvh keyutils-libs-devel-1.4-5.el6.x86_64.rpm
rpm -Uvh libcom_err-devel-1.41.12-22.el6.x86_64.rpm
rpm -Uvh libsepol-devel-2.0.41-4.el6.x86_64.rpm
rpm -Uvh libselinux-devel-2.0.94-7.el6.x86_64.rpm
rpm -Uvh krb5-devel-1.10.3-57.el6.x86_64.rpm
rpm -Uvh zlib-devel-1.2.3-29.el6.x86_64.rpm
rpm -Uvh openssl-devel-1.0.1e-48.el6.x86_64.rpm

rpm -Uvh perl-5.10.1-141.el6_7.1.x86_64.rpm perl-libs-5.10.1-141.el6_7.1.x86_64.rpm perl-Module-Pluggable-3.90-141.el6_7.1.x86_64.rpm perl-Pod-Simple-3.13-141.el6_7.1.x86_64.rpm perl-Pod-Escapes-1.04-141.el6_7.1.x86_64.rpm perl-version-0.77-141.el6_7.1.x86_64.rpm

rpm -Uvh libxml2-devel-2.7.6-21.el6.x86_64.rpm
rpm -Uvh bzip2-devel-1.0.5-7.el6_0.x86_64.rpm

rpm -Uvh libjpeg-turbo-1.2.1-3.el6_5.x86_64.rpm
rpm -Uvh libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64.rpm
rpm -Uvh libpng-1.2.49-2.el6_7.x86_64.rpm
rpm -Uvh libpng-devel-1.2.49-2.el6_7.x86_64.rpm

rpm -Uvh freetype-2.3.11-17.el6.x86_64.rpm
rpm -Uvh freetype-devel-2.3.11-17.el6.x86_64.rpm

rpm -Uvh libmcrypt-2.5.7-5.el6.art.x86_64.rpm
rpm -Uvh libmcrypt-devel-2.5.7-5.el6.art.x86_64.rpm


rpm -qa|grep -i mysql
yum -y remove mysql-libs-5.1.73-7.el6.x86_64
rpm -e --nodeps mysql-libs-5.1.73-7.el6.x86_64

rpm -Uvh numactl-2.0.9-2.el6.x86_64.rpm
rpm -Uvh numactl-devel-2.0.9-2.el6.x86_64.rpm
rpm -Uvh libaio-devel-0.3.107-10.el6.x86_64.rpm

tar -xvf mysql-5.7.19-1.el6.x86_64.rpm-bundle.tar
rpm -Uvh mysql-community-common-5.7.19-1.el6.x86_64.rpm
rpm -Uvh mysql-community-libs-5.7.19-1.el6.x86_64.rpm
rpm -Uvh mysql-community-client-5.7.19-1.el6.x86_64.rpm
rpm -Uvh mysql-community-devel-5.7.19-1.el6.x86_64.rpm
rpm -Uvh mysql-community-server-5.7.19-1.el6.x86_64.rpm
cd ..

tar -zxvf apr-1.6.2.tar.gz
cd apr-1.6.2
rm -fr /vvonline/installpackage/apr-1.6.2/configure
cp -rv /vvonline/installpackage/conf/configure /vvonline/installpackage/apr-1.6.2/
chmod +x ./configure
./configure --prefix=/usr/local/apr
make
make install
cd ..

tar -zxvf apr-util-1.6.0.tar.gz
cd apr-util-1.6.0
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
make
make install
cd ..

tar -zxvf pcre-8.41.tar.gz
cd pcre-8.41
./configure --prefix=/usr/local/pcre
make
make install
cd ..

tar -zvxf httpd-2.4.26.tar.gz
cd httpd-2.4.26
mkdir -p /usr/local/apache2
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-ssl --enable-ssl --enable-module=so --enable-rewrite --enable-cgid --enable-cgi
make
make install

rm -fr /usr/local/apache2/conf/httpd.conf
cp -rv /vvonline/installpackage/conf/httpd.conf /usr/local/apache2/conf/
chmod +x /usr/local/apache2/conf/httpd.conf
PATH=$PATH:/usr/local/apache2/bin
export PATH
source /etc/profile
chown daemon.daemon -R /usr/local/apache2/htdocs
chmod 700 /usr/local/apache2/htdocs
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
service httpd start

cd ..

rm -fr /usr/local/apache2/bin/apxs
cp -rv /vvonline/installpackage/conf/apxs /usr/local/apache2/bin/apxs
chmod +x /usr/local/apache2/bin/apxs

tar -zxvf php-7.1.6.tar.gz
cd php-7.1.6

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-mysqli

make && make install

PATH=$PATH:/usr/local/php/bin

export PATH
source /etc/profile
cp php.ini-production /usr/local/php/etc/php.ini
/usr/local/apache2/bin/apachectl -t
service httpd restart
mv /usr/local/apache2/htdocs/index.html /usr/local/apache2/htdocs/index_bak.html
cp -rv /vvonline/installpackage/conf/index.php /usr/local/apache2/htdocs/
chmod +x /usr/local/apache2/htdocs/index.php
service httpd restart

####################### 配置 #######################
############配置数据库############
service mysqld start

service mysqld start

grep "password" /var/log/mysqld.log

mysql-> set global validate_password_policy=0;set global validate_password_length=0;

mysql_secure_installation

mysql-> create database testDB;
mysql-> CREATE USER 'test'@'%' IDENTIFIED BY '1234';
mysql-> grant all privileges on testDB.* to 'test'@'%';flush privileges;

############配置wordpress############
cd /vvonline/installpackage/wordpress/
tar -zxvf wordpress-4.8-zh_CN.tar.gz
mv /vvonline/installpackage/wordpress/wordpress /usr/local/apache2/htdocs/

cd /usr/local/apache2/htdocs/wordpress/
cp -rv wp-config-sample.php wp-config.php
vi wp-config.php
############配置文件上传路径和权限############
chmod -R 777 /usr/local/apache2/htdocs/wordpress/wp-content/
在WordPress数据库wp_options表中,upload_path值填入:wp-content/uploads

九、LAMP 阿里云CentOS6.8

yum install gcc-c++ -y

yum install expat-devel -y
yum -y install pcre-devel
yum install openssl-devel -y
yum update openssl

cd /vvonline/installpackage/
tar -zxvf apr-1.6.2.tar.gz
cd apr-1.6.2
rm -fr /vvonline/installpackage/apr-1.6.2/configure
cp -rv /vvonline/installpackage/conf/configure /vvonline/installpackage/apr-1.6.2/
chmod +x ./configure
./configure --prefix=/usr/local/apr
make
make install
cd ..

tar -zxvf apr-util-1.6.0.tar.gz
cd apr-util-1.6.0
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
make
make install
cd ..

tar -zxvf pcre-8.41.tar.gz
cd pcre-8.41
./configure --prefix=/usr/local/pcre
make
make install
cd ..

tar -zvxf httpd-2.4.26.tar.gz
cd httpd-2.4.26
mkdir -p /usr/local/apache2
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-ssl --enable-ssl --enable-module=so --enable-rewrite --enable-cgid --enable-cgi
make
make install
cd ..

rm -fr /usr/local/apache2/conf/httpd.conf
cp -rv /vvonline/installpackage/conf/httpd.conf /usr/local/apache2/conf/
chmod +x /usr/local/apache2/conf/httpd.conf
PATH=$PATH:/usr/local/apache2/bin
export PATH
source /etc/profile
chown daemon.daemon -R /usr/local/apache2/htdocs
chmod 700 /usr/local/apache2/htdocs
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
service httpd start

rm -fr /usr/local/apache2/bin/apxs
cp -rv /vvonline/installpackage/conf/apxs /usr/local/apache2/bin/apxs
chmod +x /usr/local/apache2/bin/apxs
cd ..

yum install libxml2 libxml2-devel
yum install bzip2 bzip2-devel
yum install libjpeg libjpeg-devel
yum install libpng libpng-devel
yum install freetype freetype-devel
yum install libmcrypt libmcrypt-devel

tar -zxvf php-7.1.6.tar.gz
cd php-7.1.6
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-mysqli

make && make install

PATH=$PATH:/usr/local/php/bin
export PATH
source /etc/profile
cp php.ini-production /usr/local/php/etc/php.ini
/usr/local/apache2/bin/apachectl -t
service httpd restart
mv /usr/local/apache2/htdocs/index.html /usr/local/apache2/htdocs/index_bak.html
cp -rv /vvonline/installpackage/conf/index.php /usr/local/apache2/htdocs/
chmod +x /usr/local/apache2/htdocs/index.php
service httpd restart

rpm -qa|grep -i mysql
yum -y remove mysql-libs-5.1.73-8.el6_8.x86_64
wget http://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
rpm -ivh mysql57-community-release-el6-11.noarch.rpm
yum install mysql-community-server
service mysqld start
grep "password" /var/log/mysqld.log
****mysql-> ****
set global validate_password_policy=0;set global validate_password_length=0;
mysql_secure_installation
**********************
****mysql-> ****
create database testDB;
CREATE USER 'test'@'%' IDENTIFIED BY '1234';
grant all privileges on testDB.* to 'test'@'%';flush privileges;

###################################### The End! ######################################

1、文件上传,文件大小控制配置:

(1)、php.ini。 memory_limit = 2048M  post_max_size = 2048M  upload_max_filesize = 2048M

(2.1)、mysql 数据库。set global max_allowed_packet = 2048*1024*1024;

(2.2)、mysql配置文件。编辑my.cnf(windows下my.ini)max_allowed_packet=50M (或max_allowed_packet  = 50*1024*1024)

2、文件上传,时间长短配置: php.ini。max_execution_time=180

原文地址:https://www.cnblogs.com/vvonline/p/7056647.html