CentOS 8 APM(Apache + PHP + mariadb) yum 설치 방법
2019.12.24 13:55
1. Apache + PHP + mariadb 설치
# 설치가 필요할수도 있는 프로그램
yum -y install zlib libpng freetype gd gcc g++ |
# Apache + PHP + mariadb 설치
# Apache 설치 yum -y install httpd* # PHP 설치 yum -y install php php-mysqlnd; # mariadb 설치 yum -y install mariadb* |
2. Apache 설정 및 서비스 작동
# Apache 설정
# httpd.conf 원본 파일 백업 cp /etc/httpd/conf/httpd.conf /usr/local/src/httpd.conf_backup # Apache는 html 파일만 인식하도록 설정되어있으며 차후 워드프레스, XE1를 사용할 경우 index.php도 추가해야한다. sed -i "s/DirectoryIndex index.html/DirectoryIndex index.html index.php/g" /etc/httpd/conf/httpd.conf |
# Apache + mariadb 서비스 등록 및 작동
# 서비스 등록 /sbin/chkconfig --level 3 httpd on /sbin/chkconfig --level 3 mariadb on # 서비스 작동 service httpd start service mariadb start # mariadb root 패스워드 셋팅 'password'안에는 원하는 패스워드를 설정 mysqladmin -u root -- password 'password' |
3. PHP 작동 확인
# index.php 생성 후 웹 브라우저에 IP로 접속하여 php 설치 목록 확인
# /var/www/html 디렉토리에 index.html이 있을경우 파일을 잠시 이동시킨후 아래의 명령어를 사용한다. echo "<?php phpinfo(); ?>" >> /var/www/html/index.php |
4. Apache + PHP + mariadb 버전 확인
# Apache 버전
[root@imitator ~]# httpd -v Server version: Apache/2.4.37 (centos) Server built: Oct 7 2019 21:42:02 |
# PHP 버전
[root@imitator ~]# php -v PHP 7.2.11 (cli) (built: Oct 9 2018 15:09:36) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies |
# mariadb 버전
[root@imitator ~]# mysql -V mysql Ver 15.1 Distrib 10.3.11-MariaDB, for Linux (x86_64) using readline 5.1 |