linux下搭建LAMP环境
linux下LAMP环境搭建
需要的源代码
httpd-2.2.15.tar.gzmysql-5.1.44.tar.gzphp-5.3.2.tar.gz
Discuz_7.2_FULL_SC_UTF8.zip
2,将需要的源代码准备好,复制到/usr/local/src/目录中
3,开始安装
[root@zhaoyun~]#cd/usr/local/src/
[root@zhaoyunsrc]#ll
-r-xr-xr-x1rootroot6593633Aug2107:45httpd-2.2.15.tar.gz
-r-xr-xr-x1rootroot23400457Aug2107:45mysql-5.1.44.tar.gz
-r-xr-xr-x1rootroot13734462Aug2107:45php-5.3.2.tar.gz
-r-xr-xr-x1rootroot4704098Sep906:49Discuz_7.2_FULL_SC_UTF8.zip
[root@zhaoyunsrc]#tarxzvfhttpd-2.2.15.tar.gz解压文件
[root@zhaoyunsrc]#cdhttpd-2.2.15
[[email protected]]#./configure—prefix=/usr/local/apache--enable-so;make;makeinstall
编译前要确定gcc已经安装
安装mysql
安装前配置
[root@zhaoyun~]#useradd-s/sbin/nologinmysql建一个mysql的用户
[root@zhaoyun~]#mkdir/var/lib/mysql/建mysql的工作目录
[root@zhaoyun~]#chownmysql.mysql/var/lib/mysql/修改目录的属主组为mysql
[root@zhaoyun~]#cd/usr/local/src/
[root@zhaoyunsrc]#tarxzvfmysql-5.1.44.tar.gz
[[email protected]]#./configure--prefix=/usr/local/mysql/--sysconfdir=/etc--localstatedir=/var/lib/mysql/;make;makeinstall
将mysql安装到/usr/local/mysql指定主配置文件目录到/etc目录指定工作目录是/var/lib/mysql
安装完成后复制一下配置文件
[root@zhaoyun~]#cd/usr/local/mysql/share/mysql
[root@zhaoyunmysql]#cpmy-medium.cnf/etc/my.cnf
运行mysql初始化
[root@zhaoyunmysql]#cd/usr/local/mysql/bin/
[root@zhaoyunbin]#./mysql_install_db
然后在/var/lib/mysql/目录中生成好多文件将他们的属主和属组更改为mysql
[root@zhaoyunbin]##chown-Rmysql.mysql/var/lib/mysql/
[root@zhaoyunbin]#./mysqld_safe&后台运行mysql的支持程序
[root@zhaoyunbin]#./mysql试着运行一下看行不行
安装PHP
[root@zhaoyunsrc]#tarxzvfphp-5.3.2.tar.gz
[root@zhaoyunsrc]#cdphp-5.3.2
[[email protected]]#./configure--prefix=/usr/local/php5--with-mysql=/usr/local/mysql--with-apxs2=/usr/local/apache/bin/apxs:make;makeinstall
[root@zhaoyun~]#cd/usr/local/src/php-5.3.2
[[email protected]]#cpphp.ini-development/usr/local/php5/lib/php.ini
[[email protected]]#vi/usr/local/apache/conf/httpd.conf
修改apache的配置文件
修改ServerName192.168.0.205:80
在有AddType附近添加AddTypeapplication/x-httpd-php.php
查找DirectoryIndexindex.html添加index.php中间加,号
重启apache程序
[root@zhaoyun~]#cd/usr/local/apache/bin/
[root@zhaoyunbin]#./apachectlrestart
测试支持PHP
[[email protected]]#cd/usr/local/apache/htdocs/
[root@zhaoyunhtdocs]#vitest.php
添加<?php
phpinfo();
?>
打开浏览器输入http://192.168.0.205/test.php测试是否支持php
安装论坛程序
设置mysql
[root@zhaoyunbin]#./mysqladmin-uroot-ppassword123456给mysql设密码
[root@zhaoyunbin]#./mysql-uroot-p
Enterpassword:输入密码123456
mysql>createdatabasebbsdb;创建一个数据库
QueryOK,1rowaffected(0.00sec)
mysql>grantallonbbsdb.*tozhaoyun@localhostidentifiedby'123456';
QueryOK,0rowsaffected(0.00sec)
mysql>quit
安装论坛解压
[root@zhaoyunsrc]#unzipDiscuz_7.2_FULL_SC_UTF8.zip
[root@zhaoyunsrc]#mvupload//usr/local/apache/htdocs/解压后有一个upload的文件夹移动到/usr/local/apache/htdocs目录下
[root@zhaoyunupload]#pwd
/usr/local/apache/htdocs/upload
[root@zhaoyunupload]#chown-Rdaemonconfig.inc.phpattachments/forumdata/uc_client/data/cache/修改一下这几个文件的属主为daemon
[root@zhaoyunupload]#vi/usr/local/php5/lib/php.ini
查找并修改为short_open_tag=on要重启apache
按照提示下一步,下一步完成安装,完成后删除install文件
<!--[if!supportEmptyParas]-->
<!--[if!vml]--><!--[endif]-->安装过程结束