본문 바로가기

Server관련

CentOS 6 CentOS 7 명령어차이

반응형
CentOS 6.x이하 버전과  CentOS 7이상 버전 명령어차이

리눅스에서는 흔한 터미널창

 

각종 서비스는 시작하고 정지 그리고 추가 되는 옵션들로 인해 재시작(리로드) 같은 명령어를 자주 사용하곤 합니다.

그런데 최신운영체제 리눅스(CentOS)를 사용하면 전혀 문제가 없는데

회사나 개인적으로 사용하는게 예전버전이라면 문제가 발생됩니다.

보안상 최신버전을 사용하는게 최고지만 사내에서 사용하거나 개인적으로 사용할 경우 문제없이 잘 돌아 가기때문에...



평소 터미널로 접속하면 이서버가 버전이 어떻게 되었지......헷갈릴수 있으니

◈버전부터 확인

[root@fileserver /]# rpm --query centos-release
centos-release-6-10.el6.centos.12.3.x86_64

 

[root@localhost /]# rpm --query centos-release
centos-release-7-9.2009.1.el7.centos.x86_64

이렇게 버전이 확인이 되었다면 버전에 맞게 명령어를 기억을 되살려서 입력해주면되겠죠

 

 

버전 확인하는 명령어는 많지만

rpm --query centos-release

로 쉽게 확인 가능합니다.

 

혹시 안되면 cat /etc/redhat-release

 

 

 

서비스 관련 예를 들겠습니다.

 

▶아파치 재시작 명령어
-CentOS 6.x
service httpd restart

-CentOS 7.x 이상
systemctl restart httpd service


▶MariaDB 재시작 명령어
-CentOS 6.x
service mariadb restart

-CentOS 7.x 이상
systemctl restart mariadb service

▶아파치 상태보기 명령어
-CentOS 6.x
service httpd status

-CentOS 7.x 이상
systemctl status httpd

 

 

정리 하자면
CentOS 6.x 에서는 service [서비스명] [서비스동작] 

CentOS 7.x 이상에서는 systemctl [서비스동작] [서비스명]

service 와 systemctl 명령어가 변경이 되었고

가끔 실수하는게 서비스동작과 서비스명 순서.....

 

 

명령어 비교표

기능명 CentOS 6.x CentOS 7
서비스 상태 service [서비스명] status systemctl status [서비스명]
서비스 시작 service [서비스명] start systemctl start [서비스명]
서비스 정지 service [서비스명] stop systemctl stop [서비스명]
서비스 재시작 service [서비스명] restart systemctl restart [서비스명]
서비스 리로드 service [서비스명] reload systemctl reload [서비스명]
자동시작 확인 chkconfig [서비스명] systemctl is-enabled [서비스명]
자동시작 설정 chkconfig [서비스명] on systemctl enable [서비스명]
자동시작 해제 chkconfig [서비스명] off systemctl disable [서비스명]
방화벽 중지 service iptables stop systemctl stop firewalld
방화벽 시작 service iptables start systemctl start firewalld
방화벽 자동시작 적용 chkconfig iptables on systemctl enable firewalld
방화벽 자동시작 해제 chkconfig iptables off systemctl disable firewalld

이렇게 정리표로 보니 CentOS 7.x 이상 명령어로 변경된게 통일성 있고 괜찮아 보입니다.

※회사에 지원하지 않는 와전 구닥다리 서버만 아니면 다 CentOS 7.x 이상으로 변경하고 싶군요

 

 

 

 

 

 

 

개인적으로 잊혀질만하면 다시 찾게 되는 장애처리 및 명령어들로 인해 개인적으로 메모도 중요하지만
구글링등을 통해 이런 메모들로 인해 단 한명이라도 문제가 해결 될 수 있었으면 좋겠습니다. (삽질은 진짜..)

 

반응형

'Server관련' 카테고리의 다른 글

Windows Server 2019 설치 오류  (0) 2023.10.17
CentOS 8 repo 오류  (2) 2023.04.26
CentOS6 Repo지원종료 설치 후 yum 문제해결  (2) 2023.01.27