2013/3/29
038FreeBSD 5.2安裝設定
940616
說明:
本文為以5.2重新架設網路伺服器(class2)之過程記錄 本伺服器主要伺服程式包含 apache2.0.54
php 4.3.11(含pdflib-5.0.4) mysql 4.1.12 webmin-1.2.10
目的作為伺服器的基本組態。
安裝記錄:
1.安裝基本系統:(安裝到可以從遠端登入,詳細步驟請參考相關文件05) 以 FreeBSD 5.2 安裝光碟開機;安裝系統;media (媒體) CD-ROM安裝
以 ports 安裝 bash shell; 設定root 密碼; 設定網路組態;
設定網路卡介面(interface)
開啟 inetd 伺服程式;開啟ftp, telnet服務程式。 增加一遠端登入的使用者;wheel群組
以chsh 指令更改使用者及root的shell 為bash shell 重新開機;遠端登入
2.安裝套件(遠端安裝) 以 telnet 連接 系統 重新登入
2.1 安裝cvsup (目的為保持最新的ports)
cd /usr/ports/net/cvsup make
make install
取得批次檔及設定檔;(由class1.dahan.edu.tw取得,或下載來改名)
ftp class1.dahan.edu.tw cd /usr/local/bin lcd /usr/local/bin get run_cvsup cd /etc
- 1 -
45813388.doc
2013/3/29
lcd /etc
get cvsupfile
get cvsupfile-ports bye
修改 run_cvsup 執行檔
ee /usr/local/bin/run_cvsup
找到 cvsupfile-stable 改成 cvsupfile
chmod 744 /usr/local/bin/run_cvsup
自動更新(加入 crontab)
ee /etc/crontab
在crontab加入一列:(每週4之3點25分執行) 25 3 * * 4 root /usr/local/bin/run_cvsup
---------- 安裝cvsup完成
執行一次 run_cvsup 以更新 ports
2.2 安裝 mysql (mysql-server-4.1.12) cd /usr/ports/databases/mysql41-server 修改編譯指示檔;加入中文字碼 ee Makefile 找到
CONFIGURE_ARGS=
在其後的參數設定中加入: --with-charset=big5 \\
make make install
----- 系統顯示資料 ----- Added group \"mysql\". Added user \"mysql\".
install-info --quiet /usr/local/info/mysql.info /usr/local/info/dir ===> Installing rcNG startup script(s)
===> Compressing manual pages for mysql-server-4.1.12
- 2 -
45813388.doc
2013/3/29
===> Registering installation for mysql-server-4.1.12 ===> SECURITY REPORT:
This port has installed the following files which may act as network servers and may therefore pose a remote security risk to the system. /usr/local/libexec/mysqld
This port has installed the following startup scripts which may cause these network services to be started at boot time. /usr/local/etc/rc.d/mysql-server.sh
If there are vulnerabilities in these programs there may be a security risk to the system. FreeBSD makes no guarantee about the security of ports included in the Ports Collection. Please type 'make deinstall' to deinstall the port if this is a concern.
For more information, and contact details about the security status of this software, see the following webpage: http://www.mysql.com/ -----顯示資料 結束 -----
----- 安裝 mysql 完成 啟始資料庫
/usr/local/bin/mysql_install_db
-----顯示資料 開始 ----- Installing all prepared tables Fill help tables
To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/local/bin/mysqladmin -u root password 'new-password'
/usr/local/bin/mysqladmin -u root -h class2.dahan.edu.tw password 'new-password' See the manual for more instructions.
You can start the MySQL daemon with: cd /usr/local ; /usr/local/bin/mysqld_safe &
- 3 -
45813388.doc
2013/3/29
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory: cd sql-bench ; perl run-all-tests
Please report any problems with the /usr/local/bin/mysqlbug script!
The latest information about MySQL is available on the web at http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com -----顯示資料 結束-----
變更檔案擁有者:
chown -R mysql:mysql /var/db/mysql
---------- 這部分等 webmin 安裝妥後再安裝 ----- 設定密碼:
/usr/local/bin/mysqladmin -u root password '12345'
/usr/local/bin/mysqladmin -u root -h class2.dahan.edu.tw password '12345'
進入 webmin 處理 伺服器:
警告:您的系統上沒有安裝Perl模組 DBI和DBD::mysql,
所以Webmin無法順利的連線到您的MySQL資料庫,按這兒來安裝。
自動安裝失敗;改用手動安裝:
cd /usr/ports/databases/p5-DBI make
make install
cd /usr/ports/databases/p5-DBD-mysql make
make install
---------- 這部分等 webmin 安裝妥後再安裝 完成 -----
2.3 安裝 openssl (openssl-0.9.7g) cd /usr/ports/security/openssl make
make install
-----顯示資料 -----
===> Compressing manual pages for openssl-0.9.7g ===> Running ldconfig
- 4 -
45813388.doc
2013/3/29
/sbin/ldconfig -m /usr/local/lib
===> Registering installation for openssl-0.9.7g ===> SECURITY REPORT:
This port has installed the following files which may act as network servers and may therefore pose a remote security risk to the system. /usr/local/bin/openssl /usr/local/lib/libcrypto.so.3 /usr/local/lib/libssl.so.3
If there are vulnerabilities in these programs there may be a security risk to the system. FreeBSD makes no guarantee about the security of ports included in the Ports Collection. Please type 'make deinstall' to deinstall the port if this is a concern.
For more information, and contact details about the security status of this software, see the following webpage: http://www.openssl.org/ -----顯示資料 -----
----- 安裝 openssl 完成
2.4 安裝 webmin (webmin-1.210.tar.gz) cd /usr/ports/sysutils/webmin make
make install
-----顯示資料 -----
===> Returning to build of webmin-1.210
===> webmin-1.210 depends on file: /usr/local/bin/perl5.6.1 - found ===> Generating temporary packing list
===> Checking if sysutils/webmin already installed @comment Insert PLIST.lib-webmin here =================================== To reconfigure webmin you should run the following command as root:
${LOCALBASE}/lib/webmin/setup.sh
You won't have to perform this step after every webmin upgrade.
- 5 -
45813388.doc
2013/3/29
Since 1.150_2, to run webmin from startup, add webmin_enable=\"YES\" in your /etc/rc.conf.
=================================== ===> Registering installation for webmin-1.210 -----顯示資料 完 -----
設定開機時即啟動: ee /etc/rc.conf 加入一列:
webmin_enable=\"YES\"
----- 安裝 webmin 完成 ----- 設定webmin
/usr/local/lib/webmin/setup.sh
*********************************************************************** * Welcome to the Webmin setup script, version 1.210 * *********************************************************************** Webmin is a web-based interface that allows Unix-like operating systems and common Unix services to be easily administered.
Installing Webmin in /usr/local/lib/webmin ...
*********************************************************************** Webmin uses separate directories for configuration files and log files. Unless you want to run multiple versions of Webmin at the same time you can just accept the defaults.
Config file directory [/usr/local/etc/webmin]: Log file directory [/var/log/webmin]:
*********************************************************************** Webmin is written entirely in Perl. Please enter the full path to the Perl 5 interpreter on your system.
Full path to perl (default /usr/bin/perl):
- 6 -
45813388.doc
2013/3/29
Testing Perl ...
Perl seems to be installed ok
*********************************************************************** Operating system name: FreeBSD Operating system version: 2004
*********************************************************************** Webmin uses its own password protected web server to provide access to the administration programs. The setup script needs to know : - What port to run the web server on. There must not be another web server already using this port.
- The login name required to access the web server. - The password required to access the web server.
- If the webserver should use SSL (if your system supports it). - Whether to start webmin at boot time.
Web server port (default 10000): Login name (default admin): Login password: Password again: Use SSL (y/n): y
*********************************************************************** Creating web server config files.. ..done
Creating access control file.. ..done
Creating start and stop scripts.. ..done
Copying config files.. ..done
Creating uninstall script /usr/local/etc/webmin/uninstall.sh .. ..done
- 7 -
45813388.doc
2013/3/29
Changing ownership and permissions .. ..done
Running postinstall scripts .. ..done
Attempting to start Webmin mini web server.. ..done
*********************************************************************** Webmin has been installed and started successfully. Use your web browser to go to
https://class2.dahan.edu.tw:10000/
and login with the name and password you entered previously.
Because Webmin uses SSL for encryption only, the certificate it uses is not signed by one of the recognized CAs such as Verisign. When you first connect to the Webmin server, your browser will ask you if you want to accept the certificate presented, as it does not recognize the CA. Say yes.
設定完成;系統會自動執行; 可以下列方式登入:
https://class2.dahan.edu.tw:10000/ 登入後可先調整語系。
有關伺服器的管理,必頇在webmin中,各伺服器的組態設定中設定相關的路徑後,才可正確執行;設定例請參考附件
2.5 安裝PHP前,先安裝相關的 package cd /usr/ports/graphics/jpeg make
make install
===> Running ldconfig /sbin/ldconfig -m /usr/local/lib
===> Registering installation for jpeg-6b_3
- 8 -
45813388.doc
2013/3/29
cd /usr/ports/graphics/tiff make
make install
===> Running ldconfig /sbin/ldconfig -m /usr/local/lib
===> Registering installation for tiff-3.7.2
cd /usr/ports/devel/t1lib make
make install
===> Running ldconfig /sbin/ldconfig -m /usr/local/lib
===> Registering installation for t1lib-5.0.1,1
安裝PDFlib;
由於新版的PDFlib (PDFlib-Lite-6.0.1) 刪除了某函數(pdf_open_fp),造成和其他相依的軟體配合出了問題;所以只好使用舊的版本;php已內建pdf的支援程式;可是還頇要lib及include的pdflib程式(可參看下文make install的顯示資料);目前採用的是5.0.4的版本。
先取得軟體:PDFlib-Lite-5.0.4p1-Unix-src存到 /usr/ports/distfiles mkdir /tmp/work cd /tmp/work
tar zxvf /usr/ports/distfiles/PDFlib-Lite-5.0.4p1-Unix-src.tar.gz cd /tmp/work/PDFlib-Lite-5.0.4p1-Unix-src ./configure
-----顯示資料 完 -----
_____________________________________________________________ For your convenience, here's a summary of configure's results:
Support for shared libraries: yes C++ language binding for PDFlib: yes Java language binding for PDFlib: no Perl language binding for PDFlib: yes Python language binding for PDFlib: no Tcl language binding for PDFlib: no PDF import library (PDI): no
- 9 -
45813388.doc
2013/3/29
Note: if you purchase the additional PDF import library (PDI) you can also manipulate existing PDF documents with PDFlib. The additional block feature can be used to personalize PDF. See http://www.pdflib.com for details.
Please observe the licensing terms for commercial PDFlib usage.
PDFlib license agreement and purchase order can be found in the doc directory. -----顯示資料 完 -----
make
make install
-----顯示資料 -----
if test ! -d /usr/local/lib ; then mkdir -p /usr/local/lib; chmod 755 /usr/local/lib; fi
if test ! -d /usr/local/include ; then mkdir -p /usr/local/include; chmod 755 /usr/local/include; fi
../../config/install-sh -c -m 4 pdflib.h /usr/local/include
../../libtool --silent ../../config/install-sh -c -m 4 libpdf.la /usr/local/lib; ../../../libtool --silent --mode=install ../../../config/install-sh -c -m 4 p dflib_pl.la /usr/local/lib/perl5/site_perl/5.6.1/mach
../../../config/install-sh -c -m 4 pdflib_pl.pm /usr/local/lib/perl5/site_perl/5.6.1/mach ./config/install-sh -c pdflib-config /usr/local/bin -----顯示資料 完 -----
2.6 安裝 mod_php4
先處理php4 ( mod_php4 使用 php4 的 Makefile 檔) cd /usr/ports/lang/php4 ee Makefile
找到:
CONFIGURE_ARGS= --enable-versioning \\ --enable-memory-limit \\ --with-layout=GNU \\
--with-config-file-scan-dir=${PREFIX}/etc/php \\ --disable-all
改成:(php4 內建支援 pdf;在work/php-4.3.11/ext/pdf的目錄內)
CONFIGURE_ARGS= --enable-versioning \\
- 10 -
45813388.doc
2013/3/29
--enable-memory-limit \\ --with-layout=GNU \\
--with-config-file-scan-dir=${PREFIX}/etc/php \\ --with-gd --enable-gd-native-ttf --enable-gd-jis-conv \\ --with-t1lib \\ --enable-mbstring \\ --enable-mbregex \\ --enable-cli \\
--with-zlib-dir=/usr \\ --with-jpeg-dir=/usr/local \\ --with-png-dir=/usr/local \\ --with-pdf \\ --prefix=/usr/local
修改完後返回 mod_php4: cd /usr/ports/www/mod_php4 make
Options for mod_php4 4.3.11_1,1
[X] APACHE2 Use apache 2.x instead of apache 1.3.x [ ] DEBUG Enable debug [X] IPV6 Enable ipv6 support [X] OPENSSL Build static OpenSSL extension
安裝mod_php4 前會先安裝 APACHE
-----顯示資料 -----
cp .libs/libphp4.so /usr/local/libexec/apache2/libphp4.so
libtool: install: warning: remember to run `libtool --finish /usr/ports/www/mod_ php4/work/php-4.3.11/libs'
grep: /usr/local/libexec/apache2/libphp4.la: No such file or directory grep: /usr/local/libexec/apache2/libphp4.la: No such file or directory Warning! dlname not found in /usr/local/libexec/apache2/libphp4.la. Assuming installing a .so rather than a libtool archive. chmod 755 /usr/local/libexec/apache2/libphp4.so
[activating module `php4' in /usr/local/etc/apache2/httpd.conf] Installing build environment: /usr/local/lib/php/build/ Installing header files: /usr/local/include/php/ Installing helper programs: /usr/local/bin/ program: phpize
- 11 -
45813388.doc
2013/3/29
program: php-config program: phpextdist
***************************************************************
Make sure index.php is part of your DirectoryIndex.
You should add the following to your Apache configuration file:
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
*************************************************************** ===> Registering installation for mod_php4-4.3.11_1,1 -----顯示資料 -----
----- 安裝 php_mod4 完成
2.7 修改 apache2 設定
ee /usr/local/etc/apache2/httpd.conf 修改下列資料:
ServerAdmin cyr@cyr.idv.tw
# DirectoryIndex index.html index.html.var index.php AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps ----- 修改 apache2 設定完成 ----- 修改 php 設定 cp /usr/local/etc/php.ini-recommended /usr/local/etc/php.ini ee /usr/local/etc/php.ini - 12 - 45813388.doc 2013/3/29 修改下列資料: ;;;;;;;;;;;;;;;;;;; ; Resource Limits ; ;;;;;;;;;;;;;;;;;;; max_execution_time = 300 ; Maximum execution time of each script, in seconds max_input_time = 60 ; Maximum amount of time each script may spend parsing r memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) ----- 修改 php 設定 完成 ----- 檢查環境設定 mkdir /home/cyr/web chown cyr:www /home/cyr/web ee /home/cyr/web/phpinfo.php phpinfo(); ?> ee /home/cyr/web/pdftest.php $pdf = pdf_new(); pdf_open_file($pdf, \"test.pdf\"); pdf_set_info($pdf, \"Author\ pdf_set_info($pdf, \"Title\pdf_set_info($pdf, \"Creator\pdf_set_info($pdf, \"Subject\pdf_begin_page($pdf, 595, 842); pdf_add_outline($pdf, \"Page 1\"); $font = pdf_findfont($pdf, \"Times New Roman\pdf_setfont($pdf, $font, 10); pdf_set_value($pdf, \"textrendering\ pdf_show_xy($pdf, \"Times Roman outlined\pdf_moveto($pdf, 50, 740); pdf_lineto($pdf, 330, 740); pdf_stroke($pdf); pdf_end_page($pdf); - 13 - 45813388.doc 2013/3/29 pdf_close($pdf); pdf_delete($pdf); echo \"finished\"; ?> chown cyr:www /home/cyr/web/phpinfo.php chmod 755 /home/cyr/web/phpinfo.php chown cyr:www /home/cyr/web/pdftest.php chmod 755 /home/cyr/web/pdftest.php 執行 phpinfo 看看是否正確 (apache必頇先跑起來;可使用 webmin 去啟動) ======================================================== 2.8 webmin 的 apache2的組態修正: 組態設定 給模組 Apache 網頁伺服器 給 Apache 網頁伺服器 的可組態選項 Configurable 選項 顯示虛擬伺服器 依 ⊙ 圖示 列表 排序虛擬伺服器 依 ⊙ 設定檔案內的位置 伺服器名稱 IP位置 最多顯示的伺服器數量 新增虛擬伺服器檔案到 100 ⊙ httpd.conf ⊙ Default ($DOM.conf) Filename pattern for virtual servers 測試設定檔案在套用變更前? 測試設定檔案在手動變更後? 測試設定檔案在其他變更後? 測試組態檔指令 httpd 加上 -D 參數 顯示Apache管理名稱 ⊙ 是 否 是 ⊙ 否 是 ⊙ 否 ⊙ apachectl configtest 是 否 Apache文件根目錄 ⊙ Apache全球網站 系統組態 Apache伺服器根目錄 /usr/local/etc/apache ==> /usr/local/www/data httpd的執行路徑 Apache版本? apachectl指令路徑 無 ⊙ /usr/local/sbin/apachectl 啟動 Apache 的命令 ⊙ 使用apachectl或手動啟動 停止 Apache 的命令 ⊙ 使用apachectl或砍掉程序 /usr/local/sbin/httpd 不變 - 14 - 45813388.doc 2013/3/29 套用組態指令 ⊙ 使用apachectl 或 HUP訊號 httpd.conf路徑 自動 ⊙ /usr/local/etc/apache/httpd.conf ==> /usr/local/etc/apache2/httpd.conf srm.conf 路徑 自動 ⊙ /usr/local/etc/apache2/srm.conf access.conf 路徑 自動 ⊙ /usr/local/etc/apache2/access.conf mime.types 路徑 自動 ⊙ /usr/local/etc/apache2/mime.types Apache PID檔案路徑 <- 回到 索引 ⊙ 自動執行 ====================================================== 2.9 webmin 的 mysql的組態修正: 組態設定 給模組 MySQL 資料庫伺服器 給 MySQL 資料庫伺服器 的可組態選項 組態選項 資料庫管理者名稱 root 資料庫管理者密碼 ⊙ 不改變 Set to 每頁顯示的列數 25 顯示資料庫與表格為 清單 ⊙ 圖示 使用垂直列編輯介面 ⊙ 是 否 顯示粗體欄在 ⊙ 表格中資料 下載連結 如果可以的話使用DBI連接? ⊙ 是 否 執行strftime 取代備份目標? Password hashing mode 是 ⊙ 否 Old ⊙ Default Encoding for database ⊙ content 系統組態 到 mysqlshow 指令的完整路徑 /usr/local/bin/mysqlshow 到 mysqladmin 指令的完整路徑 /usr/local/bin/mysqladmin 到 mysql 指令的完整路徑 /usr/local/bin/mysql mysqldump指令路徑 /usr/local/bin/mysqldump mysqlimport指令路徑 /usr/local/bin/mysqlimport (/usr/local/bin/safe_mysqld || 啟動 MySQL 伺服器的命令 /usr/local/bin/mysqld_safe) & 停止 MySQL 伺服器的命令 ⊙ 自動 到 MySQL 共享函式庫的路徑 無 /usr/local/lib/mysql Path to MySQL databases directory 連接MySQL主機道 ⊙ 本地端 MySQL連接埠 ⊙ 預設 MySQL socket 檔案 ⊙ 預設 None /usr/local/var/mysql - 15 - 45813388.doc 2013/3/29 ================================================================= 錯誤處理參考: -----顯示資料 ----- /bin/sh /usr/local/bin/libtool15 --silent --mode=link cc -O -pipe -mcpu=pentiuma ===> Installing for expat-1.95.8_2 ===> Generating temporary packing list ===> Checking if textproc/expat2 already installed ===> An older version of textproc/expat2 is already installed (expat-1.95.6_1) You may wish to ``make deinstall'' and install this port again by ``make reinstall'' to upgrade it properly. If you really wish to overwrite the old port of textproc/expat2 without deleting it first, set the variable \"FORCE_PKG_REGISTER\" in your environment or the \"make install\" command line. *** Error code 1 Stop in /usr/ports/textproc/expat2. *** Error code 1 Stop in /usr/ports/www/apache2. *** Error code 1 Stop in /usr/ports/www/mod_php4. -----顯示資料 ----- 原因: textproc/expat2的版本舊,要更新: 切換過去 cd /usr/ports/textproc/expat2 make deinstall make reinstall ----- 處理完成 ----- 錯誤處理參考: webmin 啟動 Apache 失敗 : Syntax error on line 274 of /usr/local/etc/apache2/httpd.conf: Cannot load /usr/local/libexec/apache2/libphp4.so into server: /usr/local/libexec/apache2/libphp4.so: Undefined symbol \"PDF_open_fp\" mod_php4 include pdflib 時,新的版本(pdflib-6.0.1)已沒有 \"PDF_open_fp\" 的函數,可是 libphp4.so 中還有,導致失敗 - 16 -
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- huatuo0.cn 版权所有 湘ICP备2023017654号-2
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务