Ubuntu11.10_X86_32,編譯安裝相應的軟件:nginx+mysql+php。
libiconv-1.14.tar.gz
libmcrypt-2.5.7.tar.gz
mcrypt-2.6.8.gz
mhash-0.9.9.9.tar.gz
mysql-5.5.39.tar.gz
nginx-1.1.10.tar.gz
pcre-8.20.tar.gz
php-5.4.34.tar.gz
系統較為純淨要安裝一些必要的工具軟件
apt-get install gcc g++ ssh automake cmake build-essential autoconf make re2c wget cron bzip2 rcconf flex vim bison m4 mawk cpp binutils libncurses5 unzip tar libncurses5 libncurses5-dev libtool libpcre3 libpcrecpp0 libssl-dev zlibc openssl libxml2-dev libltdl3-dev libpcre3 libpcrecpp0 libssl-dev zlibc openssl libxml2-dev libltdl3-dev libmcrypt-dev
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14/
cd libiconv-1.14/
./configure --prefix=/usr/local
make
make install
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure
make
make install
cd ../
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
tar zxvf pcre-8.10.tar.gz
cd pcre-8.10
./configure
make
make install
groupadd mysql #添加mysql組
useradd -g mysql mysql -s /bin/false #創建用戶mysql並加入到mysql組,不允許mysql用戶直接登錄系統
mkdir -p /data/mysql #創建MySQL數據庫存放目錄
chown -R mysql:mysql /data/mysql #設置MySQL數據庫目錄權限
tar zxvf mysql-5.5.19.tar.gz
cd mysql-5.5.19
mkdir -p /usr/local/mysql #創建MySQL安裝目錄
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8-unicode_ci -DMYSQL_DATADIR=/usr/local/mysql/data -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DSYSCONFDIR=/etc -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_TCP_PORT=3306
make
make install
cp support-files/my-small.cnf /etc/my.cnf
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
/usr/local/mysql/scripts/mysql_install_db --user=mysql
cd /usr/local/mysql
cp ./support-files/my-huge.cnf /etc/my.cnf #拷貝配置文件(注意:/etc目錄下面默認有一個my.cnf,直接覆蓋即可)
vi /etc/my.cnf #編輯配置文件,在 [mysqld] 部分增加
datadir = /data/mysql #添加MySQL數據庫路徑
./scripts/mysql_install_db --user=mysql #生成mysql系統數據庫
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld #把Mysql加入系統啟動
chmod 755 /etc/init.d/mysqld #增加執行權限
啟動:bin/mysqld_safe -user=mysql &
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
修改密碼/usr/local/mysql/bin/mysqladmin -u root -p password "123456"
錯誤1:
解決辦法:
apt-get install libfreetype6-dev libjpeg8-dev libpng12-dev slapd ldap-utils db5.1-util
apt-get install libldap2-dev libsasl2-dev
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --disable-maintainer-zts
錯誤1:configure: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/
解決方法:apt-get install curl
apt-get install libcurl4-gnutls-dev
apt-get install php5-curl