且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

centos 7 lamp搭建

更新时间:2022-10-02 13:35:37

**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 ,如需转载请自行联系原作者