4
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Dockerコンテナ内のCentOS7にPHP7をインストールする

Posted at

環境

  • OS X El Capitan 10.11.6
  • Vagrant 1.9.3
  • CentOS 7.2.1511
  • Docker 17.04.0-ce

MacBookにVagrant,VirtualBoxをインストールして、
そこでCentOSを立ち上げて、その中でDockerでCentOSコンテナを使ってます。

つまったところ

その1 PHP7がインストールできない

ただyum install phpとやっても古いバージョンしかインストールできなかった。

参考にしたサイト

下記サイトを参考にリポジトリの追加やらを実行

https://www.lancork.net/2016/05/yum-centos67-php7-install/
http://www.kakiro-web.com/linux/remi-install.html
http://www.kakiro-web.com/linux/epel-install.html

その2 Nodejsのインストールができない

参考にしたサイト

結果のDockerfile

FROM centos:centos7
MAINTAINER dynamonda

RUN rm /bin/sh && ln -s /bin/bash /bin/sh

RUN yum -y install wget epel-release

RUN wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
RUN rpm -Uvh ./remi-release-7.rpm
RUN sed -i '4a priority=1' /etc/yum.repos.d/remi-php71.repo
RUN yum -y install --enablerepo=remi-php71 php php-fpm php-mcrypt php-cli php-common php-devel php-gd php-mbstring php-mysqlnd php-opcache php-pdo php-pear php-pecl-apcu php-pecl-zip php-process php-xml
RUN yum clean all

RUN yum install -y httpd
RUN yum clean all

RUN yum -y update
RUN yum clean all

RUN yum -y install git

ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION v6.10.3

RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.26.1/install.sh | bash \
	&& source ~/.bashrc \
	&& source $NVM_DIR/nvm.sh \
	&& nvm install $NODE_VERSION \
	&& nvm alias default $NODE_VERSION \
	&& nvm use default

EXPOSE 80

4
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?