본문 바로가기
IT와 코딩

CentOS8 서버에 아파치, PHP, mariaDB 설치 방법

by 불타는통닭 2023. 3. 3.

centOS8 아파치, PHP, mariaDB 설치 방법

1. apache 설치 방법

 

터미널에서

 

yum -y install httpd*

 

2. php 설치

 

yum -y install php php-mysqlnd

 

3. mariadb 설치

 

yum -y install mariadb*

 

아파치 실행

systemctl start httpd

 

아파치 동작 확인

systemctl status httpd

Active 에서 running 확인!!!

----------------------

● httpd.service - The Apache HTTP Server

   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)

  Drop-In: /usr/lib/systemd/system/httpd.service.d

           └─php-fpm.conf

   Active: active (running) since Tue 2021-06-15 09:52:01 KST; 1min 28s ago

     Docs: man:httpd.service(8)

 Main PID: 44882 (httpd)

   Status: "Running, listening on: port 80"

    Tasks: 213 (limit: 23533)

   Memory: 37.3M

   CGroup: /system.slice/httpd.service

           ├─44882 /usr/sbin/httpd -DFOREGROUND

           ├─44902 /usr/sbin/httpd -DFOREGROUND

           ├─44903 /usr/sbin/httpd -DFOREGROUND

           ├─44904 /usr/sbin/httpd -DFOREGROUND

           └─44905 /usr/sbin/httpd -DFOREGROUND

 

 615 09:51:51 centos systemd[1]: Starting The Apache HTTP Server...

 615 09:52:01 centos httpd[44882]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::a00:27ff:fe62:>

 615 09:52:01 centos systemd[1]: Started The Apache HTTP Server.

 615 09:52:11 centos httpd[44882]: Server configured, listening on: port 80

 

-------------------------------------------------

PHP 작동 확인

폴더에 index.php 를 만들어서 동작하는 걸 확인한다.

 

폴더 위치 : /var/www/html

vi /var/www/html/index.php

 

vi 편집기!!!

i 를 눌러 삽입모드로 변경

 

<?php

        phpinfo();

?>

 

작성 후

esc 누르고 :wq 엔터 후 빠져나옴

 

웹브라우저로 ip 치고 /index.php 를 쳐본다

mariaDB 실행

systemctl start mariadb

systemctl status mariadb

mariadb.service - MariaDB 10.3 database server

   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)

   Active: active (running) since Tue 2021-06-15 11:28:35 KST; 20s ago

     Docs: man:mysqld(8)

           https://mariadb.com/kb/en/library/systemd/

 Main PID: 47320 (mysqld)

   Status: "Taking your SQL requests now..."

    Tasks: 30 (limit: 23533)

   Memory: 98.8M

   CGroup: /system.slice/mariadb.service

           └─47320 /usr/libexec/mysqld --basedir=/usr

 

 615 11:28:30 centos mysql-prepare-db-dir[47217]: MySQL manual for more instructions.

 615 11:28:30 centos mysql-prepare-db-dir[47217]: Please report any problems at http://mariadb.org/jira

 615 11:28:30 centos mysql-prepare-db-dir[47217]: The latest information about MariaDB is available at http://mariadb.org/.

 615 11:28:30 centos mysql-prepare-db-dir[47217]: You can find additional information about the MySQL part at:

 615 11:28:30 centos mysql-prepare-db-dir[47217]: http://dev.mysql.com

 615 11:28:30 centos mysql-prepare-db-dir[47217]: Consider joining MariaDB's strong and vibrant community:

 615 11:28:30 centos mysql-prepare-db-dir[47217]: https://mariadb.org/get-involved/

 615 11:28:30 centos mysqld[47320]: 2021-06-15 11:28:30 0 [Note] /usr/libexec/mysqld (mysqld 10.3.28-MariaDB) starting as process 47320 ...

 615 11:28:30 centos mysqld[47320]: 2021-06-15 11:28:30 0 [ERROR] WSREP: rsync SST method requires wsrep_cluster_address to be configured on startup.

 615 11:28:35 centos systemd[1]: Started MariaDB 10.3 database server.

 

그리고 서버가 재시작 되었을 때 자동으로 실행시켜 주는 명령어

systemctl enable 로 아파치 및 마리아디비를 활성화 해 준다

systemctl enable httpd

Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.

 

그리고 외부에서 들어올 수 있게 방화벽에 인터넷 포트를 열어준다 80 443

firewall-cmd --add-port=80/tcp

success

[root@centos /]# firewall-cmd --add-port=80/udp

success

[root@centos /]# firewall-cmd --add-port=443/udp

success

[root@centos /]# firewall-cmd --add-port=443/tcp


댓글