centos8環境安裝配置rsync

2022-06-28 21:33:14 字數 3438 閱讀 7098

[root@localhost lib]# cat /etc/redhat-release 

centos linux release 8.1.1911 (core)

對應的原始碼可以訪問這裡獲取: 

[root@localhost source]# rpm -qa | grep

rsync

rsync-3.1.3-6.el8.x86_64

[root@localhost yum.repos.d]# dnf install rsync

[root@localhost dest]# mkdir /data/rsync

[root@localhost dest]# cd /data/rsync/[root@localhost rsync]#

mkdir

run[root@localhost rsync]#

chmod

777run

[root@localhost rsync]#

mkdir

log[root@localhost rsync]#

chmod

777log

[root@localhost rsync]#

mkdir

conf

[root@localhost rsync]#

chmod

777conf

[root@localhost rsync]# cd conf/[root@localhost conf]#

vi server.pass

說明:server.pass的內容:pusher:123456

pusher是訪問rsync服務時的使用者名稱

123456是pusher對應的密碼

[root@localhost yum.repos.d]# vi /etc/rsyncd.conf

uid =root

gid =root

port = 873

#use

chroot =no #是否可以改變同步的根目錄

#read only =yes #唯讀或者可以上傳檔案

#hosts allow=192.168.1.220

#hosts deny=*# transfer logging =yes

#motd

file = /data/rsync/conf/motd

# log format = %t %a %m %f %b

# syslog facility =local3

# timeout = 300

max connections = 200

pid

file = /data/rsync/run/rsyncd.pid

lock

file = /data/rsync/run/rsync.lock

log

file = /data/rsync/log/rsyncd.log

[wwwroot]

path = /data/nfs/dest

comment =lg69_rsync

#read only =yes

read only =no

auth users =pusher

secrets

file = /data/rsync/conf/server.pass

hosts allow = 127.0.0.1,192.168.1.0/24,59.151.1.0/24,211.151.133.0/24,58.221.35.0/24,125.76.249.0/24

# list=yes

# ignore errors

# exclude = test/ test.php

1,生成rsync客戶端密碼檔案

[root@localhost conf]# vi client.pass

說明:內容與服務端中pusher的密碼相同,內容設定為:123456

2,密碼檔案的許可權一律切換為 600

[root@localhost conf]# ll

總用量

8-rw-r--r-- 1 root root 7 2月 24

16:51

client.pass

-rw-r--r-- 1 root root 7 2月 24

16:47

server.pass

[root@localhost conf]#

chmod

600 *[root@localhost conf]# ll

總用量

8-rw------- 1 root root 7 2月 24

16:51

client.pass

-rw------- 1 root root 7 2月 24

16:47 server.pass

[root@localhost conf]# rsync --version

rsync version

3.1.3 protocol version 31

1,建立乙個配置檔案

[root@localhost conf]# vi /etc/sysconfig/rsyncd

說明:內容為:

options=""

2,建立service檔案

[root@localhost conf]# vi /lib/systemd/system/rsyncd.service

說明:service檔案內容為:

[unit]

description=fast remote file

copy program daemon

conditionpathexists=/etc/rsyncd.conf

[service]

environmentfile=/etc/sysconfig/rsyncd

execstart=/usr/bin/rsync --daemon --no-detach "

$options

"[install]

wantedby=multi-user.target

3,測試啟動:

[root@localhost conf]# systemctl start rsyncd

[root@localhost conf]# rsync -vzrtopg --progress --password-file=/data/rsync/conf/client.pass [email protected]::wwwroot /data/nfs/test

Centos8 環境變數配置

path path home xyg mysql bin echo pathvim bash profile 更改,原行 path path home bin,改為下面的 path path home bin home xyg mysql bin 儲存退出 source bash profile 或...

centos 7 環境安裝配置

yum update1 安裝ifconfig netstat 命令 yum install net tools2 安裝lsof命令 yum install lsof3 安裝vim yum install vim4 安裝ntfs 3g,及行動硬碟掛載 安裝ntfs 3g yum install gcc...

Centos8 環境下安裝mysql 5 7

安裝mysql 1 在執行wget命令的目錄下或你的上傳目錄下找到mysql安裝包 mysql 5.7.24 linux glibc2.12 x86 64.tar.gz 執行解壓命令 root localhost tar xzvf mysql 5.7.24 linux glibc2.12 x86 6...