XserverVPSでWordPress環境を構築していきます。Xserverでは無くとも、Ubuntuならば同様にできるようになっています。
1回目は、WebサーバーアプリのApache2のインストールについてです。
Apache2のインストールについては、こちらの記事を参考にさせて頂きました。
Ubuntu 22.04 LTS に WordPress 6.2 をインストール - Qiita
Ubuntu にLAMP(Linux/Apache/MariaDB/PHP)環境のインストールを行う手順を以下に記します。タイムゾーンの変更sudo su - timedatectl set-t…
環境
- XserverVPS
- OS: Ubuntu 24.04 LTS
XserverVPSで行っていますが、Ubuntuであれば他の環境でも同じだと思います。
環境確認
Ubuntuのバージョン確認
# lsb_release -d
No LSB modules are available.
Description: Ubuntu 24.04 LTS
タイムゾーン変更
XserverVPSに接続したてなので、先ずはタイムゾーンを変更しておきます。
東京時間に設定です。
# timedatectl set-timezone Asia/Tokyo
Apache2のインストール
Apache2は、インターネット上でウェブサイトを表示するためのソフトウェアです。ユーザーがウェブブラウザでウェブサイトにアクセスすると、Apache2がそのリクエストを受け取り、ウェブページを返します。
aptの更新
アプリケーションをインストールするツールの情報更新をします。
# apt -y update
Get:1 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
Get:2 http://nova.clouds.archive.ubuntu.com/ubuntu noble InRelease [256 kB]
Get:3 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages [158 kB]
Get:4 http://security.ubuntu.com/ubuntu noble-security/main Translation-en [41.5 kB]
Get:5 http://security.ubuntu.com/ubuntu noble-security/main amd64 Components [6876 B]
Get:6 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Packages [44.4 kB]
Get:7 http://security.ubuntu.com/ubuntu noble-security/universe Translation-en [17.0 kB]
Get:8 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Components [8632 B]
Get:9 http://security.ubuntu.com/ubuntu noble-security/universe amd64 c-n-f Metadata [112 B]
Get:10 http://security.ubuntu.com/ubuntu noble-security/restricted amd64 Packages [70.1 kB]
Get:11 http://security.ubuntu.com/ubuntu noble-security/restricted Translation-en [14.3 kB]
Get:12 http://security.ubuntu.com/ubuntu noble-security/restricted amd64 Components [212 B]
Get:13 http://security.ubuntu.com/ubuntu noble-security/multiverse amd64 Components [208 B]
Get:14 http://security.ubuntu.com/ubuntu noble-security/multiverse amd64 c-n-f Metadata [116 B]
Get:15 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB]
Get:16 http://nova.clouds.archive.ubuntu.com/ubuntu noble-backports InRelease [126 kB]
Get:17 http://nova.clouds.archive.ubuntu.com/ubuntu noble/main amd64 Packages [1401 kB]
Get:18 http://nova.clouds.archive.ubuntu.com/ubuntu noble/main Translation-en [513 kB]
Get:19 http://nova.clouds.archive.ubuntu.com/ubuntu noble/universe amd64 Packages [15.0 MB]
Get:20 http://nova.clouds.archive.ubuntu.com/ubuntu noble/universe Translation-en [5982 kB]
Get:21 http://nova.clouds.archive.ubuntu.com/ubuntu noble/universe amd64 Components [3871 kB]
Get:22 http://nova.clouds.archive.ubuntu.com/ubuntu noble/universe amd64 c-n-f Metadata [301 kB]
Get:23 http://nova.clouds.archive.ubuntu.com/ubuntu noble/restricted amd64 Packages [93.9 kB]
Get:24 http://nova.clouds.archive.ubuntu.com/ubuntu noble/restricted Translation-en [18.7 kB]
Get:25 http://nova.clouds.archive.ubuntu.com/ubuntu noble/multiverse amd64 Packages [269 kB]
Get:26 http://nova.clouds.archive.ubuntu.com/ubuntu noble/multiverse Translation-en [118 kB]
Get:27 http://nova.clouds.archive.ubuntu.com/ubuntu noble/multiverse amd64 Components [35.0 kB]
Get:28 http://nova.clouds.archive.ubuntu.com/ubuntu noble/multiverse amd64 c-n-f Metadata [8328 B]
Get:29 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages [177 kB]
Get:30 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/main Translation-en [49.1 kB]
Get:31 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/main amd64 Components [8564 B]
Get:32 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages [66.7 kB]
Get:33 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/universe Translation-en [25.1 kB]
Get:34 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/universe amd64 Components [45.0 kB]
Get:35 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/universe amd64 c-n-f Metadata [112 B]
Get:36 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Packages [70.1 kB]
Get:37 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/restricted Translation-en [14.3 kB]
Get:38 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Components [212 B]
Get:39 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Packages [2968 B]
Get:40 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/multiverse Translation-en [968 B]
Get:41 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Components [212 B]
Get:42 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 c-n-f Metadata [116 B]
Get:43 http://nova.clouds.archive.ubuntu.com/ubuntu noble-backports/main amd64 Components [208 B]
Get:44 http://nova.clouds.archive.ubuntu.com/ubuntu noble-backports/main amd64 c-n-f Metadata [112 B]
Get:45 http://nova.clouds.archive.ubuntu.com/ubuntu noble-backports/universe amd64 Packages [6840 B]
Get:46 http://nova.clouds.archive.ubuntu.com/ubuntu noble-backports/universe Translation-en [9652 B]
Get:47 http://nova.clouds.archive.ubuntu.com/ubuntu noble-backports/universe amd64 Components [17.6 kB]
Get:48 http://nova.clouds.archive.ubuntu.com/ubuntu noble-backports/universe amd64 c-n-f Metadata [116 B]
Get:49 http://nova.clouds.archive.ubuntu.com/ubuntu noble-backports/restricted amd64 Components [216 B]
Get:50 http://nova.clouds.archive.ubuntu.com/ubuntu noble-backports/restricted amd64 c-n-f Metadata [116 B]
Get:51 http://nova.clouds.archive.ubuntu.com/ubuntu noble-backports/multiverse amd64 Components [212 B]
Get:52 http://nova.clouds.archive.ubuntu.com/ubuntu noble-backports/multiverse amd64 c-n-f Metadata [116 B]
Fetched 29.1 MB in 8s (3700 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
70 packages can be upgraded. Run 'apt list --upgradable' to see them.
Apache2のインストール
# apt -y install apache2
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
apache2-bin apache2-data apache2-utils libapr1t64 libaprutil1-dbd-sqlite3
libaprutil1-ldap libaprutil1t64 liblua5.4-0 ssl-cert
Suggested packages:
apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapr1t64
libaprutil1-dbd-sqlite3 libaprutil1-ldap libaprutil1t64 liblua5.4-0 ssl-cert
0 upgraded, 10 newly installed, 0 to remove and 70 not upgraded.
Need to get 2080 kB of archives.
After this operation, 8091 kB of additional disk space will be used.
Get:1 http://nova.clouds.archive.ubuntu.com/ubuntu noble/main amd64 libapr1t64 amd64 1.7.2-3.1build2 [107 kB]
Get:2 http://nova.clouds.archive.ubuntu.com/ubuntu noble/main amd64 libaprutil1t64 amd64 1.6.3-1.1ubuntu7 [91.9 kB]
Get:3 http://nova.clouds.archive.ubuntu.com/ubuntu noble/main amd64 libaprutil1-dbd-sqlite3 amd64 1.6.3-1.1ubuntu7 [11.2 kB]
Get:4 http://nova.clouds.archive.ubuntu.com/ubuntu noble/main amd64 libaprutil1-ldap amd64 1.6.3-1.1ubuntu7 [9116 B]
Get:5 http://nova.clouds.archive.ubuntu.com/ubuntu noble/main amd64 liblua5.4-0 amd64 5.4.6-3build2 [166 kB]
Get:6 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/main amd64 apache2-bin amd64 2.4.58-1ubuntu8.1 [1327 kB]
Get:7 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/main amd64 apache2-data all 2.4.58-1ubuntu8.1 [163 kB]
Get:8 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/main amd64 apache2-utils amd64 2.4.58-1ubuntu8.1 [96.2 kB]
Get:9 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/main amd64 apache2 amd64 2.4.58-1ubuntu8.1 [90.2 kB]
Get:10 http://nova.clouds.archive.ubuntu.com/ubuntu noble/main amd64 ssl-cert all 1.1.2ubuntu1 [17.8 kB]
Fetched 2080 kB in 3s (706 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libapr1t64:amd64.
(Reading database ... 66791 files and directories currently installed.)
Preparing to unpack .../0-libapr1t64_1.7.2-3.1build2_amd64.deb ...
Unpacking libapr1t64:amd64 (1.7.2-3.1build2) ...
Selecting previously unselected package libaprutil1t64:amd64.
Preparing to unpack .../1-libaprutil1t64_1.6.3-1.1ubuntu7_amd64.deb ...
Unpacking libaprutil1t64:amd64 (1.6.3-1.1ubuntu7) ...
Selecting previously unselected package libaprutil1-dbd-sqlite3:amd64.
Preparing to unpack .../2-libaprutil1-dbd-sqlite3_1.6.3-1.1ubuntu7_amd64.deb ...
Unpacking libaprutil1-dbd-sqlite3:amd64 (1.6.3-1.1ubuntu7) ...
Selecting previously unselected package libaprutil1-ldap:amd64.
Preparing to unpack .../3-libaprutil1-ldap_1.6.3-1.1ubuntu7_amd64.deb ...
Unpacking libaprutil1-ldap:amd64 (1.6.3-1.1ubuntu7) ...
Selecting previously unselected package liblua5.4-0:amd64.
Preparing to unpack .../4-liblua5.4-0_5.4.6-3build2_amd64.deb ...
Unpacking liblua5.4-0:amd64 (5.4.6-3build2) ...
Selecting previously unselected package apache2-bin.
Preparing to unpack .../5-apache2-bin_2.4.58-1ubuntu8.1_amd64.deb ...
Unpacking apache2-bin (2.4.58-1ubuntu8.1) ...
Selecting previously unselected package apache2-data.
Preparing to unpack .../6-apache2-data_2.4.58-1ubuntu8.1_all.deb ...
Unpacking apache2-data (2.4.58-1ubuntu8.1) ...
Selecting previously unselected package apache2-utils.
Preparing to unpack .../7-apache2-utils_2.4.58-1ubuntu8.1_amd64.deb ...
Unpacking apache2-utils (2.4.58-1ubuntu8.1) ...
Selecting previously unselected package apache2.
Preparing to unpack .../8-apache2_2.4.58-1ubuntu8.1_amd64.deb ...
Unpacking apache2 (2.4.58-1ubuntu8.1) ...
Selecting previously unselected package ssl-cert.
Preparing to unpack .../9-ssl-cert_1.1.2ubuntu1_all.deb ...
Unpacking ssl-cert (1.1.2ubuntu1) ...
Setting up ssl-cert (1.1.2ubuntu1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/ssl-cert.service → /usr/lib/systemd/system/ssl-cert.service.
Setting up libapr1t64:amd64 (1.7.2-3.1build2) ...
Setting up liblua5.4-0:amd64 (5.4.6-3build2) ...
Setting up apache2-data (2.4.58-1ubuntu8.1) ...
Setting up libaprutil1t64:amd64 (1.6.3-1.1ubuntu7) ...
Setting up libaprutil1-ldap:amd64 (1.6.3-1.1ubuntu7) ...
Setting up libaprutil1-dbd-sqlite3:amd64 (1.6.3-1.1ubuntu7) ...
Setting up apache2-utils (2.4.58-1ubuntu8.1) ...
Setting up apache2-bin (2.4.58-1ubuntu8.1) ...
Setting up apache2 (2.4.58-1ubuntu8.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 → /usr/lib/systemd/system/apache2.service.
Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /usr/lib/systemd/system/apache-htcacheclean.service.
Processing triggers for ufw (0.36.2-6) ...
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for libc-bin (2.39-0ubuntu8) ...
Scanning processes...
Scanning linux images...
Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
Apache2のバージョン確認
# apache2 -v
Server version: Apache/2.4.58 (Ubuntu)
Server built: 2024-04-18T15:13:41
Apache2の自動起動
サーバー起動時にApache2が起動するようにします。
# systemctl enable apache2
Synchronizing state of apache2.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable apache2
Apache2の起動
Apache2を起動します。
# systemctl start apache2
Apache2のステータス確認
# systemctl status apache2
● apache2.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: >
Active: active (running) since Wed 2024-06-19 07:45:59 JST; 5min ago
Docs: https://httpd.apache.org/docs/2.4/
Main PID: 2370 (apache2)
Tasks: 55 (limit: 2313)
Memory: 5.7M (peak: 6.0M)
CPU: 44ms
CGroup: /system.slice/apache2.service
tq2370 /usr/sbin/apache2 -k start
tq2372 /usr/sbin/apache2 -k start
mq2373 /usr/sbin/apache2 -k start
Jun 19 07:45:59 x162-43-14-152 systemd[1]: Starting apache2.service - The Apach>
Jun 19 07:45:59 x162-43-14-152 systemd[1]: Started apache2.service - The Apache>
qキー(quit)を押すことで、systemctlから抜けることができます。
動作確認
ブラウザから自分のサーバーにアクセスしてみます。
下の様な画面が表示されれば完了です。
上記の表示がされていない場合は、VPS側のWeb用のポートが開いていない可能性があります。
VPSの管理画面でWeb用のポートが開放されているか確認してみてください。(20 / 21 / 80 / 443)
ポートの開放については、下記記事を参照ください。
ご覧いただき有難うございました。良かったら いいね(thumb up)ボタンをお願いします。
PR
コメント