centos6.5
4張網卡
network 強制啟動
web server
#######################
如何手動Yum安裝「指令setup」(Text Mode Setup Utility) for CentOS 6.2
step 1) $ yum install -y setuptool ntsysv system-config-* vim mlocate xinetd
step 2) 安裝成功後,下指令setup,如下:
$ setup
#######################
setup
network
停止
service firewalld disable
service firewalld stop
set firewall no
vim /etc/selinux/config
SELINUX=disabled
enforced-->disabled
########################1.rsync ---設定
vim /etc/xinetd.d/rsync
簡單範本如下:
# default: off
# description: The rsync server is a good addition to am ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
然後下 ,
启动服务:rsync –daemon –config=/etc/rsyncd.conf
使上述設定生效.
備份的方法 3 : 使用 rsync
上述, 主要是要打開 rsync 這個 daemon, 一旦有 rsync client 要連接時, xinetd 會把它轉介給 rsyncd (跑 port 873).
##############################
如果出现
# rsync -vau --password-file=/home/passwrd1XX.secrets /home/test root@174.XXXX::test
rsync: failed to connect to 174.XXXXX: Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(107) [sender=2.6.8]
这都是端口问题!
看看端口
netstat -ntpl
如果没有873端口的话,就
yum -y install xinetd rsync
肯定是没安装xinetd!!!这么傻的问题!
service xinetd restart
systemctl rsyncd enable
systemctl rsyncd start
service rsyncd enable
service rsyncd start
就好了!
# rsync -vau --password-file=/home/passwrd1XX.secrets /home/test root@174.XXXX::test
rsync: failed to connect to 174.XXXXX: Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(107) [sender=2.6.8]
这都是端口问题!
看看端口
netstat -ntpl
如果没有873端口的话,就
yum -y install xinetd rsync
肯定是没安装xinetd!!!这么傻的问题!
service rsyncd enable
service rsyncd start
就好了!
############################
2. 設定 /etc/rsyncd.conf :
以下區塊, 代表開放給某一台 rsync client 主機的設定, 簡單範本如下:
############################
vim /etc/rsyncd.conf
############################
[homelia]
path = /home/lia
auth users = home
uid = root
gid = root
secrets file = /etc/r.p
read only = no
[home]
path = /home
auth users = home
uid = root
gid = root
secrets file = /etc/r.p
read only = no
[mail]
path = /var/spool/mail
auth users = mail
uid = root
gid = root
secrets file = /etc/r.p
read only = no
[public]
path = /public
auth users = public
uid = root
gid = root
secrets file = /etc/r.p
read only = no
[mysql]
path = /var/lib/mysql
auth users = mysql
uid = root
gid = root
secrets file = /etc/r.p
read only = no
[html]
path = /var/www/html
auth users = html
uid = root
gid = root
secrets file = /etc/r.p
read only = no
[ftp]
path = /var/ftp
auth users = ftp
uid = root
gid = root
secrets file = /etc/r.p
read only = no
[www]
path = /var/www
auth users = www
uid = root
gid = root
secrets file = /etc/r.p
read only = no
[163.17.209.1]
path = /163.17.209.1
auth users = etc1
uid = root
gid = root
secrets file = /etc/r.p
read only = no
[163.17.209.6]
path = /163.17.209.6
auth users = etc6
uid = root
gid = root
secrets file = /etc/r.p
read only = no
[lib]
path = /var/lib
auth users = lib
uid = root
gid = root
secrets file = /etc/r.p
read only = no
vim /etc/r.p
###############################
home:home
mail:mail
public:public
mysql:mysql
html:html
ftp:ftp
etc1:etc1
etc6:etc6
www:www
lib:lib
#####/etc/r.p##############
chown root.root /etc/r.p
chmod 600 /etc/r.p
############################################
/etc/rc.d/init.d/xinetd restart
############################################
mkdir /163.17.209.1
mkdir /163.17.209.5
mkdir /public
mkdir /home/teacher
mkdir /home/office
############################################
vmware exsi 設定第2網卡
vim /etc/sysconfig/network-scripts/ifcfg-ens33
#####################
ONBOOT=yes
################################
首先關掉 NetworkManager (開始採用新的指令)
systemctl disable NetworkManager.service
systemctl stop NetworkManager.service
chkconfig network on
#因為network不是標準的 systemd 的程序
systemctl stop network
systemctl start network
yum update -y
關閉 firewalld.service systemctl disable firewalld.service systemctl stop firewalld.service
開啟 rsyncd.service systemctl enable rsyncd.service systemctl start rsyncd.service
######################################################
systemctl start network
yum update -y
關閉 firewalld.service systemctl disable firewalld.service systemctl stop firewalld.service
開啟 rsyncd.service systemctl enable rsyncd.service systemctl start rsyncd.service
######################################################
Freebsd10+centos7+Rsync
[FREEBSD10] 安裝rsync server
安裝
# cd /usr/ports/net/rsync
# make install clean
# make install clean
設置開機啟動
# vi /etc/rc.conf
加入
rsyncd_enable="YES"
rsyncd_enable="YES"
設定組態
# vi /usr/local/etc/rsync/rsyncd.conf
# vi /usr/local/etc/rsync/rsyncd.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
| uid = root gid = wheel use chroot = no max connections = 4 syslog facility = local5 [w1] path = /home/_backup comment = backup_www ignore errors secrets file = /usr/local/etc/rsync/rsync . passwd auth users = www read only = no |
第7行中刮號內是群組,第12行設定該群組使用的帳號,第11行設定帳號的密碼檔
設定密碼檔
# vi /usr/local/etc/rsync/rsync.passwd
# vi /usr/local/etc/rsync/rsync.passwd
內容為 帳號:密碼,這裡的帳號專屬rsync用,和系統帳號無關
www:12345
www:12345
設定檔案權限
# chmod 600 /usr/local/etc/rsync/rsync.passwd
啟動/重啟
# /usr/local/etc/rc.d/rsyncd restart
# /usr/local/etc/rc.d/rsyncd restart
[FREEBSD10] rsync client
安裝同server的安裝,不必啟動,安裝完後會有rsync的指令
設定密碼檔
# vi /home/_backup/rsync.secrets
# vi /home/_backup/rsync.secrets
裡面只需要打入密碼即可
12345
12345
修改權限
# chmod 600 /home/_backup/rsync.secrets
# chmod 600 /home/_backup/rsync.secrets
將rsync server的檔案複製到本地端
# rsync -avHS --password-file=/home/_backup/rsync.secrets /home/_backup/ www@10.0.0.2::w1
將本地端的檔案傳到rsync server
# rsync -avHS --password-file=/home/_backup/rsync.secrets www@10.0.0.2::w1 /home/_backup/
[CentOS7] rsync server/client
安裝
# yum install rsync
# yum install rsync
CentOS5及CentOS6中rsync在xinetd中,啟動及設定的方法可參考這篇。
CentOS7中rsync就沒放在xinetd中,是獨立的程式,設定檔在 /etc/rsyncd.conf,設定方法同 freebsd10
補充說明
* 參數可以參考rsync 的參數
* 使用 --delete 參數要很小心,如果是將server檔案傳到本地,他會把本地目錄中在server裡不存在的檔案都刪掉;若是將本地端的檔案傳到server用了這個參 數,他會把server端中本地沒有的檔案刪除,這些動作都沒有辦法複原(我自己就是白痴的把自己原本要備份的檔案刪了)。
* 設定排程,他就會定時的備份
* 別忘了防火牆 tcp/873,若要使用ssh的協定,加上 -e ssh 參數
* 若要使用selinux,關於selinux的設定可參考這篇
* freebsd 上有2點要注意的,1 rsync 的檔案位置不同 2 備份內容的寫法,如果要備份整個目錄的話,最後面的斜線不要加
* 參數可以參考rsync 的參數
* 使用 --delete 參數要很小心,如果是將server檔案傳到本地,他會把本地目錄中在server裡不存在的檔案都刪掉;若是將本地端的檔案傳到server用了這個參 數,他會把server端中本地沒有的檔案刪除,這些動作都沒有辦法複原(我自己就是白痴的把自己原本要備份的檔案刪了)。
* 設定排程,他就會定時的備份
* 別忘了防火牆 tcp/873,若要使用ssh的協定,加上 -e ssh 參數
* 若要使用selinux,關於selinux的設定可參考這篇
* freebsd 上有2點要注意的,1 rsync 的檔案位置不同 2 備份內容的寫法,如果要備份整個目錄的話,最後面的斜線不要加