sh 最小化安装CentOS 6.9之后的必要设置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 最小化安装CentOS 6.9之后的必要设置相关的知识,希望对你有一定的参考价值。

# Part 1: network
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.ori
sed -i 's/ONBOOT=no/ONBOOT=yes/; s/BOOTPROTO=dhcp/BOOTPROTO=none/' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i '$a IPADDR=192.168.6.240\nPREFIX=24\nGATEWAY=192.168.6.1' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i '$a DNS1=223.5.5.5\nDNS2=119.29.29.29' /etc/sysconfig/network-scripts/ifcfg-eth0
ifdown eth0 && ifup eth0

# If you use a VMware cloned virtual machine, you'll see an error:
# `Device eth0 does not seem to be present, delaying initialization.`, you can change DEVICE name and HWADDR to solve it.
cat /etc/udev/rules.d/70-persistent-net.rules
# The output contains a field like `ATTR{address}="00:11:22:33:44:55"` is HWADDR,
# but there are more than one HWADDR, you need to find the right one by comparing with MAC from VMware settings.
# The output contains a filed like `NAME="eth1"` is DEVICE name
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
sed -i 's/^DEVICE.*$/DEVICE=eth1; s/^HWADDR.*$/HWADDR=00:11:22:33:44:55/' /etc/sysconfig/network-scripts/ifcfg-eth1
ifdown eth1 && ifup eth1

# If your VM's NIC has been set to NAT mode, you just need below 2 lines:
sed -i 's/ONBOOT=no/ONBOOT=yes/' /etc/sysconfig/network-scripts/ifcfg-eth0
ifdown eth0 && ifup eth0

# Part 2: yum repo
# change default repo from centos.org to 163.com (for Chinese user ONLY)
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.ori
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum update -y

# Part 3: essential packages
yum groupinstall "Base" "Compatibility libraries" "Development tools" "Debugging Tools"
yum install tree telnet dos2unix sysstat lrzsz nc nmap -y

以上是关于sh 最小化安装CentOS 6.9之后的必要设置的主要内容,如果未能解决你的问题,请参考以下文章

VMware安装CentOS之三——CentOS网络设置及软件安装

centos-610最小安装之后 后续设置

CentOS 6.9安装jdk1.8

CentOS 6.9下安装PostgreSQL

虚拟机上CentOS-6.9-x86_64系统安装教程

centos 6.9安装jira 7.2.6