ubuntu 14.04 阿里云服务器安装lamp环境脚本

17-04-13 17:23 字数 1709 阅读 5171 已编辑
阿里云环境搭建:

#!/bin/bash
#安装包
apt-get update
apt-get -y install php5 apache2 mysql-server 
apt-get -y install curl libcurl3 libcurl3-dev php5-curl php5-mysql php5-dev php5-gd php5-soap 
apt-get -y install libapache2-mod-php5
apt-get -y install cronolog
a2enmod rewrite 
a2enmod expires
a2enmod include
apt-get -y install zabbix-agent
#####安全方面
sed  -i "s/ServerTokens OS/ServerTokens Prod/g" /etc/apache2/conf-available/security.conf
sed  -i "s/ServerSignature On/ServerSignature Off/g" /etc/apache2/conf-available/security.conf
######安装apf
#阿里云防火墙:
apt-get -y install apf-firewall
sed -i "s/IFACE_IN="eth0"/IFACE_IN="eth1"/g" /etc/apf-firewall/conf.apf 
sed -i "s/IFACE_OUT="eth0"/IFACE_OUT="eth1"/g" /etc/apf-firewall/conf.apf 
sed -i "s/IFACE_TRUSTED=""/IFACE_TRUSTED="eth0"/g" /etc/apf-firewall/conf.apf 
sed -i "s/DEVEL_MODE="1"/DEVEL_MODE="0"/g" /etc/apf-firewall/conf.apf 
sed -i "s/SET_MONOKERN="0"/SET_MONOKERN="1"/g" /etc/apf-firewall/conf.apf
sed -i "s/IG_TCP_CPORTS="22"/IG_TCP_CPORTS="80"/g" /etc/apf-firewall/conf.apf
sed -i "s/DLIST_DSHIELD="0"/DLIST_DSHIELD="1"/g" /etc/apf-firewall/conf.apf
sed -i "s/no/yes/g" /etc/default/apf-firewall
apf -a 允许访问的ip地址
apf -r
#下载phpmyadmin
wget https://files.phpmyadmin.net/phpMyAdmin/4.0.10.20/phpMyAdmin-4.0.10.20-all-languages.tar.gz
######安装pure-ftpd
apt-get -y install  pure-ftpd
groupadd ftpgroup
useradd ftpuser -g ftpgroup -s /bin/false -d /dev/null
mkdir -p /data/web/
mkdir /data/logs
chown -R ftpuser.ftpgroup /data/web/
ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/60puredb
(echo ftptest;echo ftptest) | pure-pw useradd test -u ftpuser -d /data/web/
pure-pw mkdb
/etc/init.d/pure-ftpd restart

#配置安装zabbix客户端

sed -i "s/Server=127.0.0.1/Server=监控ip地址/g"  /etc/zabbix/zabbix_agentd.conf
/etc/init.d/zabbix-agent restart
#配置apache,在文件末尾加ServerName,避免报错
sed -i '$aServerName localhost' /etc/apache2/apache2.conf
0人点赞>
关注 收藏 改进 举报
8 条评论
排序方式 时间 投票
水格

收录了。。。[em_28]

Up骚年
什么收录了?
xxliu
@saonian 为啥我写的#注释都没有了?bug?
xxliu

哈哈

Up骚年

欢迎小刘同学。[em_71][em_13]

请登录后发表评论
静坐常思己过,闲谈莫记他非!
文章
2
粉丝
1
喜欢
0
收藏
6
排名 : 21
访问 : 1.02万
私信