源碼包搭建lamp

來源:互聯網
上載者:User

標籤:源碼包搭建lamp

lamp環境搭建1、apahce安裝(1)安裝相關的依賴包

         [[email protected]~]#yum–y install gcc make openssl-devel c++ libxml2-devel

 

(2).編譯安裝apahce

 

[[email protected]]# tar -zxf httpd-2.2.25

[[email protected]]#cd httpd-2.2.25

[[email protected] src]# ./configure--prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-cgi--enable-ssl --enable-charset-lite --enable-suexec --with-suexec-caller=daemon--with-suexec-docroot=/usr/local/httpd/htdocs

[[email protected] src]#make&& make install

(3)、編譯安裝完之後啟動apache測試

[[email protected]]# /usr/local/httpd/bin/apachectl start

[[email protected] httpd-2.2.25]# netstat-tlnp | grep :80

tcp        0     0 :::80                       :::*                        LISTEN      56629/httpd

(4)、把apache加為系統服務

[[email protected] init.d]# cp/usr/local/httpd/bin/apachectl /etc/init.d/myhttpd

[[email protected] init.d]# vim/etc/init.d/myhttpd 

在#!/bin/bash下面加上如下兩行:

# chkconfig: 35 85 15

# description: 描述資訊

[[email protected] init.d]# chkconfig --add myhttpd

2、安裝mysql(1)、解壓並編譯安裝

[[email protected] src]# useradd -M -u 49 -s/sbin/nolog mysql

[[email protected]host src]# tar -zxfmysql-5.1.62.tar.gz

 [[email protected]]# cd mysql-5.1.62

[[email protected] mysql-5.1.62]# ./configure--prefix=/usr/local/mysql --with-charset=utf8 --with-collation=utf8_general_ci--with-extra-charsets=gbk,gb2312

[[email protected] mysql-5.1.62]# make&& make install

(2)、資料庫配置

[[email protected]]# cp support-files/my-medium.cnf /etc/my.cnf

[[email protected]]# cd /usr/local/mysql/bin/

[[email protected]]# ./mysql_install_db --user=mysql

 

[[email protected] bin]#chown -R root:mysql /usr/local/mysql/

[[email protected] bin]#chown -R mysql /usr/local/mysql/var/

 

[[email protected] bin]#ln -s /usr/local/mysql/bin/* /usr/local/bin/

[[email protected] bin]#ln -s /usr/local/mysql/lib/mysql/* /usr/lib64/

[[email protected] bin]#ln -s /usr/local/mysql/include/mysql/* /usr/include/

(3)、把mysqld加為系統服務

[[email protected] bin]#cd  /usr/src/mysql-5.1.62/support-files/

[[email protected]]# cp  mysql.server  /etc/init.d/mysqld

 [[email protected] support-files]# chmod  +x /etc/rc.d/init.d/mysqld

[[email protected]]# chkconfig  --add  mysqld

(4)、啟動mysql測試

[[email protected] support-files]# servicemysqld start

[[email protected] support-files]# netstat-tlnp | grep :3306

tcp       0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      18314/mysqld

[[email protected] support-files]#

 

3、php源碼包安裝(1)、解壓並編譯安裝

1、  [[email protected] src]# tar -zxf php-5.4.19.tar.gz

2、   [[email protected] src]# cdphp-5.4.19

3、  [[email protected] php-5.4.19]# ./configure --prefix=/usr/local/php--enable-mbstring --enable-sockets  --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php

[[email protected] php-5.4.19]# make  && make install

[[email protected] php-5.4.19]# cpphp.ini-development /usr/local/php/php.ini

(2)、修改httpd設定檔,以便支援php格式檔案

[[email protected] httpd]# vim/usr/local/httpd/conf/httpd.conf,添加一行:

AddType application/x-httpd-php  .php 

[[email protected] httpd]#vim /var/www/html/index.php

<?

php phpinfo();

?>

 


本文出自 “linux學習” 部落格,請務必保留此出處http://2993336.blog.51cto.com/2983336/1439708

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.