English version:
Before doing this, you need to know something about vi and vim first.
1. Connect to the network.
vi /etc/sysconfig/network-scripts/ifcfg-enoxxxxxxxx
Change the item ONBOOT=yes, then save and reboot.
Attention, we choose NAT network connection here. If you choose Bridge, you need to configure the IP address and others manually. Later I will talk about this.
2. Install ifconfig command
yum search ifconfig, to find the package related to ifconfig which is net-tools.
yum install net-tools
3. Install vim
yum search vim, to find that the package we need to install is vim-X11 and vim-enhanced.
We can just use this command to install all the vim packages:
yum install -y vim*
4. Disable the alarm bell
4.1 The alarm in command line
vim /etc/inputrc
Delete the commont "#" before "set bell-style none", save and reboot.
4.2 The alarm in vi and vim
vim /etc/vimrc
Add "set vb t_vb = " at the end of file.
5. Connect to the Internet using Bridge
vim /etc/sysconfig/network-scripts/ifcfg-enoxxxxxxxx
Add or change the configuration below:
BOOTPROTO=static
IPADDR=xxx.xxx.xxx.xxx
NETMASK=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.xxx
DNS=xxx.xxx.xxx.xxx
If you have multiple DNS addresses, you can write:
DNS1=xxx.xxx.xxx
DNS2=xxx.xxx.xxx
Save and then restart the network service:
systemctl restart network
Chinese version
Before doing this, you need to know something about vi and vim first.
1. Connect to the network.
vi /etc/sysconfig/network-scripts/ifcfg-enoxxxxxxxx
Change the item ONBOOT=yes, then save and reboot.
Attention, we choose NAT network connection here. If you choose Bridge, you need to configure the IP address and others manually. Later I will talk about this.
2. Install ifconfig command
yum search ifconfig, to find the package related to ifconfig which is net-tools.
yum install net-tools
3. Install vim
yum search vim, to find that the package we need to install is vim-X11 and vim-enhanced.
We can just use this command to install all the vim packages:
yum install -y vim*
4. Disable the alarm bell
4.1 The alarm in command line
vim /etc/inputrc
Delete the commont "#" before "set bell-style none", save and reboot.
4.2 The alarm in vi and vim
vim /etc/vimrc
Add "set vb t_vb = " at the end of file.
5. Connect to the Internet using Bridge
vim /etc/sysconfig/network-scripts/ifcfg-enoxxxxxxxx
Add or change the configuration below:
BOOTPROTO=static
IPADDR=xxx.xxx.xxx.xxx
NETMASK=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.xxx
DNS=xxx.xxx.xxx.xxx
If you have multiple DNS addresses, you can write:
DNS1=xxx.xxx.xxx
DNS2=xxx.xxx.xxx
Save and then restart the network service:
systemctl restart network
Chinese version
在这之前,你要清楚vi、vim最基本的编辑命令。
1、连接网络
vi
/etc/sysconfig/network-scripts/ifcfg-enoxxxxxxxx
把最后一项的ONBOOT
= yes,保存。
然后重启,注意,这里的网络连接方式选择为NAT,如果选择为Bridge模式,需要手动配置ip地址,后面会讲到如何配置。
2、安装ifconfig等相关命令
yum search ifconfig,找到需要安装的软件包是net-tools。
yum install net-tools
3、安装vim
yum search vim,找到要安装的软件包,安装vim-X11,vim-enhanced。
用下面命令一步到位:
yum install –y vim*
vim是一个很强大的编辑器,可以给vim加上很多个性化的自定义功能及按键,同时有很多很强大的插件可以使用,有兴趣的可以了解一下vim的配置。
4、删除讨厌的警告音
4.1 按Tab键总是有讨厌的警告音,修改以下文件:
vim /etc/inputrc
将第二行“#set
bell-style none”前面的注释“#”去掉,保存,重启之后生效。
4.2 vi、vim中讨厌的警告音
vim /etc/vimrc
在文件最后添加配置“set
vb t_vb = ”
5、修改系统时间
CentOS系统默认的系统时区是美国时区,我们把改成中国时区:
cp
/usr/share/zoneinfo/Asia/Shanghai /etc/localtime
6、使用Bridge模式上网,使得外网的电脑能ping通本机
vim
/etc/sysconfig/network-scripts/ifcfg-enoxxxxxxxx
改变或增加以下配置:
BOOTPROTO=static
IPADDR=xxx.xxx.xxx.xxx #你需要设置的静态ip地址
NETMASK=xxx.xxx.xxx.xxx # 子网掩码
GATEWAY=XXX.XXX.XXX.xxx # 网关
DNS=XXX.XXX.XXX.XXX # DNS地址
如果有多个DNS地址,可以写成:
DNS1=xxx.xxx.xxx.xxx
DNS2=xxx.xxx.xxx.xxx
保存。然后重启网络服务:
systemctl restart network
7、自己的电脑,为了省事,直接关闭了防火墙:
systemctl stop firewalld
关闭开机启动:systemctl disable firewalld
没有评论:
发表评论