CentOS最小化安装后初始化
网络
ifconfig
1 | yum install net-tools -y |
Set Static IP Addresses
配置地址:/etc/sysconfig/network-scripts/ifcfg-ens192
默认网卡设置:
1 | TYPE=Ethernet |
修改成静态地址:
1 |
其中参数的一些说明:
BOOTPROTO=
where is one of the following:
- none — No boot-time protocol should be used.
- bootp — The BOOTP protocol should be used.
- dhcp — The DHCP protocol should be used.
IPADDR=
where is the IP address.
DEVICE=where is the name of the physical device.
DNS{1,2}= where is a name server address to be placed in /etc/resolv.conf
GATEWAY= where is the IP address of the network router
MACADDR=Where is the hardware address of the Ethernet device in the form AA:BB:CC:DD:EE:F
NETMASK=Where is the netmask value.
ONBOOT=Where is one of the following:
- yes — This device should be activated at boot-time.
- no — This device should not be activated at boot-time.
PEERDNS=Where is one of the following: - yes – Modify /etc/resolv.conf if the DNS directive is set. If using DHCP, then yes is the default.
- no – Do not modify /etc/resolv.conf.
USERCTL=where is one of the following: - yes – Non-root users are allowed to control this device.
- no – Non-root users are not allowed to control this device.
主机名称
修改以下两个文件:
- /etc/hostname
- /etc/hosts
Utilities
Oh-my-bash
需要先安装Git:
1 | yum install git -y |
然后安装on-my-bash:
1 | bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)" |
EPEL
安装epel:
1 | yum install epel-release -y |
Source List
修改镜像为上海交大镜像:
1 | sed -e 's/mirrorlist/#mirrorlist/g' -e 's|#baseurl=http://mirror.centos.org/|baseurl=http://mirror.sjtu.edu.cn/|g' -i.bak /etc/yum.repos.d/CentOS-Stream-BaseOS.repo |
转载请注明出处:CentOS最小化安装后初始化
原文地址:https://www.xiaotanzhu.com/linux/2022-12-17-centos-8-initialization.html