12
18

More than 5 years have passed since last update.

Ubuntu 18.04にLAMP環境をインストールする。

Last updated at Posted at 2019-04-07

Ubuntu 18.04.2LAMPをインストールしたので、その時の手順をメモしておきます。

1. Taskselをインストール

$ sudo apt install tasksel

2. Taskselを使ってLAMPをインストール

$ sudo tasksel install lamp-server

3. インストールしたLAMPのバージョン確認

以下のコマンドを実行してVersionが表示されれば、問題なくインストールできています。

3-1. Apacheのバージョン確認

apachectl -v

3-2. MySQLのバージョン確認

$ mysql --version

3-3. PHPのバージョン確認

$ php --version

4. PHPとApacheの動作確認

phpinfo()を使ってPHPとApacheの動作確認をします。

4-1. Apacheを起動

$ sudo service apache2 start

$ cd /var/www/html

4-2. index.phpの作成

var/www/html$ vi index.php
viコマンドの使い方は以下のサイトをご確認ください。
viエディタの使い方

index.php
<?php
phpinfo();
?>

index.phpが作成されているか確認
var/www/html$ cat index.php

4-3. ブラウザで確認

ブラウザで以下のリンクにアクセスし、PHPの情報が表示されれば問題ありません。
http://(LinuxのIPアドレス)/index.php

なお、LinuxのIPアドレスは以下のコマンドで確認できます。
$ ip a

参考記事

How to Install a LAMP Stack on Ubuntu 18.04
猿にも分かるかもしれない、LAMPの構築方法

12
18
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
12
18