标签归档:mini

Centos7 虚拟机最小化安装

决定在腾讯云买学生机,反正才1元。不过,现在暂时还不买,等我这段时间毕设忙完了再买。学生机的系统决定用Centos7。但是自己很少用Centos,所以打算在自己的虚拟机上折腾下。所以昨晚临时下载了ISO,今天就先装上它把。


打开虚拟机,发现现在的安装都图形化了,简单很多了。根本就不用搜教程。

当然是选择英语了。

为了折腾到底,所以选择最小化安装。一切从零开始,慢慢折腾。


装完后,只有root用户。所以添加个用户。

useradd <username>创建用户

passwd <username>设置密码

为了在必要的时候能够使用root权限,就必须把用户加入wheel组。这样就可以使用sudo来获得root权限了。

gpasswd -a very9s wheel


/////////////////////////////////////////////////////////////////////

再来设置网络

虚拟机的网络选择NAT,在network editor中看看NAT的网关设置。

然后就是在网卡设置文件中添加网关地址,否则是联不了网的。

onboot=yes

重启下网络 service network restart

ip addr show检查下。

然后重启试了下yum~OK啦

关于网络设置的相关资料也顺便附上,我就是看着这个资料改网络设置的。

Theconfiguration files for network interfaces are located in the /etc/sysconfig/network-scripts/ directory

Although the number and type ofinterface files can differ from system to system, there are three categories offiles that exist in this directory:

  1. Interface configuration files
    
  2. Interface control scripts
    
  3. Network function files
    

The files in each ofthese categories work together to enable various network devices.

/etc/hosts

The main purpose of this file is to resolve hostnamesthat cannot be resolved any other way. It can also be used to resolve hostnameson small networks with no DNS server. Regardless of the type of network thecomputer is on, this file should contain a line specifying the IP address ofthe loopback device (127.0.0.1)as localhost.localdomain. For more information, refer tothe hosts man page.

/etc/resolv.conf

This file specifies the IP addresses of DNS servers andthe search domain. Unless configured to do otherwise, the networkinitialization scripts populate this file. For more information about thisfile, refer to the resolv.conf man page.

/etc/sysconfig/network

This file specifies routing and host information for allnetwork interfaces. For more information about this file and the directives itaccepts, refer to

Section 28.1.22, “/etc/sysconfig/network”

.

/etc/sysconfig/network-scripts/ifcfg-<interface-name>

For each network interface, there is a correspondinginterface configuration script. Each of these files provide informationspecific to a particular network interface. Refer to

Section 14.2, “Interface Configuration Files”

for more information on this typeof file and the directives it accepts.

来自 <

https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s1-networkscripts-files.html

>

以及设置参数资料

14.2.1. Ethernet Interfaces