CentOSへの移行(その3) LAMP 関連パッケージのインストール
March 22, 2019 – 10:47 amCentOS7.6 minimal に、これまでの我がサーバ機能を付加するため各種パッケージをインストールするとともに必要な設定作業を行った。
パッケージのインストールでは、現時点で入手可能な範囲(yum packageが入手できるもの)で最終版を選択した。
以下、インストールパッケージのうち、LAMPパッケージに含まれる、mysql, httpd そしてphp のインストールまでの作業ログをアップしておく。
- SSHサーバの設定
rootアカウントへの直接ログインを禁止/etc/ssh/sshd_config:
PermitRootLogin no
- yum repository EPELの追加
EPEL: Red Hat Enterprise Linux(RHEL)向けのアドオンパッケージ[root@server02 ~]# yum install -y epel-release
Package Installed:
========================================================================================================================== Package Arch Version Repository Size ========================================================================================================================== Installing: epel-release noarch 7-11 extras 15 k Transaction Summary ========================================================================================================================== Install 1 Package
- Mysql-8.0 インストール
- yum repository インストール
[root@server02 ~]# rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
- mysql8.0.15 ダウンロード・インストール
[root@server02 ~]#yum install mysql-community-server
Packages installed:
========================================================================================================================== Package Arch Version Repository Size ========================================================================================================================== Installing: mysql-community-libs x86_64 8.0.15-1.el7 mysql80-community 2.2 M replacing mariadb-libs.x86_64 1:5.5.60-1.el7_5 mysql-community-libs-compat x86_64 8.0.15-1.el7 mysql80-community 2.1 M replacing mariadb-libs.x86_64 1:5.5.60-1.el7_5 mysql-community-server x86_64 8.0.15-1.el7 mysql80-community 360 M Installing for dependencies: mysql-community-client x86_64 8.0.15-1.el7 mysql80-community 25 M mysql-community-common x86_64 8.0.15-1.el7 mysql80-community 566 k net-tools x86_64 2.0-0.24.20131004git.el7 base 306 k perl x86_64 4:5.16.3-294.el7_6 updates 8.0 M perl-Carp noarch 1.26-244.el7 base 19 k perl-Encode x86_64 2.51-7.el7 base 1.5 M perl-Exporter noarch 5.68-3.el7 base 28 k perl-File-Path noarch 2.09-2.el7 base 26 k perl-File-Temp noarch 0.23.01-3.el7 base 56 k perl-Filter x86_64 1.49-3.el7 base 76 k perl-Getopt-Long noarch 2.40-3.el7 base 56 k perl-HTTP-Tiny noarch 0.033-3.el7 base 38 k perl-PathTools x86_64 3.40-5.el7 base 82 k perl-Pod-Escapes noarch 1:1.04-294.el7_6 updates 51 k perl-Pod-Perldoc noarch 3.20-4.el7 base 87 k perl-Pod-Simple noarch 1:3.28-4.el7 base 216 k perl-Pod-Usage noarch 1.63-3.el7 base 27 k perl-Scalar-List-Utils x86_64 1.27-248.el7 base 36 k perl-Socket x86_64 2.010-4.el7 base 49 k perl-Storable x86_64 2.45-3.el7 base 77 k perl-Text-ParseWords noarch 3.29-4.el7 base 14 k perl-Time-HiRes x86_64 4:1.9725-3.el7 base 45 k perl-Time-Local noarch 1.2300-2.el7 base 24 k perl-constant noarch 1.27-2.el7 base 19 k perl-libs x86_64 4:5.16.3-294.el7_6 updates 688 k perl-macros x86_64 4:5.16.3-294.el7_6 updates 44 k perl-parent noarch 1:0.225-244.el7 base 12 k perl-podlators noarch 2.5.1-3.el7 base 112 k perl-threads x86_64 1.87-4.el7 base 49 k perl-threads-shared x86_64 1.43-6.el7 base 39 k Transaction Summary ========================================================================================================================== Install 3 Packages (+30 Dependent packages)
- 初期設定手続き
mysqld 起動:[root@server02 ~]# systemctl start mysqld [root@server02 ~]# systemctl enable mysqld
初期設定ログ:
[root@server02 ~]# mysqld --initialize-insecure [root@server02 ~]# mysql_secure_installation Securing the MySQL server deployment. Enter password for user root: The existing password for the user account root has expired. Please set a new password. New password: Re-enter new password: The 'validate_password' component is installed on the server. The subsequent steps will run with the existing configuration of the component. Using existing password for root. Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : y Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y ... skipping. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success. All done!
動作確認(root passwordでログイン )
[root@server02 ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 33405 Server version: 8.0.15 MySQL Community Server - GPL Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. 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> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.01 sec) mysql> exit Bye
- yum repository インストール
- httpd 最新版インストール
参考サイト:CentOS7にApache2.4最新版をyum installする- yum repository ius インストール
[root@server02 /]# yum -y install https://centos7.iuscommunity.org/ius-release.rpm
Package installed:
============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing: ius-release noarch 1.0-15.ius.centos7 /ius-release 8.5 k Transaction Summary ========================================================================================================================== Install 1 Packages
- httpd 関連パッケージインストール
nghttp2 インストール[root@server02 ~]# yum --enablerepo=epel -y install nghttp2
Package installed:
============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing: nghttp2 x86_64 1.31.1-1.el7 epel 547 k Installing for dependencies: c-ares x86_64 1.10.0-3.el7 base 78 k libev x86_64 4.15-7.el7 extras 44 k libnghttp2 x86_64 1.31.1-1.el7 epel 66 k Transaction Summary ============================================================================================================================= Install 1 Package (+3 Dependent packages)
mailcap インストール[root@server02 ~]# yum -y install mailcap
Pacage installed:
============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing: mailcap noarch 2.1.41-2.el7 base 31 k Transaction Summary ============================================================================================================================= Install 1 Package
httpd 本体インストール
[root@server02 ~]# yum --disablerepo=base,extras,updates --enablerepo=ius install httpd
Packages installed:
============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing: httpd24u x86_64 2.4.37-1.ius.centos7 ius 1.4 M Installing for dependencies: apr15u x86_64 1.5.2-2.ius.centos7 ius 111 k apr15u-util x86_64 1.5.4-3.ius.centos7 ius 92 k httpd24u-filesystem noarch 2.4.37-1.ius.centos7 ius 26 k httpd24u-tools x86_64 2.4.37-1.ius.centos7 ius 89 k Transaction Summary ============================================================================================================================= Install 1 Package (+4 Dependent packages)
- httpd verison確認:
[root@server02 ~]# httpd -v Server version: Apache/2.4.37 (IUS) Server built: Jan 9 2019 10:20:01
- http SSL化関連モジュールのインストール
openldap-devel expat-develのインストール[root@server02 ~]# yum -y install openldap-devel expat-devel
Packages installed/updated:
============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing: expat-devel x86_64 2.1.0-10.el7_3 base 57 k openldap-devel x86_64 2.4.44-21.el7_6 updates 804 k Installing for dependencies: cyrus-sasl x86_64 2.1.26-23.el7 base 88 k cyrus-sasl-devel x86_64 2.1.26-23.el7 base 310 k Updating for dependencies: openldap x86_64 2.4.44-21.el7_6 updates 356 k Transaction Summary ============================================================================================================================= Install 2 Packages (+2 Dependent packages) Upgrade ( 1 Dependent package)
libdb-devel のインストール(mod-sslインストール時に前提とされる):
[root@server02 ~]# yum install libdb-devel
Package installed
============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing: libdb-devel x86_64 5.3.21-24.el7 base 38 k Transaction Summary ============================================================================================================================= Install 1 Package
httpd-devel mod-ssl のインストール:[root@server02 ~]# yum --disablerepo=base,extras,updates --enablerepo=ius -y install httpd-devel mod_ssl
Packages installed:
============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing: httpd24u-devel x86_64 2.4.37-1.ius.centos7 ius 205 k httpd24u-mod_ssl x86_64 1:2.4.37-1.ius.centos7 ius 114 k Installing for dependencies: apr15u-devel x86_64 1.5.2-2.ius.centos7 ius 193 k apr15u-util-devel x86_64 1.5.4-3.ius.centos7 ius 76 k Transaction Summary ============================================================================================================================= Install 2 Packages (+2 Dependent packages)
- yum repository ius インストール
- php7.3 インストール
- yum repository remi のインストール
[root@server02 ~]# yum install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Package installed:
============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing: remi-release noarch 7.6-2.el7.remi /remi-release-7 19 k Transaction Summary ============================================================================================================================= Install 1 Package
- php 7.3 インストール
[root@server02 ~]# yum install php --enablerepo=remi-php73
Packages installed:
============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing: php x86_64 7.3.3-1.el7.remi remi-php73 3.2 M Installing for dependencies: libargon2 x86_64 20161029-2.el7 epel 23 k php-cli x86_64 7.3.3-1.el7.remi remi-php73 4.9 M php-common x86_64 7.3.3-1.el7.remi remi-php73 1.1 M php-json x86_64 7.3.3-1.el7.remi remi-php73 63 k Transaction Summary ============================================================================================================================= Install 1 Package (+4 Dependent packages)
- php 補助パッケージのインストール
php73-mysqlnd インストール[root@server02 ~]# yum --enablerepo=remi-php73 install php73-mysql Package php-mysql is obsoleted by php-mysqlnd, trying to install php-mysqlnd-7.3.3-1.el7.remi.x86_64 instead
Packages installed:
============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing: php-mysqlnd x86_64 7.3.3-1.el7.remi remi-php73 231 k Installing for dependencies: php-pdo x86_64 7.3.3-1.el7.remi remi-php73 125 k Transaction Summary ============================================================================================================================= Install 1 Package (+1 Dependent package)
php-gd インストール[root@server02 ~]# yum --enablerepo=remi-php73 install php-gd
Packages installed:
============================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================= Installing: php-gd x86_64 7.3.3-1.el7.remi remi-php73 78 k Installing for dependencies: dejavu-fonts-common noarch 2.33-6.el7 base 64 k dejavu-sans-fonts noarch 2.33-6.el7 base 1.4 M fontconfig x86_64 2.13.0-4.3.el7 base 254 k fontpackages-filesystem noarch 1.44-8.el7 base 9.9 k gd-last x86_64 2.2.5-5.el7.remi remi-safe 134 k jbigkit-libs x86_64 2.0-11.el7 base 46 k libX11 x86_64 1.6.5-2.el7 base 606 k libX11-common noarch 1.6.5-2.el7 base 164 k libXau x86_64 1.0.8-2.1.el7 base 29 k libXpm x86_64 3.5.12-1.el7 base 55 k libjpeg-turbo x86_64 1.2.90-6.el7 base 134 k libtiff x86_64 4.0.3-27.el7_3 base 170 k libwebp x86_64 0.3.0-7.el7 base 170 k libxcb x86_64 1.13-1.el7 base 214 k Transaction Summary ============================================================================================================================================= Install 1 Package (+14 Dependent packages)
php-mbstring インストール
[root@server02 ~]# yum --enablerepo=remi-php73 install php-mbstring
Package installed:
============================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================= Installing: php-mbstring x86_64 7.3.3-1.el7.remi remi-php73 650 k Transaction Summary ============================================================================================================================================= Install 1 Package
- 設定ファイル /etc/php.ini 修正
タイムゾーンを日本(東京)に設定
/etc/php.ini:[Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = "Asia/Tokyo"
- yum repository remi のインストール