Debian 5 快速建立Linux + Nginx + MySQL + PHP服务器

1. 安装依赖的编译工具
apt-get update 更新源

apt-get install gcc make gdb autoconf g++ libncurses5-dev curl libssl-dev libcurl4-gnutls-dev libjpeg62-dev libpng12-dev libfreetype6-dev libsasl2-dev libperl-dev libtool libxml2-dev libtidy-dev libpcre3 libpcre3-dev libmcrypt-dev libmhash-dev install build-essential bison chrpath debhelper flex freetds-dev libapr1-dev libbz2-dev libc-client-dev libexpat1-dev libfreetype6-dev libgcrypt11-dev libgd2-xpm-dev libjpeg62-dev libkrb5-dev libldap2-dev libmcrypt-dev libmhash-dev libmysqlclient15-dev libncurses5-dev libpam0g-dev libpcre3-dev libpng12-dev libpq-dev libpspell-dev librecode-dev libsnmp9-dev libsqlite0-dev libt1-dev libtidy-dev libwrap0-dev libxmltok1-dev libxml2-dev libxslt1-dev re2c unixodbc-dev

apt-get install build-essential

2. 安装所需工具
libiconv
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar -zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure –prefix=/usr/local/libiconv
make && make install

libxml2
wget http://xmlsoft.org/sources/libxml2-2.7.3.tar.gz
tar -zxvf libxml2-2.7.3.tar.gz
cd libxml2-2.7.3
./configure –prefix=/usr/local/libxml2
make && make install

curl
wget http://curl.haxx.se/download/curl-7.19.6.tar.gz
tar -zxvf curl-7.19.6.tar.gz
cd curl-7.19.6
./configure –prefix=/usr/local/curl

openssl
wget http://www.openssl.org/source/openssl-0.9.8k.tar.gz
tar -zxvf openssl-0.9.8k.tar.gz
cd openssl-0.9.8k
./config
make && make install

zlib
wget http://google-desktop-for-linux-mirror.googlecode.com/files/zlib-1.2.3.tar.gz
tar -zxvf zlib-1.2.3.tar.gz
cd zlib/1.2.3
./configure –prefix=/usr/local/zlib

3.安装mysql
groupadd mysql
useradd -g mysql mysql

wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.41.tar.gz
tar -zxvf mysql-5.1.41.tar.gz
cd mysql-5.1.41
./configure –prefix=/usr/local/mysql/ –without-debug –without-bench –enable-thread-safe-client –enable-assembler –with-mysqld-ldflags=-all-static –with-client-ldflags=-all-static –with-charset=latin1 –with-extra-charset=utf8,gbk –with-innodb –with-cvs-storage-engine –with-federated-storage-engine –with-mysqld-user=mysql –without-embedded-server –with-server-suffix=-community –with-unix-socket-path=/usr/local/mysql/sock/mysql.sock

make && make install

cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysql
cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .

mv /etc/mysql/my.cnf /etc/mysql/my.cnf.bak
export PATH=/usr/local/mysql/bin/:$PATH
bin/mysql_install_db –user=mysql

chown -R root .
chown -R mysql var
chown -R mysql var/.
chown -R mysql var/mysql/.
chgrp -R mysql .
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql

chmod 777 /etc/init.d/mysql
bin/mysqld_safe –user=mysql &

相关推荐