LAMP之平臺搭建

LAMP之平臺搭建

項目描述

近期因朋友需求,想要自己做個網站,已得到網站源碼,需要查看網站效果,因而諮詢於我。奈於自身學藝不精,攻業不深,基於Windows平臺的PHP環境始終出問題(IISApache都讓我好崩潰,連WAMP都用了,配置就是不行,唉~~),無法查看到效果,甚至焦心。

由於時間緊迫,朋友對我又比較信任,索性使用相對熟悉的Linux平臺,優點就是便捷、迅速還省事兒,遂有此文!

廢話不多說,直接上乾貨!

項目資源

項目平臺資源:基於Vmware 8.0

項目環境資源:Red Hat Enterprise Linux 5LAMP

項目軟件包資源:基於RHEL5光盤文件

項目實施及操作流程

1.掛載光盤

2.安裝相關服務及其軟件包(主要包含DNS服務,Apache服務,MySQL服務,PHP服務)

3.配置相關文件及參數

操作流程:

/*掛載光盤*/

[root@LAMP~]# mount /dev/cdrom /mnt

mount:block device /dev/cdrom is write-protected, mounting read-only

/*進入光盤*/

[root@LAMP~]# cd /mnt/Server/

/*安裝DNS服務bindcaching-nameser*/

[root@LAMPServer]# rpm -ivh bind-9.3.3-7.el5.i386.rpmcaching-nameserver-9.3.3-7.el5.i386.rpm

warning:bind-9.3.3-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...###########################################[100%]

1:bind########################################### [ 50%]

2:caching-nameserver########################################### [100%]

/*編輯DNS配置文件*/

[root@LAMPServer]# vim /etc/named.caching-nameserver.conf

options{

//listen-on port 53 { 127.0.0.1; };

listen-on-v6 port 53 { ::1; };

directory"/var/named";

dump-file"/var/named/data/cache_dump.db";

statistics-file "/var/named/data/named_stats.txt";

memstatistics-file"/var/named/data/named_mem_stats.txt";

query-sourceport 53;

query-source-v6 port 53;

//allow-query{ localhost; };

};

logging{

channel default_debug {

file "data/named.run";

severity dynamic;

};

};

viewlocalhost_resolver {

//match-clients{ localhost; };

//match-destinations { localhost; };

recursion yes;

include"/etc/named.rfc1912.zones";

};

/*編輯區域配置文件*/

[root@LAMPServer]# vim /etc/named.rfc1912.zones

/*新增區域*/

zone"test.com" IN {

type master;

file "test.com.zone";

};

/*爲新增區域創建配置文件*/

[root@LAMPServer]# vim /var/named/test.com.zone

@    IN    SOA    ns.test.com.    root.test.com.    (

    20130509

    28800

    14400

    3600000

    86400

)

@    IN    NS    ns.test.com.

ns    IN    A    192.168.79.2

www  IN    CNAME    ns.test.com.

/*查看新增文件*/

[root@LAMPServer]# ls /var/named/

chrootlocalhost.zonenamed.ip6.localslaves

datanamed.broadcastnamed.localtest.com.zone

localdomain.zonenamed.canamed.zero

/*啓動DNS服務,並使用nslookupping命令驗證解析*/

[root@LAMPServer]# service named start

Startingnamed:[OK]

[root@LAMPServer]# nslookup www.test.com

Server:192.168.79.2

Address:192.168.79.2#53

www.test.comcanonical name = ns.test.com.

Name:ns.test.com

Address:192.168.79.2

[root@LAMPServer]# ping www.test.com

PINGns.test.com (192.168.79.2) 56(84) bytes of data.

64 bytesfrom 192.168.79.2: icmp_seq=1 ttl=64 time=2.23 ms

64 bytesfrom 192.168.79.2: icmp_seq=4 ttl=64 time=0.044 ms

/*安裝Apache服務httpd*/

[root@LAMPServer]# rpm -ivhhttpd-2.2.3-6.el5.i386.rpm 

warning:httpd-2.2.3-6.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...########################################### [100%]

package httpd-2.2.3-6.el5 is alreadyinstalled

/*啓動Apache服務*/

[root@LAMPServer]# service httpd start

Startinghttpd:[OK]

/*安裝MySQL服務及其相關軟件包*/

[root@LAMPServer]# rpm -ivh mysql-5.0.22-2.1.i386.rpm mysql-server-5.0.22-2.1.i386.rpmphp-mysql-5.1.6-5.el5.i386.rpm perl-DBI-1.52-1.fc6.i386.rpmperl-DBD-MySQL-3.0007-1.fc6.i386.rpm php-pdo-5.1.6-5.el5.i386.rpm

warning:mysql-5.0.22-2.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...###########################################[100%]

1:perl-DBI########################################### [ 17%]

2:mysql########################################### [ 33%]

3:perl-DBD-MySQL###########################################[ 50%]

4:php-pdo########################################### [ 67%]

5:mysql-server########################################### [ 83%]

6:php-mysql########################################### [100%]

/*啓動MySQL服務*/

[root@LAMPServer]# service mysqld start

InitializingMySQL database:Installing all preparedtables

Fillhelp tables

To startmysqld at boot time you have to copy support-files/mysql.server

to theright place for your system

PLEASEREMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To doso, start the server, then issue the following commands:

/usr/bin/mysqladmin-u root password 'new-password'

/usr/bin/mysqladmin-u root -h LAMP password 'new-password'

See themanual for more instructions.

You canstart the MySQL daemon with:

cd /usr; /usr/bin/mysqld_safe &

You cantest the MySQL daemon with the benchmarks in the 'sql-bench' directory:

cdsql-bench ; perl run-all-tests

Pleasereport any problems with the /usr/bin/mysqlbug script!

Thelatest information about MySQL is available on the web at

http://www.mysql.com

SupportMySQL by buying support/licenses at http://shop.mysql.com

[OK]

StartingMySQL:[OK]

/*設置MySQL用戶密碼*/

[root@LAMPServer]# mysqladmin -u root password 123456

/*安裝PHP軟件包*/

[root@LAMPServer]# rpm -ivh php-5.1.6-5.el5.i386.rpm php-cli-5.1.6-5.el5.i386.rpmphp-common-5.1.6-5.el5.i386.rpm

warning:php-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...########################################### [100%]

package php-common-5.1.6-5.el5 is alreadyinstalled

package php-cli-5.1.6-5.el5 is alreadyinstalled

package php-5.1.6-5.el5 is alreadyinstalled

 

/*至此服務安裝及配置結束*/

 

/*設置以上所有服務爲開機自動啓動*/

[root@LAMPServer]# chkconfig --level 2345 named on

[root@LAMPServer]# chkconfig --level 2345 mysqld on

[root@LAMPServer]# chkconfig --level 2345 httpd on

最後編輯測試頁面,測試一下即可。

[root@LAMPServer]# vim /var/www/html/index.php

<?php

phpinfo();

?>

自帶DNS服務的LAMP平臺搭建圓滿完成!好想給它起了個名字,叫LAMPD?還是DLAMP?(*^__^*) 

 

嘮嘮閒話:

項目操作流程按照LAMP的順序進行,方便新手閱讀,也方便自己捋順思路!

與人方便於己方便嘛~~

先到這裏吧~~後續在接着數據庫寫寫!

 

本文出自 “龍目小子,博聞天下” 博客,請務必保留此出處http://longmuxiaozi.blog.51cto.com/865148/1197206

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