首页 > 系统相关 >4、linux设置主机名

4、linux设置主机名

时间:2024-02-01 09:45:02浏览次数:39  
标签:hostname 主机名 etc hosts 设置 linux localhost

linux设置主机名

1、查看主机名

hostname

默认:localhost.localdomain

2、更改主机名

编辑/etc/hostname,修改成自己需要的主机名

vi /etc/hostname

3、设置hosts

编辑/etc/hosts,将修改的主机名增加一个映射

vi /etc/hosts

/etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1   appserver

重新加载hosts

systemctl restart network.service

4、重启

reboot

标签:hostname,主机名,etc,hosts,设置,linux,localhost
From: https://www.cnblogs.com/lgxdev/p/18000570

相关文章

  • Linux下查询CPU,内存,磁盘及操作系统
    查询CPU核数nproc结果为4查询内存free-h#以人类(human)可读的方式展示结果为totalusedfreesharedbuff/cacheavailableMem:15Gi2.2Gi327Mi1.0Mi13Gi13GiSwap:......
  • Lazarus windows远程交叉调试Linux
    一、在目标机上安装gdbserver服务。运行gdbserver:2345你要调试的程序二、编译gdb(重点)1、下载gdb源,下载msys2-x86_64-20220118.exe。2、安装msys23、到Msys2安装目录下运行mingw64.exe4、安装以下包pacman-Syupacman-Smingw-w64-x86_64-toolchainpacman-Stexinfo......
  • linux内核-3.Linux 内核启动流程
    1链接脚本vmlinux.lds先编译一下Linux源码,因为有很多文件是需要编译才会生成的。首先分析Linux内核的连接脚本文件arch/arm/kernel/vmlinux.lds,通过链接脚本可以找到Linux内核的第一行程序是从哪里执行的。vmlinux.lds中有如下代码:492OUTPUT_ARCH(arm)493ENTRY(ste......
  • [office] excel表格锁定单元格不滚动的设置方法
    excel表格锁定单元格不滚动的设置方法1.打开需要修改的表格,在表格主页面中找到上方视图选项,点击该选项进入视图页面。2.在视图页面中找到冻结窗格选项,点击该选项进入至冻结窗格页面中。3.在冻结窗格页面中找到冻结首行选项即可固定该表格中的首行单元格。4.在冻结窗格页面中找到冻......
  • QCN9024 QCN9074|Step by Step to load driver for DR9074-Triband on linux 5.17.0
    LoadingDR9074-TribandDriveronLinux5.17.0withATH11KSupportWallysrecentlyannouncedATH11KsupportforDR9074-TRIBANDonLinux,expandingitscompatibilitybeyondQualcommplatformstovariousLinuxembeddedsystems,includingUbuntu.Inthisartic......
  • linux之socket编程
    linux之socket编程源IP地址与目的IP地址任何主机想要进行网络通信,首先就要拥有IP地址!因为每台主机都有网络地址就注定了有——源IP与目的IP消息从哪里发送——发送主机的IP就是源IP消息要到哪里——接收消息的主机的IP就是目的IP!在IP报头里面就包含了源IP与目的IP端口号......
  • 3、linux配置静态ip
    linux配置静态ip1、找到ifcfg-ens*网络配置文件使用root用户编辑ifcfg-ens192文件,每个版本的可能后缀有点不一样cd/etc/sysconfig/network-scripts/viifcfg-ens1922、配置ifcfg-ens*更改的配置项为:更改为静态ip:BOOTPROTO=static(修改)开机启动:ONBOOT=yes(修改)配置本机......
  • 2、linux增加域名代替ip
    linux增加域名代替ip1、查看当前的域名配置列表cat/etc/hosts2、配置域名vi/etc/hosts/etc/hosts:192.168.0.10为当前服务器ip192.168.0.20为配置其他服务ip127.0.0.1localhostlocalhost.localdomainlocalhost4localhost4.localdomain4::1localhostl......
  • Matplotlib绘图设置中文字体
    importmatplotlibimportmatplotlib.pyplotaspltmatplotlib.font_manager.fontManager.addfont("/home/lixg/.fonts/msyh.ttf")#查看字体名以及对应的字体文件名#forfontinfont_manager.fontManager.ttflist:#print(font.name,'-',font.fname)plt.r......
  • Linux 中 mkdir -p选项
     001、测试1[root@pc1test1]#ls[root@pc1test1]#mkdira/b/c##mkdir创建连续目录,失败mkdir:cannotcreatedirectory‘a/b/c’:Nosuchfileordirectory[root@pc1test1]#ls[root@pc1test1]#mkdir-pa/b/c##增加-p选项,表示传递......