centos7基本配置
阿新 • • 發佈:2018-05-28
centos7基本配置一、修改網卡名:
- 網卡配置文件:
vi /etc/sysconfig/network-scripts/ifcfg-ens33TYPE=Ethernet BOOTPROTO=static DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no NAME=eth0 DEVICE=eth0 ONBOOT=yes IPADDR=192.168.8.81 NETMASK=255.255.255.0 GATEWAY=192.168.8.1 DNS1=8.8.8.8 DNS2=114.114.114.114
- 改名:
mv /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-eth0
- 引導文件配置:
vi /etc/default/grubGRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed ‘s, release .*$,,g‘ /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet net.ifnames=0 biosdevname=0" GRUB_DISABLE_RECOVERY="true"
- 更新內核:
grub2-mkconfig -o /boot/grub2/grub.cfg
- 重啟:
reboot
- 測試:
ip addr
二、添加網卡:
- 增加新網卡:
- 添加新網卡的配置文件:
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1TYPE=Ethernet BOOTPROTO=static DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no NAME=eth1 DEVICE=eth1 ONBOOT=yes IPADDR=192.168.8.201 NETMASK=255.255.255.0 GATEWAY=192.168.8.1 DNS1=8.8.8.8 DNS2=114.114.114.114
- 重啟網絡:
systemctl restart network
- 測試:
ip addr
三、修改系統時間:
- 更改系統時間:
date -s "2017-12-18 09:40:00"
- 寫入系統時間:
hwclock -w
四、修改主機名:
- 永久修改:
vi /etc/hostnamelee
- 臨時修改:
hostname lee
- 查看:
hostname
五、修改系統語言:
- 永久:
vi /etc/profile,添加export LANG="zh_CN.UTF-8" 或 export LANG="en_US.UTF-8"
- 臨時:
命令行下LANG="zh_CN.UTF-8"
六、別名設置:
- 添加:
alias ll=‘ls -lah --color‘
- 刪除:
unalias ll
centos7基本配置