当前位置: 首页 > Linux

Linux的Centos使用笔记记录

时间:2023-04-06 07:09:05 Linux

renameModifycentos6[root@centos6~]$hostname#查看当前主机nmaecentos6[root@centos6~]$vim/etc/sysconfig/network#编辑网络文件修改hostname行(重启生效)[root@centos6~]$cat/etc/sysconfig/network#检查并修改NETWORKING=yesHOSTNAME=centos6[root@centos6~]$hostnamecentos6#设置当前主机名(立即生效)[root@centos6~]$vim/etc/hosts#编辑hosts文件,给127.0.0.1addhostname[root@centos6~]$cat/etc/hosts#查看127.0.0.1localhostlocalhost.localdomainlocalhost4localhost4.localdomain4centos6::1localhostlocalhost.localdomainlocalhost6localhost6.localdomain6centos7[root@centos7~]$hostnamectlset-hostnamecentos7#使用这个命令会立即生效,重启也会生效[root@centos7~]$hostname#查看centos7[root@centos7~]$vim/etc/hosts#编辑hosts文件,添加hostname[root@centos7~]$到127.0.0.1cat/etc/hosts#查看127.0.0.1localhostlocalhost.localdomainlocalhost4localhost4.localdomain4centos7::1localhostlocalhost.localdomainlocalhost6localhost6.localdomain6