梦想在左,生活在右。
Debian10下安装Nginx+MySQL5.6+PHP5.6+APCu
一、安装依赖包
apt-get -y install build-essential
apt-get -y install libncurses5-dev libncursesw5-dev libcurl4-gnutls-dev libssl-dev libxml2-dev libjpeg-dev libxpm-dev libfreetype6-dev
apt-get -y install libpcre3 libpcre3-dev libpcrecpp0v5 zlib1g-dev libevent-dev
apt-get install openssl libssl-dev libmcrypt-dev libreadline-dev
二、安装MySQL
tar xzf mysql-5.6.39.tar.gz
cd mysql-5.6.39
./configure \
--prefix=/usr/local/mysql \
--localstatedir=/data/mysql \
--with-comment=Source \
--with-server-suffix=-enterprise-gpl \
--with-mysqld-user=mysql \
--without-debug \
--with-big-tables \
--with-charset=utf8 \
--with-collation=utf8_general_ci \
--with-extra-charsets=all \
--with-pthread \
--enable-static \
--enable-thread-safe-client \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--enable-assembler \
--without-ndb-debug \
--enable-local-infile \
--with-readline \
--sysconfdir=/etc
make
make install
cd /usr/local/mysql
bin/mysql_install_db \
--user=mysql \
--basedir=/usr/local/mysql \
--datadir=/data/mysql
groupadd mysql
useradd -d /data/mysql -g mysql mysql
chown -R root:mysql .
chown -R mysql /data/mysql
chgrp -R mysql .
mkdir /var/log/mysql /tmp/mysql
chown mysql:mysql /var/log/mysql /var/tmp/mysql
cp share/mysql/my-medium.cnf /etc/my.cnf
cp share/mysql/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
/etc/init.d/mysqld start
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
三、安装PHP
1、安装openssl
因为php5.6和新版的openssl不兼容,所以要自己编译安装一个低版本的。
tar xzf openssl-1.0.2l.tar.gz
cd openssl-1.0.2l
./config --prefix=/usr/local/openssl-1.0.2l
make
make install
2、安装freetype
apt安装的freetype版本太高,已把freetype-config改为pkg-config,会出现找不到freetype-config的错误。
wget https://download.savannah.gnu.org/releases/freetype/freetype-2.4.0.tar.bz2
tar xjf freetype-2.4.0.tar.bz2
cd freetype-2.4.0
./configure --prefix=/usr/local/freetype
3、安装PHP
ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/
ln -s /usr/include/x86_64-linux-gnu/curl/ /usr/include/
tar xzf php-5.6.33.tar.gz
cd php-5.6.33
./configure \
--prefix=/usr/local/php56 \
--with-config-file-path=/etc/php56 \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-opcache \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-gettext \
--enable-mbstring \
--with-iconv \
--with-mcrypt \
--with-mhash \
--with-openssl=/usr/local/openssl-1.0.2l \
--enable-bcmath \
--enable-soap \
--with-libxml-dir \
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-sockets \
--with-curl \
--with-zlib \
--enable-zip \
--with-bz2 \
--with-freetype-dir=/usr/local/freetype \
--with-vpx-dir=/usr \
--with-jpeg-dir=/usr \
--with-xpm-dir=/usr \
--with-png-dir=/usr \
--with-gd \
--enable-gd-native-ttf \
--with-readline
make
make install
mkdir /etc/php56
cp php.ini-production /etc/php56/php.ini
cd /usr/local/php56/etc/
mv php-fpm.conf.default php-fpm.conf
三、安装APCu
APC之前因为存在bug已被官方舍弃,后面出了APCu,接口和APC一模一样,应该是APC的改良版吧,APC Update之意。就效率上来说,APC的单机版效率要比Memcached快2-3倍。
wget https://pecl.php.net/get/apcu-4.0.11.tgz
这是我测过兼容php5.6的版本,apcu-5.1.14测试了编译没通过。
apt-get install autoconf
/usr/local/php56/bin/phpize
./configure --prefix=/usr/local/apcu \
--with-php-config=/usr/local/php56/bin/php-config \
--enable-apcu \
--enable-apcu-mmap \
--sysconfdir=/etc
make
cp modules/apcu.so /usr/local/php56/lib/
vi /etc/php56/php.ini
extension=/usr/local/php56/lib/apcu.so
四、安装Nginx
groupadd www
useradd -d /data/web -g www www
mkdir /tmp/nginx /var/log/nginx
chown www:www /tmp/nginx /var/log/nginx
tar xzf nginx-1.17.4.tar.gz
cd nginx
./configure \
--user=www \
--group=www \
--prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-http_ssl_module \
--http-log-path=/var/log/nginx/access.log \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-client-body-temp-path=/tmp/nginx/client_temp \
--http-proxy-temp-path=/tmp/nginx/proxy_temp \
--http-fastcgi-temp-path=/tmp/nginx/fcgi_temp \
--http-uwsgi-temp-path=/tmp/nginx/uwsgi_temp \
--http-scgi-temp-path=/tmp/nginx/scgi_temp
make
make install
ln -s /usr/local/nginx/sbin/nginx /usr/sbin/
Track this back : http://www.koven.org/rserver.php?mode=tb&sl=494
name
password
homepage
隐藏评论(只有管理员可见)
▲
?