• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

php7 安装yar 生成docker镜像

php 搞代码 4年前 (2022-01-01) 44次浏览 已收录 0个评论

这篇文章主要介绍了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-config7.0*

来源gao*daima.com搞@代#码网7)make && make install

(8)如果出现模块未安装可 php –ini 查看ini路径相对调整

(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

以上所述是小编给大家介绍的php7 安装yar 生成docker镜像,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对gaodaima搞代码网网站的支持!

以上就是php7 安装yar 生成docker镜像的详细内容,更多请关注gaodaima搞代码网其它相关文章!


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:php7 安装yar 生成docker镜像

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址