直接上命令
cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
首先需要先下载tar.gz文件
cd /usr/local/src
wget http://nginx.org/download/nginx-1.12.2.tar.gz
wget https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.38.tar.gz
wget http://ca2.php.net/get/php-7.1.12.tar.gz/from/this/mirror
解压
tar -zxvf nginx-1.12.2.tar.gz
tar -zxvf mysql-5.6.38.tar.gz
tar -zxvf mirror
解压完成
在centos高版本自带的mariadb卸了
//出来一个文件名
rpm -qa|grep mariadb
rpm -e --nodeps(文件名)
好的准备工作好了开搞
https://help.aliyun.com/document_detail/50700.html?spm=5176.product25365.6.750.ko6GHi
跟着阿里云的文档走的
文档中有的解释我就不写了
groupadd -r nginx
useradd -r -g nginx nginx
一次性安装开发工具
yum groupinstall "Development tools"
安装一些依赖
yum -y install gcc wget gcc-c++ automake autoconf libtool libxml2-devel libxslt-devel perl-devel perl-ExtUtils-Embed pcre-devel openssl-devel
cd nginx-1.12.2
./configure --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --user=nginx --group=nginx --with-pcre --with-http_v2_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_v2_module --with-threads --with-stream --with-stream_ssl_module
make && make install
mkdir -pv /var/tmp/nginx/client
vim /etc/init.d/nginx
加入下面一段脚本
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
# pidfile: /var/run/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/etc/nginx/nginx.conf"
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
killall -9 nginx
}
restart() {
configtest || return $?
stop
sleep 1
start
}
reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
chmod +x /etc/init.d/nginx
chkconfig --add nginx
chkconfig nginx on
启动nginx服务
service nginx start
Starting nginx (via systemctl): [ OK ](表示成功)
访问ip地址
welcome to nginx
yum groupinstall "Server Platform Development" "Development tools" -y
没有需要安装的进行下一步
yum install cmake -y
mkdir /mnt/data
groupadd -r mysql
useradd -r -g mysql -s /sbin/nologin mysql
chown -R mysql:mysql /mnt/data
cd mysql-5.6.38
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mnt/data -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LIBWRAP=0 -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
错误:
Curses library not found. Please install appropriate package,
http://blog.csdn.net/u010098331/article/details/51519234
rm -rf CMakeCache.txt
yum install ncurses-devel
重新编译好了
make && make install
chown -R mysql:mysql /usr/local/mysql/
/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/mnt/data/ --basedir=/usr/local/mysql
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
cp support-files/my-default.cnf /etc/my.cnf
chkconfig mysqld on
chkconfig --add mysqld
echo -e "basedir = /usr/local/mysql\ndatadir = /mnt/data\n" >> /etc/my.cnf
echo "export PATH=$PATH:/usr/local/mysql/bin" > /etc/profile.d/mysql.sh
source /etc/profile.d/mysql.sh
service mysqld start
mysql -h 127.0.0.1
mysql_secure_installation
yum install libmcrypt libmcrypt-devel mhash mhash-devel libxml2 libxml2-devel bzip2 bzip2-devel
cd php-7.1.12/
后面加入了–disable-fileinfo
./configure --prefix=/usr/local/php --with-config-file-scan-dir=/usr/local/php/etc --with-config-file-path=/etc --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --with-openssl -enable-xml --enable-sockets --enable-fpm --with-mcrypt --with-bz2 --disable-fileinfo
make && make install