Linux服务器之自动搭建LAMP环境Shell代码分享[服务器安全]
本文“Linux服务器之自动搭建LAMP环境Shell代码分享[服务器安全]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
LAMP(Linux-Apache-MySQL-PHP)网站架构是目前国际风行的Web框架,该框架包含:Linux操作系统,Apache网络服务器,MySQL数据库,Perl、PHP大概Python编程语言,全部构成产品均是开源软件,是国际上成熟的架构框架,很多风行的商业利用都是采纳这个架构,和Java/J2EE架构相比,LAMP具有Web资源丰富、轻量、快速开辟等特点,微软的.NET架构相比,LAMP具有通用、跨平台、高性能、低价钱的上风,因此LAMP无论是性能、质量还是价钱都是企业搭建网站的首选平台.
将Apache MySQL php源码包与安装脚本放在同一目录下,履行脚本文件按照脚本提醒输入安装途径便可.
#!/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
以上是“Linux服务器之自动搭建LAMP环境Shell代码分享[服务器安全]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |