- 論壇徽章:
- 1
|
作者:樹偉 出處:Unix愛好者家園unix-cd.com
在SCO UNIXWARE 7.1.1 系統(tǒng)中安裝Apache + PHP4 + MySQL + PGSQL
樹偉 2003.10.31
我的系統(tǒng)環(huán)境:SCO UNIXWARE7.1.1 PIII 600X2 128MB 20GB(SCSI)+60GB(IDE) Intel芯片組
所需組件:
apache-1.3.26.pkg : Apache Web Server (i386) 1.3.26
zlib-1.1.4.pkg : zlib - unencumbered lossless data-compression library (i386) 1.1.4
glibs-2.0.3.pkg : glibs - graphics libraries and headers (i386) Version 2.0.3
glib-1.2.8.pkg : glib - handy library of C utility functions (i386) 1.2.8
openssl-0.9.6e.pkg : OpenSSL - Secure Sockets Layer / TLS cryptography toolkit (i386) 0.9.6e
php4-4.1.2.pkg : PHP - server-side, cross-platform, HTML embedded scripting language (i386) 4.1.2
mysql-3.22.30.pkg : MySQL - SQL database server (i386) 3.22.30
gzip-1.2.4.pkg : gzip - GNU file compression utilities (i386) Version 1.2.4
postgresq-7.2.pkg : PostgreSQL Data Base Management System (i386) 7.2
phpMyAdmin-2.2.4-php.tar.gz
phpPgAdmin_2-3.tar.gz
以上組件除phpMyAdmin-2.2.4-php.tar.gz和phpPgAdmin_2-3.tar.gz外均來自:
ftp://ftp2.caldera.com/pub/skunkware/uw7/Packages/
這個(gè)鏈接打開速度很慢,至少在我這兒是相當(dāng)慢的。
全部下載后就開始按順序安裝吧,很辛苦的啦。
除最后兩個(gè)組件外,其余的均用pkgadd -d /path/package軟件管理工具安裝。
...... was successful. (是軟件包安裝成功的提示)
把所有上面提到的文檔下載到本地后,就可以開始安裝了。
注:在安裝postgresq-7.2.pkg這個(gè)包時(shí),會(huì)自動(dòng)創(chuàng)建用戶postgres,并提示輸入口令
之后會(huì)為PGSQL設(shè)置核心參數(shù):SHMMAX 如果此參數(shù)足夠大,可以敲 no 不理會(huì),否則還是敲yes吧。
如果以后想修改SHMMAX 可以如下操作:
# /etc/conf/bin/idtune -m SHMMAX 10485760
# /etc/conf/bin/idbuild
# cd /
# shutdown -y -g0
所有組件全部裝完后修改文件:
# vi /usr/local/apache/conf/httpd.conf
## 在 AddType application/x-tar .tgz 后插入一行:
AddType application/x-httpd-php .php
## 修改此行:
## DirectoryIndex index.html 為:
DirectoryIndex index.php index.html
創(chuàng)建一個(gè)鏈接:
ln -s /usr/bin/hostname /usr/local/bin/hostname
## 激活A(yù)pache WEB 服務(wù)器
# apache enable
# apache start
好啦,第一步完成,你可以測(cè)試一下:
新建文件:
# vi /usr/lib/apache/htdocs/default.php
內(nèi)容如下:
啟動(dòng)瀏覽器,在地址處輸入:
![]()
http://localhost/default.php
應(yīng)該顯示輸入的文字及PHP的相關(guān)信息。
為Postgresql自由數(shù)據(jù)庫的啟動(dòng)做準(zhǔn)備:
首先
# vi /etc/services
## 增加一行:
postgresql 5432/tcp # Postgres SQL Connect-Port
然后重新啟動(dòng)機(jī)器,以使SHMMAX核心參數(shù)及5432/tcp端口生效,系統(tǒng)引導(dǎo)后以postgres用戶登錄(這個(gè)用戶是安裝PostgreSQL Data Base Management System時(shí),由安裝腳本創(chuàng)建的)
查看該用戶的.profile文件,關(guān)注環(huán)境變量MANPATH、PGLIB、PGDATA、USER,如果都設(shè)置正確,就可以創(chuàng)建數(shù)據(jù)庫集群了,方法如下:
initdb -D /usr/local/pgsql/data
***請(qǐng)注意你必須以 Postgres 用戶的身份來執(zhí)行這條命令。
技巧: 作為 -D選項(xiàng)的替代品,你還可以使用環(huán)境變量 PGDATA
系統(tǒng)提示如下:
$ initdb
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
Fixing permissions on existing directory /usr/local/pgsql/data... ok
creating directory /usr/local/pgsql/data/base... ok
creating directory /usr/local/pgsql/data/global... ok
creating directory /usr/local/pgsql/data/pg_xlog... ok
creating directory /usr/local/pgsql/data/pg_clog... ok
creating template1 database in /usr/local/pgsql/data/base/1... ok
creating configuration files... ok
initializing pg_shadow... ok
enabling unlimited row size for system tables... ok
creating system views... ok
loading pg_description... ok
vacuuming database template1... ok
copying template1 to template0... ok
Success. You can now start the database server using:
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
or
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
啟動(dòng)數(shù)據(jù)庫:
$ pg_ctl -l $HOME/data/server.log start
postmaster successfully started
$ cat data/server.log
DEBUG: database system was shut down at 2003-10-31 19:22:27 CST
DEBUG: checkpoint record is at 0/109664
DEBUG: redo record is at 0/109664; undo record is at 0/0; shutdown TRUE
DEBUG: next transaction id: 89; next oid: 16556
DEBUG: database system is ready
$ pg_ctl stop
waiting for postmaster to shut down......done
postmaster successfully shut down
$ pg_ctl -l $PGDATA/server.log start
postmaster successfully started
致此,PGSQL自由數(shù)據(jù)庫已經(jīng)正常工作啦。 :)
/***************************************************
如果要在系統(tǒng)每次啟動(dòng)時(shí)都啟動(dòng)PGSQL 在/etc/rc2.d/目錄下創(chuàng)建S99pgsql文件
# cat /etc/rc2.d/S99pgsql
#
# Start/Stop PGSQL
#
# PGDATA='/usr/local/pgsql/data'
case "$1" in
start)
su - postgres -c '/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/data/server.log start'
;;
stop)
su - postgres -c '/usr/local/pgsql/bin/pg_ctl stop' postgres
;;
*)
exit 1
esac
exit 0
然后為此文件加執(zhí)行權(quán)限:
chmod +x /etc/rc2.d/S99pgsql
***************************************************/
##############上面這一段不用了,原來PGSQL也提供了一個(gè)腳本,我剛才發(fā)現(xiàn)的,hoho。
# /etc/init.d/postgresql enable
# /etc/rc2.d/S97pgsql start
這樣就搞定了,哈哈,覺得自己有些笨。
現(xiàn)在建一個(gè)數(shù)據(jù)庫試試吧
$ createdb temp
$ psql temp
temp=# create table test (t1 char(9),t2 int);
temp=# select * from test;
t1 | t2
----+----
(0 rows)
temp=#
temp=#\q
$
temp=# 是進(jìn)入psql后的提示符,前面的temp表示你正在操作的當(dāng)前數(shù)據(jù)庫是"temp"。如果不建數(shù)據(jù)庫,psql就不能用,psql 后面一定要跟一個(gè)數(shù)據(jù)庫名,缺省是postgres
你也可以先建一個(gè)叫postgres的數(shù)據(jù)。
好了,用吧,具說PGSQL是個(gè)精品數(shù)據(jù)庫呢,我也是才拿到UW711系統(tǒng),花了一天時(shí)間搞定的,加上改SHELL,用了我兩天時(shí)間,不過精力不是很集中的哈。
好了,PGSQL已經(jīng)一切OK了。
為MySQL啟動(dòng)做準(zhǔn)備:
# vi /etc/services
## 增加一行:
mysql 3306/tcp MySQL_Connect-Port
啟動(dòng)mysql數(shù)據(jù)庫,執(zhí)行方法:
# /etc/init.d/mysql start
## 增加路徑: /usr/local/bin
# vi /etc/profile
## 在最后增加一行:
PATH=$PATH:/usr/local/bin
重新登錄root 執(zhí)行
# mysql
.
.
.
mysql>show databases;
應(yīng)該可以看到兩個(gè)數(shù)據(jù)庫 mysql & test
現(xiàn)在該小小慶賀一下了吧。
最后將MySQL管理軟件phpMyAdmin裝上,這個(gè)軟件可以在網(wǎng)上搜索到,下載后解壓。
# cd /tmp
# gunzip phpMyAdmin-2.2.4-php.tar.gz
# cd /usr/local/apache/htdocs
# tar xvf /tmp/phpMyAdmin-2.2.4-php.tar
# mv PhpMyAdmin-2.2.4 admin ## 只是為了方便一些:)
在瀏覽器地址欄輸入:
![]()
http://localhost/admin/main.php
如果看到一個(gè)MySQL的管理頁面就大功告成啦,這個(gè)MySQL是3.21.26伽馬版的,蠻穩(wěn)定的。在使用MySQL管理工具時(shí),由于版本問題會(huì)出現(xiàn)一些錯(cuò)誤,原因是phpMyAdmin管理模塊是基于MySQL3.23以上版本的,所以有些小的錯(cuò)誤。如果你有興趣可以下載新版的源代碼然后自己編譯。
相關(guān)網(wǎng)站:
PHP:
![]()
http://www.php.net
Apache:
![]()
http://www.apache.org
MySQL:
![]()
http://www.mysql.com
OpenSSL:
![]()
http://www.openssl.org
Postpres:
![]()
http://www.pgsql.org
記得編譯前還要下載egcs,freetype,jpeg,zlib,gd,gcc,autoconf,libtool,FSU,GNU awk,GNU make,Flex,cvs,M4,GNU ar,patch等一系列組件及GNU編譯環(huán)境,有一部分也是在www.sco.com/skunkware上可以找到的,其余的就自己奮斗吧,祝你好運(yùn)啦。
SCO的這個(gè)二進(jìn)制版的PHP是和圖形庫GD-Library一起編譯的,你可以在PHP腳本程序中調(diào)用動(dòng)態(tài)圖像操作函數(shù),PHP提供了相當(dāng)豐富的圖像接口函數(shù)(大約有44個(gè)以上),功能十分強(qiáng)大,現(xiàn)在你就可以使用GIF或PNG圖像流了。
祝你成功@_@
樹偉:
QQ:1502384,ICQ:190492112 Mail to : shuweich@yahoo.com.cn,shuweich@163.com
本文來自ChinaUnix博客,如果查看原文請(qǐng)點(diǎn):http://blog.chinaunix.net/u/31/showart_526228.html |
|