图形配置方法请看上篇文章
1, 实验环境:
一台主机物理主机两台虚拟机.
物理主机的 ip:192.168.9.6/24 gw:192.168.9.254 dns:8.8.8.8
一台虚拟机 (server) 网卡类型为自动桥接: ip:192.168.9.4/24 gw:192.168.9.254 dns 不用配置, 装 ipa-server 会自动配置
一台虚拟机 (client) 网卡类型为自动桥接: ip:192.168.9.5/24 gw:192.168.9.254 dns:192.168.9.4
2,IPA-server 服务安装前条件:
1, 必须要有完整的主机名
2, 一个静态的 ip 地址
3, 能够对主机名做解析(正向和反向解析)
4,hosts 文件也要对主机名做解析. 不能解析到 127.1
5, 开通防火墙规则和服务
6, 做时间 ntp 同步
3, 步骤
1, 设置主机名
- [root@localhost ~]# hostnamectl set-hostname server.zhuxu.vip```
- [root@localhost ~]# hostname server.zhuxu.vip
, 一个静态的 ip 地址上面准备工作已经完成
, 能够对主机名做解析(正向和反向解析) 装 ipa-server 会自动配置
,hosts 文件也要对主机名做解析. 不能解析到 127.1
[root@server ~]# vim /etc/hosts
添加 192.168.9.4 server.zhuxu.vip
5, 开通防火墙规则和服务
- TCP Ports:
- * 80, 443: HTTP/HTTPS
- * 389, 636: LDAP/LDAPS
- * 88, 464: kerberos
- * 53: bind
- UDP Ports:
- * 88, 464: kerberos
- * 53: bind
- * 123: ntp
- [root@server ~]# iptables -F 清除 iptables 规则
- [root@server ~]# systemctl stop iptables 停止 iptables 服务
- [root@server ~]# systemctl disable iptables 禁止 iptables 开机启动
开放相应的端口
- [root@client ~]# firewall-cmd --permanent
- --add-port={80/tcp,443/tcp,389/tcp,636/tcp,88/tcp,464/tcp,53/tcp,88/udp,464/udp,53/udp,123/udp}
放行 http https ldap ldaps kerberos dns ntp
[root@server ~]# firewall-cmd --permanent --add-service={http,https,ldap,ldaps,kerberos,dns,ntp}
放行 tcp 的 7389 端口
[root@server ~]# firewall-cmd --permanent --add-port=7389/tcp
重新加载 firewalld
[root@server ~]# firewall-cmd --reload
我已经查过了, 这些端口都是 selinux 的安全端口, 不需要开放安全端口.
[root@server ~]# semanage port -l -- 来查看 selinux 开放的安全端口
6,vim /etc/chrony.conf 注释前三个时间服务, 编辑最后一个为: server ntp1.aliyun.com iburst
[root@server ~]#systemctl restart chronyd.service 重启时间服务
7, 配置好 yum 源, 我这选择挂载光盘来做 yum 仓库.
[root@server ~]# vim /etc/yum.repos.d/server.repo
在文件中输入以下内容
- [base]
- name=redhat7
- baseurl=file:///mnt
- enabled=1
- gpgcheck=0
挂载光盘到 / mnt 下(请确保光盘是连接状况)
[root@server ~]# mount /dev/cdrom /mnt
服务器端安装条件准备好了:
## 4, 安装 ipa-server
ipa-server 依赖于 dns 服务才能工作, 我们要装的包有: ipa-server bind bind-dyndb-ldap ipa-server-dns
bind 是提供 dns 服务, bind-dyndb-ldap 是提供 dns 和 ldap 连接组件等,
ipa-server-dns 提供了 ipa-server 与 dns 连接组件等(根据安装系统时候选的包不同, 这个包有可能装过了)
[root@server ~]# yum install -y ipa-server bind bind-dyndb-ldap ipa-server-dns
- [root@server ~]# systemctl enable sssd -- 开机自启动 sssd 服务(sssd:system security service deamon 系统安全服务)
- [root@server ~]# systemctl start sssd -- 开启 sssd 服务(可能默认已经开启了)
- [root@server ~]# authconfig --enablemkhomedir --update 创建的用户, 默认创建用户家目录, 更新认证信息
- [root@server ~]# kinit admin --- 必须要登陆 admin 才能管理域
- Password for admin@ZHUXU.VIP:
- [root@server ~]# ipa user-find --all 查看所有域用户的信息
- 1 user matched
- dn: uid=admin,cn=users,cn=accounts,dc=zhuxu,dc=vip
- User login: admin
- ....
- Number of entries returned 1
- [root@server ~]# dig -t a server.zhuxu.vip 查看 server.zhuxu.vip 的 A 记录
- [root@server ~]# dig -t ptr 4.9.168.192.in-addr.apra 查看 server.zhuxu.vip 的 PTR 记录
- Password:
- Enter Password again to verify:
- ipa: ERROR: The host was added but the DNS update failed with:
- DNS reverse zone 168.192.in-addr.arpa. for IP address 192.168.9.5 is not managed by this server
- [root@localhost ~]# hostnamectl set-hostname client.zhuxu.vip
- [root@localhost ~]# hostname client.zhuxu.vip
- 2,```
- TCP Ports:
- * 80, 443: HTTP/HTTPS
- * 389, 636: LDAP/LDAPS
- * 88, 464: kerberos
- * 53: bind
- UDP Ports:
- * 88, 464: kerberos
- * 53: bind
- * 123: ntp
- [root@client ~]# firewall-cmd --permanent --add-port={80/tcp,443/tcp,389/tcp,636/tcp,88/tcp,464/tcp,53/tcp,88/udp,464/udp,53/udp,123/udp}
- [root@server ~]# iptables -F 清除 iptables 规则
- [root@server ~]# systemctl stop iptables 停止 iptables 服务
- [root@server ~]# systemctl disable iptables 禁止 iptables 开机启动
- [base]
- name=redhat7
- baseurl=file:///mnt
- enabled=1
- gpgcheck=0
- [root@server ~]# mount /dev/cdrom /mnt
- ## 2, 配置客户端
- ### 2.1, 下载客户工具
- [root@client ~]# yum install -y ipa-client
- ### 2.2, 加入域
- root@client ~]# ipa-client-install --domain=zhuxu.vip --no-ntp --realm=ZHUXU.VIP --mkhomedir 加入域, 不启用 ntp, 创建用户时自动创建家目录
- ### 2.3 验证用户能否登录
- [root@client ~]# ssh tom@client.zhuxu.vip
- Password:
- Current Password:
- New password:
- Retype new password:
来源: http://www.bubuko.com/infodetail-2703439.html