• php7 安装yar 生成docker镜像


    Docker包含三个概念:
    (1)远程仓库即远程镜像库所有镜像的聚集地(不可进入操作)。
    (2)本地镜像即从远程仓库拉取过来的镜像
    (3)运行起来的本地镜像叫做容器(分层的可操作)
    Docker使用:
    1.首先通过第三方镜像库(c.163.com)拉取相应的信息比如centos,ubuntu,tomcat等作为基础镜像。
    Docker pull xxxx
    2.运行下载好的镜像。
    Docker run -dt -p 宿主机端口:镜像端口 --name起一个名字 镜像id/镜像名字 bash
    -d 后台运行
    -t 生成一个伪终端
    -p 指定端口
    --name 为运行的容器起一个名字
    3.进入容器有两种方法
    (1)docker exec -it容器名字/容器id bash(ctrl+d退出时不会停止该运行的容器)
    (2)Docker attach 容器名字/容器id (ctrl+d退出时会停止该运行的容器)
    4.开始下载编译环境所需的相应的工具和所需的依赖包
    (1)yum安装wget以及编译的工具 yum install -y wget gcc gcc-c++ make openssl-devel
    (2)更新国内yum源
    Wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/xxx/
    Xxx表示你要选择的yum源
    -O 下载并以不同的文件名保存
    CentOS-Base.repo 表示命名的yum源
    (3)下载各个版本的nginx版本
    Wget http://nginx.org/download/xxx
    Xxx表示你要选择的nginx的版本
    (4)下载pcre
    ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/xxx
    Xxx表示选择的版本
    (5)更新yum确保最新的
    Yum update
    (6)下载php7
    http://php.net/downloads.php
    选择版本,选择国界
    (7)把以上下载的东西全部粘贴到/usr/local/src 并且全部解压
    (8)编译nginx
    (1)创建nginx用户
     groupadd -r nginx
    useradd -r -g nginx nginx
    (2)编译安装nginx
    cd xxx 切换到您的nginx目录
    ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-pcre=/usr/local/src/pcre-8.37
    ./configure参数说明:
    --prefix=指定文件的安装目录
    --user=指定用户
    --group指定用户组
    --with-使用已有的软件包和库文件
    Make && make install 出现问题自行百度
    echo "daemon off;" >> /usr/local/nginx/conf/nginx.conf #在nginx的配置文件里加上这一行很关键,这样nginx可以在docker启动的时候在后台运行!
    (9)编译php
    (1)准备php的依赖包
    yum install -y bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel sqlite-devel
    (2)进入php文件目录
    (3)开始编译php
    ./configure --prefix=/usr/local/php --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr/local/libxml --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr/local/libjpeg --with-png-dir=/usr/local/libpng --enable-gd-native-ttf --with-openssl --with-fpm-user=www --with-fpm-group=www --with-libdir=lib64 --enable-ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm --enable-xml --enable-shmop --enable-session --enable-ctype --with-iconv-dir --with-iconv
    注:出现问题自行百度。
    (4)make && make install
    (5)准备php配置文件
    cp php.ini-production /etc/php.ini
    cd /usr/local/php/etc
    cp php-fpm.conf.default php-fpm.conf
    (6)修改配置文件
    ;daemonize = yes的注释去掉,并把yes改为no
    (7)安装yar拓展
    (1)安装二进制打包协议msgpack
    find / -name phpize 查找phpize是否存在
    yum install php-devel
    pecl install msgpack
    注:出现问题自行百度
    (2)下载yar wget http://pecl.php.net/get/xxx
    Xxx表示版本 确定好与php版本对照这个很重要。
    (3)解压编译tar -zxvf yar-2.0.0.tgz
    (4)cd cd yar-2.0.0
    (5)/usr/bin/phpize
    (6)./configure --with-php-config=/usr/bin/php-config
    (7)make && make install
    (8)如果出现模块未安装可 php --ini 查看ini路径相对调整,将extension=yar.so写入配置文件
    (9)docker commit -m "描述" -a "作者" 容器id 仓库信息mydocker/nginx:版本信息v1
    (10)docker save xxx > /home/save.tar
    (11)Docker load xxx

      如果编译安装过程中报错,按照报错提示的去用yum解决依赖关系;如果当前的yum源解决不了,那么可以试试:

        wget http://www.atomicorp.com/installers/atomic

        chmod +x atomic

        ./atomic 

        yum install -y XXX XXX

  • 相关阅读:
    任意文件读取与下载漏洞
    命令执行与代码执行漏洞原理
    安全面试知识汇总
    科学使用Github(gayhub)搜索想要的项目
    业务逻辑漏洞--注册-登录-改密码页面总结
    Linux提权之SUID提权
    攻防世界XCTF--伪造请求头XFF和Referer(第九题)
    攻防世界XCTF--两种传输方式get_post(第八题)
    攻防世界XCTF--一个简单的PHP后端验证(第七题)
    课时14.DTD文档声明上(掌握)
  • 原文地址:https://www.cnblogs.com/ccs-mxs/p/ccs-mxs.html
Copyright © 2020-2023  润新知