安装Apache
参考:https://segmentfault.com/a/1190000004236397?_ea=539001
yum install expat-devel
1)下载。解压
2)安装apr wget下载,解压, 重命名,进入解压文件,
wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
./config --prefix=/usr/local/apr
make;make install
3)安装apr-utl wget下载,解压, 重命名,,进入解压文件,
wget http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz
./config --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
make;make install
4)将apr和apr-util的源码包拷贝到httpd的安装目录指定位置:
cp -r apr-1.5.2 /usr/local/src/httpd-2.4.38/srclib/apr
cp -r apr-util-1.5.2 /usr/local/src/httpd-2.4.38/srclib/apr-util
4)下载依赖pcre,解压,进入pcre目录,安装前的准备工作:
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
./configure --prefix=/usr/local/pcre
make 然后make install
5)安装openssl,并将文件链接到/usr/lib和/lib64
wget https://www.openssl.org/source/openssl-1.1.0k.tar.gz
tar -zxvf openssl-1.1.0k.tar.gz
cd openssl-1.1.0k
./config --prefix=/usr/local/openssl
ln -s /usr/local/openssl/lib/*.so.* /usr/lib64
ln -s /usr/local/openssl/lib/*.so.* /usr/lib
5)进入httpd目录,进行apache的安装
./configure --prefix=/usr/local/apache
--sysconfdir=/usr/local/apache/conf
--with-mpm=worker
--with-apr=/usr/local/apr
--with-apr-util=/usr/local/apr-util
--with-pcre=/usr/local/pcre
--enable-so
--enable-headers
--enable-deflate=shared
--enable-expires=shared
--enable-rewrite=shared
--enable-static-support
--enable-mods-shared=most
--enable-module=so
--enable-cache
--enable-file-cache
--enable-mem-cache
--enable-disk-cache
--enable-ssl
--enable-dav
--with-ssl=/usr/local/openssl
--enable-maintainer-mode
--with-included-apr
make 编译,然后make install
6)测试是否正确:/usr/local/apache/bin/
./apachectl -k start
安装MySQL(yum 安装)
1)下载到本地
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
2)本地安装mysql仓库
yum localinstall mysql80-community-release-el7-3.noarch.rpm
3)确保mysql57仓库是可用的
yum -y install yum-utils
yum-config-manager --enable mysql57-community
yum -y install yum-utils
yum-config-manager --enable mysql57-community
yum-config-manager --disable mysql80-community
yum -y install mysql-community-server
启动MySQL:systemctl start mysqld
查看mysql初始化的密码:cat /var/log/mysqllog.log |grep 'temporary password'
登陆mysql mysql -uroot -p
修改密码:alter user 'root'@'localhost' identified by 'xxxxx';
安装PHP
1)安装前先将下面这些依赖包安装好
yum -y install libxml2 libxml2-devel openssl-devel libcurl libcurl-devel curl-devel libjpeg-devel libpng libpng-devel freetype-devel openldap-devel libmcrypt-devel
yum groupinstall "Development Tools"
2)下载安装libiconv包
wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
tar -zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make && make install
3)开始编译安装PHP
进入解压后的PHP源码包(可在PHP官网下载),执行以下命令:
./configure --prefix=/usr/local/php
--with-apxs2=/usr/local/apache/bin/apxs
--with-config-file-path=/usr/local/php/etc
--with-mysql-sock=/var/lib/mysql/mysql.sock
--with-iconv-dir=/usr/local/libiconv
--with-fpm-user=www
--with-fpm-group=www
--with-iconv-dir
--with-freetype-dir
--with-jpeg-dir
--with-png-dir
--with-zlib
--with-libxml-dir
--enable-xml
--disable-rpath
--enable-bcmath
--enable-shmop
--enable-sysvsem
--enable-inline-optimization
--with-curl
--enable-mbregex
--enable-redis
--enable-fpm
--enable-mbstring
--with-mcrypt
--with-gd
--enable-gd-jis-conv
--enable-gd-native-ttf
--with-openssl
--with-mhash
--enable-pcntl
--enable-sockets
--with-xmlrpc
--enable-zip
--enable-soap
--enable-opcache
--with-libmbfl
--with-onig
--enable-pdo
--with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd
--with-pdo-mysql
--enable-mysqlnd-compression-support
--with-pear
--enable-maintainer-zts
--enable-roxen-zts
--enable-session
--with-gettext
--disable-ipv6
make 编译,然后make install完成安装
4)接下来根据自己的需要安装redis扩展:
wget http://pecl.php.net/get/redis-4.0.0.tgz
tar -zxf redis-4.0.0.tgz
在解压后的安装包目录里执行:/usr/local/php/bin/phpize
然后继续执行:./configure --with-php-config=/usr/local/php/bin/php-config
接下来编译安装
make && make install
编译安装好的redis扩展就放在: /usr/local/php/lib/php/extensions/no-debug-zts-20160303/目录下
接下来在配置文件中引用redis扩展包:
vi /usr/local/php/etc/php.ini 找到extensions_dir
加上下面两行:
extensions_dir=/usr/local/php/lib/php/extensions/no-debug-zts-20160303/
extension=redis.so
命令查看php有哪些扩展包:/usr/local/php/bin/php -m
安装Redis
wget http://download.redis.io/releases/redis-5.0.5.tar.gz
cd redis-5.0.5/utils/
运行./install_server.sh脚本,根据自己的需求选择键入
此脚本默认创建的服务是redis_6379,不符合我们的习惯,改成自己熟悉的服务名
mv /etc/init.d/redis_6379 /etc/init.d/redisd
systemctl daemon-reload
接下来就可以启动Redis了
systemctl restart redisd