OS
CentOS 7 minimal 설치 후 초기 설정
- 비아웹 오래 전 2022.02.16 17:50 인기
-
- 3,038
- 0
안녕하세요 서버호스팅 비아웹 입니다.
CentOS 7 최소 설치 후 기본 설정해야 되는 내용 공유합니다.
도움 되시기 바랍니다.
1. 타임존설정
2. openfile limit 수정
3. rc-local enable
4. 서버 시간 동기화
5. sftp 로그 설정
6. 서비스 정리
7. selinux disable
8. messages 로그 중 불필요 로그 정리
#!/bin/sh
# timezone KR 변경
ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
yum install -y rdate wget net-tools sysstat psmisc vim
# time 동기화
rdate -s time.bora.net
# openfile limit 수정
echo "fs.file-max = 2097152" >> /etc/sysctl.conf
echo "* soft nproc 65535" >> /etc/security/limits.conf
echo "* hard nproc 65535" >> /etc/security/limits.conf
echo "* soft nofile 65535" >> /etc/security/limits.conf
echo "* hard nofile 65535" >> /etc/security/limits.conf
# rc-local enable
chmod +x /etc/rc.d/rc.local
echo "
[Install]
WantedBy=multi-user.target" >> /usr/lib/systemd/system/rc-local.service
systemctl enable rc-local
# rdate setting
echo "rdate -s time.bora.net" >> /etc/rc.local
echo "55 * * * * root rdate -s time.bora.net" >> /etc/crontab
# alias vi=vim
echo "alias vi=vim" >> /root/.bashrc
# sftp log
sed -i "s/sftp-server/sftp-server -f local2 -l INFO /g" /etc/ssh/sshd_config
echo "# sftp log
local2.* /var/log/sftp.log" >> /etc/rsyslog.conf
# sftp log rotate
sed -i '1i/var/log/sftp.log' /etc/logrotate.d/syslog
# service change
systemctl disable NetworkManager
systemctl enable network
systemctl disable firewalld
systemctl disable chronyd
# selinux disable
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
# localhost systemd: Started Session of user root. log delete
echo 'if $programname == "systemd" and ($msg contains "Starting Session" or \
$msg contains "Started Session" or $msg contains "Created slice" or $msg contains \
"Starting user-" or $msg contains "Starting User Slice of" or $msg contains \
"Removed session" or $msg contains "Removed slice User Slice of" or $msg contains \
"Stopping User Slice of") then stop'>> /etc/rsyslog.d/ignore-systemd-session-slice.conf
systemctl restart rsyslog
감사합니다.
서버호스팅 비아웹
- 이전글no supported authentication methods available2022.02.16
- 다음글SFTP(Secure File transfer protocol) 로그 남기기2022.02.16
댓글목록
등록된 댓글이 없습니다.