LAMP平台部署跟应用
一、
LAMP
(1)、在Linux平台安装apache、MySQL及php和各种依赖搭建lamp
(2)、首先我们安装依赖
(挂载的是CentOS镜像)
(3)、安装安装apache、MySQL、php。
(4)安装phoMyadmin
(5)实现测试
1)安装依赖程序
[root@centos01 ~]# mount /dev/cdrom /mnt/
[root@centos01 ~]# rm -rf /etc/yum.repos.d/CentOS-*
[root@centos01 ~]# yum -y install zlib-devel libxml2-devel
2)安装libmcrypt
[root@centos01~]# mount /dev/cdrom /mnt/
[root@centos01~]# tar zxvf /mnt/libmcrypt-2.5.8.tar.gz -C /usr/src/
[root@centos01~]# cd /usr/src/libmcrypt-2.5.8/
[[email protected]]# ./configure && make && make install
[[email protected]]# ln -s /usr/local/lib/libmcrypt.* /usr/lib
3)接下来安装mhash
[root@centos01~]# tar zxvf /mnt/mhash-0.9.9.9.tar.gz -C /usr/src/
[root@centos01~]# cd /usr/src/mhash-0.9.9.9/
[[email protected]]# ./configure && make && make install
[[email protected]]# ln -s /usr/local/lib/libmhash.* /usr/lib
[root@centos01~]# tar zxvf /mnt/mcrypt-2.6.8.tar.gz -C /usr/src/
[root@centos01~]# cd /usr/src/mcrypt-2.6.8/
[[email protected]]# export LD_LIBRARY_PATH=/usr/local/lib
[[email protected]]# ./configure && make && make install
5)安装apache
[root@centos01~]# tar zxvf /mnt/httpd-2.2.17.tar.gz -C /usr/src/
[root@centos01~]# cd /usr/src/httpd-2.2.17/
[[email protected]]# ./configure --prefix=/usr/local/httpd --enable-so–enable-rewrite --enable-cgi --enable-charset-lite
[[email protected]]# make && make install
[[email protected]]# ln -s /usr/local/httpd/bin/* /usr/local/bin/
[[email protected]]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[[email protected]]# chmod +x /etc/init.d/httpd
[[email protected]]# vim /etc/init.d/httpd
#!/bin/sh
#chkconfig:3521 80
#description:apacheserver
[[email protected]]# chkconfig --add httpd
[[email protected]]# chkconfig --level 35 httpd on
4、配置安装php
1)配置php
[root@centos01~]# tar zxvf /mnt/php-5.3.28.tar.gz -C /usr/src/
[root@centos01
~]# cd /usr/src/php-5.3.28/
[root@centos01
php-5.3.28]# ./configure --prefix=/usr/local/php --with-mcrypt --with-apxs2=/usr/local/httpd/bin/apxs
–with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config
–with-config-file-path=/usr/local/php
2)编译安装php
[root@centos01
php-5.3.28]# make && make install
[root@centos01
php-5.3.28]# make install
3)生成php主配置文件
[root@centos01
php-5.3.28]# cp php.ini-production /usr/local/php/php.ini
5、配置zend加速
1)移动zend程序
[root@centos01~]# tar zxvf /mnt/zendguardloader-php-5.3-linux-glibc23-i386.tar.gz -C/usr/src/
[root@centos01~]# cd /usr/src/ZendGuardLoader-php-5.3-linux-glibc23-i386/
[[email protected]]# cd php-5.3.x/
[[email protected]]# ls ZendGuardLoader.so
[[email protected]]# cp ZendGuardLoader.so /usr/local/php/lib/php/
2)修改php主配置文件加载zend模块
[root@centos01~]# vim /usr/local/php/php.ini
[PHP]
zend_extension=/usr/local/php/lib/php/ZendGuardLoader.so
default_charset
= “utf-8”
6、配置apache
1)修改apache主配置文件加载php模块
[root@centos01
~]# cp /usr/local/httpd/conf/httpd.conf /usr/local/httpd/conf/httpd.con.bak
[root@centos01
~]# vim /usr/local/httpd/conf/httpd.conf
:%g/^$/d
:%g/^#/d
AddType
application/x-httpd-php .php
DirectoryIndex
index.html index.php
2)启动apache服务
[root@centos01
~]# systemctl start httpd
[root@centos01
~]# systemctl enable httpd
3)设置php测试页
[root@centos01~]# vim /usr/local/httpd/htdocs/index.php
http://192.168.100.10/
http://192.168.100.10/index.php
7、上线phpMyadmin系统
1)指定phpMyadmin安装位置
[root@centos01~]# tar zxvf /mnt/phpmyadmin-3.3.10-all-languages.tar.gz -C /usr/src/
[root@centos01
~]# cd /usr/src/
[root@centos01
src]# mv phpMyAdmin-3.3.10-all-languages/ /usr/local/httpd/htdocs/phpMyAdmin
2)生成phpMyadmin配置文件
[root@centos01
src]# cd /usr/local/httpd/htdocs/phpMyAdmin/
[root@centos01hpMyadmin]# cp config.sample.inc.php config.inc.php
[root@centos01
phpMyAdmin]# cd
[root@centos01
~]# systemctl stop httpd
[root@centos01
~]# systemctl start httpd
[root@centos01
~]# netstat -anptu | grep 80
http://192.168.100.10/ phpMyAdmin/
[root@centos01~]# umount /mnt/
[root@centos01
~]# mount /dev/cdrom /mnt/
[root@centos01
~]# yum -y install bind bind-chroot bind-utils
[root@centos01
~]# cp /etc/named.conf /etc/named.conf.bak
[root@centos01
~]# echo “” > /etc/named.conf
[root@centos01
~]# vim /etc/named.conf
options
{
listen-on port 53 { any; };
directory "/var/named";
};
zone
“phpMyadmin.com.” IN {
type master;
file "phpMyadmin.com.zone";
[root@centos01
~]# named-checkconf /etc/named.conf
[root@centos01
~]# vim /var/named/phpMyadmin.com.zone
@ SOA phpMyadmin.com. root.phpMyadmin.com. (
2021040310
1H
15M
1W
1D
)
@ NS centos01.phpMyadmin.com.
centos01 A 192.168.100.10
www A 192.168.100.10
[root@centos01~]# named-checkzone phpMyadmin.com. /var/named/phpMyadmin.com.zone
[root@centos01~]# vim /usr/local/httpd/conf/httpd.conf
ServerName
www.phpMyadmin.com:80
[root@centos01
~]# vim /etc/sysconfig/network-scripts/ifcfg-ens32
DNS1=192.168.100.10
[root@centos01
~]# systemctl restart network
[root@centos01
~]# systemctl start named
[root@centos01
~]# systemctl enable named
[root@centos01
~]# systemctl stop httpd
[root@centos01
~]# systemctl start httpd
[root@centos01
~]# netstat -anptu | grep httpd
http://www.phpmyadmin.com/phpMyAdmin/