在docker centos 6.8安装lamp脚本

#!/bin/bash

#在docker centos:6安装lamp脚本

#renphp  20160706

 

 

#一安装更改yum源

yum install -y wget

yum install -y epel-release.noarch

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

yum clean all

yum makecache

yum update -y

 

#二安装httpd

yum install httpd -y

sed -i 's/#ServerName www.example.com:80/ServerName www.example.com:80/' /etc/httpd/conf/httpd.conf

chkconfig --level 3 httpd on

/etc/init.d/httpd start

 

#三安装mysql

yum install mysql mysql-server -y

chkconfig --level 3 mysqld on

cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

/etc/init.d/mysqld start

/usr/bin/mysqladmin -u root password 'root'

mysql -uroot -proot -e "delete from mysql.user where user='' or password='';"

mysql -uroot -proot -e "drop database test;"

history -c

/etc/init.d/mysqld restart

 

 

#四安装php

yum install -y php php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath mhash-devel libmcrypt

 

#五配置LAMP

sed -i "s/erverTokens OS/erverTokens Prod/g" /etc/httpd/conf/httpd.conf

sed -i "s/ServerSignature On/ServerSignature Off/g" /etc/httpd/conf/httpd.conf

sed -i "s/Options Indexes FollowSymLinks/Options Includes ExecCGI FollowSymLinks/g" /etc/httpd/conf/httpd.conf

sed -i "s/DirectoryIndex index.html index.html.var/DirectoryIndex index.php index.html index.htm/g" /etc/httpd/conf/httpd.conf

sed -i "s/KeepAlive Off/KeepAlive On/g" /etc/httpd/conf/httpd.conf

 sed -i "s/MaxKeepAliveRequests 100/MaxKeepAliveRequests 1000/g" /etc/httpd/conf/httpd.conf

rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html

sed -i "s/;date.timezone =/date.timezone = PRC/" /etc/php.ini

sed -i "s/expose_php = On/expose_php = Off/" /etc/php.ini

sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php.ini

sed -i "s/disable_functions =/disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname/" /etc/php.ini

 

echo -e "<?php\nphpinfo();" > /var/www/html/index.php

 

/etc/init.d/mysqld restart

/etc/init.d/httpd restart

 

#原文链接:http://my.oschina.net/phpecshop/blog/701728

 

转载于:https://my.oschina.net/phpecshop/blog/707473

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值