CentOS LAMP搭建

apache+mysql+php这是二个经文的施用组合,每回学习都要安插,作者自个儿依然很欢跃用这些组合来兑现部分东西的。
第一,在合法下载apache、mysql和php的新颖版本:
数据库:mysql-standard-5.0.27-linux-i386-glibc23.tar.gz
web服务器:httpd-2.2.3.tar.gz
脚本:php-5.2.0.tar.bz2
下一场安装(下载好的装置包都放置在/usr/local/下边)
一、安装mysql
# groupadd mysql
# useradd -g mysql mysql
# cd /usr/local
# tar zvxf mysql-standard-5.0.27-linux-i386-glibc23.tar.gz
# ln -s mysql-standard-5.0.27-linux-i386-glibc23 mysql
# cd mysql
# scripts/mysql_install_db –user=mysql
# chown -R root .
# chown -R mysql data
# chgrp -R mysql .
# cp support-files/my-medium.cnf /etc/my.cnf
//复制配置文件,当运行mysql时会读取配置
# vi /etc/my.cnf
查找 The Mysql server
[mysqld]
加多一行:set-variable = max_connections=150
保留并脱离
# /usr/local/mysql/bin/safe_mysqld –user=mysql & //启动mysql
那时候可以使用/usr/local/mysql/bin/mysqladmin version 查看Mysql
DBMS版本和应用新闻.
# /usr/local/mysql/bin/mysqladmin -uroot password xxxxx
//为root访问设置密码
当计算机重新起动后mysql不会运转,要是想同期运营就增添下边包车型大巴内容:
# vi /etc/rc.local
添加:/usr/local/mysql/bin/safe_mysqld –user=mysql &
保留并退出
二、安装apache
# cd /usr/local
# tar -zxvf httpd-2.2.3.tar.gz
# cd httpd-2.2.3
# ./configure –prefix=/usr/local/apache –enable-module=most
–enable-shared=max
# make
# make install
启动Apache服务: # /usr/local/apache/bin/apachectl start
关闭Apache服务: # /usr/local/apache/bin/apachectl stop
重启Apache服务: # /usr/local/apache/bin/apachectl restart
三、安装php
# cd /usr/local
# tar -jxvf php-5.2.0.tar.bz2
# cd php-5.2.0
# ./configure –prefix=/usr/local/php –with-mysqld=/usr/local/mysql
–with-apxs2=/usr/local/apache/bin/apxs
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini
四、配置apache
编辑httpd.conf文件
# vi /usr/local/apache/conf/httpd.conf
在LoadModule处添加: LoadModule php5_module module/libphp5.so
在DirectoryIndex处添加: index.php
在AddType application处添加: AddType application/x-httpd-php .php
.phtml
AddType applicatoin/x-httpd-php-source .phps
五、测验php模块的加载
# /usr/local/apache/bin/apachectl start //开启apache
在浏览器中输入:
浏览器中突显:It Works 表示apache开启www服务
# vi /usr/local/apache/htdocs/phpinfo.php
输入:<? phpinfo(); ?>
封存并退出
在浏览器中输入:
浏览器中体现三个关于apache和php安装的Web页,表示成功加载php模块。365bet体育在线网投 1

tar -zvxf php-5.3.1.tar.gz
cd php-5.3.1
./configure –with-apxs2=/usr/local/apache2/bin/apxs
–with-mysql=/usr/local/mysql
make
make install
cp php.ini-development /usr/local/lib/php.ini
四、重新配置apache2让他协理php————————————————————————————————–

<?php
phpinfo();
?>

7.整合php和apache
cp php.ini-dist /usr/local/php5/etc/php.ini
vi /usr/local/php5/etc/php.ini
将extension=php_mysql.dll前面的#去掉
留神在/usr/local/apache2/conf/httpd.conf加上下代码使apache实践PHP

cd /usr/local/apache2/conf
vim httpd.conf
添加LoadModule php5_module modules/libphp5.so
添加AddType application/x-httpd-php .php
或者

# make && make install      //编译+安装
# cp support-files/my-large.cnf /etc/my.cnf
# /usr/local/mysql/bin/mysql_install_db –defaults-file=/etc/my.cnf
–user=mysql    //初始化MySQL
# chown -R root /usr/local/mysql
# chown -R mysql /usr/local/mysql/date
# chgrp -R mysql /usr/local/mysql
# /usr/local/mysql/bin/mysqld_safe –user=mysql &
#/usr/local/mysql/bin/mysqladmin -uroot password 123456
//设置MySQL的指挥者密码
cp support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
chkconfig –add mysqld
chkconfig –level 345 mysqld on

三 安装mysql

01-04httpd-2.2.14.tar.gz
安装包下载

#make && make install
# ln -s /usr/local/php/bin/* /usr/local/bin/
# cp php.ini-dist /usr/local/php/php.ini

四安装php

1、tar -zvxf php-5.3.1.tar.gz 解压
2、cd php-5.3.1 切换目录
3、./configure –with-apxs2=/usr/local/apache2/bin/apxs
–with-mysql=/usr/local/mysql
365bet体育在线网投,4、make
5、make install
6、cp php.ini-development /usr/local/php5/lib/php.ini
指令:

③    修改暗中同意主页167行
DirectoryIndex index.php index.html

 

tar -zxvf mysql-5.1.42-linux-i686-glibc23.tar.gz
cp -a mysql-5.1.42-linux-i686-glibc23 /usr/local/mysql
cd /usr/local/mysql
groupadd mysql
useradd -g mysql mysql 
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld 
cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
service mysqld start
netstat -atln
/usr/local/mysql/bin/mysqladmin -u root password “1q2w3e”

一、安装MySQL
# useradd mysql -s /sbin/nologin
#tar zxvf mysql-5.0.90.tar.gz
#cd mysql-5.0.90
#./configure –prefix=/usr/local/mysql
localstatedir=/usr/local/mysql/date –enable-local-infile
–with-charset-gbk –with-extra-charsets=all –with-low-memory
–with-mysqld-user=mysql –enable-thread-safe-client

一删除apache+php+mysql:

发表评论

电子邮件地址不会被公开。 必填项已用*标注