系統(tǒng)yum源優(yōu)化
yum源倉庫:匯總保存多個(gè)軟件包的服務(wù)器
yum源:/etc/yum.repos.d配置好yum源文件宇立,便于找到指定yum倉庫
yum安裝軟件特點(diǎn):便于解決軟件依賴
優(yōu)化基礎(chǔ)yum(base)
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安裝軟件排錯(cuò)
1、網(wǎng)絡(luò)配置不正確
2蹦掐、yum源是否更新
3、清理yum緩存(yum clean all)
查看軟件是否安裝
rpm -qa cowsay
查看安裝哪些信息
rpm -ql cosway
系統(tǒng)安全有關(guān)優(yōu)化
防火墻優(yōu)化:關(guān)閉
確認(rèn)一個(gè)主機(jī)里面有哪些服務(wù)
netstat -lntup 查看網(wǎng)絡(luò)服務(wù)端口號(hào)碼信息
[root@oldboy0708 /oldboy]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 6795/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 7169/master
tcp6 0 0 :::22 :::* LISTEN 6795/sshd
tcp6 0 0 ::1:25 :::* LISTEN 7169/master
udp 0 0 127.0.0.1:323 0.0.0.0:* 5869/chronyd
udp6 0 0 ::1:323 :::* 5869/chronyd
CentOS6:
etc/init.d/iptables stop 臨時(shí)關(guān)閉
etc/init.d/iptables status 查看臨時(shí)
etc/init.d/iptables start 臨時(shí)開啟
chkconfig iptables off 永久關(guān)閉
chkconfig iptables on 永久開啟
chkconfig --list iptables 查看永久
CentOS7
systemctl stop firewalld.service 臨時(shí)關(guān)
systemctl stop firewalld.service 臨時(shí)開
systemctl disable firewalld.service 永久關(guān)
systemctl enable firewalld.service 永久開
systemctl status firewalld.service 查看實(shí)時(shí)狀態(tài)
systemctl is-active firewalld.service 查看臨時(shí)狀態(tài)
systemctl is-enabled firewalld.service 查看永久狀態(tài)
selinux:企業(yè)中都會(huì)關(guān)閉
臨時(shí)關(guān)閉:
setenforce 0 臨時(shí)關(guān)
getenforce 查看狀態(tài)
Enforcing/1 處于開啟
Permissive/0 處于關(guān)閉
永久關(guān)閉:/etc/selinux/config
[root@oldboy0708 /oldboy]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced. ===============開啟
# permissive - SELinux prints warnings instead of enforcing. ===============警告信息代替開啟相當(dāng)于臨時(shí)開啟
# disabled - No SELinux policy is loaded. ===============關(guān)閉
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
修改方法:
1朵耕、vi直接修改
2、vi 替換(s###g)
3、sed
sed -i '7s#enforcing#disabled#g' /etc/selinux/config
系統(tǒng)編碼優(yōu)化
作用:1避免出現(xiàn)中文亂碼狂巢,2部分信息顯示中文
查看系統(tǒng)字符編碼:
[root@oldboy0708 /oldboy]# echo $LANG
en_US.UTF-8
修改字符編碼:
臨時(shí)修改:export LANG="en_US.UTF-8"
永久修改:
CentOS6:
vim /etc/systemconfig/i18n
export LANG="en_US.UTF-8"
CentOS7:
[root@oldboy0708 /oldboy]# vim /etc/locale.conf
LANG=en_US.UTF-8
source /etc/locale.conf
localectl set-locale LANG="en_US.UTF-8" 臨時(shí)也永久
時(shí)間和時(shí)區(qū)優(yōu)化
查看時(shí)間和時(shí)區(qū)信息
[root@oldboy0708 /oldboy]# timedatectl
Local time: Sun 2019-07-21 22:51:19 CST
Universal time: Sun 2019-07-21 14:51:19 UTC
RTC time: Sun 2019-07-21 22:51:19
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: yes
DST active: n/a
Warning: The system is configured to read the RTC time in the local time zone.
This mode can not be fully supported. It will create various problems
with time zone changes and daylight saving time adjustments. The RTC
time is never updated, it relies on external facilities to maintain it.
If at all possible, use RTC in UTC by calling
'timedatectl set-local-rtc 0'.
=======================================================================================
timedatectl set-time 09:00 手動(dòng)設(shè)置時(shí)間信息
timedatectl set-timezone Asia/Shanghai 設(shè)置時(shí)區(qū)
timedatectl list-timezone 查看有哪些時(shí)區(qū)
timedatectl set-local-trc 主板時(shí)間同步
timedatectl set-ntp 網(wǎng)絡(luò)自動(dòng)同步時(shí)間