LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-16-2013, 02:54 PM   #1
zac_haryy
LQ Newbie
 
Registered: Oct 2004
Posts: 12

Rep: Reputation: 0
cp all files from locate cmd to another machine (copy app from comp to another comp)


Hey everybody! I am setting up a VM server and am wanting to copy program from my existing standalone server to the VM instances. I am wanting to do this so that I do not have to reconfig all of the programs because this takes me a lot of time to accomplish. On the existing machine I can do a locate app1 and it will show all the file locations for that app1. I want to copy all of these files that a program uses to my new VM computer. I was hoping to do this and have everything up and running a lot quick then setting up everything from scratch again.

Maybe there is come better method then what I am doing and if there is please help me out, thanks!
 
Old 12-16-2013, 04:47 PM   #2
ondoho
Senior Member
 
Registered: Dec 2013
Posts: 4,176

Rep: Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835
what app?
i do not see how installing one app could take significantly more time then if you copy the files over.

in any case, a BIG BIG NO NO to that. don't do it.
it doesn't work like that in linux (well not in windows, either).
check out "package management".

sometimes you can copy config files (in your $HOME), but even that has to be done manually and carefully testing the result in every single case.

Last edited by ondoho; 12-16-2013 at 04:49 PM.
 
Old 12-16-2013, 06:18 PM   #3
zac_haryy
LQ Newbie
 
Registered: Oct 2004
Posts: 12

Original Poster
Rep: Reputation: 0
Well its about 10 apps total and it took me about 3 days to do intial config and months to perfect. I can see a lot of config in the home dir but there are also other configs I have done elsewhere and didnt want to spend the time to redo everything and id probable miss a lot that I have done over the months. There is no way to do this though just to test it out?
 
Old 12-16-2013, 07:17 PM   #4
c0d3d
Member
 
Registered: Aug 2012
Posts: 74

Rep: Reputation: 12
It seems like you have three options:

Safest: If you're not far through setting up your new VMs, instead of can the files, you could convert your physical server to a VM file and build your new VMs on top of it. If you plan on taking this option, could you please tell us what hypervisor are you using? Each one needs specific software to accomplish this.
Safer: Use the package manager to install the software on your VMs, then copy the /etc and $HOME directories to your VM installs.
Least Safe: If not, you can try copying the /etc and /usr and $HOME folders from your physical machines to the new VMs.

DISCLAIMER: BEFORE DOING ANY OF THIS, MAKE SURE TO BACKUP AT LEAST YOUR VIRTUAL MACHINES, IF NOT YOUR PHYSICAL SERVER, TOO! THERE IS NO GUARANTEE THAT ANY OF THE OPTIONS WILL WORK! It can safe you a lot of hassle if something goes wrong.

Reply with your results!

Last edited by c0d3d; 12-16-2013 at 07:33 PM.
 
Old 12-16-2013, 08:07 PM   #5
zac_haryy
LQ Newbie
 
Registered: Oct 2004
Posts: 12

Original Poster
Rep: Reputation: 0
Alright so the three options you listed:

safest: I am using proxmox and this may be an option. I was hoping to actually setup 4 different machines and separate some of the applications running on the existing server. So while this may work I still wanted to separate the applications to different VM's.

Safer: I could do this. However is there still a way to copy all the files for an application from the /etc dir into the new machine. Say there were four different folders in the etc dir ex: /etc/applicaitonFolder1 /etc/applicationFolder2 /etc/something/applicaitonFolder /etc/somethingelse/applicationFolder
Is there a command that would allow me to copy all instances of a file with the word "app" and it to the new machine with the respective folder path?
I am thinking if there is a command for that it would come in handy later down the road also.

Least Safe: same situation as safer with all the different directories. This would take a long time to type a cp command for all the separate folders.

I was think of some way to right the output of the "locate app" command to a file and then do a command that would check each line in that file and cp the file over from the old machine to the new.

Let me know what you guys think, thanks!
 
Old 12-16-2013, 08:11 PM   #6
c0d3d
Member
 
Registered: Aug 2012
Posts: 74

Rep: Reputation: 12
Also, what OS are you using on the physical server?
 
Old 12-16-2013, 08:55 PM   #7
c0d3d
Member
 
Registered: Aug 2012
Posts: 74

Rep: Reputation: 12
Quote:
Originally Posted by zac_haryy View Post
Least Safe: same situation as safer with all the different directories. This would take a long time to type a cp command for all the separate folders.
Also, you don't have to cp each folder. A simple
Code:
cp -r /etc /path/to/destination
will do the trick.
 
Old 12-16-2013, 08:57 PM   #8
zac_haryy
LQ Newbie
 
Registered: Oct 2004
Posts: 12

Original Poster
Rep: Reputation: 0
So I am using ubuntu 12.04 on my existing server and am using proxmox with ubuntu 12.04 VM's.

If I
Quote:
cp -r /etc /path/to/destination
that would copy the entire /etc dir and I dont want to copy everything. I just want the application components that I am interested in.
 
Old 12-16-2013, 10:21 PM   #9
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
some food for thought.

1. in the VM, fully install, update, patch, etc... both the OS and the applications.
2. from the old system copy all of the configuration files, scripts, permissions, etc... into one single location.
3. cp/scp/rsync/etc... from that one single location to an other single location on the new VM
4. BACKUP all of the new VMs config files that you will be replacing from the older system into one single location.
5. overwrite the new VMs config files with the ones you transferred from the old system to the new VM.
6. test and confirm no issues.
6b. trouble shoot as required.

Ive done this several times for server migration. it works every time if you do this way. you always have a built in restore point by NOT overwriting/deleting the "new" configuration files on the new server. as long as you copy them, you can always revert back to them and modify what needs be in case the "older" files break something in the new system.

saves time and headache.
 
Old 12-17-2013, 03:16 PM   #10
ondoho
Senior Member
 
Registered: Dec 2013
Posts: 4,176

Rep: Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835
i think lleb's answer is the best here.

i just want to point out that he's talking about copying config files, and not the whole app.
it's basically what i wrote, but much better.

@coded (mind if i don't use leet): copying your whole /etc (and even /usr) to another machine, even if it has the same system installed, is totally dangerous. so many things can go wrong, not only with the apps intended but with EVERYTHING. also i doubt it would be enough. most linux apps have files all over the system.
 
1 members found this post helpful.
Old 12-18-2013, 12:26 PM   #11
Spect73
Member
 
Registered: Aug 2013
Distribution: Slackware 14.1
Posts: 128

Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
i think lleb's answer is the best here.

i just want to point out that he's talking about copying config files, and not the whole app.
it's basically what i wrote, but much better.

@coded (mind if i don't use leet): copying your whole /etc (and even /usr) to another machine, even if it has the same system installed, is totally dangerous. so many things can go wrong, not only with the apps intended but with EVERYTHING. also i doubt it would be enough. most linux apps have files all over the system.
I read the article at the link Don't be a Help Vampire given in your signature. Was very good.

Last edited by Spect73; 12-18-2013 at 12:27 PM. Reason: Clarification
 
Old 12-18-2013, 03:00 PM   #12
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,163
Blog Entries: 10

Rep: Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979
Quote:
Originally Posted by ondoho View Post
...a BIG BIG NO NO to that. don't do it.
What ^ said:
Flirtin' with Disaster.

Got backups?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error message kernel: be2net 0000:02:00.0: Error in cmd completion - opcode 121, comp slametsu Linux - Server 1 09-27-2012 07:53 AM
is there a way to an xp home comp see a linux suse comp in a network rayclnz SUSE / openSUSE 1 01-03-2007 03:30 AM
how to do: using a linux comp to act as router for a windows comp grimhammer Linux - Networking 8 02-10-2005 10:56 PM
scp :copy file from one remote comp to another aniketh Linux - Networking 4 06-16-2004 03:31 AM
couldn't ping a WinXp comp from Fedora Comp tanbetien Fedora 5 12-04-2003 07:03 AM


All times are GMT -5. The time now is 12:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration