linux

centos - 초기세팅

sysman 2020. 12. 30. 22:02

업그레이드 및 필요데몬 설치

dnf update

dnf -y install epel-release rsync wget psmisc net-tools lsof chrony

[root@dothome-world ~]# localectl set-locale LANG=ko_KR.UTF-8 (옵션)

 

timezone 세팅

timedatectl set-timezone Asia/Seoul

 

 

ntp 세팅

vi /etc/chrony.conf

# pool 2.centos.pool.ntp.org iburst // 주석처리

server time.bora.net iburst

:wq!

 

systemctl restart chronyd

systemctl enable chronyd

systemctl status chronyd

chronyc sources

date

 

[root@dothome-world ~]# hwclock -w (옵션)

[root@dothome-world ~]# hwclock -v (옵션)

 

hostnamectl set-hostname test.example.com

hostnamectl

 

vi /etc/sysconfig/network-script/ifcfg-ens161

BOOTPROTO=static

IPV6INIT=no

IPV6_AUTOCONF=no

IPV6_DEFROUTE=no

IPV6_FAILURE_FATAL=no

ONBOOT=yes                        # 부팅 / 네트워크 재시작 시 자동 활성화를 위해 yes로 설정

IPADDR=192.168.122.250              

NETMASK=255.255.255.0               # 서브넷 마스크 설정, prefix=24 설정으로 대체가능

GATEWAY=192.168.122.1             

DNS1=8.8.8.8                        

DNS2=8.8.4.4  

 

cat /etc/resolv.conf  //확인

 

 

vi /etc/hosts

test1.example.com x.x.x.x

test2.example.com x.x.x.x

 

 

 

vi /etc/ssh/sshd_config

port xxxx

firewall-cmd --permanent --zone=public --add-port=xxxx/tcp

firewall-cmd --permanent --zone=public --remove-port=xxxx/tcp

firewall-cmd --reload

firewall-cmd --zone=public --list-all

 

semanage port -a -t ssh_port_t -p tcp xxxx

semanage port -d -t ssh_port_t -p tcp xxxx(삭제필요할 경우)

semanage port -l | grep ssh_port_t

netstat -alpt | grep <port number> //port 열렸는지 확인

 

systemctl restart sshd

systemctl restart firewalld

 

 

<방화벽에서>

firewall-cmd --zone=external --add-forward-port=port=xxxx:proto=tcp:toport=xxxx:toaddr=x.x.x.x

 

 

systemctl get-default //확인

gui-mode

systemctl set-default graphical.target

init 5

 

cli-mode

systemctl set-default multi-user.target

init 3

 

 

 

 

'linux' 카테고리의 다른 글

centos - vlan 설정  (0) 2020.12.31
centos teaming 티밍 - activebackup  (0) 2020.12.31
Centos -backup  (0) 2020.12.29
centos - postfix  (0) 2020.12.28
centos -dns 서버 설치  (0) 2020.12.28