一、安装HTTP(Apache)
1.安装APR 和 APR-Util
所用代码cd apr
./configure --prefix=/usr/local/ap
make && make install
cd apr-util
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
make && make install
cd pcre
./configure --prefix=/usr/local/pcre --with-apr=/usr/local/apr/bin/apr-1-config
make && make install
cd httpd
./configure --prefix=/usr/local/httpd --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make && make install
2.配置http开机自启动
所用代码cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd
vim /etc/rc.d/init.d/httpd
//注册到linux服务列表
/**
添加如下代码
chkconfig: 35 61 61
description: Apache
**/
chkconfig --add httpd
//启动 关闭 重启
./apachectl start
./apachectl stop
./apachectl restart
二、安装MySQL 5.7.x
所用代码//创建用户组
groupadd mysql
//创建用户并添加用户到用户组
useradd -r -g mysql mysql
//修改mysql目录所有者
chown -R mysql:mysql ./
//在mysql目录下创建data空目录
mkdir data
//安装mysql
mysql/bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
//如果报错用下面的代码
mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --initialize
//安装完成后编辑 /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data
basedir=/usr/local/mysql
socket=/tmp/mysql.sock
user=mysql
port=3306
character-set-server=utf8
# 取消密码验证
skip-grant-tables
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# skip-grant-tables
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
//开启服务
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
//开机自启
chkconfig mysql on
//启动服务
service mysql start
//登录数据库
mysql/bin/mysql -u root -p
//修改密码
update user set authentication_string=password('你的密码') where user='root';
//刷新权限
flush privileges;
//退出将/etc/my.cnf中的skip-grant-tables删除
//登录再次设置密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '修改后的密码';
//退出系统再次进入就可以正常使用数据库了
三、安装phpyum -y install libcurl-devel
yum -y install libXpm-devel
yum -y install libxml2-devel
yum -y install php-mbstring
安装libmcrypt./configure
make && make install
安装libvpx./configure --prefix=/usr/local/libvpx --enable-shared --enable-vp9
make && make install
安装tiff./configure --prefix=/usr/local/tiff --enable-shared
make && make install
安装libpng./configure --prefix=/usr/local/libpng --enable-shared
make && make install
安装freetype./configure --prefix=/usr/local/freetype --enable-shared
make && make install
安装jpeg./configure --prefix=/usr/local/jpeg --enable-shared
make && make install
安装libgd./configure --prefix=/usr/local/libgd --enable-shared --with-jpeg=/usr/local/jpeg --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-fontconfig=/usr/local/freetype --with-xpm=/usr/ --with-tiff=/usr/local/tiff --with-webp=/usr/local/libwebp/
make && make install
安装php./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=/usr/local/mysql --with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-xpm-dir=/usr/ --with-zlib-dir=/usr/local/zlib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --enable-ctype
make && make install
可能会出现关于zip扩展的错误信息,如果出现则把其中关于zip的扩展去掉
参考博客:https://www.cnblogs.com/zoulongbin/p/6379272.html