首页 文章 精选 留言 我的

精选列表

搜索[运维监控],共10000篇文章
优秀的个人博客,低调大师

运维人员的解放----Docker快速部署

Docker是一个用了一种新颖方式实现的超轻量虚拟机,在实现的原理和应用上还是和VM有巨大差别,专业的叫法是应用容器(Application Container)。(我个人还是喜欢称虚拟机) Docker应用容器相对于VM有以下几个优点: 启动速度快,容器通常在一秒内可以启动,而VM通常要更久 资源利用率高,一台普通PC可以跑上千个容器,你跑上千个VM试试 性能开销小,VM通常需要额外的CPU和内存来完成OS的功能,这一部分占据了额外的资源 因为VM的Hypervisor需要实现对硬件的虚拟化,并且还要搭载自己的操作系统,自然在启动速度和资源利用率以及性能上有比较大的开销。 个人体会较深的两处优点: 1、快速部署,传统的部署模式是:安装(包管理工具或者源码包编译)->配置->运行;Docker的部署模式是:复制->运行。 2、可以保证线上与测试环境一致,计划以后上线就直接复制测试使用的docker容器) 什么是docker? http://oilbeater.com/docker/2014/06/29/what-is-docker.html 为什么你应该关注docker? http://oilbeater.com/docker/2014/06/13/why-you-should-care-about-docker.html 1、docker安装 debian7安装docker 参考地址:http://www.webmaster.me/server/installing-docker-on-debian-wheezy-in-60-seconds.html echo deb http://get.docker.io/ubuntu docker main | sudo tee/etc/apt/sources.list.d/docker.list sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 sudo apt-get update sudo apt-get install -y lxc-docker #四行命令,Docker就安装好了。下面创建一个ubuntu虚拟系统: docker pull ubuntu #此处是从官网拉取名为ubuntu的image,也可手动在https://index.docker.io上搜索想要的镜像。 docker run -i -t ubuntu /bin/bash #创建一个容器,-t是临时终端。 ubuntu12.04、windows、macOS安装docker 参考docker中文文档http://www.widuu.com/docker/ 2、docker使用过程实践 2.1在测试机启动容器,安装ssh docker run -i -t ubuntu /bin/bash #此方式运行的容器,退出后容器就会关闭。 apt-get install openssh-server #安装ssh #需要修改/etc/sshd/sshd_config文件中内容 PermitRootLogin yes UsePAM no 2.2启动ssh,容器以后台方式运行 docker run -d -p 50001:22 <镜像id> /usr/sbin/sshd-D #容器id可通过docker ps -a查看,最上面的为最新的。 2.3通过ssh连接到容器安装软件 sshroot@127.0.0.1-p 50001 #连上后想装什么就装什么,可使用exit退出容器,但后台还会运行。 2.4服务安装完成后,停止容器。 docker stop <容器id> #停止运行的容器 2.5把容器提交生成最新的镜像 docker commit <容器id> debian02#把这个容器提交生成新的debian02镜像(该镜像是原始镜像与容器的整合) 2.6打包镜像 docker save debian02 >/root/debian02.tar #debian02镜像打包 2.7在另外的机器上导入镜像 docker load < debian02.tar #导入镜像 docker images #查看存在的镜像 2.8启动容器 docker run -h="redis-test" --name redis-test -d -p 51000:22 -p51001:3306 -p 51003:6379 -p 51004:6381-p 51005:80 -p 51006:8000 -p 51007:8888debian02 /etc/rc.local #此处是我测试机器启动命令,指定主机名与端口映射。 #启动后,后面又装了程序,开机自启动命令可放在/etc/rc.local文件中。 docker容器迁移简单方便,可以任意的拷贝部署,以后再也不怕新部署环境了,一堆依赖装的想死有木有。 3、关于docker容器的端口映射 由于docker容器的IP地址每次启动都会变,所以不适用于手动添加端口映射(难道每次重启都来查看容器的IP么?),所以需要每次启动容器时由docker程序自动添加NAT规则,前期尽可能的把需要映射的端口在创建容器时配置好,如下: docker run -h="activemq" --name activemq -d -p 51000:22 -p 51001:3306-p 51003:6379 -p 51004:6381 -p 51005:80-p 51006:8000 -p 51007:8888 debian/base/etc/rc.local #此处我把mysql,redis,nginx,ssh都进行了映射。 后续对于docker容器的管理,记住容器的名称,如上述名称是activemq,则使用docker stop,start来控制容器进程。 dockerstop activemq docker start activemq 当然,也可以不让docker每次启动容器修改容器的IP地址,参考如下: docker网络配置:http://www.open-open.com/lib/view/open1404896485747.html 4、关于docker容器的多程序开机自动运行 docker容器每次启动时,开机自启动的命令都要在启动容器前指定。如docker run -I -t debian /bin/bash命令,只会运行/bin/bash程序,其它的程序都不会运行,对于要跑多个程序的容器特别纠结。 多程序开机自动运行方法: 可把前面所说的启动命令换成dockerrun -I -t debian /etc/rc.local,在容器中把所有需要开机自的启动命令放在/etc/rc.local中,就可以达到多程序开机自启动了。 后台运行则是:docker run -d -p 50001:22 debian /etc/rc.local。注意:run命令是创建一个新的容器,如果要启动一个曾经运行过的容器,则用命令docker ps -a中找对应的容器ID,然后使用docker start <容器ID>即可。 5、关于docker容器和镜像的关系 无论容器里做什么操作,写文件,删文件。该容器的基本镜像都不会有任何改变。 这是因为Docker从父镜像建立增量镜像,只存储每个容器的更改。因此,如果你有一个300MB的父镜像,如果你在容器中安装了50MB的额外应用或服务,你的容器只有50MB,父镜像还是300MB。 但是可以使用Dockfile或commit命令来,把增量镜像和父镜像一起生成一个新的镜像。 commit使用: docker commit <容器id> <新镜像名称> Dockfile使用: root@yangrong:/data# cat Dockerfile FROMubuntu/testa #这是基础镜像 CMD["/root/start.sh"] #这是启动命令 root@yangrong:/data# docker build -t <新镜像名> ./ 关于Dockfile更多参数参考地址: http://www.tuicool.com/articles/FRvAbe http://www.colorscode.net/2014/01/04/howto-build-image-with-automatic-startup-ssh-service-from-dockerfile/ 6、docker参数详解 docker useage of docker -D默认false允许调试模式(debugmode) -H默认是unix:///var/run/docker.sock tcp://[host[:port]]来绑定或者unix://[/path/to/socket]来使用(二进制文件的时候),当主机ip host=[0.0.0.0],(端口)port=[4243]或者path=[/var/run/docker.sock]是缺省值,做为默认值来使用 -api-enable-cors默认flase允许CORS header远程api -b默认是空,附加在已存在的网桥上,如果是用'none'参数,就禁用了容器的网络 -bip默认是空,使用提供的CIDR(ClasslessInter-Domain Routing-无类型域间选路)标记地址动态创建网桥(dcoker0),和-b参数冲突 -d默认false允许进程模式(daemonmode) -dns默认是空,使docker使用指定的DNS服务器 -g默认是"/var/lib/docker":作为docker使用的根路径 -icc默认true,允许inter-container来通信 -ip默认"0.0.0.0":绑定容器端口的默认Ip地址 -iptables默认true禁用docker添加iptables规则 -mtu默认1500 :设置容器网络传输的最大单元(mtu) -p默认是/var/run/docker.pid进程pid使用的文件路径 -r默认是true重启之前运行的容器 -s默认是空,这个是docker运行是使用一个指定的存储驱动器 -v默认false打印版本信息和退出 7、docker run命令详解 Usage: docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...] Run a command in a new container -a=map[]:附加标准输入、输出或者错误输出 -c=0:共享CPU格式(相对重要) -cidfile="":将容器的ID标识写入文件 -d=false:分离模式,在后台运行容器,并且打印出容器ID -e=[]:设置环境变量 -h="":容器的主机名称 -i=false:保持输入流开放即使没有附加输入流 -privileged=false:给容器扩展的权限 -m="":内存限制(格式:<number><optional unit>, unit单位= b, k, m or g) -n=true:允许镜像使用网络 -p=[]:匹配镜像内的网络端口号 -rm=false:当容器退出时自动删除容器(不能跟-d一起使用) -t=false:分配一个伪造的终端输入 -u="":用户名或者ID -dns=[]:自定义容器的DNS服务器 -v=[]:创建一个挂载绑定:[host-dir]:[container-dir]:[rw|ro].如果容器目录丢失,docker会创建一个新的卷 -volumes-from="":挂载容器所有的卷 -entrypoint="":覆盖镜像设置默认的入口点 -w="":工作目录内的容器 -lxc-conf=[]:添加自定义-lxc-conf="lxc.cgroup.cpuset.cpus = 0,1" -sig-proxy=true:代理接收所有进程信号(even in non-tty mode) -expose=[]:让你主机没有开放的端口 -link="":连接到另一个容器(name:alias) -name="":分配容器的名称,如果没有指定就会随机生成一个 -P=false: Publish all exposed ports to thehost interfaces公布所有显示的端口主机接口 8、docker常用命令总结 docker pull <镜像名:tag> #从官网拉取镜像 docker search <镜像名> #搜索在线可用镜像名 8.1查询容器、镜像、日志 docker top <container> #显示容器内运行的进程 docker images #查询所有的镜像,默认是最近创建的排在最上。 docker ps#查看正在运行的容器 docker ps -l #查看最后退出的容器的ID docker ps -a #查看所有的容器,包括退出的。 docker logs {容器ID|容器名称} #查询某个容器的所有操作记录。 docker logs -f {容器ID|容器名称} #实时查看容易的操作记录。 8.2删除容器与镜像 docker rm$(docker ps -a -q)#删除所有容器 docker rm <容器名or ID> #删除单个容器 docker rmi <ID> #删除单个镜像 docker rmi$(docker images | grep none | awk '{print $3}' | sort -r)#删除所有镜像 8.3启动停止容器 docker stop <容器名or ID> #停止某个容器 docker start <容器名or ID> #启动某个容器 docker kill <容器名or ID> #杀掉某个容器 8.4容器迁器 docker export <CONTAINER ID> > /home/export.tar #导出 cat /home/export.tar | sudo docker import - busybox-1-export:latest #导入export.tar文件 docker save debian> /home/save.tar #将debian容器打包 docker load< /home/save.tar #在另一台服务器上加载打包文件 save和export的对比参考地址: http://www.fanli7.net/a/bianchengyuyan/C__/20140423/452256.html 8.5运行一个新容器 #运行一个新容器,同时为它命名、端口映射。以debian02镜像为例 docker run -h="redis-test" --name redis-test -d -p 51000:22 -p51001:3306 -p 51003:6379 -p 51004:6381-p 51005:80 -p 51006:8000 -p 51007:8888debian02 /etc/rc.local #从container中拷贝文件,当container已经关闭后,在里面的文件还可以拷贝出来。 sudo docker cp 7bb0e258aefe:/etc/debian_version . #把容器中的/etc/debian_version拷贝到当前目录下。 8.6 docker Dockfile镜像制作 root@yangrong:/data# cat Dockerfile FROM ubuntu/testa #这是基础镜像 CMD ["/root/start.sh"]#这是启动命令 root@yangrong:/data# docker build -t <新镜像名> ./ #生成新的镜像 Dockfile更多参数参考: http://www.tuicool.com/articles/FRvAbe http://www.colorscode.net/2014/01/04/howto-build-image-with-automatic-startup-ssh-service-from-dockerfile/ <完> 如果要把docker应用到生产环境,就要好好的规划一下,可参考下面文章: docker容器端口IP规划及端口动态扩容 http://yangrong.blog.51cto.com/6945369/1582184 本文转自杨云1028 51CTO博客,原文链接:http://blog.51cto.com/yangrong/1551327,如需转载请自行联系原作者

优秀的个人博客,低调大师

马哥运维学习作业(五)

1、显示当前系统上root、fedora或user1用户的默认shell; 1 2 3 4 5 6 [root@C7-1~] #useraddfedora#新建用户fedora [root@C7-1~] #useradduser1#新建用户user1 [root@C7-1~] #egrep'^(root|fedora|user1)\>'/etc/passwd|cut-d:-f1,7#由于(root|fedora|user1)是扩展表达式,所以要使用egrep或grep-E root: /bin/bash fedora: /bin/bash user1: /bin/bash 注:^(root|fedora|user1)\>表示以这三个用户开头的行。cut -d: -f1,7表示以:为分隔符,取第1和第7字段,这二个字段是用户名和shell的。 图示: 2、找出/etc/rc.d/init.d/functions文件中某单词后面跟一组小括号的行,形如:hello(); 1 2 3 4 [root@C7-1~] #egrep-o"^[_[:alpha:]]+\(\)"/etc/rc.d/init.d/functions checkpid() __pids_var_run() ....略 注:根据题目要求,文件中__pids_var_run()也是符合要求的,^[_[:alpha:]]+中,_不能省掉,代表以_或大小写字母开头,+表示前面字符可以出现一次或多次,\(\)是使用转义符来代表小括号() 图示: 3、使用echo命令输出一个绝对路径,使用grep取出其基名; 1 2 3 4 5 6 [root@ cat ~] #echo"/mnt/sdc"|grep-E"[^/]+$"#行尾的字符串[^/]除了/斜线的任意内容,+代表这个/至少出现1次 /mnt/sdc [root@ cat ~] #echo"/mnt/sdc/"|grep-E"[^/]+/?$"#如果sdc后还带一个/,就用/?表示可以出现1次或不出现 /mnt/sdc/ [root@ cat ~] #echo"/mnt/sdc"|grep-E-o"[^/]+/?$"|cut-d"/"-f1#-o只显示匹配的,以/作为分隔符,取第1字段,取出sdc sdc 扩展:取出其路径名 1 2 [root@ cat ~] #echo"/mnt/sdc/test"|grep-o"/.*/"#取出路径名,"/.*/"表示以/开头后面可出现任意长度任意字符,以/结尾,这样就符合路径名的规则。 /mnt/sdc/ 图示: 4、找出ifconfig命令结果中的1-255之间数字; 1 2 3 4 5 6 [root@C7-1~] #ifconfig|grep-E-o"\<([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\>" 192 168 2 127 ...略 图示: 5、挑战题:写一个模式,能匹配合理的IP地址; 1 2 3 4 5 6 7 8 [root@ cat ~] #catip#手动写了几个IP地址,有对有错,用下面的条件来筛选 980.168.88.66 192.168.88.255 253.252.251.0 192.168.2.60 255.0.0.690 [root@ cat ~] #grep-E"\<([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-3][0-9])\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-4])\>"ip 192.168.2.60 6、挑战题:写一个模式,能匹配出所有的邮件地址; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 [root@note1~] #cat/tmp/mail#编写了6个邮箱地址,其中4、5不符合邮箱命名规范 [root@c7-1~] #catmail 342076957@qq.com zhaodongwei@zhaodongwei.cn dongwei_zhao@cmdmedia.cn _dongwei@cmd.cn liupeng@_dfdfd.com zjj.d@baidu.com [root@c7-1~] #egrep-o"[[:alnum:]]+[[:punct:]]*[[:alnum:]]*@[[:alnum:]]+.[[:alnum:]]*.?[[:alnum:]]*"mail 342076957@qq.com zhaodongwei@zhaodongwei.cn dongwei_zhao@cmdmedia.cn dongwei@cmd.cn zjj.d@baidu.com 注:首先,咱们要了解邮箱地址的构成,简单来说,是由:用户名@域名 构成。用户名命名要求:可使用字母、数字、下划线,开头可以使用数字或字母(QQ邮箱就是数字开头)域名命名要求:可使用字母、数字、下划线组成,不能使用特殊字母开头等详细的介绍请看下图:分别是新浪、163邮箱命令介绍。阿里域名的命名介绍 图示: 7、查找/var目录下属主为root,且属组为mail的所有文件或目录; 1 2 3 4 [root@c7-1~] #find/var-userroot-groupmail /var/spool/mail [root@c7-1~] #find/var-userroot-groupmail-ls#-ls是将查找到的文件显示出来 1343212080drwxrwxr-x2rootmail167月3105:06 /var/spool/mail 图示: 8、查找当前系统上没有属主或属组的文件; 1 2 3 4 5 [root@C7-1~] #find/-nouser-o-nogroup-ls#用-nouser-o-nogroup表示没有属 find :‘ /proc/16897/task/16897/fd/6 ’:没有那个文件或目录 find :‘ /proc/16897/task/16897/fdinfo/6 ’:没有那个文件或目录 find :‘ /proc/16897/fd/6 ’:没有那个文件或目录 find :‘ /proc/16897/fdinfo/6 ’:没有那个文件或目录 进一步:查找当前系统上没有属主或属组,且最近3天内曾被访问过的文件或目录; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 为了方便演示,创建了一个user1的用户,并用user1创建了一个文件,然后删除user1 [user1@C7-1~]$ touch /tmp/b #在user1用户下创建/tmp/b文件 [user1@C7-1~]$ll /tmp/b #查看属主和属组,属于user1 -rw-rw-r--.1user1user109月521:24 /tmp/b [user1@C7-1~]$登出 [root@C7-1~] #登出 [root@C7-1 test ] #登出 [root@C7-1~] #登出 Lastlogin:MonSep521:23:452016 [root@C7-1~] #userdeluser1#退出后,删除user1用户 [root@C7-1~] #iduser1#user1用户已删除 id :user1:nosuchuser [root@C7-1~] #ls-l/tmp/#b文件属主和属组已变为数字 总用量4 -rw-r--r--.1rootroot289月201:2712 -rw-rw-r--.12023202309月521:24b 方法一: [root@note1~] #find/-nouser-a-nogroup-a-atime-3#-atime-3表示3天没有访问过的文件,查找到了b和user1用户下的文件 find :‘ /proc/16901/task/16901/fd/6 ’:没有那个文件或目录 find :‘ /proc/16901/task/16901/fdinfo/6 ’:没有那个文件或目录 find :‘ /proc/16901/fd/6 ’:没有那个文件或目录 find :‘ /proc/16901/fdinfo/6 ’:没有那个文件或目录 /tmp/b /home/tom /home/user1 /home/user1/ .bash_logout /home/user1/ .bash_profile /home/user1/ .bashrc /home/user1/ .bash_history 方法二: [root@C7-1~] #find/\(-nouser-o-nogroup\)-a-atime-3#也可以这样用 find :‘ /proc/16901/task/16901/fd/6 ’:没有那个文件或目录 find :‘ /proc/16901/task/16901/fdinfo/6 ’:没有那个文件或目录 find :‘ /proc/16901/fd/6 ’:没有那个文件或目录 find :‘ /proc/16901/fdinfo/6 ’:没有那个文件或目录 /tmp/b /home/tom /home/user1 /home/user1/ .bash_logout /home/user1/ .bash_profile /home/user1/ .bashrc /home/user1/ .bash_history 图示: 9、查找/etc目录下所有用户都有写权限的文件; 1 2 3 4 5 [root@c7-1~] #find/etc-perm-222-ls#所有用户都有写权限用-perm-222表示 335545640lrwxrwxrwx1rootroot179月500:00 /etc/mtab -> /proc/self/mounts 336897120lrwxrwxrwx1rootroot499月500:01 /etc/pki/tls/certs/ca-bundle .crt-> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle .pem 336897130lrwxrwxrwx1rootroot559月500:01 /etc/pki/tls/certs/ca-bundle .trust.crt-> /etc/pki/ca-trust/extracted/openssl/ca-bundle .trust.crt ...略 10、查找/etc目录下大于1M,且类型为普通文件的所有文件; 1 2 3 [root@c7-1~] #find/etc-size+1M-typef-ls#大于1MB用-size+1M表示 342884416824-r--r--r--1rootroot69848329月500:05 /etc/udev/hwdb .bin 677968023772-rw-r--r--1rootroot385892411月212015 /etc/selinux/targeted/policy/policy .29 11、查找/etc/init.d/目录下,所有用户都有执行权限,且其它用户有写权限的文件; 1 2 [root@c7-1~] #find/etc/init.d-perm-113-ls#用户都有执行,其它用户有写权限用-perm-113表示 336884510lrwxrwxrwx1rootroot119月500:01 /etc/init .d->rc.d /init .d 12、查找/usr目录下不属于root、bin或hadoop的文件; 1 2 3 4 [root@c7-1~] #find/usr-not\(-userroot-o-userbin-o-userhadoop\)-ls#-not放在()外面,对里面的内容,即不也不又不,做条件 674247010drwx------2polkitdroot66月102014 /usr/share/polkit-1/rules .d [root@c7-1~] #find/usr!\(-userroot-o-userbin-o-userhadoop\)-ls#-not和!是同样的意思 674247010drwx------2polkitdroot66月102014 /usr/share/polkit-1/rules .d 13、查找/etc/目录下至少有一类用户没有写权限的文件; 1 2 3 4 [root@c7-1~] #find/etc-not-perm-222-ls#至少一类用户没有写权限用-perm-222表示 3355456112drwxr-xr-x76rootroot81929月504:04 /etc 335545624-rw-r--r--1rootroot4659月500:00 /etc/fstab ....略 14、查找/etc目录下最近一周内其内容被修改过,且不属于root或hadoop的文件; 1 2 3 4 5 6 7 8 9 10 [root@note1~] #ll/etc/test123#默认没有满足条件的文件,所以先在/etc下创建一个test123的文件,查看其属主和属组都是root -rw-r--r--1rootroot0Sep116:00 /etc/test123 [root@note1~] #useraddtest#创建一个test用户,用来把上面文件属主属组都改为test [root@note1~] #chowntest.test/etc/test123#把/etc下的test123改为属主属组root [root@note1~] #ll/etc/test123#已改为root -rw-r--r--1 test test 0Sep116:00 /etc/test123 [root@note1~] #find/etc-mtime-7-a-not-userroot-not-userhadoop#根据题目要求查看,-mtime-7表示7天没修改过 /etc/test123 [root@note1~] #find/etc-mtime-7-not\(-userroot-o-userhadoop\)-ls#-not放外面对里面来做判断,不属于root和hadoop。注意-not放外面要把()里的-a换成-o 3974950-rw-r--r--1 test test 0Sep116:00 /etc/test123 图示: 本文转自cix123 51CTO博客,原文链接:http://blog.51cto.com/zhaodongwei/1845603,如需转载请自行联系原作者

优秀的个人博客,低调大师

Hadoop运维记录系列(二十一)

Zeppelin启用https过程和Hack内核以满足客户需求的记录。 原因是这客户很有意思,该客户中国分公司的人为了验证内网安全性,从国外找了一个***测试小组对Zeppelin和其他产品进行***测试,结果发现Zeppelin主要俩问题,一个是在内网没用https,一个是zeppelin里面可以执行shell命令和python语句。其实这不算大问题,zeppelin本来就是干这个用的。但是***小组不了解zeppelin是做什么的,认为即使在内网里,执行shell命令能查看操作系统的一些文件是大问题,然后发生的事就不说了,不是我们的问题了。 不过既然他们要求整改,我们也只好配合,虽然大家都觉得内网域名加https属于脱了裤子放屁,然后不让zeppelin干他本来应该干的事就更过分了,但鉴于客户是甲方,也只好hack源码了。 于是某个周末用了4个小时完成所有工作。 先记录下zeppelin加https访问,我们有自己的域名证书,所以直接用即可。如果没有域名证书,需要自签发,那么可以看第二部分,双向认证步骤。 https第一部分,已有域名添加jks: opensslpkcs12-export-inxxx.com.crt-inkeyxxx.com.key-outxxx.com.pkcs12 keytool-importkeystore-srckeystorexxx.com.pkcs12-destkeystorexxx.com.jks-srcstoretypepkcs12 https第二部分,自签发证书双向认证添加jks #生成root私钥和证书文件。 opensslgenrsa-outroot.key(pem)2048#Generaterootkeyfile opensslreq-x509-new-keyroot.key(pem)-outroot.crt#Generaterootcertfile #创建客户端私钥和证书以及证书请求文件csr opensslgenrsa-outclient.key(pem)2048#Generateclientkeyfile opensslreq-new-keyclient.key(pem)-outclient.csr#Generateclientcertrequestfile opensslx509-req-inclient.csr-CAroot.crt-CAkeyroot.key(pem)-CAcreateserial-days3650-outclient.crt#Userootcerttogenerateclientcertfile #生成服务器端私钥,证书和证书请求文件csr opensslgenrsa-outserver.key(pem)2048#Generateserverkeyfile,useinZeppelin opensslreq-new-keyserver.key(pem)outserver.csr@Generateservercertrequestfile opensslx509-req-inserver.csr-CAroot.crt-CAkeyroot.key(pem)-CAcreateserial-days3650-outserver.crt#Userootcerttogenerateservercertfile #生成客户端端jks文件 opensslpkcs12-export-inclient.crt-inkeyclient.key(pem)-outclient.pkcs12#Packagetopkcs12format,mustinputapassword,youshouldrememberthepassword keytool-importkeystore-srckeystoreclient.pkcs12-destkeystoreclient.jks-srcstoretypepkcs12#Theclientpasswordyoujustinputatlaststep #生成服务器端jks文件 opensslpkcs12-export-inserver.crt-inkeyserver.key(pem)-outserver.pkcs12@Packagetopkcs12format,mustinputapassword,youshouldrememberthepassword keytool-importkeystore-srckeystoreserver.pkcs12-destkeystoreserver.jks-srcstoretypepkcs12#Theserverpasswordyoujustinputatlaststep 如果是不需要双向认证,只要单向自签发,不创建客户端的各种就可以了。 然后找个地把这些文件放过去,再修改zeppelin配置即可。 mkdir-p/etc/zeppelin/conf/ssl cpserver.crtserver.jks/etc/zeppelin/conf/ssl <property> <name>zeppelin.server.ssl.port</name> <value>8443</value> <description>Serversslport.(usedwhensslpropertyissettotrue)</description> </property> <property> <name>zeppelin.ssl</name> <value>true</value> <description>ShouldSSLbeusedbytheservers?</description> </property> <property> <name>zeppelin.ssl.client.auth</name> <value>false</value> <description>ShouldclientauthenticationbeusedforSSLconnections?</description> </property> <property> <name>zeppelin.ssl.keystore.path</name> <value>/etc/zeppelin/conf/ssl/xxx.com.jks</value> <description>PathtokeystorerelativetoZeppelinconfigurationdirectory</description> </property> <property> <name>zeppelin.ssl.keystore.type</name> <value>JKS</value> <description>Theformatofthegivenkeystore(e.g.JKSorPKCS12)</description> </property> <property> <name>zeppelin.ssl.keystore.password</name> <value>passwordwhichyouinputongeneratingserverjksstep</value> <description>Keystorepassword.CanbeobfuscatedbytheJettyPasswordtool</description> </property> 然后反代那里也加上443的ssl证书以及443转8443的upstream即可。 然后是hack zeppelin源码加入关键字限制,这个确实找了一小会zeppelin发送执行源码给interpreter的地方,zeppelin架构比较清晰,但是代码挺复杂的,用到了很多小花活儿。比如thrift,interpreter脚本里建立nc监听。然后各个解释器插件用socket跟interpreter脚本通信,前端angular,后端jetty,还用shiro做验证和授权。回头可以单开好几篇说说zeppelin安装,使用和详细配置,做这项目基本把zeppelin摸透了。 找到发送前端编写内容给interpreter的java代码,然后用很生硬的办法限制执行命令。具体那个.java文件的名字我就不说了,有悬念有惊喜。我不写java,只负责读源码找到代码位置,hack的java是同事写的。然后编译,替换jar包,完成。后面改了改配置,后续的***测试顺利通过。 staticHashSet<String[]>blockedCodeString=newHashSet<>(); static{ blockedCodeString.add(newString[]{"import","os"}); blockedCodeString.add(newString[]{"import","sys"}); blockedCodeString.add(newString[]{"import","subprocess"}); blockedCodeString.add(newString[]{"import","pty"}); blockedCodeString.add(newString[]{"import","socket"}); blockedCodeString.add(newString[]{"import","commands"}); blockedCodeString.add(newString[]{"import","paramiko"}); blockedCodeString.add(newString[]{"import","pexpect"}); blockedCodeString.add(newString[]{"import","BaseHTTPServer"}); blockedCodeString.add(newString[]{"import","ConfigParser"}); blockedCodeString.add(newString[]{"import","platform"}); blockedCodeString.add(newString[]{"import","popen2"}); blockedCodeString.add(newString[]{"import","copy"}); blockedCodeString.add(newString[]{"import","SocketServer"}); blockedCodeString.add(newString[]{"import","sysconfig"}); blockedCodeString.add(newString[]{"import","tty"}); blockedCodeString.add(newString[]{"import","xmlrpmlib"}); blockedCodeString.add(newString[]{"etc"}); blockedCodeString.add(newString[]{"boot"}); blockedCodeString.add(newString[]{"dev"}); blockedCodeString.add(newString[]{"lib"}); blockedCodeString.add(newString[]{"lib64"}); blockedCodeString.add(newString[]{"lost+found"}); blockedCodeString.add(newString[]{"mnt"}); blockedCodeString.add(newString[]{"proc"}); blockedCodeString.add(newString[]{"root"}); blockedCodeString.add(newString[]{"sbin"}); blockedCodeString.add(newString[]{"selinux"}); blockedCodeString.add(newString[]{"usr"}); blockedCodeString.add(newString[]{"passwd"}); blockedCodeString.add(newString[]{"useradd"}); blockedCodeString.add(newString[]{"userdel"}); blockedCodeString.add(newString[]{"rm"}); blockedCodeString.add(newString[]{"akka"}); blockedCodeString.add(newString[]{"groupadd"}); blockedCodeString.add(newString[]{"groupdel"}); blockedCodeString.add(newString[]{"mkdir"}); blockedCodeString.add(newString[]{"rmdir"}); blockedCodeString.add(newString[]{"ping"}); blockedCodeString.add(newString[]{"nc"}); blockedCodeString.add(newString[]{"telnet"}); blockedCodeString.add(newString[]{"ftp"}); blockedCodeString.add(newString[]{"scp"}); blockedCodeString.add(newString[]{"ssh"}); blockedCodeString.add(newString[]{"ps"}); blockedCodeString.add(newString[]{"hostname"}); blockedCodeString.add(newString[]{"uname"}); blockedCodeString.add(newString[]{"vim"}); blockedCodeString.add(newString[]{"nano"}); blockedCodeString.add(newString[]{"top"}); blockedCodeString.add(newString[]{"cat"}); blockedCodeString.add(newString[]{"more"}); blockedCodeString.add(newString[]{"less"}); blockedCodeString.add(newString[]{"chkconfig"}); blockedCodeString.add(newString[]{"service"}); blockedCodeString.add(newString[]{"netstat"}); blockedCodeString.add(newString[]{"iptables"}); blockedCodeString.add(newString[]{"ip"}); blockedCodeString.add(newString[]{"route"}); blockedCodeString.add(newString[]{"curl"}); blockedCodeString.add(newString[]{"wget"}); blockedCodeString.add(newString[]{"sysctl"}); blockedCodeString.add(newString[]{"touch"}); blockedCodeString.add(newString[]{"scala.sys.process"}); blockedCodeString.add(newString[]{"0.0.0.0"}); blockedCodeString.add(newString[]{"git"}); blockedCodeString.add(newString[]{"svn"}); blockedCodeString.add(newString[]{"hg"}); blockedCodeString.add(newString[]{"cvs"}); blockedCodeString.add(newString[]{"exec"}); blockedCodeString.add(newString[]{"ln"}); blockedCodeString.add(newString[]{"kill"}); blockedCodeString.add(newString[]{"rsync"}); blockedCodeString.add(newString[]{"lsof"}); blockedCodeString.add(newString[]{"crontab"}); blockedCodeString.add(newString[]{"libtool"}); blockedCodeString.add(newString[]{"automake"}); blockedCodeString.add(newString[]{"autoconf"}); blockedCodeString.add(newString[]{"make"}); blockedCodeString.add(newString[]{"gcc"}); blockedCodeString.add(newString[]{"cc"}); } staticbooleanallMatch(Stringaim,String[]checker){ if(checker==null||checker.length<1){ returnfalse; }else{ //bydefault,treatasmatch,everynotmatchchangeit for(Stringi:checker){ if(!aim.matches(".*\\b"+i+"\\b.*")){ returnfalse; } } returntrue; } } staticStringanyMatch(Stringaim,HashSet<String[]>all)throwsException{ if(aim.contains("FUCKP&G")){ thrownewException("Howdoyouknowthis????"); }else{ for(String[]one:all){ if(allMatch(aim,one)){ StringBuildersb=newStringBuilder(); for(Strings:one){ sb.append(s+""); } returnsb.toString(); } } thrownewException("Noonematch"); } } //......此处是个public类 try{ StringmatchesStrings=anyMatch(st,blockedCodeString); result=newInterpreterResult(Code.ERROR,"Containsdangerouscode:"+matchesStrings); }catch(Exceptionme){//nomatchany scheduler.submit(job); while(!job.isTerminated()){ synchronized(jobListener){ try{ jobListener.wait(1000); }catch(InterruptedExceptione){ logger.info("ExceptioninRemoteInterpreterServerwhileinterpret,jobListener.wait",e); } } } if(job.getStatus()==Status.ERROR){ result=newInterpreterResult(Code.ERROR,Job.getStack(job.getException())); }else{ result=(InterpreterResult)job.getReturn(); //incaseofjobabortinPENDINGstatus,resultcanbenull if(result==null){ result=newInterpreterResult(Code.KEEP_PREVIOUS_RESULT); } } } //......直到该public类结束 因为客户有deadline限制,所以快速定位源码位置的过程还是挺有意思的,比较紧张刺激,在这个以小时计算deadline压力下,什么intelliJ, Eclipse都不好使啊,就grep和vi最好用,从找到到改完,比客户定的deadline提前了好几个小时。

优秀的个人博客,低调大师

Apache运维架构之Apache+PHP

当前互联网主流web服务器说明 1、IIS 微软的web服务器 2、apache 中小web服务器主流,web服务器中的老大哥 3、nginx 新兴的web服务器主流 4、tomcat 中小企业动态服务器,互联网java容器主流 5、resin 大型企业动态服务器,互联网java容器主流 apache的特点及应用场合 特点:功能强大,配置简单,速度快,应用广泛,性能稳定可靠,并可做代理服务器和负载均衡 应用场合: 1、使用apache来运行静态html网页,图片,处理静态小文件能力不及nginx 2、使用apache结合php引擎来运行php程序,lamp由此成为经典组合 3、使用apache结合tomcat及resin运行jsp java等程序,成为中小企业的首选 4、使用apache做代理及负载均衡 本次环境所用到的软件版本如下(操作系统centos6.7) 1、基础环境准备 [root@ansibletools]#tarxfapr-1.4.5.tar.gz [root@ansibletools]#cdapr-1.4.5 [root@ansibleapr-1.4.5]#./configure--prefix=/usr/local/apr [root@ansibleapr-1.4.5]#make&&makeinstall [root@ansibletools]#tarxfapr-util-1.3.12.tar.gz [root@ansibletools]#cdapr-util-1.3.12 [root@ansibleapr-util-1.3.12]#./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/bin/apr-1-config [root@ansibleapr-util-1.3.12]#make&&makeinstall [root@ansiblepcre-8.10]#unzippcre-8.10.zip [root@ansibletools]#cdpcre-8.10 [root@ansiblepcre-8.10]#./configure--prefix=/usr/local/pcre [root@ansiblepcre-8.10]#make&&makeinstall [root@ansibletools]#tarxflibxml2-2.7.6.tar.gz [root@ansibletools]#cdlibxml2-2.7.6 [root@ansiblelibxml2-2.7.6]#vimconfigure将下面那行注释掉 #$RM"$cfgfile" [root@ansiblelibxml2-2.7.6]#./configure--prefix=/usr/local/libxml2--without-zlib [root@ansiblelibxml2-2.7.6]#make&&makeinstall [root@ansibletools]#tarxflibmcrypt-2.5.8.tar.gz [root@ansibletools]#cdlibmcrypt-2.5.8 [root@ansiblelibmcrypt-2.5.8]#./configure--prefix=/usr/local/libmcrypt [root@ansiblelibmcrypt-2.5.8]#make&&makeinstall [root@ansibletools]#tarxfzlib-1.2.5.tar.gz [root@ansibletools]#cdzlib-1.2.5 [root@ansiblezlib-1.2.5]#./configure [root@ansiblezlib-1.2.5]#make&&makeinstall [root@ansibletools]#tarxflibpng-1.4.1.tar.gz [root@ansibletools]#cdlibpng-1.4.1 [root@ansiblelibpng-1.4.1]#./configure--prefix=/usr/local/libpng [root@ansiblelibpng-1.4.1]#make&&makeinstall [root@ansibletools]#mkdir/usr/local/jpeg6 [root@ansibletools]#mkdir/usr/local/jpeg6/bin [root@ansibletools]#mkdir/usr/local/jpeg6/lib [root@ansibletools]#mkdir/usr/local/jpeg6/include [root@ansibletools]#mkdir-p/usr/local/jpeg6/man/man1 [root@ansibletools]#tarxfjpegsrc.v6b.tar.gz [root@ansibletools]#cdjpeg-6b/ [root@ansiblejpeg-6b]#./configure--prefix=/usr/local/jpeg6/--enable-shared--enable-static [root@ansiblejpeg-6b]#make&&make报错 ./libtool--mode=compilegcc-O2-I.-c./jcapimin.c make:./libtool:Commandnotfound make:***[jcapimin.lo]Error127 解决方法 [root@ansibletools]#tarxflibtool-2.2.6a.tar.gz [root@ansibletools]#cdlibtool-2.2.6 [root@ansiblelibtool-2.2.6]#./configure [root@ansiblelibtool-2.2.6]#make&&makeinstall [root@ansiblelibtool-2.2.6]#cd../jpeg-6b/ [root@ansiblejpeg-6b]#cp/usr/share/libtool/config/config.sub. [root@ansiblejpeg-6b]#cp/usr/share/libtool/config/config.guess. [root@ansiblejpeg-6b]#./configure--prefix=/usr/local/jpeg6/--enable-shared--enable-static [root@ansiblejpeg-6b]#make&&make [root@ansibletools]#tarxffreetype-2.3.12.tar.gz [root@ansibletools]#cdfreetype-2.3.12 [root@ansiblefreetype-2.3.12]#./configure--prefix=/usr/local/freetype [root@ansiblefreetype-2.3.12]#make&&makeinstall [root@ansibletools]#tarxfautoconf-2.61.tar.gz [root@ansibletools]#cdautoconf-2.61 [root@ansibleautoconf-2.61]#./configure [root@ansibleautoconf-2.61]#make&&makeinstall [root@ansibletools]#tarxflibgd-2.1.1.tar. libgd-2.1.1.tar.gzlibgd-2.1.1.tar.xz [root@ansibletools]#tarxflibgd-2.1.1.tar.gz [root@ansibletools]#cdlibgd-2.1.1 [root@ansiblelibgd-2.1.1]#./configure\ >--prefix=/usr/local/gd2/\ >--enable-m4_pattern_allow\ >--with-zlib=/usr/local/zlib/\ >--with-jpeg=/usr/local/jpeg6/\ >--with-png=/usr/local/libpng/\ >--with-freetype=/usr/local/freetype/ [root@ansiblelibgd-2.1.1]#make&&makeinstall 2、安装编译apache [root@ansibletools]#useradd-s/sbin/nologin-Mwww [root@ansibletools]#tarxfhttpd-2.4.18.tar.bz2 [root@ansibletools]#cdhttpd-2.4.18 [root@ansiblehttpd-2.4.18]#./configure--prefix=/usr/local/apache2--enable-mods-shared=all--enable-so--enable-proxy-ajp--enable-rewrite--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/--with-pcre=/usr/local/pcre/ [root@ansiblehttpd-2.4.18]#make&&makeinstall 3、安装编译mysql [root@ansiblemysql-5.6.17]#useradd-s/sbin/nologin-Mmysql [root@ansiblemysql-5.6.17]#yuminstallcmake-y [root@ansibletools]#tarxfmysql-5.6.17.tar.gz [root@ansibletools]#cdmysql-5.6.17 [root@ansiblemysql-5.6.17]#cmake\ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ -DMYSQL_DATADIR=/usr/local/mysql/data\ -DSYSCONFDIR=/etc\ -DWITH_MYISAM_STORAGE_ENGINE=1\ -DWITH_INNOBASE_STORAGE_ENGINE=1\ -DWITH_MEMORY_STORAGE_ENGINE=1\ -DWITH_READLINE=1\ -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock\ -DMYSQL_TCP_PORT=3306\ -DENABLED_LOCAL_INFILE=1\ -DWITH_PARTITION_STORAGE_ENGINE=1\ -DEXTRA_CHARSETS=all\ -DDEFAULT_CHARSET=utf8\ -DDEFAULT_COLLATION=utf8_general_ci [root@ansiblemysql-5.6.17]#make&&makeinstall [root@ansiblemysql-5.6.17]#chown-Rmysql.mysql/usr/local/mysql/ [root@ansiblescripts]#pwd /tools/mysql-5.6.17/scripts [root@ansiblescripts]#chmod+xmysql_install_db [root@ansiblescripts]#./mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--user=mysql InstallingMySQLsystemtables...2016-08-1913:13:180[Warning]TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails). 2016-08-1913:13:1864062[Note]InnoDB:Usingatomicstorefcountbufferpoolpages 2016-08-1913:13:1864062[Note]InnoDB:TheInnoDBmemoryheapisdisabled 2016-08-1913:13:1864062[Note]InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins 2016-08-1913:13:1864062[Note]InnoDB:Compressedtablesusezlib1.2.3 2016-08-1913:13:1864062[Note]InnoDB:NotusingCPUcrc32instructions 2016-08-1913:13:1864062[Note]InnoDB:Initializingbufferpool,size=128.0M 2016-08-1913:13:1864062[Note]InnoDB:Completedinitializationofbufferpool 2016-08-1913:13:1864062[Note]InnoDB:Thefirstspecifieddatafile./ibdata1didnotexist:anewdatabasetobecreated! 2016-08-1913:13:1864062[Note]InnoDB:Settingfile./ibdata1sizeto12MB 2016-08-1913:13:1864062[Note]InnoDB:Databasephysicallywritesthefilefull:wait... 2016-08-1913:13:1964062[Note]InnoDB:Settinglogfile./ib_logfile101sizeto48MB 2016-08-1913:13:2164062[Note]InnoDB:Settinglogfile./ib_logfile1sizeto48MB 2016-08-1913:13:2364062[Note]InnoDB:Renaminglogfile./ib_logfile101to./ib_logfile0 2016-08-1913:13:2364062[Warning]InnoDB:Newlogfilescreated,LSN=45781 2016-08-1913:13:2364062[Note]InnoDB:Doublewritebuffernotfound:creatingnew 2016-08-1913:13:2364062[Note]InnoDB:Doublewritebuffercreated 2016-08-1913:13:2364062[Note]InnoDB:128rollbacksegment(s)areactive. 2016-08-1913:13:2364062[Warning]InnoDB:Creatingforeignkeyconstraintsystemtables. 2016-08-1913:13:2364062[Note]InnoDB:Foreignkeyconstraintsystemtablescreated 2016-08-1913:13:2364062[Note]InnoDB:Creatingtablespaceanddatafilesystemtables. 2016-08-1913:13:2364062[Note]InnoDB:Tablespaceanddatafilesystemtablescreated. 2016-08-1913:13:2364062[Note]InnoDB:Waitingforpurgetostart 2016-08-1913:13:2364062[Note]InnoDB:5.6.17started;logsequencenumber0 2016-08-1913:13:2464062[Note]Binlogend 2016-08-1913:13:2464062[Note]InnoDB:FTSoptimizethreadexiting. 2016-08-1913:13:2464062[Note]InnoDB:Startingshutdown... 2016-08-1913:13:2464062[Note]InnoDB:Shutdowncompleted;logsequencenumber1625977 OK Fillinghelptables...2016-08-1913:13:240[Warning]TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails). 2016-08-1913:13:2464085[Note]InnoDB:Usingatomicstorefcountbufferpoolpages 2016-08-1913:13:2464085[Note]InnoDB:TheInnoDBmemoryheapisdisabled 2016-08-1913:13:2464085[Note]InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins 2016-08-1913:13:2464085[Note]InnoDB:Compressedtablesusezlib1.2.3 2016-08-1913:13:2464085[Note]InnoDB:NotusingCPUcrc32instructions 2016-08-1913:13:2464085[Note]InnoDB:Initializingbufferpool,size=128.0M 2016-08-1913:13:2464085[Note]InnoDB:Completedinitializationofbufferpool 2016-08-1913:13:2464085[Note]InnoDB:HighestsupportedfileformatisBarracuda. 2016-08-1913:13:2464085[Note]InnoDB:128rollbacksegment(s)areactive. 2016-08-1913:13:2564085[Note]InnoDB:Waitingforpurgetostart 2016-08-1913:13:2564085[Note]InnoDB:5.6.17started;logsequencenumber1625977 2016-08-1913:13:2564085[Note]Binlogend 2016-08-1913:13:2564085[Note]InnoDB:FTSoptimizethreadexiting. 2016-08-1913:13:2564085[Note]InnoDB:Startingshutdown... 2016-08-1913:13:2664085[Note]InnoDB:Shutdowncompleted;logsequencenumber1625987 OK Tostartmysqldatboottimeyouhavetocopy support-files/mysql.servertotherightplaceforyoursystem PLEASEREMEMBERTOSETAPASSWORDFORTHEMySQLrootUSER! Todoso,starttheserver,thenissuethefollowingcommands: /usr/local/mysql/bin/mysqladmin-urootpassword'new-password' /usr/local/mysql/bin/mysqladmin-uroot-hansiblepassword'new-password' Alternativelyyoucanrun: /usr/local/mysql/bin/mysql_secure_installation whichwillalsogiveyoutheoptionofremovingthetest databasesandanonymoususercreatedbydefault.Thisis stronglyrecommendedforproductionservers. Seethemanualformoreinstructions. YoucanstarttheMySQLdaemonwith: cd.;/usr/local/mysql/bin/mysqld_safe& YoucantesttheMySQLdaemonwithmysql-test-run.pl cdmysql-test;perlmysql-test-run.pl Pleasereportanyproblemsathttp://bugs.mysql.com/ ThelatestinformationaboutMySQLisavailableonthewebat http://www.mysql.com SupportMySQLbybuyingsupport/licensesathttp://shop.mysql.com Newdefaultconfigfilewascreatedas/usr/local/mysql/my.cnfand willbeusedbydefaultbytheserverwhenyoustartit. Youmayeditthisfiletochangeserversettings 注:在启动MySQL服务时,会按照一定次序搜索my.cnf,先在/etc目录下找,找不到则会搜索"$basedir/my.cnf", 在本例中就是/usr/local/mysql/my.cnf,这是新版MySQL的配置文件的默认位置! [root@ansiblehttpd-2.4.18]#cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld [root@ansiblehttpd-2.4.18]#chmod+x/etc/init.d/mysqld [root@ansiblehttpd-2.4.18]#/etc/init.d/mysqldstart StartingMySQL.......SUCCESS! 4、编译安装php [root@ansiblephp-5.6.18]#yuminstalllibXpm-devel-y [root@ansibletools]#tarxfphp-5.6.18.tar.gz [root@ansibletools]#cdphp-5.6.18 [root@ansiblephp-5.6.18]#./configure\ --prefix=/usr/local/php\ --with-config-file-path=/usr/local/php/etc\ --with-apxs2=/usr/local/apache2/bin/apxs\ --with-mysql=/usr/local/mysql/\ --with-libxml-dir=/usr/local/libxml2/\ --with-png-dir=/usr/local/libpng/\ --with-jpeg-dir=/usr/local/jpeg6/\ --with-freetype-dir=/usr/local/freetype/\ --with-gd=/usr/local/gd2/\ --with-zlib-dir=/usr/local/zlib/\ --with-mcrypt=/usr/local/libmcrypt/\ --with-mysqli=/usr/local/mysql/bin/mysql_config\ --with-xpm-dir=/usr/lib64/\ --enable-soap\ --enable-mbstring=all\ --enable-sockets [root@ansiblephp-5.6.18]#make&&makeinstall 5、apache配置 [root@ansiblephp-5.6.18]#vim/usr/local/apache2/conf/httpd.conf ServerNamelocalhost DirectoryIndexindex.phpindex.html AddType application/x-httpd-php.php.phtml AddTypeapplication/x-httpd-php-source.phps Includeconf/extra/httpd-vhosts.conf LoadModulephp5_modulemodules/libphp5.so Userwww Groupwww [root@ansiblephp-5.6.18]#vim/usr/local/apache2/conf/extra/httpd-vhosts.conf #VirtualHosts <VirtualHost*:80> ServerAdmin1335120568@qq.com DocumentRoot"/usr/local/apache2/htdocs/www" ServerNamewww.martin1.com ServerAliasmartin1.com ErrorLog"logs/www-error_log" CustomLog"logs/www-access_log"common </VirtualHost> <VirtualHost*:80> ServerAdmin1335120568@qq.com DocumentRoot"/usr/local/apache2/htdocs/blog" ServerNameblog.martin1.com ErrorLog"logs/blog-error_log" CustomLog"logs/blog-access_log"common </VirtualHost> [root@ansiblephp-5.6.18]#mkdir-p/usr/local/apache2/htdocs/{www,blog} [root@ansiblephp-5.6.18]#vim/usr/local/apache2/htdocs/www/index.php <?php phpinfo(); ?> [root@ansible php-5.6.18]# /usr/local/apache2/bin/apachectl restart [root@ansible php-5.6.18]# lsof -i :80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME httpd 8307 root 4u IPv6 295815 0t0 TCP *:http (LISTEN) httpd 8309 www 4u IPv6 295815 0t0 TCP *:http (LISTEN) httpd 8310 www 4u IPv6 295815 0t0 TCP *:http (LISTEN) httpd 8312 www 4u IPv6 295815 0t0 TCP *:http (LISTEN) 6、访问测试(如果出现php页面,则说明整合成功) 再简单截图之前编译安装的过程 最后说下如果要在lamp环境下安装编译zabbix 按照如下操作即可 ./configure--prefix=/usr/local/zabbix-server --enable-server --with-mysql--with-net-snmp --with-libcurl --with-libxml2cp -a/home/oldboy/tools/zabbix-3.0.3/frontends/php/* /usr/local/apache2/htdocs/www/

资源下载

更多资源
Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册