三、 置Web
服務(wù)器
軟件
組合
??? 現(xiàn)在,我們開始配置Web
服務(wù)器
需要的組件或關(guān)鏈組件。成功安裝Linux并啟動(dòng)后,組件的安裝順序一般是Mysql數(shù)據(jù)庫(kù)、Apache、GD庫(kù)、PHP、ZendOptimizer。
??? 首先下載好相應(yīng)的安裝包,筆者在此下載了mysql源代碼文件,以Root帳號(hào)登陸Linux服務(wù)器后,就可以安裝Mysql數(shù)據(jù)庫(kù)了,整個(gè)安裝步驟如下:
??? 3.1 安裝mysql-5.0數(shù)據(jù)庫(kù)
# groupadd mysql # useradd -g mysql mysql # cd /usr/local/src **源文件存放目錄 # tar zxvf mysql-max-5.0.21-linux-i686-glibc23.tar # mv mysql-max-5.0.21-linux-i686-glibc23 /usr/local/mysql # cd /usr/local/mysql # .scripts/mysql_install_db --user=mysql # chown -R root . # chown -R mysql data # chgrp -R mysql . # bin/mysqld_safe --user=mysql & 讓Mysql數(shù)據(jù)庫(kù)服務(wù)器隨Linux系統(tǒng)啟動(dòng)時(shí)自動(dòng)加載: # cd /usr/local/src # 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
??? 3.2 安裝Apach Web服務(wù)器軟件
# cd /usr/local/src # tar zxvf httpd-2.2.4.tar.gz # cd httpd-2.2.4 # ./configure --prefix=/usr/local/apache # make # make install # echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.local(系統(tǒng)啟動(dòng)時(shí)服務(wù)自動(dòng)啟動(dòng))
??? 3.3 安裝PHP GD庫(kù)組件
# cd /usr/local/src # wget -c http://download.discuz.net/gdinstaller.tar.gz # tar xzvf gdinstaller.tar.gz # cd GDInstaller # ./install.sh
??? 3.4 安裝PHP 5.2.1 安裝包:
# cd /usr/local/src # wget -c http://download.discuz.net/php-5.1.2.tar.gz # tar xjvf php-5.2.1.tar.gz # cd php-5.2.1 # ./configure --prefix=/usr/local/apache/php --with-apxs2=/usr/local/apache/bin/apxs \ --with-zlib-dir --with-bz2 --with-tiff-dir --with-libxml-dir --with-gd \ --with-freetype-dir --with-jpeg-dir --with-png-dir --with-ttf --enable-mbstring \ --with-mysql=/usr/local/mysql --with-config-file-path=/etc --disable-ipv6 \ --enable-gd-native-ttf --enable-ftp --enable-zip --enable-ldap --enable-mbregex \ --enable-calendar --enable-curl --disable-debug --enable-inline-optimization # make # make install # cp php.ini-dist /etc/php.ini 編輯apache配置文件httpd.conf # vi /etc/httpd/httpd.conf
??? 要改的有如下幾處:
??? 1、找到LoadModule php5_module modules/libphp5.so前面的#號(hào)去掉(默認(rèn)已去掉注釋)
??? 并在# AddType application/x-gzip .gz .tgz 下加入如下二行:
??? AddType application/x-httpd-php .php
??? AddType application/x-httpd-php-source .phps
??? 2、找到DirectoryIndex index.html ,在index.html之前加上 index.php,讓index.php做為網(wǎng)站默認(rèn)文件。
??? 3.5 安裝ZendOptimizer PHP套件加速包
# cd /usr/local/src # tar xzvf ZendOptimizer-3.0.0-linux-glibc21-i386.tar.gz # cd ZendOptimizer-3.0.0-linux-glibc21-i386 # ./install.sh
??? *注意:安裝Zend過(guò)程中,會(huì)出現(xiàn)二個(gè)文本窗口出現(xiàn),其中提示輸入php.ini位置時(shí),請(qǐng)?zhí)顚?etc。另外一個(gè)窗口則選取“No”選項(xiàng)。?
??? 重啟Linux服務(wù)器后并成功啟動(dòng)Mysql、Apache服務(wù)后,在客戶端處使用Internet Explorer瀏覽器的地址欄輸入Linux服務(wù)器IP地址,就可以顯示出Apache的的默認(rèn)界面了。至此,如果沒(méi)有出現(xiàn)什么錯(cuò)誤,在Linxu配置整個(gè)Web服務(wù)套件的組合安裝基本上完成了。你也可以在Linux服務(wù)器建立測(cè)試文檔查看整個(gè)PHP、Apache、Mysql數(shù)據(jù)庫(kù)、GD庫(kù)以及ZendOptimizer安裝的情況。
??? 3.6 檢查Web服務(wù)套件支持情況
# vi /usr/local/apache/htdocs/test.php ** 在系統(tǒng)默認(rèn)目錄下建立test.php測(cè)試文檔。以下為內(nèi)容: <?php phpinfo(); ?> * 要求熟悉VI文本編輯器基本命令,保存后退出。
??? 在客戶端Internet Explorer瀏覽器輸入:http://IP/test.php。可見到如下圖信息:
1
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
