CentOS Linux 7 安装笔记

快速记录下自己在虚拟机安装CentOS Linux 7.6 的过程,仅供参考。

1. 网络设置

Network Management TUI: nmtui

2. 禁用Firewall
systemctl stop firewalld
systemctl disable firewalld
3. 配置本地Yum
mkdir /mnt/iso
mount -o loop /dev/cdrom /mnt/iso/    #write into /etc/rc.local
#Then move all Repos to /etc/yum.repos.d/back
cat /etc/yum.repos.d/local.repo
[local-yum]
name=Local Repository
baseurl=file:///mnt/iso
enable=1
gpgcheck=0

yum clean all
yum list

通过 yum install vim 验证

4. 配置NIS (服务端)

参考链接:https://blog.csdn.net/younger_china/article/details/53130780
域名:carcar
NIS Server 主机名:car-mgmt

yum install yp-tools ypbind ypserv rpcbind
echo "NISDOMAIN=carcar" >> /etc/sysconfig/network
nisdomainname carcar #temp method
#Then add all NIS domain IP address to /etc/hosts

启动服务,“yppasswdd” 是用于启用密码变更

systemctl start ypserv
systemctl start rpcbind
systemctl start yppasswdd

启用服务

systemctl enable ypserv
systemctl enable rpcbind
systemctl enable yppasswdd

创建测试账号 user1

useradd user1

初始化 NIS map

/usr/lib64/yp/ypinit -m
control + D
y

每次有新用户创建,都需要执行如下命令,来再编译 NIS 数据库

make -C /var/yp
5. 配置 NIS (客户端)
yum install yp-tools ypbind
echo "NISDOMAIN=carcar" >> /etc/sysconfig/network
nisdomainname carcar    #temp method
#Add all NIS domain IP address to /etc/hosts

修改配置文件 /etc/nsswitch.conf

…
passwd:    files nis sss
shadow:    files nis sss
group:     files nis sss
…
hosts:      files nis dns
…

添加NIS Server

echo "domain carcar server car-mgmt" >> /etc/yp.conf
echo "ypserver car-mgmt" >> /etc/yp.conf
grep NIS /etc/sysconfig/authconfig
USENIS=yes

添加 NIS 到 PAM认证, /etc/pam.d/system-auth

password    sufficient    pam_unix.so sha512 shadow nis nullok try_first_pass use_authtok

启动/启用服务,仅rpcbind和ypbind

systemctl start rpcbind
systemctl start ypbind
systemctl enable rpcbind
systemctl enable ypbind

验证NIS Server正常

yptest
ypwhich
ypwhich -x
ypcat -k passwd
6. 配置 NFS (服务端)

参考链接 https://qizhanming.com/blog/2018/08/08/how-to-install-nfs-on-centos-7

yum install nfs-utils
systemctl enable rpcbind
systemctl enable nfs
systemctl start rpcbind
systemctl start nfs

NFS要提供的路径比如叫 /export

mkdir /export
chmod 755 /export
echo "/export  192.168.1.0/24(rw,sync,no_root_squash,no_all_squash)" >>/etc/exports

服务端本地验证

showmount -e localhost
7. 配置 NFS (客户端)
yum install nfs-utils
systemctl enable rpcbind
systemctl start rpcbind

通过服务端IP地址或域名验证

showmount -e 192.168.1.4

创建本地要挂在NFS共享的挂载点(也可以不叫/export)

mkdir /export
mount -t nfs 192.168.1.4:/export /export   #(or...not, see next)
8. 配置NFS自动挂载 auto-NFS ( 在NFS客户端 )

参考链接:https://www.linuxtechi.com/automount-nfs-share-in-linux-using-autofs/
参考链接:https://linux.die.net/man/5/auto.master

yum install autofs
echo "/export /etc/auto.nfs -rw,intr" >>/etc/auto.master
echo "* -fstype=nfs,rw,hard,intr 192.168.1.4:/export/&" >>/etc/auto.nfs
systemctl start autofs
systemctl enable autofs
cd /export/apps   #"apps" or any folder within /export@192.168.1.4
9. 配置root用户的ssh无密码登录

在每个节点执行,生成公钥和私钥

ssh-keygen -t rsa   (with all default)   

在某一个节点例如login1上生成一个授权文件

cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys

除login1外其他节点执行,公钥会自动追加写入login1的授权文件

ssh-copy-id -i login1
chmod 600 authorized_keys

从login1分发整合后的公钥文件到每个节点

scp authorized_keys n01:/root/.ssh/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值