Linux/Rokcy 8.5

Apache 설치하기

6미리 2022. 3. 29. 17:54

CentOS 가 Stream으로 변경되면서 어쩌고 저쩌고 했습니다.

그래서 이럴바에 다른 OS로 갈까 싶어서, 알아보던 차에 Rocky Linux를 알게 되었습니다.

늘 그렇듯 minimal버전 설치하고 원하는걸 설치하던 차에, 늘 하던대로 APM을 설치해보기로 했습니다.

 

[root@rocky-test]# yum install httpd
마지막 메타자료 만료확인 0:04:58 이전인: 2022년 01월 01일 (수) 오후 05시 52분 10초.
종속성이 해결되었습니다.
======================================================================================================================
 꾸러미                     구조            버전                                             레포지터리          크기
======================================================================================================================
설치 중:
 httpd                      x86_64          2.4.37-43.module+el8.5.0+746+b6ce3176.2          appstream          1.4 M
종속 꾸러미 설치 중:
 apr                        x86_64          1.6.3-12.el8                                     appstream          128 k
 apr-util                   x86_64          1.6.1-6.el8.1                                    appstream          104 k
 httpd-filesystem           noarch          2.4.37-43.module+el8.5.0+746+b6ce3176.2          appstream           39 k
 httpd-tools                x86_64          2.4.37-43.module+el8.5.0+746+b6ce3176.2          appstream          106 k
 mod_http2                  x86_64          1.15.7-3.module+el8.5.0+695+1fa8055e             appstream          153 k
 rocky-logos-httpd          noarch          85.0-3.el8                                       baseos              22 k
취약한 종속 꾸러미 설치 중:
 apr-util-bdb               x86_64          1.6.1-6.el8.1                                    appstream           23 k
 apr-util-openssl           x86_64          1.6.1-6.el8.1                                    appstream           26 k
모듈 스트림 활성화:
 httpd                                      2.4                                                                      

연결 요약
======================================================================================================================
설치  9 꾸러미

총계 내려받기 크기: 2.0 M
설치된 크기 : 5.4 M
진행 할 까요? [y/N]:

그래서 여튼 설치를 진행합니다.

 

[root@rocky-test]# httpd -v
Server version: Apache/2.4.37 (rocky)
Server built:   Mar 24 2022 17:33:25

버전 확인해보니 잘 설치 되었습니다. Nginx도 좋다지만, 저는 Apache가 익숙해서 그냥 이거 사용합니다.

 

그리고 위에처럼 하고 나면 끝나지는 않아요.

이제 방화벽에 등록하고 프로그램도 시작해줘야 하죠

방화벽에 80포트 등록

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

방화벽에 443포트 등록
firewall-cmd --permanent --add-port=443/tcp

방화벽 다시 로드
firewall-cmd --reload

방화벽 확인
firewall-cmd --list-all

[root@rocky-test]# firewall-cmd --permanent --add-port=80/tcp
success
[root@rocky-test]# firewall-cmd --permanent --add-port=443/tcp
success
[root@rocky-test]# firewall-cmd --reload
success
[root@rocky-test]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp0s3
  sources: 
  services: cockpit dhcpv6-client ssh
  ports: 80/tcp 443/tcp
  protocols: 
  forward: no
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 
[root@rocky-test]#

 

 

이제 아파치를 시작하고 서버가 재시작 되어도 다시 시작할수 있도록 등록도 합니다.

아파치 시작(restart대신 start를 해도 됩니다)
[root@rocky-test]# systemctl restart httpd

아파치 서비스를 등록합니다.
[root@rocky-test]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.

 

그러면 아래와 같이 정상적으로 실행되는 화면을 볼 수 있습니다.