CentOS Stream9でLAMP環境をインストール

CemtOS Stream9の環境にLAMP環境をインストールした際の実行内容を記録しました。

※目次をクリックすると目次の下部にコンテンツが表示されます。

Apache2のインストール
1)パッケージの確認
 

$ dnf info httpd

利用可能なパッケージ
名前         : httpd
バージョン   : 2.4.57
リリース     : 5.el9
Arch         : x86_64
サイズ       : 47 k
ソース       : httpd-2.4.57-5.el9.src.rpm
リポジトリー : appstream
  ;
  :

 
2)インストール
 

# dnf install httpd

インストール済み:
  apr-1.7.0-11.el9.x86_64                apr-util-1.6.1-23.el9.x86_64
  apr-util-bdb-1.6.1-23.el9.x86_64       apr-util-openssl-1.6.1-23.el9.x86_64
  centos-logos-httpd-90.4-1.el9.noarch   httpd-2.4.57-5.el9.x86_64
  httpd-core-2.4.57-5.el9.x86_64         httpd-filesystem-2.4.57-5.el9.noarch
  httpd-tools-2.4.57-5.el9.x86_64        mailcap-2.1.49-5.el9.noarch
  mod_http2-1.15.19-5.el9.x86_64         mod_lua-2.4.57-5.el9.x86_64

完了しました!

 
3)起動確認
 
①システムサービスの確認
# rpm -ql httpd
  :
/usr/lib/systemd/system/htcacheclean.service
/usr/lib/systemd/system/httpd.service
/usr/lib/systemd/system/httpd.socket
/usr/lib/systemd/system/httpd@.service
  :
②起動の確認

# systemctl start httpd

# systemctl status httpd
 httpd.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; preset: d>
     Active: active (running) since Tue 2023-12-12 07:40:16 JST; 13s ago
       Docs: man:httpd.service(8)
   Main PID: 217265 (httpd)
     Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes>
      Tasks: 213 (limit: 4634)
     Memory: 30.9M
        CPU: 55ms
     CGroup: /system.slice/httpd.service
             tq217265 /usr/sbin/httpd -DFOREGROUND
             tq217266 /usr/sbin/httpd -DFOREGROUND
             tq217267 /usr/sbin/httpd -DFOREGROUND
             tq217268 /usr/sbin/httpd -DFOREGROUND
             mq217269 /usr/sbin/httpd -DFOREGROUND

12月 12 07:40:16 inst-strm9.us-west1-b.c.poetic-archway-405306.internal systemd>
12月 12 07:40:16 inst-strm9.us-west1-b.c.poetic-archway-405306.internal systemd>
12月 12 07:40:16 inst-strm9.us-west1-b.c.poetic-archway-405306.internal httpd[2

 
4)ブラウザから動作確認
 
http://サーバーの外部IPアドレス
 
※必要に応じてファイアウォールの設定を行う。

MySQLのインストール
1)パッケージの確認
 

# dnf info mysql-server
名前         : mysql-server
バージョン   : 8.0.32
リリース     : 1.el9
Arch         : x86_64
サイズ       : 17 M
ソース       : mysql-8.0.32-1.el9.src.rpm
リポジトリー : appstream
  ;
  :

 
2)インストール
 

# dnf install mysql-server

インストール済み:
  libaio-0.3.111-13.el9.x86_64
  libtirpc-1.3.3-2.el9.x86_64
  mariadb-connector-c-config-3.2.6-1.el9.noarch
  mecab-0.996-3.el9.4.x86_64
  mysql-8.0.32-1.el9.x86_64
  mysql-common-8.0.32-1.el9.x86_64
  mysql-errmsg-8.0.32-1.el9.x86_64
  mysql-selinux-1.0.5-1.el9.noarch
  mysql-server-8.0.32-1.el9.x86_64
  perl-AutoLoader-5.74-480.el9.noarch
  perl-B-1.80-480.el9.x86_64
  perl-Carp-1.50-460.el9.noarch
  perl-Class-Struct-0.66-480.el9.noarch
  perl-Data-Dumper-2.174-462.el9.x86_64
  perl-Digest-1.19-4.el9.noarch
  perl-Digest-MD5-2.58-4.el9.x86_64
  perl-Encode-4:3.08-462.el9.x86_64
  perl-Errno-1.30-480.el9.x86_64
  perl-Exporter-5.74-461.el9.noarch
  perl-Fcntl-1.13-480.el9.x86_64
  perl-File-Basename-2.85-480.el9.noarch
  perl-File-Path-2.18-4.el9.noarch
  perl-File-Temp-1:0.231.100-4.el9.noarch
  perl-File-stat-1.09-480.el9.noarch
  perl-FileHandle-2.03-480.el9.noarch
  perl-Getopt-Long-1:2.52-4.el9.noarch
  perl-Getopt-Std-1.12-480.el9.noarch
  perl-HTTP-Tiny-0.076-461.el9.noarch
  perl-IO-1.43-480.el9.x86_64
  perl-IO-Socket-IP-0.41-5.el9.noarch
  perl-IO-Socket-SSL-2.073-1.el9.noarch
  perl-IPC-Open3-1.21-480.el9.noarch
  perl-MIME-Base64-3.16-4.el9.x86_64
  perl-Mozilla-CA-20200520-6.el9.noarch
  perl-NDBM_File-1.15-480.el9.x86_64
  perl-Net-SSLeay-1.92-2.el9.x86_64
  perl-POSIX-1.94-480.el9.x86_64
  perl-PathTools-3.78-461.el9.x86_64
  perl-Pod-Escapes-1:1.07-460.el9.noarch
  perl-Pod-Perldoc-3.28.01-461.el9.noarch
  perl-Pod-Simple-1:3.42-4.el9.noarch
  perl-Pod-Usage-4:2.01-4.el9.noarch
  perl-Scalar-List-Utils-4:1.56-461.el9.x86_64
  perl-SelectSaver-1.02-480.el9.noarch
  perl-Socket-4:2.031-4.el9.x86_64
  perl-Storable-1:3.21-460.el9.x86_64
  perl-Symbol-1.08-480.el9.noarch
  perl-Term-ANSIColor-5.01-461.el9.noarch
  perl-Term-Cap-1.17-460.el9.noarch
  perl-Text-ParseWords-3.30-460.el9.noarch
  perl-Text-Tabs+Wrap-2013.0523-460.el9.noarch
  perl-Time-Local-2:1.300-7.el9.noarch
  perl-URI-5.09-3.el9.noarch
  perl-base-2.27-480.el9.noarch
  perl-constant-1.33-461.el9.noarch
  perl-if-0.60.800-480.el9.noarch
  perl-interpreter-4:5.32.1-480.el9.x86_64
  perl-libnet-3.13-4.el9.noarch
  perl-libs-4:5.32.1-480.el9.x86_64
  perl-mro-1.23-480.el9.x86_64
  perl-overload-1.31-480.el9.noarch
  perl-overloading-0.02-480.el9.noarch
  perl-parent-1:0.238-460.el9.noarch
  perl-podlators-1:4.14-460.el9.noarch
  perl-subs-1.03-480.el9.noarch
  perl-vars-1.05-480.el9.noarch
  protobuf-lite-3.14.0-13.el9.x86_64

完了しました!

 
(3)起動の確認
 
1)システムサービスの確認
 
# rpm -ql mysql-server | grep systemd
/usr/bin/mysqld_pre_systemd
/usr/lib/systemd/system/mysqld.service
/usr/lib/systemd/system/mysqld@.service
 
2)起動の確認
 

# systemctl start mysqld

# systemctl status mysqld
 mysqld.service - MySQL 8.0 database server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; preset: >
     Active: active (running) since Tue 2023-12-12 16:17:22 JST; 5s ago
    Process: 1337 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, st>
    Process: 1359 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service>
   Main PID: 1393 (mysqld)
     Status: "Server is operational"
      Tasks: 39 (limit: 4634)
     Memory: 390.0M
        CPU: 988ms
     CGroup: /system.slice/mysqld.service
             mq1393 /usr/libexec/mysqld --basedir=/usr

12月 12 16:17:17 inst-strm9.us-west1-b.c.poetic-archway-405306.internal systemd>
12月 12 16:17:22 inst-strm9.us-west1-b.c.poetic-archway-405306.internal systemd

 
3)コマンドラインで動作確認
 

# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.32 Source distribution

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

PHPのインストール
1)PHPのインストール
 

# dnf install php

インストール済み:
  php-common-8.0.30-1.el9.x86_64
  libxslt-1.1.34-9.el9.x86_64         nginx-filesystem-1:1.22.1-2.el9.noarch
  oniguruma-6.9.6-1.el9.5.x86_64      php-8.0.30-1.el9.x86_64
  php-cli-8.0.30-1.el9.x86_64         php-fpm-8.0.30-1.el9.x86_64
  php-mbstring-8.0.30-1.el9.x86_64    php-opcache-8.0.30-1.el9.x86_64
  php-pdo-8.0.30-1.el9.x86_64         php-xml-8.0.30-1.el9.x86_64

完了しました!

 
2)関連パッケージをインストール
 

# dnf install php-devel php-gmp php-gd php-process php-bcmath php-mysqlnd

インストール済み:
  autoconf-2.69-38.el9.noarch
  automake-1.16.2-8.el9.noarch
  cmake-filesystem-3.26.5-2.el9.x86_64
  cpp-11.4.1-2.3.el9.x86_64
  emacs-filesystem-1:27.2-9.el9.noarch
  fontconfig-2.14.0-2.el9.x86_64
  freetype-2.10.4-9.el9.x86_64
  gcc-11.4.1-2.3.el9.x86_64
  gcc-c++-11.4.1-2.3.el9.x86_64
  gd-2.3.2-3.el9.x86_64
  glibc-devel-2.34-88.el9.x86_64
  glibc-headers-2.34-88.el9.x86_64
  graphite2-1.3.14-9.el9.x86_64
  harfbuzz-2.7.4-10.el9.x86_64
  jbigkit-libs-2.1-23.el9.x86_64
  kernel-headers-5.14.0-391.el9.x86_64
  keyutils-libs-devel-1.6.3-1.el9.x86_64
  krb5-devel-1.21.1-1.el9.x86_64
  libX11-1.7.0-9.el9.x86_64
  libX11-common-1.7.0-9.el9.noarch
  libXau-1.0.9-8.el9.x86_64
  libXpm-3.5.13-10.el9.x86_64
  libcom_err-devel-1.46.5-4.el9.x86_64
  libjpeg-turbo-2.0.90-6.el9.x86_64
  libkadm5-1.21.1-1.el9.x86_64
  libmpc-1.2.1-4.el9.x86_64
  libpkgconf-1.7.3-10.el9.x86_64
  libpng-2:1.6.37-12.el9.x86_64
  libselinux-devel-3.6-0.rc1.1.el9.x86_64
  libsepol-devel-3.6-0.rc1.1.el9.x86_64
  libstdc++-devel-11.4.1-2.3.el9.x86_64
  libtiff-4.4.0-10.el9.x86_64
  libtool-2.4.6-45.el9.x86_64
  libverto-devel-0.3.2-3.el9.x86_64
  libwebp-1.2.0-8.el9.x86_64
  libxcb-1.13.1-9.el9.x86_64
  libxcrypt-devel-4.4.18-3.el9.x86_64
  libxml2-devel-2.9.13-5.el9.x86_64
  m4-1.4.19-1.el9.x86_64
  make-1:4.3-7.el9.x86_64
  openssl-devel-1:3.0.7-24.el9.x86_64
  pcre2-devel-10.40-3.el9.x86_64
  pcre2-utf16-10.40-3.el9.x86_64
  pcre2-utf32-10.40-3.el9.x86_64
  perl-DynaLoader-1.47-480.el9.x86_64
  perl-File-Compare-1.100.600-480.el9.noarch
  perl-File-Copy-2.34-480.el9.noarch
  perl-File-Find-1.37-480.el9.noarch
  perl-Thread-Queue-3.14-460.el9.noarch
  perl-threads-1:2.25-460.el9.x86_64
  perl-threads-shared-1.61-460.el9.x86_64
  php-bcmath-8.0.30-1.el9.x86_64
  php-devel-8.0.30-1.el9.x86_64
  php-gd-8.0.30-1.el9.x86_64
  php-gmp-8.0.30-1.el9.x86_64
  php-mysqlnd-8.0.30-1.el9.x86_64
  php-process-8.0.30-1.el9.x86_64
  pkgconf-1.7.3-10.el9.x86_64
  pkgconf-m4-1.7.3-10.el9.noarch
  pkgconf-pkg-config-1.7.3-10.el9.x86_64
  xml-common-0.6.3-58.el9.noarch
  xz-devel-5.2.5-8.el9.x86_64
  zlib-devel-1.2.11-41.el9.x86_64

完了しました!

 
3)動作確認
 
①/var/www/html/ディレクトリに動作確認用スクリプト(php-test.php)を作成

<?php
phpinfo();
?>

 
②自端末のブラウザからアクセスし、動作確認
http://サーバーの外部IPアドレス/php-test.php

関連記事の目次

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください