[伊達原創]FreeBSD8.0源碼編譯安裝MYSQL5 APACHE2.2 PHP5.3.2

/**********************************************
@desc:FreeBSD8.0+APACHE-2.2.15+MYSQL-5.1.45+PHP-5.3.2
@mail:[email protected] 如果有遺漏請提示 3Q  ╮(╯3╰)╭       

@MSN:[email protected]
@Source 的獲取:sf.net和官方網站 .tbz文件在BSD的安裝盤裏。    
/**********************************************

@note:安裝前的準備    
@note:安裝Perl 兩種模式 兩個版本 隨意
Install perl5
(1)tbz files install mode
pkg_add perl-5.8.9_3.tbz

(2)Source Installation
tar zxvf perl-5.10.1.tar.bz2
cd perl-5.10.1
sh Configure -de
make
make test
make install
 
@note:gmake是安裝freetype時需要的
Install gmake
pkg_add gmake-3.81_3.tbz
@兩個依賴包和pkg的一個包放在同一個目錄下
libiconv-1.13.1.tbz and gettext-0.17_1.tbz and pkg-config-0.23_1.tbz
 

Install MYSQL5.1.45-Source

@添加用戶 Linux和UNIX的方式不一樣 原理相通

@Linux 用戶

shell> groupadd mysql
shell> useradd -g mysql mysql
+-------This is a FreeBSD8.0 add user'mode--------+
woody# adduser
Username: mysql
Full name: mysql
Uid (Leave empty for default):
Login group [mysql]:
Login group is mysql. Invite mysql5 into other groups? []:
Login class [default]:
Shell (sh csh tcsh nologin) [sh]: nologin
Home directory [/home/mysql]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]: yes
Lock out the account after creation? [no]:
Username   : mysql
Password   : <blank>
Full Name  : mysql
Uid        : 1003
Class      :
Groups     : mysql
Home       : /home/mysql
Home Mode  :
Shell      : /usr/sbin/nologin
Locked     : no
+--------------------------Step---------------------------+
shell> gunzip < mysql-5.1.45.tar.gz.tar.gz | tar -xvf -
shell> cd mysql-mysql-5.1.45
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
@note:my-medium.cnf 按需 copy
@change: 修改my.cnf文件 不修改也可以 這裏只是修改數據庫位置。
+my.cnf add a line ''+
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
.....略.....
datadir = /data/mysql
 
@Step:建數據庫目錄
shell> mkdir -p /data/mysql
+--------------------+
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql /data/mysql
@note:如果沒有修改my.cnf的datadir位置 則執行:
@#shell> chown -R mysql var
@啓動
shell> bin/mysqld_safe --user=mysql &
 
 

Step:Starting and Stopping MySQL Automatically

@note:開機自動啓動
/etc/rc.local
/bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'
 
 
 
Install APACHE2.2.15
 
Step 1
編譯Apache的要求
  1. 磁盤空間
  2. ANSI- C編譯器及編譯環境
  3. 確保準確的時間
  4. Perl 5 [可選]
  5. apr/apr-util >= 1.2
apr和apr-util包含在Apache httpd的發行源代碼中,並且在絕大多數情況下使用都不會出現問題。當然,如果apr或apr-util的1.0或1.1版本已經安裝在你的系統中了, 則必須將你的apr/apr-util升級到1.2版本,或者將httpd單獨分開編譯。要使用發行源代碼中自帶的apr/apr-util源代碼進行安 裝,你必須手動完成:
@note: 編譯和安裝 apr 1.2
cd srclib/apr
./configure –prefix=/usr/local/apr/
make
make install
@note: 編譯和安裝 apr-util 1.2
cd ../apr-util
./configure –prefix=/usr/local/apr-util/ –with-apr=/usr/local/apr/
make
make install

Step2-1
tar zxvf httpd-2.2.15.tar.gz
ln -s httpd-2.2.15.tar.gz httpd
cd httpd

./configure --prefix=/usr/local/apache2 --enable-so \
--enable-mods-shared=most --with-mpm=worker
\
--with-mysql=/usr/local/mysql --enable-cache \
--enable-file-cache --enable-mem-cache 
\
--enable-disk-cache --enable-static-support
\
--disable-cgid --disable-cgi 
--with-apr=/usr/local/apr/  \
--with-apr-util=/usr/local/apr-util/
--with-perl \
--enable-module=rewrite

make
make install


PHP-support

@note:freetype的安裝需 要gmake 先修改configure文件中的編譯器
shell > tar zxvf freetype-2.2.1
shell > cd freetype-2.2.1

vi configure

if test "x$GNUMAKE" = x; then
  GNUMAKE=gmake
fi
./configure
gmake
gmake install

@note:其餘的就容易了 該make的 該install的就那啥了...( ̄︶ ̄)↗

/usr/local/libjpeg
./configure --prefix=/usr/local/libjpeg

/usr/local/libpng
./configure --prefix=/usr/local/libpng

/usr/local/libxml2
./configure --prefix=/usr/local/libxml2

/usr/local/zlib
./configure --prefix=/usr/local/zlib


GD2
@note:make時如果出錯的話 copy兩個文件到gd當前目錄下
@Error:
gd_png.c:16:53: error: png.h: No such file or directory
png.h:395:21: error: pngconf.h: No such file or directory
woody# cp /usr/local/libpng/include/png.h /usr/local/src/gd-2.0.35/
woody# cp /usr/local/libpng/include/pngconf.h /usr/local/src/gd-2.0.35/

tar zxvf gd-2.0.35.tar.gz

cd gd-2.0.35

./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg8 --with-zlib-dir=/usr/local/zlib --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype
make
make install
 
Install PHP-5.3.2 Released.
@note:5.3.2這個版本里貌似沒有 --enable-so和--with-ttf 這兩個選項了
 

./configure --prefix=/usr/local/php5  \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-gd=/usr/local/gd2 \
--enable-gd-native-ttf  \
--enable-gd-jis-conv \
--with-freetype-dir=/usr/local/freetype \
--with-jpeg-dir=/usr/local/jpeg8 \
--with-png-dir=/usr/local/libpng  \
--with-libxml-dir=/usr/local/libxml \
--with-zlib-dir=/usr/local/zlib \
--with-kerberos  --enable-xml \
--enable-mbstring --enable-sockets \
--enable-calendar 
 
make
make test #執行到這一步可以去看 看電影 泡杯茶之類的 (^。^)y-~~
make install
 
woody# cp /usr/local/src/php-5.3.2/php.ini-production /usr/local/php5/lib/php.ini
@edit apache's httpd.conf
@checking:LoadModule php5_module        modules/libphp5.so
@Add:
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
 
 
炮 灰!!! ( ̄︶ ̄)↗ 漲
woody# du -h -d 1 /usr/local/src/
 52M    /usr/local/src/httpd-2.2.15
272M    /usr/local/src/mysql-5.1.45
106M    /usr/local/src/perl-5.10.1
 18M    /usr/local/src/freetype-2.2.1
9.6M    /usr/local/src/jpeg-8a
3.2M    /usr/local/src/zlib-1.2.4
6.3M    /usr/local/src/libpng-1.4.1
 59M    /usr/local/src/libxml2-2.7.2
217M    /usr/local/src/php-5.3.2
7.5M    /usr/local/src/gd2
 82M    /usr/local/src/ImageMagick-6.6.1-0
7.5M    /usr/local/src/gd-2.0.35
918M    /usr/local/src/

woody# du -h -d 1 /usr/local/
918M    /usr/local/src
138M    /usr/local/mysql
2.2M    /usr/local/apr
2.0M    /usr/local/apr-util
 17M    /usr/local/apache2
2.7M    /usr/local/bin
 74M    /usr/local/lib
 18M    /usr/local/man
6.7M    /usr/local/share
6.0K    /usr/local/etc
1.1M    /usr/local/include
1.2M    /usr/local/info
 50K    /usr/local/libdata
2.0K    /usr/local/libexec
2.0K    /usr/local/sbin
2.0K    /usr/local/www
2.5M    /usr/local/jpeg8
4.8M    /usr/local/freetype
306K    /usr/local/zlib
1.4M    /usr/local/libpng
 14M    /usr/local/libxml
1.3M    /usr/local/gd2
 24M    /usr/local/php5
 36M    /usr/local/apache
1.2G    /usr/local/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章