#author("2021-02-12T13:22:55+09:00","","")
#author("2021-02-12T13:25:30+09:00","","")
#nofollow
#norelated
総数:&counter(total); 今日:&counter(today); 昨日:&counter(yesterday);

* もくじ [#y9ea9566]

#contents

*apache2 パッケージをインストールする。 [#y3f31daa]
 ~$ sudo apt -y install apache2

 パッケージリストを読み込んでいます... 完了
 依存関係ツリーを作成しています                
 状態情報を読み取っています... 完了
 以下の追加パッケージがインストールされます:
   apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
 提案パッケージ:
   apache2-doc apache2-suexec-pristine | apache2-suexec-custom
 以下のパッケージが新たにインストールされます:
   apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
 アップグレード: 0 個、新規インストール: 8 個、削除: 0 個、保留: 0 個。
 1,713 kB のアーカイブを取得する必要があります。
 この操作後に追加で 7,494 kB のディスク容量が消費されます。
 取得:1 http://jp.archive.ubuntu.com/ubuntu focal/main amd64 libapr1 amd64 1.6.5-1ubuntu1 [91.4 kB]
 取得:2 http://jp.archive.ubuntu.com/ubuntu focal/main amd64 libaprutil1 amd64 1.6.1-4ubuntu2 [84.7 kB]
 取得:3 http://jp.archive.ubuntu.com/ubuntu focal/main amd64 libaprutil1-dbd-sqlite3 amd64 1.6.1-4ubuntu2 [10.5 kB]
 取得:4 http://jp.archive.ubuntu.com/ubuntu focal/main amd64 libaprutil1-ldap amd64 1.6.1-4ubuntu2 [8,736 B]
 取得:5 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 apache2-bin amd64 2.4.41-4ubuntu3.1 [1,180 kB]
 取得:6 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 apache2-data all 2.4.41-4ubuntu3.1 [158 kB]
 取得:7 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 apache2-utils amd64 2.4.41-4ubuntu3.1 [83.8 kB]
 取得:8 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 apache2 amd64 2.4.41-4ubuntu3.1 [95.5 kB]
 1,713 kB を 1秒 で取得しました (1,734 kB/s)
 以前に未選択のパッケージ libapr1:amd64 を選択しています。
 (データベースを読み込んでいます ... 現在 196397 個のファイルとディレクトリがインストールされています。)
 .../0-libapr1_1.6.5-1ubuntu1_amd64.deb を展開する準備をしています ...
 libapr1:amd64 (1.6.5-1ubuntu1) を展開しています...
 以前に未選択のパッケージ libaprutil1:amd64 を選択しています。
 .../1-libaprutil1_1.6.1-4ubuntu2_amd64.deb を展開する準備をしています ...
 libaprutil1:amd64 (1.6.1-4ubuntu2) を展開しています...
 以前に未選択のパッケージ libaprutil1-dbd-sqlite3:amd64 を選択しています。
 .../2-libaprutil1-dbd-sqlite3_1.6.1-4ubuntu2_amd64.deb を展開する準備をしています ...
 libaprutil1-dbd-sqlite3:amd64 (1.6.1-4ubuntu2) を展開しています...
 以前に未選択のパッケージ libaprutil1-ldap:amd64 を選択しています。
 .../3-libaprutil1-ldap_1.6.1-4ubuntu2_amd64.deb を展開する準備をしています ...
 libaprutil1-ldap:amd64 (1.6.1-4ubuntu2) を展開しています...
 以前に未選択のパッケージ apache2-bin を選択しています。
 .../4-apache2-bin_2.4.41-4ubuntu3.1_amd64.deb を展開する準備をしています ...
 apache2-bin (2.4.41-4ubuntu3.1) を展開しています...
 以前に未選択のパッケージ apache2-data を選択しています。
 .../5-apache2-data_2.4.41-4ubuntu3.1_all.deb を展開する準備をしています ...
 apache2-data (2.4.41-4ubuntu3.1) を展開しています...
 以前に未選択のパッケージ apache2-utils を選択しています。
 .../6-apache2-utils_2.4.41-4ubuntu3.1_amd64.deb を展開する準備をしています ...
 apache2-utils (2.4.41-4ubuntu3.1) を展開しています...
 以前に未選択のパッケージ apache2 を選択しています。
 .../7-apache2_2.4.41-4ubuntu3.1_amd64.deb を展開する準備をしています ...
 apache2 (2.4.41-4ubuntu3.1) を展開しています...
 libapr1:amd64 (1.6.5-1ubuntu1) を設定しています ...
 apache2-data (2.4.41-4ubuntu3.1) を設定しています ...
 libaprutil1:amd64 (1.6.1-4ubuntu2) を設定しています ...
 libaprutil1-ldap:amd64 (1.6.1-4ubuntu2) を設定しています ...
 libaprutil1-dbd-sqlite3:amd64 (1.6.1-4ubuntu2) を設定しています ...
 apache2-utils (2.4.41-4ubuntu3.1) を設定しています ...
 apache2-bin (2.4.41-4ubuntu3.1) を設定しています ...
 apache2 (2.4.41-4ubuntu3.1) を設定しています ...
 Enabling module mpm_event.
 Enabling module authz_core.
 Enabling module authz_host.
 Enabling module authn_core.
 Enabling module auth_basic.
 Enabling module access_compat.
 Enabling module authn_file.
 Enabling module authz_user.
 Enabling module alias.
 Enabling module dir.
 Enabling module autoindex.
 Enabling module env.
 Enabling module mime.
 Enabling module negotiation.
 Enabling module setenvif.
 Enabling module filter.
 Enabling module deflate.
 Enabling module status.
 Enabling module reqtimeout.
 Enabling conf charset.
 Enabling conf localized-error-pages.
 Enabling conf other-vhosts-access-log.
 Enabling conf security.
 Enabling conf serve-cgi-bin.
 Enabling site 000-default.
 Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.service.
 Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /lib/systemd/system/apache-htcacheclean.service.
 ufw (0.36-6) のトリガを処理しています ...
 systemd (245.4-4ubuntu3.4) のトリガを処理しています ...
 man-db (2.9.1-1) のトリガを処理しています ...
 libc-bin (2.31-0ubuntu9.2) のトリガを処理しています ...

**バージョンを確認 [#f6baba36]
 ~$ apache2 -version
 Server version: Apache/2.4.41 (Ubuntu)
 Server built:   2020-08-12T19:46:17
-2.4.41 だった。

*ServerName を設定 [#o795b828]
-ServerName を ubdt20042 (設定例)に設定する。
 ~$ sudo bash
 ~# cat << EOF > /etc/apache2/conf-available/servername.conf
 ServerName ubdt20042
 EOF
 ~# exit
 ~$ sudo a2enconf servername
 Enabling conf servername.
 To activate the new configuration, you need to run:
   service apache2 reload
 ~$ sudo service apache2 reload

*提案パッケージもインストールする。 [#kf33158a]
 ~$ sudo apt -y install apache2-doc
 ~$ sudo apt -y install apache2-suexec-pristine
 ~$ sudo apt -y install apache2-suexec-custom
 ~$ sudo apt -y install apache2-utils

*IP固定化 [#l09cc201]
参考URL https://linuxfan.info/ubuntu-1804-desktop-static-ip-address/ &br;
**各種設定を確認 [#oa250a9f]
***アドレスとネットマスク [#v4e8c41a]
 ~$ ifconfig 
 enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
         inet 192.168.3.12  netmask 255.255.255.0  broadcast 192.168.3.255
         inet6 2400:2653:4e41:5900:b3ba:c58b:aa96:5662  prefixlen 64  scopeid 0x0<global>
         inet6 fe80::eee0:69c7:1f86:9fd0  prefixlen 64  scopeid 0x20<link>
         inet6 2400:2653:4e41:5900:3f9c:98c5:693a:c000  prefixlen 64  scopeid 0x0<global>
         ether 08:00:27:ad:38:aa  txqueuelen 1000  (イーサネット)
         RX packets 33120  bytes 28473550 (28.4 MB)
         RX errors 0  dropped 0  overruns 0  frame 0
         TX packets 22392  bytes 4972899 (4.9 MB)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
 lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
         inet 127.0.0.1  netmask 255.0.0.0
         inet6 ::1  prefixlen 128  scopeid 0x10<host>
         loop  txqueuelen 1000  (ローカルループバック)
         RX packets 3330  bytes 292494 (292.4 KB)
         RX errors 0  dropped 0  overruns 0  frame 0
         TX packets 3330  bytes 292494 (292.4 KB)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 

アドレスは「192.168.3.12」、ネットマスクは「255.255.255.0」だ。&br;
***ゲートウェイ [#md290c44]
 ~$ route -n
 カーネルIP経路テーブル
 受信先サイト    ゲートウェイ    ネットマスク   フラグ Metric Ref 使用数 インタフェース
 0.0.0.0         192.168.3.1     0.0.0.0         UG    100    0        0 enp0s3
 169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 enp0s3
 192.168.3.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s3
 
ゲートウェイは「192.168.3.1」だ。

***DNSネームサーバ [#u9a79c60]
 ~$ cat /etc/resolv.conf
 # This file is managed by man:systemd-resolved(8). Do not edit.
 #
 # This is a dynamic resolv.conf file for connecting local clients to the
 # internal DNS stub resolver of systemd-resolved. This file lists all
 # configured search domains.
 #
 # Run "systemd-resolve --status" to see details about the uplink DNS servers
 # currently in use.
 #
 # Third party programs must not access this file directly, but only through the
 # symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
 # replace this symlink by a static file or a different symlink.
 #
 # See man:systemd-resolved.service(8) for details about the supported modes of
 # operation for /etc/resolv.conf.
 
 nameserver 127.0.0.53
 search flets-west.jp iptvf.jp

**IPアドレスを固定する [#m24a07d1]

***ネットワーク設定を開く [#z8d83a86]
「トップバー」の一番右をクリックし、「システムメニュー」を開きます。&br;
そして、「工具」のアイコンをクリックしましょう。

***有線でネットワーク接続している場合 [#e72936a2]
左側の設定カテゴリーにある「ネットワーク」をクリックし、&br;
「有線」の歯車アイコンをクリックすると設定ダイアログが開きます。

***ネットワーク設定の確認と変更 [#i58100a9]
設定ダイアログが開くと、割り当てられたIPv4アドレスやIPv6アドレス、&br;
デフォルトルートやDNSサーバーのアドレスなどが表示されます。

-「IPv4」タブをクリックし、「IPv4メソッド」を「手動」に切り替えると、&br;
IPアドレス・ネットマスク・ゲートウェイ・DNSなどを設定できます。

-(例)アドレス
|アドレス|ネットマスク|ゲートウェイ|h
|192.168.3.12|255.255.255.0|192.168.3.1|

-(例)DNS(「自動」をOFFにする)
|192.168.3.1|

-「適用」を選択する。
ダイアログが閉じます。しかし、まだ変更したネットワーク設定は有効にはなっていません。&br;
変更するのは、ネットワークに再接続する必要があります。

-有線LANに接続している場合、「オン」となっているスイッチを一度「オフ」にし、再度「オン」にします。

*テスト [#f31888cf]
**他のPCからデフォルトページを表示 [#x1de6a8a]
-次のurlに接続する。(例 192.168.3.12 の場合)
 http://192.168.3.12/
--Apache2 Ubuntu Defult Page が表示されればOK。

*www-data グループへの参加 [#d182ef82]
**ユーザ <username> の所属グループを確認 [#m8702aab]
 ~$ groups <username>
 <username> : <username> adm cdrom sudo dip plugdev lpadmin sambashare

**ユーザ <username> をグループ www-data に追加する [#ya026eed]
 ~$ sudo gpasswd -a <username> www-data
 ユーザ <username> をグループ www-data に追加

**ユーザ <username> の所属グループを再度確認 [#b4f14562]
 ~$ groups <username>
 <username> : <username> adm cdrom sudo dip www-data plugdev lpadmin sambashare


* ''次は'' [#wf446f74]
-php のインストール[[installing php on ubuntu desktop 18.04.1]]へ
-mysql server のインストール [[installing mysql on ubuntu desktop 18.04.1]] へ
-php のインストール[[installing php on ubuntu desktop 20.04.2]]へ
-mysql server のインストール [[installing mysql on ubuntu desktop 20.04.2]] へ

トップ   差分 バックアップ リロード   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS