php7 安装yar 生成docker镜像
Docker包含三个概念:
(1)远程仓库即远程镜像库所有镜像的聚集地(不可进入操作)。
(2)本地镜像即从远程仓库拉取过来的镜像
(3)运行起来的本地镜像叫做容器(分层的可操作)
Docker使用:
1.首先通过第三方镜像库(c.163.com)拉取相应的信息比如centos,ubuntu,tomcat等作为基础镜像。
Dockerpullxxxx
2.运行下载好的镜像。
Dockerrun-dt-p宿主机端口:镜像端口--name起一个名字镜像id/镜像名字bash
-d后台运行
-t生成一个伪终端
-p指定端口
--name为运行的容器起一个名字
3.进入容器有两种方法
(1)dockerexec-it容器名字/容器idbash(ctrl+d退出时不会停止该运行的容器)
(2)Dockerattach容器名字/容器id(ctrl+d退出时会停止该运行的容器)
4.开始下载编译环境所需的相应的工具和所需的依赖包
(1)yum安装wget以及编译的工具yuminstall-ywgetgccgcc-c++makeopenssl-devel
(2)更新国内yum源
Wget-O/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/xxx/ Xxx表示你要选择的yum源 -O下载并以不同的文件名保存 CentOS-Base.repo表示命名的yum源
(3)下载各个版本的nginx版本
Wgethttp://nginx.org/download/xxx Xxx表示你要选择的nginx的版本
(4)下载pcre
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/xxx
Xxx表示选择的版本
(5)更新yum确保最新的
Yumupdate
(6)下载php7
http://php.net/downloads.php
选择版本,选择国界
(7)把以上下载的东西全部粘贴到/usr/local/src并且全部解压
(8)编译nginx
(1)创建nginx用户
groupadd-rnginx useradd-r-gnginxnginx
(2)编译安装nginx
cdxxx切换到您的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&&makeinstall出现问题自行百度 echo"daemonoff;">>/usr/local/nginx/conf/nginx.conf#在nginx的配置文件里加上这一行很关键,这样nginx可以在docker启动的时候在后台运行!
(9)编译php
(1)准备php的依赖包
yuminstall-ybisonbison-develzlib-devellibmcrypt-develmcryptmhash-devellibxml2-devellibcurl-develbzip2-develreadline-devellibedit-develsqlite-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&&makeinstall
(5)准备php配置文件
cpphp.ini-production/etc/php.ini cd/usr/local/php/etc cpphp-fpm.conf.defaultphp-fpm.conf
(6)修改配置文件
;daemonize=yes的注释去掉,并把yes改为no
(7)安装yar拓展
(1)安装二进制打包协议msgpack
find/-namephpize查找phpize是否存在 yuminstallphp-devel peclinstallmsgpack
注:出现问题自行百度
(2)下载yarwgethttp://pecl.php.net/get/xxx
Xxx表示版本确定好与php版本对照这个很重要。
(3)解压编译tar-zxvfyar-2.0.0.tgz
(4)cdcdyar-2.0.0
(5)/usr/bin/phpize
(6)./configure--with-php-config=/usr/bin/php-config7.0*
(7)make&&makeinstall
(8)如果出现模块未安装可php--ini查看ini路径相对调整
(9)dockercommit-m"描述"-a"作者"容器id仓库信息mydocker/nginx:版本信息v1
(10)dockersavexxx>/home/save.tar
(11)Dockerloadxxx
如果编译安装过程中报错,按照报错提示的去用yum解决依赖关系;如果当前的yum源解决不了,那么可以试试:
wgethttp://www.atomicorp.com/installers/atomic chmod+xatomic ./atomic yuminstall-yXXXXXX
以上所述是小编给大家介绍的php7安装yar生成docker镜像,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对毛票票网站的支持!