鸿 网 互 联 www.68idc.cn

当前位置 : 服务器租用 > 服务器相关 > 批处理 > >

自动搭建LAMP环境

来源:互联网 作者:佚名 时间:2016-03-03 12:14
将apache mysql php源码包与安装脚本放在同一目录下,执行脚本文件根据脚本提示输入安装路径即可 LAMP MySQL #!/bin/bash echo "1.please input the mysql's path where will installed [default:/web/mysql]" read sqlreadif [ "$sqlread" != "" ];thensql=$
将apache mysql php源码包与安装脚本放在同一目录下,执行脚本文件根据脚本提示输入安装路径即可

LAMP MySQL
#!/bin/bash 
echo "1.please input the mysql's path where will installed [default:/web/mysql]" 
read sqlread
if [ "$sqlread" != "" ];then
sql=$sqlread
else 
sql="/web/mysql"
fi

echo "2.please input the httpd's path where will installed [default:/web/httpd]"
read httpdread
if [ "$httpdread" != "" ];then
httpd=$httpdread
else
httpd="/web/httpd"
fi

echo "3.please input the php's path where will installed [default:/web/php]"
read phpread
if [ "$phpread" != "" ];then
php=$phpread
else
php="/web/php"
fi


mkdir -p $sql
mkdir -p $httpd
mkdir -p $php
useradd mysql
tar zxvf `ls | grep mysql | grep tar`
cd `ls -d */ | grep mysql`
./configure --prefix=$sql --enable-thread-safe-client --with-extra-charsets=gbk && make && make install
cp ./support-files/my-medium.cnf /etc/my.cnf
${sql}/bin/mysql_install_db --user=mysql
cd ..

tar zxvf `ls | grep http | grep tar`
cd `ls -d */ | grep http`
./configure --prefix=$httpd --enable-so --enable-rewrite && make && make install
cd ..

tar zxvf `ls | grep php | grep tar`
cd `ls -d */ | grep php`
./configure --prefix=$php --with-mysql=$sql --with-apxs2=${httpd}/bin/apxs --with-config-file-path=/usr/local/lib/ && make && make install
cp -f `ls | grep php.ini | head -1` /usr/local/lib/php.ini
cd ..

ln -s ${sql}/bin/* /usr/bin/
ln -s ${httpd}/bin/* /usr/bin/
ln -s ${php}/bin/* /usr/bin/
echo "${httpd}/bin/apachectl start" >> /etc/rc.d/rc.local 
echo "${sql}/bin/mysqld_safe --user=mysql &" >> /etc/rc.d/rc.local
echo "AddType application/x-httpd-php .php" >> ${httpd}/conf/httpd.conf
网友评论
<