LAMP 編譯安裝基本步驟

weixin_34391854發表於2009-03-10


安裝mysql

shell>; groupadd mysql 
shell>; useradd -g mysql mysql
shell>; cd /usr/local
shell>; tar zxvf mysql.tar.gz
shell>; cd mysql
shell>; ./configure –prefix=/usr/local
shell>;make;make install
shell>; scripts/mysql_install_db --user=mysql
shell>; chown -R root .
shell>; chown -R mysql var
shell>; chgrp -R mysql .
shell>; bin/mysqld_safe --user=mysql &
./bin/mysqladmin -u root password "123456" 基於安全的原因,為root使用者設定密碼才能讓root使用者登陸mysql,不然會有2002錯誤出現
建立啟動指令碼:
cp ./support-files/mysql.server /etc/init.d/mysql

安裝apache

tar -zxvf httpd-2.0.54.tar.gz
cd httpd-2.0.54.tar.gz
./configure --prefix=/var/www --enable-so 這個選項一定要有
make && make install
建立啟動指令碼
cp /var/www/bin/apachectl /etc/init.d/httpd
cd /etc/rc3.d
ln -s ../init.d/httpd S85httpd
ln -s ../init.d/httpd K85httpd

安裝php

#./configure --prefix=/usr/local
--with-apxs2=/var/www/bin/apxs
--with-config-file-path=/usr/local
--enable-socket
--with-mysql=/usr/local/mysql
--with-zlib-dir=/usr/include
--with-gd
--enable-mbstring (這個選項一定要有,否則在訪問頁面的時候會出現mb_ereg()函式未定義的提示)
注意:這些選項是必須的,如果有編譯不能通過的情況,請安裝相應的包。
#make && make install
cp php.ini-dist /user/local/php.ini
vi /www/conf/httpd.conf
加入:
###############for php and cacti###################
AddType application/x-tar .tgz
AddType application/x-httpd-php .php
AddType image/x-icon .ico
DirectoryIndex index.php index.html index.html.var
#######################over########################
/etc/init.d/httpd restart


相關文章