LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   server backup (https://www.linuxquestions.org/questions/linux-newbie-8/server-backup-909277/)

amartlk 10-21-2011 01:05 AM

server backup
 
Hi

i have centos 5.3 installed , i want data to backup from one location to another location,

how can it poassible in centos


AMAR

deep27ak 10-21-2011 04:33 AM

just compress the folder you want to take backup of

Code:

#tar -zcvf (tar-archive-name.tar.gz)  (source-folder-name)
and use scp to copy from server location to remote location

Code:

#scp (foldername) 192.168.0.100:/backup/
                            ^
                            |
                            |
        IP of remote machine with location of bacup folder


fukawi1 10-21-2011 05:08 AM

If you want to set it up as a cron job, to do it automagically, without authentication.
Set up passwordless authentication on the remote server the backup is destined for, and use something like:

Code:

tar -cJf /folder | ssh -i keyfile user@server ">" file.tar.xz

JJJCR 10-21-2011 05:12 AM

Quote:

Originally Posted by amartlk (Post 4504024)
Hi

i have centos 5.3 installed , i want data to backup from one location to another location,

how can it poassible in centos


AMAR

i had also same problem, then while trawling the web found this link:
http://www.lazysystemadmin.com/2010/...ile-it-is.html

amartlk 10-21-2011 05:15 AM

Thanks for reply

i tried this but it was copied in my local pc but not in remote pc, it shows copying but when i see in remote pc it will not shown cpied file,
if i want to copy from centos server to remote windows pc then it is possible or not

and the solution you given here i have to manually fired command as i want this backup done automatically at midnight daily on remote pc pls suggest

fukawi1 10-21-2011 05:21 AM

Quote:

Originally Posted by amartlk (Post 4504169)
if i want to copy from centos server to remote windows pc then it is possible or not

Nice of you to mention that in your OP... And people wonder why they dont get the answer they are looking for.

Backing up TO a windows machine is kind of like putting all of your eggs in one concrete mixer....

JJJCR 10-21-2011 05:26 AM

you can try exploring the rsync command if you want automation, but please make sure you understand everything before you do anything.

You might end up losing your data.

here's the link for rysnc backup example:
http://www.bobulous.org.uk/misc/rsync-backup.html

you can use crontab to run the script at night:
http://rootprompt.org/article.php3?article=8976

deep27ak 10-21-2011 05:31 AM

Quote:

Originally Posted by amartlk (Post 4504169)
Thanks for reply

i tried this but it was copied in my local pc but not in remote pc, it shows copying but when i see in remote pc it will not shown cpied file,
if i want to copy from centos server to remote windows pc then it is possible or not

and the solution you given here i have to manually fired command as i want this backup done automatically at midnight daily on remote pc pls suggest

what was the command that you were trying?

just try samba server.it is the best one for sharing files and folder between linux and windows

amartlk 10-21-2011 06:22 AM

Hi deep27ak

#tar -zcvf (tar-archive-name.tar.gz) (source-folder-name)

and use scp to copy from server location to remote location

Code:

#scp (foldername) 192.168.0.100:/backup/
^
|
|
IP of remote machine with location of bacup folder


this work for me, i copied data from one centos server to another centos server, but i want this should done automated at everymidnight, pls suggest

deep27ak 10-21-2011 07:22 AM

I am not so good with crontab but you can try this one
Code:

#crontab -e

0  0  *  *  *  tar -zcvf (tar-archive-name.tar.gz) (source-folder-name) && scp (foldername) 192.168.0.100:/backup/

but this will ask for password everytime it uses scp so you need to generate a RSA key for scp

Code:

#ssh-keygen -t rsa -----(on your server)
(follow the steps and generate a pass phrase)


Now copy the id_rsa.pub to your remote machine

Code:

#scp ~/.ssh/id_rsa.pub 192.168.0.100:~/.ssh/authorized_keys
By default authorized_keys file is not present so you will have to create that manually on your remote machine
(on your remote machine)
Code:

#touch ~/.ssh/authorized_keys
Now try accessing your machine with ssh
It will ask for the RSA passphrase instead of password

Now you can save this password
(on your server machine)

Code:

#ssh-agent /bin/bash
#ssh-add
(enter the passphrase)

now try ssh to your remote machine, it won't ask for password or any passphrase

lithos 10-21-2011 07:29 AM

see something like you need I wrote a guide


All times are GMT -5. The time now is 06:10 PM.