Centos 7 - 6와 다른 명령어 정리

치치·2021년 4월 14일
0

CentOS6 CentOS7 변경된 부분

1. Service

기능CentOS 6CentOS 7
서비스 상태service 서비스명 statussystemctl status 서비스명
서비스 시작service 서비스명 startsystemctl start 서비스명
서비스 정지service 서비스명 stopsystemctl stop 서비스명
서비스 재시작service 서비스명 restartsystemctl restart 서비스명
서비스 리로드service 서비스명 reloadsystemctl reload 서비스명

2. chkcofig

기능CentOS 6CentOS 7
자동시작 확인chkconfig 서비스명systemctl is-enabled 서비스명
자동시작 설정chkconfig 서비스명 onsystemctl enabled 서비스명
자동시작 해제chkconfig 서비스명 offsystemctl disabled 서비스명

3. 방화벽

기능CentOS 6CentOS 7
방화벽 중지service iptables stopsystemctl stop firewalld
방화벽 시작service iptables startsystemctl start firewalld
방화벽 자동시작 해제chkconfig iptables offsystemctl disable firewalld
방화벽 자동시작 해제chkconfig iptables onsystemctl enable firewalld

포트 관리하기

Centos6 는 /etc/sysconfig/iptables 에서 포트를 관리하였다. 하지만 7에서는 방화벽을 관리하는 방식이 다르다.

  • 우선 사용중인 포트 확인은 아래와 같이 한다.
    # netstat -tulpn | grep LISTEN

  • 허용하고자 하는 port를 열때
    # firewall-cmd --permanent --zone=public --add-port=80/tcp

  • 수정한 내용을 실제 서비스에 반영한다.
    # firewall-cmd --reload

  • public zone 포트 확인
    # firewall-cmd --zone=public --list-ports

방화벽을 열어주었으나 해당 포트를 bind 하지 못하는 경우 아래와 같이 포트를 등록해주어야 한다.

  • 설치
    # yum install policycoreutils-python
  • 포트 등록
    # semanage port -a -t http_port_t -p tcp 8090
  • 등록 내용 확인
    # semanage port -l | grep http_port_t

기타 변경된 명령어들

그리고 아래와 같은 명령어들도 변경이 되었다.
service postgresql status --> systemctl status postgresql
netstat -anop --> ss -anop
ifconfig --> ip addr

profile
안녕하세요. 개발자입니다.

0개의 댓글