linux下安裝apache,mysql,php5簡單過程和整理

安裝apache
tar -xvzf httpd-2.2.22.tar.gz
./configure --enable-dav --enable-so --enable-mods-shared=all --prefix=/usr/local/apache2 --with-included-apr
make
make install
可能會遇到的錯誤:
modules/http/.libs/libmod_http.a(byterange_filter.o): In function `ap_set_byterange':
byterange_filter.c:(.text+0x12c1): undefined reference to `apr_array_clear'
collect2: ld returned 1 exit status
make[1]: *** [httpd] Error 1
make[1]: Leaving directory `/root/httpd-2.2.22'
make: *** [all-recursive] Error 1
解決:
編譯時加入--with-included-apr

apache加入到自啓動行列
Apache安裝路徑爲:/usr/local/apache2
Linux的啓動級別爲5,版本爲Linux AS4

Apache安裝完後,發現Apache無法自動啓動,查看/etc/rc.d/rc5.d/下,應該沒有S打頭,httpd結尾的鏈接文檔。
1、將apachectl文檔拷貝到/etc/rc.d/init.d 中,然後在/etc/rc.d/rc5.d/下加入鏈接即可。
命令如下:
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd //假如有其他的版本的Apache存在,也能夠直接覆蓋掉
ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S85httpd //建立鏈接(85的意義後面介紹)
此時Apache就能夠自動啓動了。
2、運行chkconfig --list,發現沒有linux服務列表中httpd,通過chkconfig --add httpd來添加,但是提示:httpd服務不支持 chkconfig。需要編輯/etc/rc.d/init.d/httpd,添加以下注釋信息:
# chkconfig: 345 85 15
# description: Apache
第一行3個數字參數意義分別爲:哪些Linux級別需要啓動httpd(3,4,5);啓動序號(85);關閉序號(15)。
保存後執行:chkconfig --add httpd,成功添加。
在rc3.d、rc4.d、rc5.d路徑中會出現S85httpd的鏈接文檔,其他運行級別路徑中會出現K61httpd的鏈接文檔。
3、運行chkconfig --list,httpd在其中。

安裝mysql5

rpm -ivh Mysql—Server-xxxx.rpm

問題:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

解決: 原因是,/var/lib/mysql 的訪問權限問題。
shell> chown -R mysql:mysql /var/lib/mysql

修改密碼:usr/bin/mysqladmin -u root password 'new-password'
格式:mysqladmin -u用戶名 -p舊密碼 password 新密碼


安裝php5.3.8
tar -zxvf php**

編譯配置: ./configure --prefix=/usr/local/php --with-mysql=/usr/ --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc

指定Mysql,必須先安裝Mysql-dev**.rpm
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章