systemctl 실습
systemctl list-units
or
systemctl
systemctl status httpd.service
systemctl status sshd.service
systemctl start httpd.service
systemctl enable httpd
or
systemctl enable httpd --now
systemctl status httpd.service
systemctl stop httpd
systemctl disable httpd
systemctl enable sshd
systemctl mask httpd
systemctl status httpd
log 실습
vi /etc/rsyslog.conf
/RULE
authpriv.crit - /var/log/securetest
:wq
systemctl restart rsyslog.service
logger -p authpriv.err "auth.error"
logger -p authpriv.crit - "auth.critical"
tail -2 /var/log/secure
auth.error
auth.critical
tail -2 /var/log/securetest
auth.critical
journalctl -p notice
journalctl -p err
mkdir /var/log/journal
chmod g+s /var/log/journal
chown :systemd-journal - /var/log/journal
systemctl restart systemd-journald
ls -l /run/log
ls -l /var/log/journal
root 비번 변경
mount -o rw,remount /sysroot
chroot /sysroot
passwd
touch /.autorelabel
ctrl+d
ctrl+d
vi /etc/default/grub
GRUB_TIMEOUT=5 => 5를 다른 숫자로
:wq
vi /etc/grub.d/00_header
G를 눌러 제일 마지막 부분으로 이동
o를 눌러 편집모드로 들어가서 해당 부분 작성
cat << EOF
set superusers='ID명'
password ID명 PW
EOF
:wq
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot
default-target 확인
default-target 변경
target 전환
소프트웨어 추가 / 삭제
- 설치된 패키치 확인 가능
- 설치된 소프트웨어의 지원 패키지 확인
- 제거된 패키지 파일 잔재 추적
패키지 파일 이름 구성
name-version-release.architecture
yum
RPM 관련 패키지 정보 확인 명령어
rpm -q (쿼리)
a : 시스템에 설치되어 있는 모든 패키지
i : 패키지에 대한 정보
c : 패키지의 설정파일들 보여줌
d : 패키지의 문서(document)를 보여줌
l : 패키지의 모든 파일 보여줌
f : 파일이나 디렉토리가 어떠한 패키지로 인해서 파생되었는지 알려줌.
RPM 관련 패키지 설치 및 업데이트
rpm -Uvh 패키지 파일명
RPM 관련 패키지 삭제
rpm -e 패키지명
YUM 명령어
yum sub명령어
install 패키지명 : 패키지 설치
remove 패키지명 : 패키지 삭제
update 패키지명 : 패키지 업데이트
info 패키지명 : 패키지 정보확인
list : repository 의 패키지 리스트 출력
provies file/dir : 해당 파일이나 디렉토리가 어떠한 패키지로 인해서 파생되었는지 알려줌( = rpm -qf 와 동일한 작용)
repolist all : repository 점검
groups list : 그룹 패키지 리스트 출력
groups install 그룹 패키지명 : 그룹 패키지 설치
groups remove 그룹 패키지명 : 그룹 패키지 삭제
groups update 그룹 패키지명 : 그룹 패키지 업데이트
groups info 그룹 패키지명 : 그룹 패키지 정보
localinstall 패키지파일명 : 패키지파일을 yum으로 설치
repository 파일 설정(/etc/yum.repos.d/)
확장자가 반드시 .repo 이여만 함.
[ID명]
name=repo명
baseurl=http://주소
file://경로
enabled=1/0 (1이면 활성화, 0이면 비활성화)
gpgcheck=1/0 (1이면 라이센스 키가 있을 경우, 0이면 라이센크 키가 없는 경우)
gpgkey=file//경로(gpgcheck=1 일 경우에만 작성)
실습
처음 설정으로 스냅샷
가상머신에 DVD 연결
umount /dev/cdrom
mkdir /media/cdrom
mount /dev/cdrom /media/cdrom
cd /etc/yum.repos.d/
mkdir backup/
mv C b
yum repolist all
아무것도 안나옴
vi test.repo
[DVD]
name=dvd
baseurl=file:///media/cdrom
enabled=1
gpgcheck=0
[Net]
name=network
baseurl=http://mirror.centos.org/cento- s/7/os/x86_64
enabled=1
gpgcheck=0
:wq
dvd 에 있는
enabled=0
:wq
yum repolist all
dvd : disabled
net : enabled
yum -y install telnet*
systemctl start telnet.socket
systemctl enable telnet.socket
systemctl status telnet.socket
rpm -qc telnet-server
rpm -qd telnet-server
rpm -qf /etc/rsyslog.conf
yum provides /etc/rsyslog.conf
rpm -qi rsyslog
yum info rsyslog
===========================================================================================
ssh
키기반 인증 방식
클라이언트 사용자
ssh-keygen
=> 키 기반 인증을 위한 공개키와 개인키 생성
ssh-copy-id id@server ip address
=> 클라이언트가 생성한 공개키를 서버에 등록하게 됩니다.