概述:
FreeBSD版本8.4
Nginx版本1.6
php版本5.4
mysql版本5.6
在配置之前要先更新系統,在root模式下輸入如下命令查看pkg安裝工具版本,如果版本低於1.4,那么需要更新才可使用:
配置環境的服務器要能上網,因為需要直接從官方資源站點下載配置包。
#pkg info
將看到如下信息,系統提示需要安裝pkg工具:
root@localhost:/usr/home/root001 # pkg info
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]:
選擇yes
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg please wait
_http._tcp.pkg.FreeBSD.org
Installing pkg-1.4.7...
Extracting pkg-1.4.7: 100%
Message for pkg-1.4.7:
If you are upgrading from the old package format, first run:
將看到如下信息,系統提示需要安裝pkg工具:
root@localhost:/usr/home/root001 # pkg info
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]:
選擇yes
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg please wait
_http._tcp.pkg.FreeBSD.org
Installing pkg-1.4.7...
Extracting pkg-1.4.7: 100%
Message for pkg-1.4.7:
If you are upgrading from the old package format, first run:
# pkg2ng
pkg: PACKAGESITE in pkg.conf is no longer supported. Convert to the new repository style. See pkg.conf(5)
pkg: Cannot parse configuration file!
系統提示運行pkg2ng 此時配置文件和內部數據庫還未更新
pkg: PACKAGESITE in pkg.conf is no longer supported. Convert to the new repository style. See pkg.conf(5)
pkg: Cannot parse configuration file!
Analysing shared libraries, this will take a while...
pkg: PACKAGESITE in pkg.conf is no longer supported. Convert to the new repository style. See pkg.conf(5)
pkg: Cannot parse configuration file!
更新系統安裝包,在/usr/ports/下運行如下命令:
root@localhost:/usr/ports # portsnap fetch
Looking up portsnap.FreeBSD.org mirrors... 7 mirrors found.
Fetching public key from ec2-ap-southeast-2.portsnap.freebsd.org... done.
Fetching snapshot tag from ec2-ap-southeast-2.portsnap.freebsd.org... done.
Extracting snapshot... done.
Verifying snapshot integrity... done.
Fetching snapshot tag from ec2-ap-southeast-2.portsnap.freebsd.org... done.
Fetching snapshot metadata... done.
Updating from Mon Feb 9 08:16:34 CST 2015 to Mon Feb 9 23:26:07 CST 2015.
Fetching 4 metadata patches... done.
Applying metadata patches... done.
Fetching 0 metadata files... done.
Fetching 33 patches.....10....20....30. done.
Applying patches... done.
Fetching 3 new ports or files... done.
root@localhost:/usr/ports #
然后運行釋放更新命令,這個時間稍微久一些:
root@localhost:/usr/ports # portsnap extract
然后更新目錄和數據庫:
root@localhost:/usr/ports # portsnap fetch update
Looking up portsnap.FreeBSD.org mirrors... 7 mirrors found.
Fetching snapshot tag from ec2-ap-southeast-2.portsnap.freebsd.org... done.
Fetching snapshot metadata... done.
Updating from Mon Feb 9 23:26:07 CST 2015 to Mon Feb 9 23:43:52 CST 2015.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 0 metadata files... done.
Fetching 1 patches. done.
Applying patches... done.
Fetching 0 new ports or files... done.
Removing old files and directories... done.
Extracting new files:
/usr/ports/cad/pcb/
Building new INDEX files... done.
//開始編譯安裝pkg工具
root@localhost:/usr/ports # make && make install clean
或者:
root@localhost:/usr/ports/ports-mgmt/pkg # pkg_add -r pkg
............................
checking for arc4random_uniform... (cached) yes
checking for chflags... yes
checking for chflagsat... no
checking whether we should only build the static version of pkg... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating external/Makefile
config.status: creating scripts/Makefile
config.status: creating docs/Makefile
config.status: creating tests/Makefile
config.status: creating libpkg/Makefile
config.status: creating libpkg/repo/Makefile
config.status: creating libpkg/pkg.h
config.status: creating libpkg/pkg.pc
config.status: creating scripts/periodic/400.status-pkg
config.status: creating scripts/periodic/410.pkg-audit
config.status: creating scripts/periodic/411.pkg-backup
config.status: creating scripts/periodic/460.pkg-checksum
config.status: creating scripts/periodic/490.status-pkg-changes
config.status: creating scripts/sbin/pkg2ng
config.status: creating scripts/completion/_pkg.bash
config.status: creating scripts/completion/_pkg
config.status: creating libpkg/repo/binary/Makefile
config.status: creating pkg_config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing pkg_repos.h commands
config.status: executing mkdir commands
===> Building for pkg-1.4.10
/usr/bin/make all-recursive
CC libucl/src/libucl_la-ucl_emitter.lo
CC libucl/src/libucl_la-ucl_emitter_utils.lo
CC libucl/src/libucl_la-ucl_emitter_streamline.lo
CC libucl/src/libucl_la-ucl_hash.lo
CC libucl/src/libucl_la-ucl_parser.lo
CC libucl/src/libucl_la-ucl_schema.lo
CC libucl/src/libucl_la-ucl_util.lo
CC libucl/src/libucl_la-xxhash.lo
libucl/src/ucl_schema.c: In function 'ucl_schema_validate':
libucl/src/ucl_schema.c:885: warning: 'ret' may be used uninitialized in this function
CC libucl/src/libucl_static_la-ucl_emitter.lo
CC libucl/src/libucl_static_la-ucl_emitter_utils.lo
CC libucl/src/libucl_static_la-ucl_emitter_streamline.lo
CC libucl/src/libucl_static_la-ucl_hash.lo
CC libucl/src/libucl_static_la-ucl_parser.lo
CC libucl/src/libucl_static_la-ucl_schema.lo
CC libucl/src/libucl_static_la-ucl_util.lo
libucl/src/ucl_schema.c: In function 'ucl_schema_validate':
libucl/src/ucl_schema.c:885: warning: 'ret' may be used uninitialized in this function
CC libucl/src/libucl_static_la-xxhash.lo
CC sqlite/libsqlite_la-sqlite3.lo
CC sqlite/libsqlite_la-shell.lo
sqlite/sqlite3.c: In function 'sqlite3BtreeBeginTrans':
sqlite/sqlite3.c:54924: warning: unused variable 'pBlock'
sqlite/sqlite3.c: In function 'balance_nonroot':
sqlite/sqlite3.c:59023: warning: unused variable 'key'
CC sqlite/libsqlite_static_la-sqlite3.lo
CC sqlite/libsqlite_static_la-shell.lo
sqlite/sqlite3.c: In function 'sqlite3BtreeBeginTrans':
sqlite/sqlite3.c:54924: warning: unused variable 'pBlock'
sqlite/sqlite3.c: In function 'balance_nonroot':
sqlite/sqlite3.c:59023: warning: unused variable 'key'
CC expat/lib/libexpat_la-xmlparse.lo
CC expat/lib/libexpat_la-xmlrole.lo
CC expat/lib/libexpat_la-xmltok.lo
CC expat/lib/libexpat_static_la-xmlparse.lo
CC expat/lib/libexpat_static_la-xmlrole.lo
CC expat/lib/libexpat_static_la-xmltok.lo
CC libsbuf/libsbuf_la-subr_sbuf.lo
CC libsbuf/libsbuf_static_la-subr_sbuf.lo
CC picosat/libpicosat_la-picosat.lo
CC picosat/libpicosat_la-version.lo
CC picosat/libpicosat_static_la-picosat.lo
....................
.............................................
pkg: PACKAGESITE in pkg.conf is no longer supported. Convert to the new repository style. See pkg.conf(5)
pkg: Cannot parse configuration file!
系統提示運行pkg2ng 此時配置文件和內部數據庫還未更新
pkg: PACKAGESITE in pkg.conf is no longer supported. Convert to the new repository style. See pkg.conf(5)
pkg: Cannot parse configuration file!
Analysing shared libraries, this will take a while...
pkg: PACKAGESITE in pkg.conf is no longer supported. Convert to the new repository style. See pkg.conf(5)
pkg: Cannot parse configuration file!
更新系統安裝包,在/usr/ports/下運行如下命令:
root@localhost:/usr/ports # portsnap fetch
Looking up portsnap.FreeBSD.org mirrors... 7 mirrors found.
Fetching public key from ec2-ap-southeast-2.portsnap.freebsd.org... done.
Fetching snapshot tag from ec2-ap-southeast-2.portsnap.freebsd.org... done.
Extracting snapshot... done.
Verifying snapshot integrity... done.
Fetching snapshot tag from ec2-ap-southeast-2.portsnap.freebsd.org... done.
Fetching snapshot metadata... done.
Updating from Mon Feb 9 08:16:34 CST 2015 to Mon Feb 9 23:26:07 CST 2015.
Fetching 4 metadata patches... done.
Applying metadata patches... done.
Fetching 0 metadata files... done.
Fetching 33 patches.....10....20....30. done.
Applying patches... done.
Fetching 3 new ports or files... done.
root@localhost:/usr/ports #
然后運行釋放更新命令,這個時間稍微久一些:
root@localhost:/usr/ports # portsnap extract
然后更新目錄和數據庫:
root@localhost:/usr/ports # portsnap fetch update
Looking up portsnap.FreeBSD.org mirrors... 7 mirrors found.
Fetching snapshot tag from ec2-ap-southeast-2.portsnap.freebsd.org... done.
Fetching snapshot metadata... done.
Updating from Mon Feb 9 23:26:07 CST 2015 to Mon Feb 9 23:43:52 CST 2015.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 0 metadata files... done.
Fetching 1 patches. done.
Applying patches... done.
Fetching 0 new ports or files... done.
Removing old files and directories... done.
Extracting new files:
/usr/ports/cad/pcb/
Building new INDEX files... done.
//開始編譯安裝pkg工具
root@localhost:/usr/ports # make && make install clean
或者:
root@localhost:/usr/ports/ports-mgmt/pkg # pkg_add -r pkg
............................
checking for arc4random_uniform... (cached) yes
checking for chflags... yes
checking for chflagsat... no
checking whether we should only build the static version of pkg... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating external/Makefile
config.status: creating scripts/Makefile
config.status: creating docs/Makefile
config.status: creating tests/Makefile
config.status: creating libpkg/Makefile
config.status: creating libpkg/repo/Makefile
config.status: creating libpkg/pkg.h
config.status: creating libpkg/pkg.pc
config.status: creating scripts/periodic/400.status-pkg
config.status: creating scripts/periodic/410.pkg-audit
config.status: creating scripts/periodic/411.pkg-backup
config.status: creating scripts/periodic/460.pkg-checksum
config.status: creating scripts/periodic/490.status-pkg-changes
config.status: creating scripts/sbin/pkg2ng
config.status: creating scripts/completion/_pkg.bash
config.status: creating scripts/completion/_pkg
config.status: creating libpkg/repo/binary/Makefile
config.status: creating pkg_config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing pkg_repos.h commands
config.status: executing mkdir commands
===> Building for pkg-1.4.10
/usr/bin/make all-recursive
CC libucl/src/libucl_la-ucl_emitter.lo
CC libucl/src/libucl_la-ucl_emitter_utils.lo
CC libucl/src/libucl_la-ucl_emitter_streamline.lo
CC libucl/src/libucl_la-ucl_hash.lo
CC libucl/src/libucl_la-ucl_parser.lo
CC libucl/src/libucl_la-ucl_schema.lo
CC libucl/src/libucl_la-ucl_util.lo
CC libucl/src/libucl_la-xxhash.lo
libucl/src/ucl_schema.c: In function 'ucl_schema_validate':
libucl/src/ucl_schema.c:885: warning: 'ret' may be used uninitialized in this function
CC libucl/src/libucl_static_la-ucl_emitter.lo
CC libucl/src/libucl_static_la-ucl_emitter_utils.lo
CC libucl/src/libucl_static_la-ucl_emitter_streamline.lo
CC libucl/src/libucl_static_la-ucl_hash.lo
CC libucl/src/libucl_static_la-ucl_parser.lo
CC libucl/src/libucl_static_la-ucl_schema.lo
CC libucl/src/libucl_static_la-ucl_util.lo
libucl/src/ucl_schema.c: In function 'ucl_schema_validate':
libucl/src/ucl_schema.c:885: warning: 'ret' may be used uninitialized in this function
CC libucl/src/libucl_static_la-xxhash.lo
CC sqlite/libsqlite_la-sqlite3.lo
CC sqlite/libsqlite_la-shell.lo
sqlite/sqlite3.c: In function 'sqlite3BtreeBeginTrans':
sqlite/sqlite3.c:54924: warning: unused variable 'pBlock'
sqlite/sqlite3.c: In function 'balance_nonroot':
sqlite/sqlite3.c:59023: warning: unused variable 'key'
CC sqlite/libsqlite_static_la-sqlite3.lo
CC sqlite/libsqlite_static_la-shell.lo
sqlite/sqlite3.c: In function 'sqlite3BtreeBeginTrans':
sqlite/sqlite3.c:54924: warning: unused variable 'pBlock'
sqlite/sqlite3.c: In function 'balance_nonroot':
sqlite/sqlite3.c:59023: warning: unused variable 'key'
CC expat/lib/libexpat_la-xmlparse.lo
CC expat/lib/libexpat_la-xmlrole.lo
CC expat/lib/libexpat_la-xmltok.lo
CC expat/lib/libexpat_static_la-xmlparse.lo
CC expat/lib/libexpat_static_la-xmlrole.lo
CC expat/lib/libexpat_static_la-xmltok.lo
CC libsbuf/libsbuf_la-subr_sbuf.lo
CC libsbuf/libsbuf_static_la-subr_sbuf.lo
CC picosat/libpicosat_la-picosat.lo
CC picosat/libpicosat_la-version.lo
CC picosat/libpicosat_static_la-picosat.lo
....................
.............................................
===> Installing for pkg-1.4.10
===> Checking if pkg already installed
===> Registering installation for pkg-1.4.10
Installing pkg-1.4.10...
If you are upgrading from the old package format, first run:
# pkg2ng
//系統提示更新數據庫:
root@localhost:/usr/ports/ports-mgmt/pkg # pkg2ng
Converting packages from /var/db/pkg
Analysing shared libraries, this will take a while...
Checking all packages: 100%
root@localhost:/usr/ports/ports-mgmt/pkg # ls
Makefile distinfo files pkg-descr pkg-message pkg-plist work
For more information on available commands and options see 'pkg help'.
//然后更新pkg
root@localhost:/usr/ports/ports-mgmt/pkg # pkg update
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100% 968 B 1.0kB/s 00:01
Fetching packagesite.txz: 100% 5 MiB 58.1kB/s 01:31
Processing entries: 100%
FreeBSD repository update completed. 23775 packages processed
root@localhost:/usr/ports/ports-mgmt/pkg #
//此時在看pkg版本
root@localhost:/usr/ports/ports-mgmt/pkg # pkg -v
1.4.10
此時pkg更新完畢
root@localhost:/usr/ports/ports-mgmt/pkg # pkg2ng
Converting packages from /var/db/pkg
Analysing shared libraries, this will take a while...
Checking all packages: 100%
root@localhost:/usr/ports/ports-mgmt/pkg # ls
Makefile distinfo files pkg-descr pkg-message pkg-plist work
For more information on available commands and options see 'pkg help'.
//然后更新pkg
root@localhost:/usr/ports/ports-mgmt/pkg # pkg update
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100% 968 B 1.0kB/s 00:01
Fetching packagesite.txz: 100% 5 MiB 58.1kB/s 01:31
Processing entries: 100%
FreeBSD repository update completed. 23775 packages processed
root@localhost:/usr/ports/ports-mgmt/pkg #
//此時在看pkg版本
root@localhost:/usr/ports/ports-mgmt/pkg # pkg -v
1.4.10
此時pkg更新完畢
我們利用pkg工具直接安裝web服務所需的程序包,可以一次將所需包安裝,此時pkg自動會將關聯的
支持程序全部安裝,web服務器我們需要nginx php5 及php5-extensions擴展,此擴展包含了gd等的擴展程序
pecl擴展,mysql數據庫
如下:
root@localhost:/usr/local # pkg install nginx php5 php5-extensions pecl-APC mysql56-server
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Updating database digests format: 100%
The following 28 packages will be affected (of 0 checked):
支持程序全部安裝,web服務器我們需要nginx php5 及php5-extensions擴展,此擴展包含了gd等的擴展程序
pecl擴展,mysql數據庫
如下:
root@localhost:/usr/local # pkg install nginx php5 php5-extensions pecl-APC mysql56-server
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Updating database digests format: 100%
The following 28 packages will be affected (of 0 checked):
New packages to be INSTALLED:
nginx: 1.6.2_1,2
php5: 5.4.37
php5-extensions: 1.7
pecl-APC: 3.1.14_1
mysql56-server: 5.6.22
pcre: 8.35_2
libxml2: 2.9.2_2
libiconv: 1.14_6
php5-session: 5.4.37
php5-xmlwriter: 5.4.37
php5-xmlreader: 5.4.37
php5-dom: 5.4.37
php5-xml: 5.4.37
php5-simplexml: 5.4.37
php5-ctype: 5.4.37
php5-posix: 5.4.37
php5-hash: 5.4.37
php5-filter: 5.4.37
php5-tokenizer: 5.4.37
php5-json: 5.4.37
php5-sqlite3: 5.4.37_1
sqlite3: 3.8.8.1
php5-pdo_sqlite: 5.4.37_1
php5-pdo: 5.4.37
php5-iconv: 5.4.37
php5-phar: 5.4.37
perl5: 5.18.4_11
mysql56-client: 5.6.22
nginx: 1.6.2_1,2
php5: 5.4.37
php5-extensions: 1.7
pecl-APC: 3.1.14_1
mysql56-server: 5.6.22
pcre: 8.35_2
libxml2: 2.9.2_2
libiconv: 1.14_6
php5-session: 5.4.37
php5-xmlwriter: 5.4.37
php5-xmlreader: 5.4.37
php5-dom: 5.4.37
php5-xml: 5.4.37
php5-simplexml: 5.4.37
php5-ctype: 5.4.37
php5-posix: 5.4.37
php5-hash: 5.4.37
php5-filter: 5.4.37
php5-tokenizer: 5.4.37
php5-json: 5.4.37
php5-sqlite3: 5.4.37_1
sqlite3: 3.8.8.1
php5-pdo_sqlite: 5.4.37_1
php5-pdo: 5.4.37
php5-iconv: 5.4.37
php5-phar: 5.4.37
perl5: 5.18.4_11
mysql56-client: 5.6.22
The process will require 192 MiB more space.
28 MiB to be downloaded.
28 MiB to be downloaded.
Proceed with this action? [y/N]:
///選擇“y”pkg會自動將所需包全部安裝完畢
Proceed with this action? [y/N]: y
Fetching nginx-1.6.2_1,2.txz: 100% 239 KiB 49.0kB/s 00:05
Fetching php5-5.4.37.txz: 100% 1 MiB 63.0kB/s 00:28
Fetching php5-extensions-1.7.txz: 100% 1 KiB 1.1kB/s 00:01
Fetching pecl-APC-3.1.14_1.txz: 100% 94 KiB 48.6kB/s 00:02
Fetching mysql56-server-5.6.22.txz: 100% 8 MiB 49.5kB/s 02:50
Fetching pcre-8.35_2.txz: 100% 1 MiB 58.7kB/s 00:19
Fetching libxml2-2.9.2_2.txz: 100% 709 KiB 66.0kB/s 00:11
Fetching libiconv-1.14_6.txz: 100% 594 KiB 60.9kB/s 00:10
Fetching php5-session-5.4.37.txz: 100% 29 KiB 29.7kB/s 00:01
Fetching php5-xmlwriter-5.4.37.txz: 100% 12 KiB 13.0kB/s 00:01
Fetching php5-xmlreader-5.4.37.txz: 100% 13 KiB 13.4kB/s 00:01
Fetching php5-dom-5.4.37.txz: 100% 54 KiB 56.0kB/s 00:01
Fetching php5-xml-5.4.37.txz: 100% 19 KiB 19.8kB/s 00:01
Fetching php5-simplexml-5.4.37.txz: 100% 21 KiB 21.5kB/s 00:01
Fetching php5-ctype-5.4.37.txz: 100% 6 KiB 6.7kB/s 00:01
Fetching php5-posix-5.4.37.txz: 100% 11 KiB 11.5kB/s 00:01
Fetching php5-hash-5.4.37.txz: 100% 116 KiB 39.9kB/s 00:03
Fetching php5-filter-5.4.37.txz: 100% 19 KiB 20.3kB/s 00:01
Fetching php5-tokenizer-5.4.37.txz: 100% 8 KiB 8.7kB/s 00:01
Fetching php5-json-5.4.37.txz: 100% 17 KiB 17.6kB/s 00:01
Fetching php5-sqlite3-5.4.37_1.txz: 100% 17 KiB 18.3kB/s 00:01
Fetching sqlite3-3.8.8.1.txz: 100% 660 KiB 96.6kB/s 00:07
Fetching php5-pdo_sqlite-5.4.37_1.txz: 100% 13 KiB 13.5kB/s 00:01
Fetching php5-pdo-5.4.37.txz: 100% 44 KiB 45.5kB/s 00:01
Fetching php5-iconv-5.4.37.txz: 100% 17 KiB 18.0kB/s 00:01
Fetching php5-phar-5.4.37.txz: 100% 101 KiB 104.0kB/s 00:01
Fetching perl5-5.18.4_11.txz: 100% 12 MiB 52.7kB/s 04:14
Fetching mysql56-client-5.6.22.txz: 100% 1 MiB 62.6kB/s 00:30
Checking integrity... done (0 conflicting)
[1/28] Installing libiconv-1.14_6...
[1/28] Extracting libiconv-1.14_6: 100%
[2/28] Installing pcre-8.35_2...
[2/28] Extracting pcre-8.35_2: 100%
[3/28] Installing libxml2-2.9.2_2...
[3/28] Extracting libxml2-2.9.2_2: 100%
[4/28] Installing php5-5.4.37...
[4/28] Extracting php5-5.4.37: 100%
[5/28] Installing php5-dom-5.4.37...
[5/28] Extracting php5-dom-5.4.37: 100%
[6/28] Installing php5-hash-5.4.37...
[6/28] Extracting php5-hash-5.4.37: 100%
[7/28] Installing sqlite3-3.8.8.1...
[7/28] Extracting sqlite3-3.8.8.1: 100%
[8/28] Installing php5-pdo-5.4.37...
[8/28] Extracting php5-pdo-5.4.37: 100%
[9/28] Installing php5-session-5.4.37...
[9/28] Extracting php5-session-5.4.37: 100%
[10/28] Installing php5-xmlwriter-5.4.37...
[10/28] Extracting php5-xmlwriter-5.4.37: 100%
[11/28] Installing php5-xmlreader-5.4.37...
[11/28] Extracting php5-xmlreader-5.4.37: 100%
[12/28] Installing php5-xml-5.4.37...
[12/28] Extracting php5-xml-5.4.37: 100%
[13/28] Installing php5-simplexml-5.4.37...
[13/28] Extracting php5-simplexml-5.4.37: 100%
[14/28] Installing php5-ctype-5.4.37...
[14/28] Extracting php5-ctype-5.4.37: 100%
[15/28] Installing php5-posix-5.4.37...
[15/28] Extracting php5-posix-5.4.37: 100%
[16/28] Installing php5-filter-5.4.37...
[16/28] Extracting php5-filter-5.4.37: 100%
[17/28] Installing php5-tokenizer-5.4.37...
[17/28] Extracting php5-tokenizer-5.4.37: 100%
[18/28] Installing php5-json-5.4.37...
[18/28] Extracting php5-json-5.4.37: 100%
[19/28] Installing php5-sqlite3-5.4.37_1...
[19/28] Extracting php5-sqlite3-5.4.37_1: 100%
[20/28] Installing php5-pdo_sqlite-5.4.37_1...
[20/28] Extracting php5-pdo_sqlite-5.4.37_1: 100%
[21/28] Installing php5-iconv-5.4.37...
[21/28] Extracting php5-iconv-5.4.37: 100%
[22/28] Installing php5-phar-5.4.37...
[22/28] Extracting php5-phar-5.4.37: 100%
[23/28] Installing perl5-5.18.4_11...
[23/28] Extracting perl5-5.18.4_11: 100%
[24/28] Installing mysql56-client-5.6.22...
[24/28] Extracting mysql56-client-5.6.22: 100%
[25/28] Installing nginx-1.6.2_1,2...
===> Creating users and/or groups.
Using existing group 'www'.
Using existing user 'www'.
[25/28] Extracting nginx-1.6.2_1,2: 100%
[26/28] Installing php5-extensions-1.7...
[27/28] Installing pecl-APC-3.1.14_1...
[27/28] Extracting pecl-APC-3.1.14_1: 100%
[28/28] Installing mysql56-server-5.6.22...
===> Creating users and/or groups.
Creating group 'mysql' with gid '88'.
Creating user 'mysql' with uid '88'.
[28/28] Extracting mysql56-server-5.6.22: 100%
Message for pecl-APC-3.1.14_1:
************************************************************************
You may edit /usr/local/etc/php.ini to change this variables:
///選擇“y”pkg會自動將所需包全部安裝完畢
Proceed with this action? [y/N]: y
Fetching nginx-1.6.2_1,2.txz: 100% 239 KiB 49.0kB/s 00:05
Fetching php5-5.4.37.txz: 100% 1 MiB 63.0kB/s 00:28
Fetching php5-extensions-1.7.txz: 100% 1 KiB 1.1kB/s 00:01
Fetching pecl-APC-3.1.14_1.txz: 100% 94 KiB 48.6kB/s 00:02
Fetching mysql56-server-5.6.22.txz: 100% 8 MiB 49.5kB/s 02:50
Fetching pcre-8.35_2.txz: 100% 1 MiB 58.7kB/s 00:19
Fetching libxml2-2.9.2_2.txz: 100% 709 KiB 66.0kB/s 00:11
Fetching libiconv-1.14_6.txz: 100% 594 KiB 60.9kB/s 00:10
Fetching php5-session-5.4.37.txz: 100% 29 KiB 29.7kB/s 00:01
Fetching php5-xmlwriter-5.4.37.txz: 100% 12 KiB 13.0kB/s 00:01
Fetching php5-xmlreader-5.4.37.txz: 100% 13 KiB 13.4kB/s 00:01
Fetching php5-dom-5.4.37.txz: 100% 54 KiB 56.0kB/s 00:01
Fetching php5-xml-5.4.37.txz: 100% 19 KiB 19.8kB/s 00:01
Fetching php5-simplexml-5.4.37.txz: 100% 21 KiB 21.5kB/s 00:01
Fetching php5-ctype-5.4.37.txz: 100% 6 KiB 6.7kB/s 00:01
Fetching php5-posix-5.4.37.txz: 100% 11 KiB 11.5kB/s 00:01
Fetching php5-hash-5.4.37.txz: 100% 116 KiB 39.9kB/s 00:03
Fetching php5-filter-5.4.37.txz: 100% 19 KiB 20.3kB/s 00:01
Fetching php5-tokenizer-5.4.37.txz: 100% 8 KiB 8.7kB/s 00:01
Fetching php5-json-5.4.37.txz: 100% 17 KiB 17.6kB/s 00:01
Fetching php5-sqlite3-5.4.37_1.txz: 100% 17 KiB 18.3kB/s 00:01
Fetching sqlite3-3.8.8.1.txz: 100% 660 KiB 96.6kB/s 00:07
Fetching php5-pdo_sqlite-5.4.37_1.txz: 100% 13 KiB 13.5kB/s 00:01
Fetching php5-pdo-5.4.37.txz: 100% 44 KiB 45.5kB/s 00:01
Fetching php5-iconv-5.4.37.txz: 100% 17 KiB 18.0kB/s 00:01
Fetching php5-phar-5.4.37.txz: 100% 101 KiB 104.0kB/s 00:01
Fetching perl5-5.18.4_11.txz: 100% 12 MiB 52.7kB/s 04:14
Fetching mysql56-client-5.6.22.txz: 100% 1 MiB 62.6kB/s 00:30
Checking integrity... done (0 conflicting)
[1/28] Installing libiconv-1.14_6...
[1/28] Extracting libiconv-1.14_6: 100%
[2/28] Installing pcre-8.35_2...
[2/28] Extracting pcre-8.35_2: 100%
[3/28] Installing libxml2-2.9.2_2...
[3/28] Extracting libxml2-2.9.2_2: 100%
[4/28] Installing php5-5.4.37...
[4/28] Extracting php5-5.4.37: 100%
[5/28] Installing php5-dom-5.4.37...
[5/28] Extracting php5-dom-5.4.37: 100%
[6/28] Installing php5-hash-5.4.37...
[6/28] Extracting php5-hash-5.4.37: 100%
[7/28] Installing sqlite3-3.8.8.1...
[7/28] Extracting sqlite3-3.8.8.1: 100%
[8/28] Installing php5-pdo-5.4.37...
[8/28] Extracting php5-pdo-5.4.37: 100%
[9/28] Installing php5-session-5.4.37...
[9/28] Extracting php5-session-5.4.37: 100%
[10/28] Installing php5-xmlwriter-5.4.37...
[10/28] Extracting php5-xmlwriter-5.4.37: 100%
[11/28] Installing php5-xmlreader-5.4.37...
[11/28] Extracting php5-xmlreader-5.4.37: 100%
[12/28] Installing php5-xml-5.4.37...
[12/28] Extracting php5-xml-5.4.37: 100%
[13/28] Installing php5-simplexml-5.4.37...
[13/28] Extracting php5-simplexml-5.4.37: 100%
[14/28] Installing php5-ctype-5.4.37...
[14/28] Extracting php5-ctype-5.4.37: 100%
[15/28] Installing php5-posix-5.4.37...
[15/28] Extracting php5-posix-5.4.37: 100%
[16/28] Installing php5-filter-5.4.37...
[16/28] Extracting php5-filter-5.4.37: 100%
[17/28] Installing php5-tokenizer-5.4.37...
[17/28] Extracting php5-tokenizer-5.4.37: 100%
[18/28] Installing php5-json-5.4.37...
[18/28] Extracting php5-json-5.4.37: 100%
[19/28] Installing php5-sqlite3-5.4.37_1...
[19/28] Extracting php5-sqlite3-5.4.37_1: 100%
[20/28] Installing php5-pdo_sqlite-5.4.37_1...
[20/28] Extracting php5-pdo_sqlite-5.4.37_1: 100%
[21/28] Installing php5-iconv-5.4.37...
[21/28] Extracting php5-iconv-5.4.37: 100%
[22/28] Installing php5-phar-5.4.37...
[22/28] Extracting php5-phar-5.4.37: 100%
[23/28] Installing perl5-5.18.4_11...
[23/28] Extracting perl5-5.18.4_11: 100%
[24/28] Installing mysql56-client-5.6.22...
[24/28] Extracting mysql56-client-5.6.22: 100%
[25/28] Installing nginx-1.6.2_1,2...
===> Creating users and/or groups.
Using existing group 'www'.
Using existing user 'www'.
[25/28] Extracting nginx-1.6.2_1,2: 100%
[26/28] Installing php5-extensions-1.7...
[27/28] Installing pecl-APC-3.1.14_1...
[27/28] Extracting pecl-APC-3.1.14_1: 100%
[28/28] Installing mysql56-server-5.6.22...
===> Creating users and/or groups.
Creating group 'mysql' with gid '88'.
Creating user 'mysql' with uid '88'.
[28/28] Extracting mysql56-server-5.6.22: 100%
Message for pecl-APC-3.1.14_1:
************************************************************************
You may edit /usr/local/etc/php.ini to change this variables:
apc.enabled="1"
^^^ -> Default value
^^^ -> Default value
apc.shm_size="30"
^^^^ -> Default value
^^^^ -> Default value
* More information on /usr/local/share/doc/APC/INSTALL
Then restart your web server and consult the output of phpinfo().
If there is an informational section for APC, the installation was
successful.
************************************************************************
Message for mysql56-server-5.6.22:
************************************************************************
If there is an informational section for APC, the installation was
successful.
************************************************************************
Message for mysql56-server-5.6.22:
************************************************************************
Remember to run mysql_upgrade the first time you start the MySQL server
after an upgrade from an earlier version.
after an upgrade from an earlier version.
************************************************************************
root@localhost:/usr/local #
//編輯系統啟動文件
//FreeBSD下面自帶vi,ee,編輯器看情況習慣使用
root@localhost:/usr/local #
//編輯系統啟動文件
//FreeBSD下面自帶vi,ee,編輯器看情況習慣使用
root@localhost:/usr/local # ee /etc/rc.conf
//在配置文件中加入下面幾行:
//在配置文件中加入下面幾行:
=====line 16 col 20 lines from top 16 =========================================
# -- sysinstall generated deltas -- # Tue Feb 10 14:06:43 2015
# Created: Tue Feb 10 14:06:43 2015
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
sendmail="NONE"
defaultrouter="192.168.1.1"
hostname="localhost"
ifconfig_em0="inet 192.168.1.105 netmask 255.255.255.0"
keymap="us.iso"
sshd_enable="YES"
###################################
nginx_enable="YES"
mysql_enable="YES"
php_fpm_enable="YES"
# Created: Tue Feb 10 14:06:43 2015
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
sendmail="NONE"
defaultrouter="192.168.1.1"
hostname="localhost"
ifconfig_em0="inet 192.168.1.105 netmask 255.255.255.0"
keymap="us.iso"
sshd_enable="YES"
###################################
nginx_enable="YES"
mysql_enable="YES"
php_fpm_enable="YES"
//按“Esc"退出,提示是否保存時保存並退出
//配置mysql系統文件,此安裝默認將mysql安裝至:/usr/local/share/mysql下
進入目錄,拷貝下面的配置文件至/usr/local/etc
//配置mysql系統文件,此安裝默認將mysql安裝至:/usr/local/share/mysql下
進入目錄,拷貝下面的配置文件至/usr/local/etc
root@localhost:/usr/local # cd share/mysql/
root@localhost:/usr/local/share/mysql # ls
binary-configure errmsg-utf8.txt italian
root@localhost:/usr/local/share/mysql # ls
binary-configure errmsg-utf8.txt italian
mysql_system_tables.sql romanian
bulgarian estonian japanese
bulgarian estonian japanese
mysql_system_tables_data.sql russian
charsets fill_help_tables.sql korean
charsets fill_help_tables.sql korean
mysql_test_data_timezone.sql serbian
czech french magic
czech french magic
mysqld_multi.server slovak
danish german my-default.cnf
danish german my-default.cnf
norwegian spanish
dictionary.txt greek mysql-log-rotate
dictionary.txt greek mysql-log-rotate
norwegian-ny swedish
dutch hungarian mysql.server
dutch hungarian mysql.server
polish ukrainian
english innodb_memcached_config.sql
english innodb_memcached_config.sql
mysql_security_commands.sql portuguese
root@localhost:/usr/local/share/mysql # cp my-default.cnf /usr/local/etc/my.cnf
root@localhost:/usr/local/share/mysql #
root@localhost:/usr/local/share/mysql # cp my-default.cnf /usr/local/etc/my.cnf
root@localhost:/usr/local/share/mysql #
//然后啟動mysql
root@localhost:/usr/local # service mysql-server start
Starting mysql.
root@localhost:/usr/local #
//設置root密碼,系統裝后默認的mysql指令全部在bin下面
root@localhost:/usr/local # service mysql-server start
Starting mysql.
root@localhost:/usr/local #
//設置root密碼,系統裝后默認的mysql指令全部在bin下面
# /usr/local/bin/mysqladmin -u root password '123456'
//配置php
root@localhost:/usr/local/etc # ls
bash_completion.d periodic php.ini-development
devd perl5_version php.ini-production
man.d php pkg
my.cnf php-fpm.conf pkg.conf.sample
nginx php-fpm.conf.default rc.d
pam.d php.conf
root@localhost:/usr/local/etc # mv php.ini-production php.ini
root@localhost:/usr/local/etc # ls
bash_completion.d periodic php.ini
devd perl5_version php.ini-development
man.d php pkg
my.cnf php-fpm.conf pkg.conf.sample
nginx php-fpm.conf.default rc.d
pam.d php.conf
root@localhost:/usr/local/etc #
root@localhost:/usr/local/etc # ls
bash_completion.d periodic php.ini-development
devd perl5_version php.ini-production
man.d php pkg
my.cnf php-fpm.conf pkg.conf.sample
nginx php-fpm.conf.default rc.d
pam.d php.conf
root@localhost:/usr/local/etc # mv php.ini-production php.ini
root@localhost:/usr/local/etc # ls
bash_completion.d periodic php.ini
devd perl5_version php.ini-development
man.d php pkg
my.cnf php-fpm.conf pkg.conf.sample
nginx php-fpm.conf.default rc.d
pam.d php.conf
root@localhost:/usr/local/etc #
//其他保持默認,啟動php-fpm
root@localhost:/usr/local/etc # service php-fpm start
Starting php_fpm.
root@localhost:/usr/local/etc #
root@localhost:/usr/local/etc # service php-fpm start
Starting php_fpm.
root@localhost:/usr/local/etc #
//配置apc,這里也可以直接打開php.ini文件編輯,以下我們直接寫入
root@localhost:/usr/local/etc # echo 'apc.enable="1"' >> /usr/local/etc/php.ini
root@localhost:/usr/local/etc # echo 'apc.shm_size="32M"' >> /usr/local/etc/php.ini
//重新啟動php
root@localhost:/usr/local/etc # service php-fpm restart
Stopping php_fpm.
Waiting for PIDS: 82460.
Starting php_fpm.
root@localhost:/usr/local/etc #
root@localhost:/usr/local/etc # echo 'apc.enable="1"' >> /usr/local/etc/php.ini
root@localhost:/usr/local/etc # echo 'apc.shm_size="32M"' >> /usr/local/etc/php.ini
//重新啟動php
root@localhost:/usr/local/etc # service php-fpm restart
Stopping php_fpm.
Waiting for PIDS: 82460.
Starting php_fpm.
root@localhost:/usr/local/etc #
//下面配置nginx
root@localhost:/usr/local # cd etc/
root@localhost:/usr/local/etc # ls
bash_completion.d my.cnf periodic php-fpm.conf php.ini pkg.conf.sample
devd nginx perl5_version php-fpm.conf.default php.ini-development rc.d
man.d pam.d php php.conf pkg
root@localhost:/usr/local/etc # cd nginx/
root@localhost:/usr/local/etc/nginx # ls
fastcgi_params koi-win nginx.conf scgi_params-dist win-utf
fastcgi_params-dist mime.types nginx.conf-dist uwsgi_params
koi-utf mime.types-dist scgi_params uwsgi_params-dist
root@localhost:/usr/local/etc/nginx # ee nginx.conf
root@localhost:/usr/local # cd etc/
root@localhost:/usr/local/etc # ls
bash_completion.d my.cnf periodic php-fpm.conf php.ini pkg.conf.sample
devd nginx perl5_version php-fpm.conf.default php.ini-development rc.d
man.d pam.d php php.conf pkg
root@localhost:/usr/local/etc # cd nginx/
root@localhost:/usr/local/etc/nginx # ls
fastcgi_params koi-win nginx.conf scgi_params-dist win-utf
fastcgi_params-dist mime.types nginx.conf-dist uwsgi_params
koi-utf mime.types-dist scgi_params uwsgi_params-dist
root@localhost:/usr/local/etc/nginx # ee nginx.conf
#####################################################
#user nobody;
user www;
worker_processes 1;
#user nobody;
user www;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
file "nginx.conf", 118 lines
................
keepalive_timeout 65;
file "nginx.conf", 118 lines
................
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/local/www/nginx;
index index.php index.html index.htm;#這里加入php頁面支持
}
root /usr/local/www/nginx;
index index.php index.html index.htm;#這里加入php頁面支持
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#將這里的注釋#去掉,讓nginx解析php腳本
location ~ \.php$ {
root /usr/local/www/nginx;#修改文件目錄
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#將這里的注釋#去掉,讓nginx解析php腳本
location ~ \.php$ {
root /usr/local/www/nginx;#修改文件目錄
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
//啟動nginx
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
//啟動nginx
root@localhost:/usr/local/etc/nginx # service nginx start
Performing sanity check on nginx configuration:
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
Starting nginx.
root@localhost:/usr/local/etc/nginx #
Performing sanity check on nginx configuration:
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
Starting nginx.
root@localhost:/usr/local/etc/nginx #
此時在瀏覽器輸入http://192.168.1.105/應該能看到如下界面
//進入web默認目錄新建phpinfo.php文件
<?php
phpinfo();
?>
root@localhost:/usr/local/www/nginx # ls
50x.html index.html
EXAMPLE_DIRECTORY-DONT_ADD_OR_TOUCH_ANYTHING phpinfo.php
root@localhost:/usr/local/www/nginx # ee phpinfo.php

//進入web默認目錄新建phpinfo.php文件
<?php
phpinfo();
?>
root@localhost:/usr/local/www/nginx # ls
50x.html index.html
EXAMPLE_DIRECTORY-DONT_ADD_OR_TOUCH_ANYTHING phpinfo.php
root@localhost:/usr/local/www/nginx # ee phpinfo.php