代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
Shell
】
web安装脚本
作者:
赤那
/ 发布于
2015/5/19
/
828
#!/sbin/bash export PATH=$PATH:/bin:/sbin:/usr/sbin #检查是否root用户执行 if [[ "$(whoami)" != "root" ]]; then echo "please run this script as root" >&2 exit 1 fi . /etc/init.d/functions touche /tmp/install_lamp.log #安装apache Install_apache(){ if [[ `rpm -qa httpd |wc -l` != 0 ]]; then rpm -e httpd-2.2.15-39.el6.centos.x86_64.rpm fi for (( i = 0; i < 4; i++ )); do yum -y install lrzsz gcc gcc-c++ pcre pcre-devel openssl \ openssl-devel zlib zlib-devel ncurses-devel gd gd-devel done [ -d /opt/tools/ ] && cd /opt/tools/ || exit #安装apr tar xfz apr-1.5.2.tar.gz cd apr-1.5.2 ./configure --prefix=/usr/local/apr make && make install i=$(echo $?) if [[ ${i} != 0 ]]; then echo 'install apr is fail' >> /tmp/install_lamp.log exit elif [[ ${i} == 0 ]]; then echo "install apr is succ" >> /tmp/install_lamp.log fi cd .. #安装apr-util tar xfz apr-util-1.5.4.tar.gz cd apr-util-1.5.4 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make && make install i=$(echo $?) if [[ ${i} != 0 ]]; then echo 'install apr-util is fail' >> /tmp/install_lamp.log exit elif [[ ${i} == 0 ]]; then echo "install apr-util is succ" >> /tmp/install_lamp.log fi cd .. #安装apache tar xfz httpd-2.4.12.tar.gz cd httpd-2.4.12 ./configure --prefix=/usr/local/apache2.4.12 \ --enable-deflate \ --enable-so \ --enable-ssl \ --enable-proxy-fcgi \ --enable-rewrite \ --with-zlib \ --with-pcre \ --with-apr=/usr/local/apr \ --with-apr-util=/usr/local/apr-util \ --enable-modules=most \ --enable-mpms-shared=all \ --with-mpm=event \ --enable-expires \ --enable-headers make && make install i=$(echo $?) if [[ ${i} != 0 ]]; then echo 'install apache is fail' >> /tmp/install_lamp.log exit elif [[ ${i} == 0 ]]; then echo "install apache is succ" >> /tmp/install_lamp.log fi cd .. ln -s /usr/local/apache2.4.12 /usr/local/apache } #安装mysql Install_Mysql(){ for (( i = 0; i < 4; i++ )); do yum -y install pcre-devel gcc-c++ gcc ncurses-devel \ bison libxml2 libxml2-devel autoconf libjpeg libjpeg-devel libpng \ libpng-devel freetype freetype-devel zlib zlib-devel glibc \ glibc-devel glib2 glib2-devel flex bzip2* curl* openssl-devel openssl done cd /opt/tools/ #安装cmake tar xfz cmake-3.2.2.tar.gz cd cmake-3.2.2 ./bootstrap && \ gmake && make install i=$(echo $?) if [[ ${i} != 0 ]]; then echo 'install camake is fail' >> /tmp/install_lamp.log exit elif [[ ${i} == 0 ]]; then echo "install camake is succ" >> /tmp/install_lamp.log fi cd .. #安装mysql mkdir /mydata/data -p groupadd -r mysql useradd -g mysql -r -s /sbin/nologin -M -d /mydata/data mysql tar xfz mysql-5.5.43.tar.gz cd mysql-5.5.43 /usr/local/bin/cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.43 \ -DMYSQL_DATADIR=/mydata/data \ -DSYSCONFDIR=/etc \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \ -DWITHOUT_PARTITION_STORAGE_ENGINE=1 \ -DWITH_FAST_MUTEXES=1 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_EMBEDDED_SERVER=1 \ -DWITH_DEBUG=0 \ -DWITH_READLINE=1 \ -DWITH_SSL=bundled \ -DWITH_ZLIB=system \ -DWITH_LIBWRAP=0 \ -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \ -DENABLED_LOCAL_INFILE=ON make && make install i=$(echo $?) if [[ ${i} != 0 ]]; then echo 'install mysql is fail' >> /tmp/install_lamp.log exit elif [[ ${i} == 0 ]]; then echo "install mysql is succ" >> /tmp/install_lamp.log fi ln -s /usr/local/mysql-5.5.43 /usr/local/mysql cd /usr/local/mysql chown -R mysql:mysql . scripts/mysql_install_db --user=mysql --datadir=/mydata/data \cp /etc/my.cnf /etc/my.cnf.bak cd /usr/local/mysql \cp support-files/my-large.cnf /etc/my.cnf sed -i '/thread_concurrency = 8/a datadir = /mydata/data' /etc/my.cnf sed -i '/datadir = \/mydata\/data/a log-slow-queries = \/mydata\/data\/slow.log' /etc/my.cnf sed -i '/log-slow-queries = \/mydata\/data\/slow.log/a \/mydata\/data\/error.log' /etc/my.cnf cat >> /etc/my.cnf << EOF [mysqld_safe] log-error = /mydata/data/mysql_3306.err pid-file = /mydata/data/mysqld.pid EOF #安装mysql的man cd /usr/local/mysql cp support-files/mysql.server /etc/rc.d/init.d/mysqld echo "MANPATH /usr/local/mysql/man" >>/etc/man.config ln -sv /usr/local/mysql/include /usr/include/mysql echo '/usr/local/mysql/lib' > /etc/ld.so.conf.d/mysql.conf ldconfig echo 'PATH=$PATH:/usr/local/mysql/bin' >>/etc/profile source /etc/profile /etc/init.d/mysqld start /usr/local/mysql/bin/mysql --version && \ echo -e "\e[31m mysql install is OK\e[0m" #删除无用用户与测试库 echo -e "delete from mysql.user where user='';" | mysql echo -e "delete from mysql.user where host='::1';" | mysql echo -e "drop database test;" | mysql } #安装php Install_Php(){ for (( i = 0; i < 4; i++ )); do yum -y install gcc-c++ libxml2 libxml2-devel autoconf libjpeg libjpeg-devel \ libpng libpng-devel freetype freetype-devel zlib zlib-devel glibc glibc-devel \ glib2 glib2-devel flex bzip2* curl curl-devel libmcrypt libmcrypt-devel mhash mhash-devel \ mcrypt libevent libevent-devel openssl openssl-devel done cd /opt/tools tar xfz php-5.6.8.tar.gz cd php-5.6.8 ./configure \ --prefix=/usr/local/php-5.5.42 \ --with-mysql=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-openssl \ --enable-fpm \ --enable-sockets \ --enable-sysvshm \ --enable-mbstring \ --with-freetype-dir \ --with-jpeg-dir \ --with-png-dir \ --with-zlib-dir \ --with-libxml-dir=/usr \ --enable-xml \ --with-config-file-path=/etc \ --with-config-file-scan-dir=/etc/php.d \ --with-bz2 \ --with-curl \ --with-gd make && make install i=$(echo $?) if [[ ${i} != 0 ]]; then echo 'install php is fail' >> /tmp/install_lamp.log exit elif [[ ${i} == 0 ]]; then echo "install php is succ" >> /tmp/install_lamp.log fi ln -s /usr/local/php-5.5.42 /usr/local/php cp php.ini-production /etc/php.ini cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm chmod +x /etc/rc.d/init.d/php-fpm chkconfig --add php-fpm chkconfig php-fpm on cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf } Install_apache Install_Mysql Install_Php
试试其它关键字
web安装脚本
同语言下
.
判断用户输入的是否为IP地址
.
根据web访问日志,封禁请求量异常的IP,如IP在半小时
.
iptables自动屏蔽访问网站频繁的IP
.
批量修改服务器用户密码
.
监控httpd的进程数,根据监控情况做相应处理
.
创建10个用户,并分别设置密码,密码要求10位且包含大
.
Expect实现SSH免交互执行命令
.
输入数字运行相应命令
.
用shell打印示例语句中字母数小于6的单词
.
扫描主机端口状态
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
赤那
贡献的其它代码
(
2
)
.
web安装脚本
.
样式重置升级版
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3