源码部署脚本

[ root@mail ~]# vi lamp.sh
#!/bin/bash
mkdir -p / var / tmp /lamp
tar - xf /root/lamp/httpd-2.2.12.tar.bz2 -C / var / tmp /lamp
tar - xf /root/lamp/php-5.2.11.tar.bz2 -C / var / tmp /lamp
tar - zxf /root/lamp/mysql-5.1.37.tar.gz -C / var / tmp /lamp
cd / var / tmp /lamp/httpd-2.2.12
./configure --prefix=/ usr /local/lamp/apache2
make && make install
/ usr /local/lamp/apache2/bin/ apachectl start
lsof -n -i:80
curl http://localhost/ -I
groupadd mysql
useradd -g mysql mysql
cd / var / tmp /lamp/mysql-5.1.37
./configure --prefix=/ usr /local/lamp/ mysql
make && make install
cp support-files/my- medium.cnf / etc / my.cnf
cd / usr /local/lamp/ mysql
chown -R mysql .
chgrp -R mysql .
bin/ mysql_install_db --user= mysql
chown -R root .
chown -R mysql var
bin/ mysqld_safe --user= mysql &
cd / var / tmp /lamp/php-5.2.11/
./configure  --prefix=/ usr /local/lamp/ php --with-apxs2=/ usr /local/lamp/apache2/bin/ apxs --with- mysql =/ usr /local/lamp/ mysql /
make
make install
cp php.ini- dist / etc /php.ini
echo $"It’s Complete "
 
执行部署脚本:
[ root@mail ~]# sh lamp.sh
It’s Comp lete
 
web 服务配置文件:
可以通过修改 apache 配置文件,设置默认页面。
[ root@mail ~]# vim / usr /local/lamp/apache2/ conf / httpd.conf
ServerName 127.0.0.1:80
 
< IfModule dir_module >
   DirectoryIndex index.php index.html
</ IfModule >
AddType application/x- httpd - php . php . phtml
AddType application/x-httpd-php-source . phps
 
重启服务:
[ root@mail ~]# / usr /local/lamp/apache2/bin/ apachectl stop
[root@mail ~]# /usr/local/lamp/apache2/bin/apachectl start
 
测试:
vi / var /www/html/ index.php
<? php
echo 'This is the  index.php  page!';
phpinfo ();
?>