centos7lamp搭建

技術小甜發表於2017-11-16

**1.原始碼安裝 LAMP 之 Apache

yum install apr-devel apr-util-devel –y; 

wget -c http://mirror.bit.edu.cn/apache/httpd/httpd-2.2.34.tar.gz ;

tar xzf httpd-2.2.34.tar.gz ;

cd httpd-2.2.34 ;

./configure –prefix=/usr/local/apache –enable-so –enable-rewrite &&make

&&make install

**2原始碼安裝 LAMP 之 MySQL

cd /usr/src ;wget -c 
http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.63.tar.gz ;

tar xzf mysql-5.1.63.tar.gz ;

cd mysql-5.1.63 ;

./configure –prefix=/usr/local/mysql –enable-assembler &&make &&make install

配置 Mysql 服務為系統服務:

cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf

cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld

chkconfig –add mysqld

chkconfig –level 345 mysqld on

cd /usr/local/mysql

useradd mysql

chown -R mysql.mysql /usr/local/mysql

/usr/local/mysql/bin/mysql_install_db –user=mysql

chown -R mysql var

/usr/local/mysql/bin/mysqld_safe –user=mysql &

3 原始碼安裝 LAMP 之 PHP

wget -c http://mirrors.sohu.com/php/php-5.3.28.tar.bz2 ;

tar jxf php-5.3.28.tar.bz2 ;cd php-5.3.28 ;

./configure –prefix=/usr/local/php5

–with-config-file-path=/usr/local/php/etc

–with-apxs2=/usr/local/apache/bin/apxs

–with-mysql=/usr/local/mysql/

原始碼安裝 Apache+PHP 整合

整合 apache+php 環境,修改 httpd.conf 配置檔案,然後加入如下語句:

LoadModule php5_module modules/libphp5.so (預設已存在)

AddType application/x-httpd-php .php

DirectoryIndex index.php index.html (把 index.php 加入 index.html 之前)

然後在/usr/local/apache/htdocs 目錄下建立 index.php 測試頁面,執行如下

命令:

cat >>/usr/local/apache/htdocs/index.php <<EOF

<?php

phpinfo();

?>

EOF

重新啟動 apache 服務,通過 IP 訪問介面如下圖,即代表 LAMP 環境搭建成功。

原始碼安裝 DISCUZ 論壇

下載 discuz 原始碼包檔案,然後解壓:*

cd /usr/src ;wget
http://download.comsenz.com/DiscuzX/3.1/Discuz_X3.1_SC_UTF8.zip

解 壓 discuz 程 序 包 : unzip Discuz_X3.1_SC_UTF8.zip -d

/usr/local/apache/htdocs/

重新命名程式檔案:cd /usr/local/apache/htdocs/ ;mv upload/
 .

賦予 discuz 目錄完全訪問許可權:cd /usr/local/apache/htdocs/ ;chmod 777

-R data/ uc_server/ config/ uc_client/****

然後訪問 IP 安裝 discuz 論壇,如下圖,選擇“我同意”

本文轉自zhang25yun51CTO部落格,原文連結:http://blog.51cto.com/1585654/2049311 ,如需轉載請自行聯絡原作者