centos7基本設置和優化

網絡

開啓網卡

sed -i '/ONBOOT/s/no/yes/' /etc/sysconfig/network-scripts/ifcfg-ens33

重啓網卡

systemctl restart network

更換國內源

備份官方源

cd /etc/yum.repos.d
mkdir repo_bak
mv *.repo  repo_bak

下載阿里雲源

curl -O http://mirrors.aliyun.com/repo/Centos-7.repo
curl -O http://mirrors.aliyun.com/repo/epel-7.repo
curl -O http://mirrors.aliyun.com/repo/epel-testing.repo

清理和創建緩存

yum clean all && yum makecache

防火牆和selinux選項

關閉防火牆

systemctl stop firewalld.service
systemctl disable firewalld.service

關閉selinux

sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config

oh my zsh

安裝依賴軟件

yum install -y zsh git

基本安裝

sh -c "$(wget -O- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

主題和插件選擇

vim ~/.zshrc

中文man手冊

yum install -y man-pages-zh-CN

時間同步

yum  install -y ntpdate 
echo ntpdate -u ntp.api.bz >>/etc/rc.local

會話超時

sed -i '/#ClientAlive/s/#//' /etc/ssh/sshd_config
systemctl restart sshd

ClientAliveInterval會話超時時間,即爲一次
ClientAliveCountMax容許超時次數linux

相關文章
相關標籤/搜索