lamp源碼安裝方法

先安裝centos系統,然後更新:

yum -y install apr-devel apr-util check-devel cairo-devel pango-devel libxml2-devel rpmbuild glib2-devel dbus-devel freetype-devel fontconfig-devel gcc-c++ expat-devel python-devel libXrender-devel

mysql 源碼包安裝
1.useradd mysql
2.passwd mysql(增加密碼,可以不用)
3.進入mysql源碼包解壓目錄
cacti安裝時的方法:

  ./configure --prefix=/usr/local/mysql --enable-local-infile --with-charset=gbk --with-extra-charsets=all  --with-low-memory --with-mysqld-user=mysql --enable-thread-safe-client
4.make
5.make install
  cp support-files/my-medium.cnf /etc/my.cnf
6.cd /opt/mysql5
7.chown -R mysql:mysql .
8.bin/mysql_install_db  --user=mysql
9.chown -R root .
  chown -R mysql var
10.bin/mysqld_safe --user=mysql &(啓動mysql)

11、ln -s /usr/local/mysql/bin/* /usr/local/bin(可以直接運行mysql裏面的命令了,不用在打目錄)

 

自啓動的配置方法

     cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld

     chmod +x /etc/rc.d/init.d/mysqld

     chkconfig --add mysqld

     service mysqld start
11.bin/mysqladmin shutdown(關閉mysql)

     service mysqld stop

 

 

apache與php安裝
1.進入httpd的解壓目錄
 ./configure --enable-so --prefix=/opt/www(普通安裝)

 

cacti安裝方法: 

./configure --prefix=/usr/local/www --enable-so --enable-rewrite --enable-ssl --with-ssl=/usr/local/openssl --with-zlib --enable-mods-shared=all --enable-track-vars --with-mysql=/usr/local/mysql --with-included-apr

 


 make
 make install

 

/opt/www/bin/apachectl start|stop

ln -s /opt/www/bin/apachectl /usr/local/bin/apachectl

 

cp /opt/www/bin/apachectl /etc/rc.d/init.d/httpd

chkconfig --add httpd

chkconfig --list httpd

service httpd start
apache安裝好了
2.安裝php,進入php解壓目錄
  ./configure --with-apxs2=/opt/www/bin/apxs --with-mysql=/opt/mysql5  --enable-sockets
說明:
  ./configure --with-apxs2=/opt/www/bin/apxs(安裝好的apache裏面的apxs目錄) --with-

mysql=/opt/mysql5(mysql的安裝目錄) --enable-sockets(cacti必須要帶的參數)

 

./configure --prefix=/usr/local/php --with-config-file-path=/etc -with-apxs2=/usr/local/www/bin/apxs --enable-fastcgi --enable-safe-mode --with-zlib --with-bz2 --with-freetype-dir --enable-mbstring -with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config  --with-gd --with-libxml-dir --with-png-dir --with-jpeg-dir --enable-sockets

 

(出現要安裝的lib庫,用yum安裝一下,包括庫的-devel庫)


  make
  make install

 cp php.ini-dist /etc/php.ini

(配置目錄在./configure裏面說明了是/etc)
在httpd.conf裏面修改:

 找到下面字段:
  DirectoryIndex 
  在index.html前面添加index.php
  增加:
  AddType application/x-httpd-php .php .phtml

 AddType application/x-httpd-php-source .phps

3.啓動apache
  /opt/www/bin/apachectl start

 

 

 

注:mysql下載地址:

ftp://mirror2.dataphone.se/pub/mysql/Downloads/MySQL-5.1/

ftp://mirror2.dataphone.se/pub/mysql/Downloads/MySQL-5.1/mysql-5.1.44.tar.gz

http://dl-sh-ctc-1.pchome.net/05/ae/mysql-5.1.45-linux-i686-glibc23.tar.gz

php下載地址:http://www.php.net

apache下載地址:http://www.apache.org

 

 ========================================

錯誤解決:

安裝apache時類似於以下信息:
“exports.c:1653: error: redefinition of 'ap_hack_apr_version_string'
exports.c:1022: error: previous definition of 'ap_hack_apr_version_string' was here
make[2]: *** [exports.lo] Error 1
make[2]: Leaving directory `/usr/local/src/httpd-2.2.*/server'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/httpd-2.2.*/server'
make: *** [all-recursive] Error 1”

有些人說路徑不對,有些說perl包不對,有的說zlib不對。
反正有病亂投醫。
翻了好久的網頁才搞定。
解決辦法:
在configure後加上 “--with-included-apr”。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章