代码同步环境部署

1.安装rsync

下载源码: wget https://download.samba.org/pub/rsync/rsync-3.1.1.tar.gz

解压,./configure ,make,make install

客户端:

1.touch /etc/rsyncd.conf

2.rsync --daemon

服务端:
1.在/etc/下创建三个文件
rsyncd.conf     rsyncd.motd     rsyncd.secrets 
2.配置文件
vi rsyncd.conf
motd file = /etc/rsyncd.motd #欢迎文件
read only = no
list = yes
uid = root
gid = root
hosts allow = 192.168.128.133
hosts deny =192.168.128.0/24
max connections = 2
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
#define dirctory for rsync
[test]
comment = nagios's directory from 192.168.128.133
path =/test
secrets file =/etc/rsyncd.secrets#密码文件
auth users = test #rsync用户(与linux里的用户无关)
read only = no
3.欢迎文件
[root@localhost test]# vi /etc/rsyncd.motd
Welcome to use the rsync services!
4.密码文件
[root@localhost test]#vi /etc/rsyncd.secrets
test:test
5.chmod 600 /etc/rsyncd.*
6.运行rsync
/usr/local/rsync/bin/rsync --daemon /etc/rsyncd.conf

安装salt

在Ubuntu下,按照官方的文档,是下面几个步骤

安装python-software-properties

sudo apt-get install python-software-properties

#添加saltstack的ppa

sudo add-apt-repository ppa:saltstack/salt

将saltstack apt 源写入 /etc/apt/sources.list.d/

echo deb http://ppa.launchpad.net/saltstack/salt/ubuntu `lsb_release -sc` main | sudo tee /etc/apt/sources.list.d/saltstack.list

下载key

wget -q -O- "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x4759FA960E27C0A6" | sudo apt-key add -

更新和安装

sudo apt-get update
sudo apt-get install salt-master

实际上,还有简单暴力的方法,直接把saltstack源写入/etc/apt/sources.list.d

echo deb http://ppa.launchpad.net/saltstack/salt/ubuntu `lsb_release -sc` main | sudo tee /etc/apt/sources.list.d/saltstack.list
sudo apt-get update
sudo apt-get install salt-master
配置:
配置minion:
vi /etc/salt/minion
配置master:
vi /etc/salt/master
master命令:
salt-keys -L 才能认得到 然后加入-a 如果修改过ID,最好把旧的删掉 -d
salt-key -D      //删除所有KEY
salt-key -d key  //删除单个key
salt-key -A      //接受所有KEY
salt-key -a key  //接受单个key
salt '*' test.ping
salt '*' cmd.run "ping www.baidu.com"
minion 命令:
salt-call test.ping


你可能感兴趣的:(服务器)