1.服务器:
192.168.9.106 admin
192.168.9.107 node1
192.168.9.108 node2
2.创建deph账号并赋予sudo权限:(3台)
创建账号
[[email protected] ~]# mkdir /app/userhome -p
[[email protected] ~]# useradd -d /app/userhome/deph deph
[[email protected] ~]# passwd deph
赋予sudo权限
[[email protected] ~]# echo "deph ALL = (root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/deph
[[email protected] ~]# sudo chmod 0440 /etc/sudoers.d/deph
修改sudo配置文件
#此处有一个小坑,使用不同账户,执行执行脚本时候sudo经常会碰到 sudo: sorry, you must have a tty to run sudo这个情况,其实修改一下sudo的配置就好了,用vi /etc/sudoers (最好用visudo命令),注释掉 Default requiretty 一行
[[email protected] ~]# visudo
#Default requiretty
3.建立admin主机和node节点的信任
#创建秘钥
[[email protected] ~]# su - deph
[[email protected] ~]$ ssh-keygen
#分发公钥
[[email protected] ~]$ ssh-copy-id [email protected]
[[email protected] ~]$ ssh-copy-id [email protected]
#修改 管理节点的~/.ssh/config文件,ceph-deploy以便ceph-deploy能够以您创建的用户身份登录Ceph节点
[[email protected] ~]$ vim .ssh/config
Host admin
Hostname admin
User deph
Host node1
Hostname node1
User deph
Host node2
Hostname node2
User deph
#修改权限
[[email protected] ~]$ cd .ssh/
[[email protected] .ssh]$ chmod 600 config
#测试登录ssh
[[email protected] ~]$ ssh node1
[[email protected] ~]$ exit
logout
Connection to node1 closed.
[[email protected] ~]$ ssh node2
[[email protected] ~]$ exit
logout
Connection to node2 closed
4.修改repo文件
#移动原repo文件
[[email protected] ~]$ exit
[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# mkdir source
[[email protected] yum.repos.d]# mv C* source/
[[email protected] yum.repos.d]# mv e* source/
#修改yum源,官网的yum源可能会很慢,下载aliyun源
[[email protected] yum.repos.d]# curl http://mirrors.aliyun.com/repo/Centos-7.repo >/etc/yum.repos.d/CentOS-Base.repo
[[email protected] yum.repos.d]# curl http://mirrors.aliyun.com/repo/epel-7.repo >/etc/yum.repos.d/epel.repo
[[email protected] yum.repos.d]# sed -i ‘/aliyuncs/d‘ /etc/yum.repos.d/CentOS-Base.repo
[[email protected] yum.repos.d]# sed -i ‘/aliyuncs/d‘ /etc/yum.repos.d/epel.repo
[[email protected] yum.repos.d]# yum makecache
原文地址:http://blog.51cto.com/13893093/2306858
时间: 2024-10-12 12:02:31