系統版本:CentOS-7-x86_64-Minimal-1810.isophp
運行環境:虛擬機windows上的VM 15html
系統安裝:參照老男孩運維要求python
配置靜態IP mysql
網卡文件:cat /etc/sysconfig/network-scripts/ifcfg-eth0linux
配置靜態IP代碼以下 ios
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=7abea26f-6286-4806-877c-b6710950fba1 DEVICE=ens33 ONBOOT=yes IPADDR=10.1.1.133 PREFIX=24 GATEWAY=10.1.1.2 DNS1=10.1.1.2 DNS2=114.114.114.114 DNS3=8.8.8.8 IPV6_PEERDNS=yes IPV6_PEERROUTES=yes NETMAST=255.255.255.0 NM_CONTROLLED=no
重啓網卡: sql
service network restartvim
systemctl restart networkwindows
修改主機名:bash
vi /etc/hostname
hostnamectl status
推薦使用:hostnamectl set-hostname test
修改字符集:
[root@localhost ~]# localectl status
System Locale: LANG=en_US.UTF-8
VC Keymap: us
X11 Layout: us
localectl set-locale LANG=zh_CN.UTF8
查看字體:
cat /etc/redhat-release
cat /etc/os-release
開機啓動項:
查看開機啓動服務狀態:systemctl list-unit-files
查看全部開機啓動項:systemctl list-unit-files | grep enable
關閉全部開機啓動項:for oldboy in `systemctl list-unit-files|grep enabled |awk '{print $1}'` ;do systemctl disable $oldboy ;done
開啓最小化服務:for oldboy in network-online.target network-pre.target network.target crond.service rsyslog.service sshd.service sysstat.service ;do systemctl enable $oldboy ;done
查看開啓的服務:systemctl list-unit-files|grep enabled
autovt@.service enabled
crond.service enabled
getty@.service enabled
rsyslog.service enabled
sendmail.service enabled
sm-client.service enabled
sshd.service enabled
設置時區:
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
timedatectl set-timezone "Asia/Shanghai"
設置與網絡時間同步:
yum -y install ntp ntpdate
ntpdate cn.pool.ntp.org
將系統寫入硬件時間:
hwclock --systohc
查看系統時間:
timedatectl
You have new mail in /var/spool/mail/root
echo "unset MAILCHECK" >> /etc/profile
source /etc/profile
查看防火牆狀態:systemctl status firewalld.service
關閉:systemctl stop firewalld
開啓:systemctl start firewalld
開機自動關閉:systemctl disable firewalld
開機自動啓動:systemctl enable firewalld
開發者工具:yum -y groupinstall "Development Tools"
其餘必需工具:yum -y install pidof pkill rsysnc gawk curl lsof tar sed iproute uuid psmisc wget bind-utils mysql-devel MySQL-python
配置yum源:wget https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-7.noarch.rpm
更新yum列表:yum repolist
上傳下載:yum -y install lrzsz 上傳:rz 下載sz file
查看端口號:yum -y install net-tools -- netstat -ant -- netstat -pt --netstat -ant -c
安裝ifconfig命令工具包:yum install -y net-tools
安裝wget命令:yum -y install wget
安裝vim命令:yum -y install vim
安裝命令補全:yum -y install bash-completion
安裝nmap:yum -y install nmap
yum -y install yum-utils
安裝telnet:yum -y install telnet
安裝tree命令:yum -y install tree
安裝unzip命令:yum -y install unzip 壓縮目錄: zip -r xxx.zip ./* 解壓:unzip filename.zip 解壓到指定目錄:unzip -o -d /home/sunny myfile.zip
tar包解壓縮: tar -zxvf libiconv-1.13.tar.gz ./libiconv tar -cxvf libiconv-1.13.tar.gz ./*.php
查看工具命令所在的rpm包:rpm -ql net-tools
rpm -qa iproute
查看系統版本:cat /etc/redhat-release
查看CPU:cat /proc/cpuinfo
查看磁盤:free -m df -h
設置服務開機自啓動:systemctl enable libvirtd systemctl start libvirtd
進程查詢:ps aux | grep kvm
關閉進程:kill 進程號 至關於關機關閉虛擬機
參考博客:https://blog.51cto.com/oldboy/1722101
修改網卡名稱:cd /etc/sysconfig/network-scripts/
mv ifcfg-ens33 ifcfg-eth0
修改後:cat ifcfg-eth0
NAME=eth0
DEVICE=eth0
修改並生成grup配置:cat /etc/sysconfig/grub
修改內容爲粗體字:GRUB_CMDLINE_LINUX="crashkernel=128M rhgb net.ifnames=0 biosdevname=0 quiet"
生成grup啓動菜當:grub2-mkconfig -o /boot/grub2/grub.cfg
重啓後生效:reboot
參考博客:http://www.javashuo.com/article/p-supvpfrn-dw.html
/usr/sbin/sestatus -v
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
grep SELINUX= /etc/selinux/config
cat /etc/selinux/config
echo $LANG
yum install kde-l10n-Chinese -y
yum reinstall glibc-common -y
vim /etc/locale.conf
#LANG="en_US.UTF-8"
LANG="zh_CN.UTF-8"
source /etc/locale.conf