Linux设置/更改主机名方法

Kevin 教程 947 次浏览 36条评论

为方便管理,避免平时不小心弄错操作机器,有必要设置个性化的主机名称。可以根据服务器用途设置,由单个单词或短语组成。开通VPS过程中通常商家会提供设置选项。如果之前没有设置或想修改主机名,请参考下文方法,设置后使用hostname命令确认是否成功。

CentOS / Ubuntu / Debian / Fedora / Arch Linux 设置主机名

hostnamectl set-hostname <主机名>

Ubuntu 14.04 / Debian 7 设置主机名

echo "主机名" > /etc/hostname
hostname -F /etc/hostname

CentOS 6 设置主机名

echo "HOSTNAME=主机名" >> /etc/sysconfig/network
hostname "主机名"

更新 Hosts 设置

设置主机名后需额外更新下/etc/hosts文件,修改里面与本机IP绑定的主机名,例如:

127.0.0.1       localhost localhost.localdomain
::1     localhost localhost.localdomain
1.1.1.1  hostname

评论列表

  1. #1

    michigan governor wants hydroxychloroquine https://hydroxychloroquine.webbfenix.com/

  2. #2

    vidalista 60 mg side effects https://vidalista.mlsmalta.com/

  3. #3

    100 mg clomid success rate https://salemeds24.wixsite.com/clomid

  4. #4

    ivermectin at walgreens https://ivermectin.webbfenix.com/

  5. #5

    cialis with dapoxetine 60mg https://salemeds24.wixsite.com/dapoxetine

  6. #6

    is viagra safe to use http://droga5.net/

  7. #7

    hydroxychloroquine vs chloroquine phosphate https://hydroxychloroquine.mlsmalta.com/

  8. #8

    ivermectin human dose chart https://ivermectin.mlsmalta.com/

  9. #9

    dapoxetine without a doctor prescription fast https://dapoxetine.confrancisyalgomas.com/

  10. #10

    average price of vidalista https://vidalista40mg.mlsmalta.com/

  11. #11

    priligy 60 mg daily use https://ddapoxetine.com/

  12. #12

    low dose tamoxifen 5 mg https://tamoxifen.mrdgeography.com/

  13. #13

    80 mg tadalafil https://wisig.org/

  14. #14

    how to get a prescription online https://edmeds.buszcentrum.com/

  15. #15

    latest on hydroxychloroquine treatment https://hydroxychloroquinee.com/

  16. #16

    doxycycline hyclate for ear infections http://doxycycline.zolftgenwell.org/

  17. #17

    cialis generic medication https://atadalafil.online/

  18. #18

    cialis generic medication https://tadfil.online/

  19. #19

    does amoxicillin work on women https://amoxycillin1st.com/

  20. #20

    ivermectin tablets for humans http://ivermmectin.co/

  21. #21

    I intended to compose you a bit of note in order to give many thanks again about the amazing advice you’ve contributed above. It’s generous of people like you giving easily all a few individuals could have advertised as an e-book in making some bucks for their own end, and in particular considering that you could have done it if you considered necessary. The advice additionally acted as a easy way to be aware that many people have a similar desire just as mine to figure out a good deal more around this condition. Certainly there are a lot more enjoyable instances ahead for folks who browse through your blog. https://nujemznuedi.online/

  22. #22

    Thanks for your own work on this website. Ellie enjoys doing internet research and it’s easy to see why. All of us hear all concerning the compelling means you deliver good information by means of the blog and as well cause contribution from other people about this concept plus my daughter is actually being taught a lot. Enjoy the remaining portion of the new year. You’re the one carrying out a first class job. https://joneslawncarela.com/

  23. #23

    I am glad for writing to make you know what a nice encounter my wife’s girl had studying your web site. She mastered several pieces, which include what it’s like to possess an awesome helping nature to let other individuals very easily know precisely some problematic subject matter. You truly exceeded people’s expectations. Thank you for presenting these powerful, trusted, informative and in addition fun tips about this topic to Kate. https://hillsdaledowcenter.com/

  24. #24

    I precisely had to appreciate you all over again. I’m not certain the things I might have done in the absence of the actual information documented by you directly on such field. It became a real distressing crisis for me personally, but encountering a new professional form you managed it forced me to jump for delight. I’m just happier for the guidance and even have high hopes you realize what an amazing job you have been providing teaching some other people using your web site. Most likely you haven’t got to know any of us. https://abilifyaripiprazoles.com/

  25. #25

    I am glad for writing to make you know what a magnificent encounter my friend’s girl gained studying your web site. She learned several pieces, which include what it’s like to possess an awesome helping nature to let other folks very easily know just exactly several multifaceted subject matter. You truly exceeded people’s expectations. Thank you for presenting these powerful, safe, explanatory and in addition fun tips about this topic to Kate. https://luvoxfluvoxamine.com/

  26. #26

    cialis trial voucher http://cialllis.com/

  27. #27

    I simply wished to thank you very much yet again. I do not know what I would have worked on without those tricks shown by you relating to this topic. This has been the troublesome situation in my view, nevertheless witnessing your well-written way you treated the issue took me to weep with joy. Now i am thankful for your work as well as wish you recognize what an amazing job your are undertaking training the rest with the aid of your websites. Probably you haven’t met any of us. https://sinequandoxepin.com/#

  28. #28

    Thanks for the tips about credit repair on this blog. Things i would advice people would be to give up the actual mentality that they’ll buy right now and pay out later. Like a society all of us tend to do that for many things. This includes holidays, furniture, as well as items we would like. However, you have to separate your own wants from all the needs. When you are working to improve your credit rating score make some sacrifices. For example you are able to shop online to save money or you can turn to second hand shops instead of costly department stores with regard to clothing. https://zyprexaolanzapine.com/#

  29. #29

    Thanks for the useful information on credit repair on your web-site. The thing I would offer as advice to people will be to give up a mentality they will buy at this moment and pay back later. As being a society most people tend to repeat this for many factors. This includes family vacations, furniture, plus items we really want to have. However, you must separate a person’s wants from the needs. When you’re working to fix your credit score you really have to make some trade-offs. For example you possibly can shop online to economize or you can click on second hand suppliers instead of highly-priced department stores to get clothing. https://zyprexaolanzapine.com/#

  30. #30

    how much sildenafil is safe https://viaplz.com/

  31. #31

    viagra online no prescription http://viaaagra.com/

  32. #32

    hydroxychloroquine sulfate 300 mg https://hhydroxychloroquine.com/

  33. #33

    tadalafil 60 mg generic india https://cialis.advantagetriseal.com/

  34. #34

    tadalafil 60 mg generic india https://cialis.mlsmalta.com/

  35. #35

    stromectol 3mg tablets https://ivermectin1st.com/

  36. #36

    Hi there very nice web site!! Man .. Beautiful .. Superb .. I will bookmark your blog and take the feeds additionallyKI’m satisfied to search out numerous helpful information here in the submit, we want work out more techniques in this regard, thank you for sharing. . . . . .

    http://www.vreyrolinomit.com/

发表评论

电邮地址用于 Gravatar 头像显示,不会被公开可见。