1. yum 초기화

※ yum repository를 초기화 진행합니다. ( yum이 정상적으로 진행된다면 스킵해도 됩니다. )

> 참고 포스팅 : https://momentoo.tistory.com/12

 

[Yum Repository 초기화]

Q. Yum Repository 초기화 필요성 - Centos 초기 설정 시에 Repository를 잘못 설정하여 초기화가 필요할 때가 있다. 물론 반드시 초기화가 정답은 아니다. 1. Repository 지우기 # cd /etc/yum.repos.d/ > reposi..

momentoo.tistory.com

 

2. apache 설치

#yum -y install httpd httpd-devel

> devel은 tomcat-connectors를 진행하기 위해 install

※ 설치 버전 확인

1
2
3
[root@ ~]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Apr 24 2019 13:45:48
cs

> 정상 설치 시 위와 같이 노출

 

3. Apache 서버 재시작 자동 등록

> 리눅스 재시작 시 자동으로 재시작 하도록 등록하는 부분입니다.

1
2
[root@ ~]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
cs

 

4. Apache 서버 정상 동작 확인

1
2
3
4
5
6
7
8
[root@ ~]# ps -ef | grep httpd
root     23686     1  0 10:15 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   23687 23686  0 10:15 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   23688 23686  0 10:15 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   23689 23686  0 10:15 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   23690 23686  0 10:15 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   23691 23686  0 10:15 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
root     25527 23477  0 10:49 pts/0    00:00:00 grep --color=auto httpd
cs

 

5. 방화벽 default-zone 체크

> 방화벽 설정 정보 파일을 확인할 수 있다.

1
2
[root@ ~]# firewall-cmd --get-default-zone
public
cs

 

6. Apache 포트 개방 (기본포트 80)

1
2
3
4
5
[root@ ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent
Warning: ALREADY_ENABLED: 80:tcp
success
[root@ ~]# firewall-cmd --reload
success
cs

※ 기존에 80포트가 open되어 있지 않았다면 ('Warning: ALREADY_ENABLED: 80:tcp') 해당 부분이 나타나지 않습니다.

> firewalld(방화벽) 설정 파일 위치

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@ ~]# vi /etc/firewalld/zones/public.xml
 
<?xml version="1.0" encoding="utf-8"?>
<zone>
  <short>Public</short>
  <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
  <service name="dhcpv6-client"/>
  <service name="ssh"/>
  <service name="ntp"/>
#  <service name="http"/>
#  <port protocol="tcp" port="8080"/>
#  <port protocol="tcp" port="80"/>
#  <port protocol="tcp" port="3306"/>
</zone>
cs

 

7. 서버 ip주소 확인

> eth0의 inet 부분을 확인

※ 만약 ifconfig 명령어가 동작을 하지않는다면 'yum -y install net-tools'을 설치하시길 바랍니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@ ~]# ifconfig
 
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 000.000.000.000  netmask 255.255.255.0  broadcast 000.000.000.000
        inet6 0000::000:0000:0000:0000  prefixlen 64  scopeid 0x20<link>
        ether 00:00:00:00:00:eb  txqueuelen 1000  (Ethernet)
        RX packets 109068058  bytes 18167317568 (16.9 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 19533605  bytes 2404711975 (2.2 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1506769  bytes 212891507 (203.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1506769  bytes 212891507 (203.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
cs

 

8. 브라우저 확인

> 서버 ip주소로 접속. 아래와 같은 화면을 확인하면 정상적으로 Apache 설치 완료.

Apache 기본 화면

 

'Development > CentOS' 카테고리의 다른 글

[Yum Repository 초기화]  (0) 2019.07.17

+ Recent posts