修改命令提示符顏色
PS1='[\e[33;1m][\u@\h \W]$ [\e[0m]'
修改命令提示符要有開(kāi)始和結(jié)束
yum倉(cāng)庫(kù)率寡,匯總保存軟件包的服務(wù)器。aliyun比較穩(wěn)定
yum源/etc/yum.repos.d整慎,配置好的源文件粱挡,便于找到源倉(cāng)庫(kù)
yum解決軟件依賴(lài)
優(yōu)化基礎(chǔ)yum(base) 修改默認(rèn)下載地址(aliyun)
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
優(yōu)化擴(kuò)展yum(epel -- Extra Packages for Enterprise Linux)
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum無(wú)法正常下載解決方法:
1.檢查網(wǎng)絡(luò)
2.yum源是否更新
3.yum源緩存需要清除:yum clean all
查看軟件是否安裝: rpm -qa cowsay
查看軟件都安裝哪些信息:rpm -ql cowsay
系統(tǒng)防火墻開(kāi)啟與關(guān)閉
centos6
臨時(shí)關(guān)閉:
/etc/init.d/iptables stop
/etc/init.d/iptables status
永久關(guān)閉:
chkconfig iptables off
chkconfig --list|grep iptables
chkconfig --list iptables
centos7
臨時(shí)關(guān)閉::systemctl stop firewalld.service
臨時(shí)開(kāi)啟:systemctl start firewalld.service
永久關(guān)閉:systemctl disable firewalld.service
永久開(kāi)啟:systemctl enable firewalld.service
查看狀態(tài):systemctl status firewalld.service
檢查服務(wù)是否臨時(shí)關(guān)閉或開(kāi)啟
systemctl is-active firewalld.service
檢查服務(wù)是否永久關(guān)閉或開(kāi)啟
systemctl is-enabled firewalld.service
關(guān)閉selinux
文件位置:/etc/selinux/config
字符編碼
查看系統(tǒng)字符編碼:
echo $LANG
en_US.UTF-8
修改字符編碼:
centos6
臨時(shí)調(diào)整:
export LANG="en_US.UTF-8"
永久調(diào)整:
vim /etc/sysconfig/i18n
LANG="en_US.GBK"
centos7:
臨時(shí)調(diào)整:
export LANG="en_US.UTF-8"
永久調(diào)整:
vim /etc/locale.conf
LANG="en_US.GBK"
source /etc/locale.conf
localectl set-locale LANG="en_US.UTF-8"
設(shè)置系統(tǒng)提示信息為中文:
localectl set-locale LANG="zh_CN.UTF-8"
時(shí)間地區(qū)優(yōu)化
查看時(shí)間:timedatectl
timedatectl set-time 18:49 --- 設(shè)置時(shí)間信息
timedatectl set-timezone Asia/Shanghai --- 設(shè)置時(shí)區(qū)信息 ******
timedatectl list-timezones --- 顯示時(shí)區(qū)信息
set-local-rtc BOOL --- 設(shè)置RTC功能是否開(kāi)啟 BOOL(數(shù)據(jù)布爾型--0/1 false/true)
RTC是否修改硬件主板時(shí)間
set-ntp BOOL --- 設(shè)置NTP功能是否開(kāi)啟
會(huì)通過(guò)網(wǎng)絡(luò)自動(dòng)同步時(shí)間
手動(dòng)同步時(shí)間方法:
安裝時(shí)間同步軟件:yum install -y ntpdate
同步到阿里云:ntpdate "ntp1.aliyun.com"
timedatectl命令操作不了:
第一個(gè)里程: 安裝時(shí)間同步軟件
yum install -y chrony
systemctl start chronyd
第二個(gè)里程: 修改同步方式
timedatectl set-ntp 1