LoginSignup
9
3

More than 5 years have passed since last update.

Raspberry Pi 3BにPHP7.2とnode.jsとcloud9をインストール

Last updated at Posted at 2018-06-26

はじめに

RaspberryPi 3B+でLaravel 5.5を使った開発をするために環境(php7.2 + node.js 8.11系)を構築したい。


[20180717 Update] 2018-06-27-raspbian-stretch.imgを使ってDebian Buster)のリポジトリを追加したところ、怒涛のパッケージ更新がかかります。新しいRaspbianのイメージを使うことを推奨したいです。

[20180719 Update] Raspberry Piの次世代(Debian Buster)のリポジトリを追加して、apt update & upgradeを実行して再起動すると、Raspbian OSが壊れるらしく起動しなくなりました。回避策を探してます。

[20180719 Update] 別のリポジトリを参照することで、とりあえず回避可能。

手順

php7.2が含まれているリポジトリを追加

【プランA】aptのソースにRaspberry Piの次世代(Debian Buster)のリポジトリを追加

raspbianの元になっている現在のDebianはstretchstretchではphpは7.1までサポートするらしく、php7.2が必要ならばBusterのリポジトリを指定する必要があるらしい。

/etc/apt/sources.list
  deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
  # Uncomment line below then 'apt-get update' to enable 'apt-get source'
  #deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi

+ deb http://mirrordirector.raspbian.org/raspbian/ buster main contrib non-free rpi

apt update & upgradeを実行すると、800近いパッケージ(合計600MBくらい)がアップデートされます。。

【プランB】aptのソースに https://packages.sury.org/php/ のリポジトリを追加

$ sudo apt-get -y install apt-transport-https lsb-release ca-certificates
$ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
$ sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'

aptのデータを更新 [20180717 Update]

$ sudo apt update
$ sudo apt upgrade

aptでphp7.2をインストール

$ sudo apt install php7.2 php7.2-common php7.2-cli php7.2-fpm php7.2-mbstring php7.2-sqlite3 php7.2-pdo-sqlite php7.2-json php7.2-xml

composerをインストール

$ sudo apt install composer

$ composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer 1.6.5 2018-05-04 11:44:59

aptでnode.jsをインストール

$ sudo apt install nodejs npm

$ node -v
v8.11.2

$ npm -v
1.4.21

$ sudo /usr/local/bin/npm install -g npm
$ npm -v
6.1.0

cloud9(WEB-IDE)をインストールと実行

$ sudo apt install openssl
$ sudo apt install tmux
$ git clone https://github.com/c9/core.git c9sdk
$ cd c9sdk
$ scripts/install-sdk.sh
$ node server.js -p 8080 -a :
9
3
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
9
3