Windows10をUbuntuのコマンドで操作する! 定番のWEBサーバのインストール!(apache2)

スポンサーリンク

コンテンツ

bash on Windows10を使用できるようにする方法と注意事項は、以下の記事にまとめてあります!正式名称は「bash on Ubuntu on Windows10」です。

Windows10をUbuntuのコマンドで操作する! 1.使えるように準備をする(開発者モードを有効にする)!

64ビット版 Windows10のインストール「bash on Windows10」と呼ばれている機能です。2016年5月現在、ベータ版です。Windows10インサイダー プレビュー版が必要です。通常のWindows10では利用できません

Windows10をUbuntuのコマンドで操作する! 2.「bash on Windows10」を有効にする!

「bash on Windows10」のインストール2016年5月現在、ベータ版です。Windows10インサイダー プレビュー版が必要です。通常のWindows10では利用できません。また、64ビット版Windows10でないと使用できま

Windows10をUbuntuのコマンドで操作する! 3.「bash on Windows10」のインストール!

「bash on Windows10」のインストール2016年5月現在、ベータ版です。Windows10インサイダー プレビュー版が必要です。通常のWindows10では利用できません。また、64ビット版Windows10でないと使用できま

Windows10をUbuntuのコマンドで操作する! 4.bash on Windows10(ばっしゅ おん うぃんどうずてん)を起動する!

前回までの記事この記事はbash on Windows10を使えるようにするまでの記事の4番目です。1-3番目の記事は以下をどうぞ!bash on Windows10の起動bash on Windows10を起動するには以下のようにします。

アパッチ2のインストール

「bash on Windows10」で するには、以下のコマンドを実行します

sudo apt-get install apache2

それでは実行してみましょう。

t@DESKTOP-1QGFR8O:~$ sudo apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libfreetype6 os-prober php5-cli php5-readline
Use 'apt-get autoremove' to remove them.
Suggested packages:
  apache2-doc apache2-suexec-pristine apache2-suexec-custom apache2-utils
The following NEW packages will be installed:
  apache2
0 upgraded, 1 newly installed, 0 to remove and 25 not upgraded.
Need to get 0 B/87.5 kB of archives.
After this operation, 474 kB of additional disk space will be used.
E: Can not write log (Is /dev/pts mounted?) - openpty (2: No such file or directory)
Selecting previously unselected package apache2.
(Reading database ... 27341 files and directories currently installed.)
Preparing to unpack .../apache2_2.4.7-1ubuntu4.9_amd64.deb ...
Unpacking apache2 (2.4.7-1ubuntu4.9) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
WARN: / is group writable!
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up apache2 (2.4.7-1ubuntu4.9) ...
runlevel:/var/run/utmp: No such file or directory
invoke-rc.d: policy-rc.d denied execution of restart.

動作を確認してみます。

t@DESKTOP-1QGFR8O:~$ apache2
[Sat May 14 02:51:24.533858 2016] [core:warn] [pid 1113] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Sat May 14 02:51:24.533858 2016] [core:warn] [pid 1113] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Sat May 14 02:51:24.549537 2016] [core:warn] [pid 1113] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Sat May 14 02:51:24.549537 2016] [core:warn] [pid 1113] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Sat May 14 02:51:24.549537 2016] [core:warn] [pid 1113] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load: Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: cannot open shared object file: No such file or directory

エラーのようです。

2016年5月現在の「bash on Windows10」では、エラーのため「ifconfig」コマンドの実行は無理のようです。
正式版だと使えるようになるかもしれません!