设为首页 收藏本站
查看: 895|回复: 0

[经验分享] How to change the HostName of Mac OS/X Server

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-12-30 10:04:54 | 显示全部楼层 |阅读模式
I have used "hostname -s <name>" to change the hostname of server, but the settings are lost after reboot. And I have checked the link from Apple Support:http://docs.info.apple.com/article.html?artnum=303697.
Here I have some way to fix this requirement, please refer to:
This would have several implications, especially if the server is an Open Directory Master.
Generally, I recommend setting the hostname with scutil or hostname, but I also suggest checking /etc/hostconfig for errors. Specifically, you're looking for:
HOSTNAME=-AUTOMATIC- or no entry for HOSTNAME at all.
In 10.4 Server, you can change that to HOSTNAME= specific name, but I don't recommend that for 10.5.
Essentially what happens upon startup is the server does a reverse lookup (address-to-name) by querying its PTR record in your DNS zone. So the first things to check would be:
1. Is your server using the correct DNS name server?
2. Does the server have both a valid A and PTR record?
But if you changed your server's hostname or IP address, you need to update the entries in its shared LDAP directory and Kerberos realm if it's also an Open Directory Master:
1. Update the LDAP directory: Use slapconfig -changeip like this:
sudo slapconfig -changeip old IP new IP old hostname new hostname
If the IP didn't change, enter it twice. Now your LDAP directory knows about the new hostname.
2. You'll also have to update your Kerberos configuration if the realm changed. By default, the Kerberos realm is the server's hostname in uppsercase. An example would be HOSTNAME.DOMAIN.EXTENSION.
Perhaps the easiest way to do this would be to destroy and recreate the Kerberos realm:
a. First, stop all services, and use sso_util to "de-Kerberize" all services, destroying the Kerberos realm:
sudo sso_util remove -r server's old REALM -k -a diradmin
The -a switch attempts to destroy the realm. If that fails, you'll need to remove the /Local/Default/Config/KerberosKDC and /Local/Default/Config/KerberosClient records in your server's local LDAP domain (10.5). For 10.4, those paths are /NetInfo/Config/ instead of /Local/Default/Config.
b. Re-Kerberize your server. I've got a pretty good response with how-to here:
http://discussions.apple.com/message.jspa?messageID=5917575#5917575
Have you tried setting the hostname manually with scutil command like these examples:
sudo scutil --set HostName full DNS name
mbp105svrx86v16:~ root# scutil --set HostName mbp105svrx86v16.local
I suggest using scutil, because that informs the hostname BSD command of changes; it doesn't work the other way around!
When the name is set by scutil, the hostname is stored in /Library/Preferences/SystemConfiguration/preferences.plist:
defaults read /Library/Preferences/SystemConfiguration/preferences System
mbp105svrx86v16:~ root# defaults read /Library/Preferences/SystemConfiguration/preferences System
{
    Network =     {
        HostNames =         {
            LocalHostName = mbp105svrx86v16;
        };
    };
    System =     {
        ComputerName = mbp105svrx86v16;
        ComputerNameEncoding = 0;
        HostName = "mbp105svrx86v16.local";
    };
}
mbp105svrx86v16:~ root#
As you know, starting with 10.4.6, /etc/hostconfig should have the HOSTNAME variable set to -AUTOMATIC-. In 10.5, as you've noticed, there doesn't need to be any HOSTNAME variable, because /etc/hostconfig is going away anyway.
Normally, the automatic PTR to IP lookup is done by servermgrd if a hostname is not set. See http://docs.info.apple.com/article.html?artnum=303697 for more.

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-158221-1-1.html 上篇帖子: ios下编译ffmpeg:Mac OS X 10.9.2 + XCode 5.1 + iOS7.1 + ffmpeg 2.1 下篇帖子: Mac OS X Common Lisp环境配置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表