歡迎您光臨本站 註冊首頁

Apache2.2.4+PHP5.2.1+MySQL5.0.41+openssl0.98e安裝筆記

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

Apache2.2.4+PHP5.2.1+MySQL5.0.41+openssl0.98e安裝筆記(RedHat9.0)(+discuz5.5.0)

Apache2.2.4+PHP5.2.1+MySQL5.0.41+openssl0.98e(+discuz-5.5.0)安裝筆記

此實驗在RedHat9.0上實現,特把過程寫下來,希望能給初學者以指點;並肯請高手給予更多的改進方面的指點。並歡迎各位朋友關注本人博客:http://marion.cublog.cn

其中所需軟體包均可以從網上下載得到,就不再指出路徑。

1.1.安裝mysql-5.0.41
#groupadd mysql
#useradd -g mysql mysql
#tar zxvf mysql-5.0.41.tar.gz
#cd mysql-5.0.41
#./configure --prefix=/usr/local/mysql --enable-thread-safe-client --enable-local-infile --with-charset=gbk --with-extra-charset=all --with-low-memory
#make
#make install
#cp support-files/my-medium.cnf /etc/my.cnf
#cd /usr/local/mysql
#chown -R mysql .
#chgrp -R mysql .
#bin/mysql_install_db --user=mysql
#chown -R root .
#chown -R mysql var
#bin/mysqld_safe --user=mysql &
#cd /usr/local/src/mysql-5.0.41
#cp support-files/mysql.server /etc/rc.d/init.d/mysqld
#chmod 700 /etc/rc.d/init.d/mysqld
#chkconfig --add mysqld
#chkconfig --level 345 mysqld on


測試
#/usr/local/mysql/bin/mysqladmin ping
#/usr/local/mysql/bin/mysqladmin version
#/usr/local/mysql/bin/mysql

添加root密碼
#/usr/local/mysql/bin/mysqladmin -uroot -p

2.安裝zlib-1.2.3

#tar zxvf zlib-1.2.3.tar.gz
#cd zlib-1.2.3
#./configure --prefix=/usr/local/zlib
#make
#make install

3.安裝openssl-0.9.8e

#tar zxvf openssl-0.9.8e.tar.gz
#cd openssl-0.9.8e
#./config shared zlib
#make
#make test
#make install
mv /usr/bin/openssl /usr/bin/openssl.OFF
mv /usr/include/openssl /usr/include/openssl.OFF
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl

配置庫文件搜索路徑

#echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
#ldconfig -v


4.安裝httpd-2.2.4

#tar zxvf httpd-2.2.4.tar.gz
#cd httpd-2.2.4
#./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --with-ssl=/usr/local/ssl --enable-track-vars --enable-rewrite --with-z-dir=/usr/local/zlib --enable-mods-shared=most
#make
#make install

#echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.local(系統啟動時服務自動啟動)

5.安裝libpng-1.2.14

#tar zxvf libpng-1.2.14.tar.gz   
# cd libpng-1.2.14
# cp scripts/makefile.linux makefile
# make (若是提示找不到zlib庫文件或者頭文件,多半是makefile文件里zlib的默認路徑有誤。可編輯makefile文件,找到zlib項並重新指定路徑到/usr/local/zlib/lib和/usr/local/zlib/include)。
# make install

6.安裝freetype-2.1.10

# tar -zvxf freetype-2.1.10.tar.gz
# cd freetype-2.1.10
# mkdir -p /usr/local/freetype
# ./configure --prefix=/usr/local/freetype
# make;make install  

7.安裝jpegsrc.v6b

jpeg默認不會自建目錄,因此需手動建立目錄:
# mkdir -pv /usr/local/jpeg6/{,bin,lib,include,man/man1,man1}

安裝
#tar zxvf jpegsrc.v6b.tar.gz   
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
# make
# make install  
# make install-lib

8.安裝libxml2-2.6.19

# tar -zxf libxml2-2.6.19.tar.gz
# cd libxml2-2.6.19
# mkdir -p /usr/local/libxml2
# ./configure --prefix=/usr/local/libxml2
# make; make install
#cp xml2-config /usr/bin

9.安裝GD-2.0.33庫

# tar -zvxf gd-2.0.33.tar.gz
# mkdir -p /usr/local/gd2
# cd gd-2.0.33
# ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/
--with-png=/usr/local/lib/
--with-zlib=/usr/local/zlib/
--with-freetype=/usr/local/freetype/
# make; make install

10.安裝php-5.2.1

# tar -zvxf php-5.2.1.tar.gz
# mkdir -p /usr/local/php
# cd php-5.2.1
  # ./configure --prefix=/usr/local/php              (注意使用續行符)
  --with-apxs2=/usr/local/apache/bin/apxs
  --with-mysql=/usr/local/mysql
  --with-mysqli=/usr/local/mysql/bin/mysql_config
  --with-xml=/usr/local/libxml2
  --with-png=/usr/local/lib
  --with-jpeg-dir=/usr/local/jpeg6
  --with-zlib=/usr/local/zlib
  --with-freetype=/usr/local/freetype
  --with-gd=/usr/local/gd2  
  --enable-track-vars  
  --enable-mbstring=all
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini

11.編輯apache配置文件httpd.conf
  
  # vi /etc/httpd/httpd.conf
  要改的有如下幾處:
  找到LoadModule php5_module modules/libphp5.so
  前面的#號去掉(默認已去掉註釋)
  #AddType application/x-gzip .gz .tgz
  下加二行
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php-source .phps
  還有找到DirectoryIndex index.html
  加上 index.php 讓它把index.php做為默認頁

12.測試PHP
  
# vi /usr/local/apache/htdocs/index.php(其中/usr/local/apache/htdocs為網頁主目錄)
  添加:
   <?
    phpinfo();
   ?>
  
重新啟動apache伺服器
# /usr/local/apache/bin/apachectl restart
瀏覽器里http://localhost測試一下

13.安裝ZendOptimizer-3.2.6-linux-glibc21-i386

#tar zxvf ZendOptimizer-3.2.6-linux-glibc21-i386.tar.gz
#cd ZendOptimizer-3.2.6
#./install.sh
接下去按提示輸入php.ini文件的位置等即可


14.啟用ssl

(1)下載ssl.ca-0.1.tar.gz(適合新手使用)到/etc/httpd(Apache2.2.4安裝時指定的配置文件目錄)
#tar zxvf ssl.ca-0.1.tar.gz
#cd ssl.ca-0.1

生成根證書
#./new-root-ca.sh
No Root CA key round. Generating one
Generating RSA private key, 1024 bit long modulus
...............................++++++
.......++++++
e is 65537 (0x10001)
Enter pass phrase for ca.key:   (此處要輸入一個密碼,至少四位)
Verifying - Enter pass phrase for ca.key: (重複以上密碼)
Self-sign the root CA...
Enter pass phrase for ca.key:   (剛剛輸過的密碼)
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) :CN
State or Province Name (full name) :HeNan
Locality Name (eg, city) :Zhengzhou
Organization Name (eg, company) :Benet Ltd
Organizational Unit Name (eg, section) :Marion
Common Name (eg, MD Root CA) []:Benet CA
Email Address []:[email protected]
如此可以生成ca.key和ca.crt兩個文件;其中的省份、公司等內容可以按照你自己的相法來設定。

接下來要為伺服器生成一個證書:
# ./new-server-cert.sh server (這個證書的名字是server)
No server.key round. Generating one
Generating RSA private key, 1024 bit long modulus
....++++++
.............++++++
e is 65537 (0x10001)
Fill in certificate data
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) :CN
State or Province Name (full name) :HeNan
Locality Name (eg, city) :Zhengzhou
Organization Name (eg, company) :Benet Ltd
Organizational Unit Name (eg, section) :Marion
Common Name (eg, www.domain.com) []:localhost
Email Address []:[email protected]
You may now run ./sign-server-cert.sh to get it signed
執行結束後生成了server.csr和server.key這兩個文件。但它們還需要簽署一下才能使用。

# ./sign-server-cert.sh server
CA signing: server.csr -> server.crt:
Using configuration from ca.config
Enter pass phrase for ./ca.key:
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName           :PRINTABLE:'CN'
stateOrProvinceName   :PRINTABLE:'HeNan'
localityName          :PRINTABLE:'Zhengzhou'
organizationName      :PRINTABLE:'Benet Ltd'
organizationalUnitName:PRINTABLE:'Marion'
commonName            :PRINTABLE:'localhost'
emailAddress          :IA5STRING:'[email protected]'
Certificate is to be certified until Nov 21 11:58:38 2007 GMT (365 days)
Sign the certificate? :y

1 out of 1 certificate requests certified, commit? y
Write out database with 1 new entries
Data Base Updated
CA verifying: server.crt <-> CA cert
server.crt: OK

(2)接下來要按照/etc/httpd/extra/httpd-ssl.conf裡面的設置,將證書放在適當的位置。
#cp ./server.key /etc/httpd
#cp ./server.crt /etc/httpd
#cd ..
#chmod 400 server.key

(3)編輯/etc/httpd/httpd.conf
找到如下一句,將前面的註釋#去掉
#Include /etc/httpd/extra/httpd-ssl.conf
而後重啟apache即可
#killall -9 httpd
#/usr/local/apache/bin/apachectl start

(4)查看監聽埠,確認裡面有:443埠
#netstat -tnl

(5)https://localhost


附:安裝discuz5.5.0論壇,實現應用測試

1.獲得discuz5.5.0論壇源碼
下載地址為:
http://www.discuz.net/download/download.html
建議下載使用簡體中文的GBK版本。

2.按其說明將upload文件夾中的文件上傳至網站根目錄中
此處應為上文中的/usr/local/apache/htdocs

3.修改網站根目錄中相關文件的許可權
#cd /usr/local/apache/htdocs
#chmod 777 templates
#chmod 777 templates/default
#chmod 777 templates/default/*.*
#chmod 777 attachments
#chmod 777 customavatar
#chmod 777 forumdata
#chmod 777 forumdata/cache
#chmod 777 forumdata/templates
#chmod 777 forumdata/threadcaches
#chmod 777 forumdata/logs

4.修改全局配置文件
#vi config.inc.php
$dbhost = 'localhost';    //資料庫伺服器,如果是本機,可不做更改
$dbuser = 'dbuser';     //資料庫用戶名,此處可改為root
$dbpw = 'dbpw';     //資料庫密碼,即以上用戶的密碼
$dbname = 'discuz';  //資料庫名
$adminemail = '[email protected]'; //論壇系統 Email
$dbreport = 0;   //是否發送資料庫錯誤報告? 0=否, 1=是
此處可先將其許可權更改為666,等論壇安裝完畢后再改為原許可權
#chmod 666 config.inc.php

5.安裝論壇
在你的瀏覽器輸入以下地址即可實現安裝了
http://你的linux主機IP/install.php
安裝腳本會檢查您的伺服器系統環境、剩餘空間、資料庫環境,並具備一定的糾錯功能。

6.其它設置
安全起見,安裝完成後最好刪除install.php文件,並將config.inc.php改為只讀
#rm -f install.php
#chmod 444 config.inc.php

[ 本帖最後由 marion 於 2007-8-6 21:17 編輯 ]
《解決方案》

不知道我寫的夠不夠詳細,歡迎各位進行探討!
《解決方案》

辛苦啦!

學習一下!
呵呵~!~!
《解決方案》

詳細是夠詳細了,可是我覺得有點不足,通常這類文章都是寫給我們菜鳥們看的,所以我覺得應該加上註釋,告訴讀者,這個整合實現了什麼功能,各模塊是用來做什麼的。
《解決方案》

學習中,,,
《解決方案》

--with-gd=/usr/local/gd   
應該為
--with-gd=/usr/local/gd2
測試一下看看ssl行不行先。。哈哈
《解決方案》

原帖由 marion 於 2006-11-30 01:49 發表
不知道我寫的夠不夠詳細,歡迎各位進行探討!
:P:em03::em02::lol::P
確實好,了解一些常用的知識
《解決方案》

RedHat9.0 為何還要用這個版本?
《解決方案》

make 很正常的編譯過去了!
但是到 make test就出現錯誤了!
為什麼我的openssl總是編譯出錯!
錯誤信息是make (1) ****與(亂碼...)與(亂碼...)同文件
error   1

[ 本帖最後由 qiubowinter 於 2006-12-24 17:08 編輯 ]
《解決方案》

very good

[火星人 ] Apache2.2.4+PHP5.2.1+MySQL5.0.41+openssl0.98e安裝筆記已經有691次圍觀

http://coctec.com/docs/service/show-post-26003.html