centsos 基本安裝參考指令

centsos 基本安裝參考指令

#更新
yum update -y && yum autoremove -y

#安裝常用工具,如vim/wget/openssh-server/nslookup/ping/ifconfig
yum install -y git vim wget openssh* nfs-utils nfs-utils-lib open-vm-tools net-tools bind-utils iputils yum-utils

#設定ssh
mkdir -p ~/.ssh
cat <<EOF > ~/.ssh/config
Host *
    StrictHostKeyChecking no
EOF

#關閉swap
SWAPLINE=$(cat /etc/fstab | grep swap | awk '{print $1}' | sed 's/\//\\\//g')
sed -i "s/$SWAPLINE/#$SWAPLINE/g" /etc/fstab
swapoff -a
free -m

#關閉SELINUX
setenforce 0
sed -i s/^SELINUX=.*$/SELINUX=disabled/ /etc/selinux/config
systemctl disable firewalld.service
systemctl disable libvirtd.service

#Forward Policy
iptables -P FORWARD ACCEPT

#關閉防火牆
iptables -P FORWARD ACCEPT
systemctl stop firewalld
systemctl disable firewalld

#NTP校時
yum install ntp ntpdate ntp-doc -y
cat > /etc/ntp.conf  <<EOL
restrict 127.0.0.1
restrict ::1
server time.stdtime.gov.tw  minpoll 1 maxpoll 3
server tock.stdtime.gov.tw  minpoll 2 maxpoll 3
server watch.stdtime.gov.tw minpoll 3 maxpoll 4
server clock.stdtime.gov.tw minpoll 4 maxpoll 5
server tick.stdtime.gov.tw  minpoll 5 maxpoll 6
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
EOL

systemctl stop ntpd
ntpdate time.stdtime.gov.tw
systemctl enable ntpd
systemctl start ntpd
ntpq -p

留言

這個網誌中的熱門文章

TeknoParrot 模擬器介紹,俗稱《鸚鵡模擬器》

[轉貼] ASP.NET傳遞參數給Crystal Report做Export或Print的動作

Raspberry Pi 樹莓派 - Raspbian 忘記密碼簡單重設