windows 将 cygwin 从一台机器移动到另一台机器时要复制什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/965731/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What to copy when moving cygwin from one machine to the other?
提问by Rook
I'm reinstalling everything on my machine, and amongst those is Cygwin. I'm trying to avoid reinstallation, partly because I don't even know what it is that I've installed. Can I just move the Cygwin directory from one machine to another and expect everything to work, or are there some other important settings that I need to move as well?
我正在我的机器上重新安装所有东西,其中包括 Cygwin。我试图避免重新安装,部分原因是我什至不知道我安装了什么。我可以将 Cygwin 目录从一台机器移动到另一台机器并期望一切正常吗,或者还有其他一些我需要移动的重要设置吗?
As far as I saw, it's pretty self-contained, but one never knows.
在我看来,它是相当独立的,但人们永远不知道。
回答by Nils Pipenbrinck
Yep! Go for it. You won't encounter any problems.
是的!去吧。你不会遇到任何问题。
You can just copy the entire cygwin directory to your new machine, open up the cygwin shell and everything (as long as you are only calling cygwin-internal programs and stuff that's within the path) will just work as if you you are working on your old machine.
您可以将整个 cygwin 目录复制到您的新机器上,打开 cygwin shell 和所有内容(只要您只调用 cygwin 内部程序和路径内的内容)就可以像您正在处理您的旧机器。
The only thing you'll loose is the directory where the "already downloaded and compressed" packages for a possible re-installation are stored. Fortunately this directory is optional, so no problem for migration to another platform. You could copy that directory as well, but most likely all the packages that you have are outdated anyways and a run of setup.exe would fetch the new versions anyway...
您唯一会丢失的是用于可能重新安装的“已下载和压缩”软件包所在的目录。幸运的是这个目录是可选的,所以迁移到另一个平台没有问题。您也可以复制该目录,但很可能您拥有的所有软件包无论如何都已过时,无论如何运行 setup.exe 都会获取新版本......
Btw - since someone said exactly the opposite some real-life experience: I use this feature quite often with success. I've copied my cygwin dir to USB-sticks and used it on friends computers. I also copied it to the laptop of my fiance when we go to holidays and take a laptop with us.
顺便说一句 - 因为有人说完全相反的一些现实生活经验:我经常成功地使用这个功能。我已将我的 cygwin 目录复制到 U 盘并在朋友的计算机上使用它。当我们去度假并随身携带笔记本电脑时,我还将它复制到我未婚夫的笔记本电脑上。
It always worked without anyproblems....
它总是工作没有任何问题......
回答by Chris Harris
No, you have to reinstall it from the cygwin installer, sorry!
不,您必须从 cygwin 安装程序重新安装它,抱歉!
Most importantly you'll want to copy everything from your home directory (default is c:/cygwin/home/) especially anything w/ a "." in front of the filename.
最重要的是,您需要从主目录(默认为 c:/cygwin/home/)中复制所有内容,尤其是任何带有“.”的内容。在文件名前面。
As for individual application preferences, etc., you may lose those -- but if you do the reinstall while you still have access to your old machine -- you can probably get to 90% of your previous install without too much trouble.
至于个别应用程序首选项等,您可能会丢失它们——但是如果您在仍然可以访问旧机器的情况下进行重新安装——您可能可以轻松完成之前安装的 90%。
回答by natersoz
My experience with copying from one cygwin64 (I don't think there is a difference) to another machine is that all of the symbolic links got crushed:
我从一台 cygwin64(我认为没有区别)复制到另一台机器的经验是所有符号链接都被破坏了:
As an example:
举个例子:
What used to be /usr/bin/cc -> /usr/bin/gcc.exe
(or something like that)
After the copy /usr/bin/cc became a text file containing the string:
过去是什么/usr/bin/cc -> /usr/bin/gcc.exe
(或类似的东西) 复制后 /usr/bin/cc 成为包含字符串的文本文件:
!<symlink>/usr/bin/gcc.exe
My method of copy was merely cp -r /cygwin/c/cygwin64 <dest>
我的复制方法仅仅是 cp -r /cygwin/c/cygwin64 <dest>
My dest was a FAT32 FS, but I don't think that had anything to do with it. There were also characters 0x00 and 0xFF sprinkled among many of these 'text' files so that they appeared to be binary.
我的目标是 FAT32 FS,但我认为这与它无关。在许多这些“文本”文件中还散布着字符 0x00 和 0xFF,因此它们看起来是二进制的。
回答by Robert
The short answer is: No, you can't copy the whole Cygwin folder. You just copy the configuration files(bash files, vim file, etc.) you need.
简短的回答是:不,您不能复制整个 Cygwin 文件夹。您只需复制您需要的配置文件(bash 文件、vim 文件等)。
The long answer is: If you copy the whole Cygwin folder, it may work in some case, and may not in some other case.
长答案是:如果您复制整个 Cygwin 文件夹,它可能在某些情况下有效,而在其他情况下可能无效。
The reason is: you will lose linux file mode
when copying files on Windows. And that will cause a lot of troubles. However, you may not have the troubles when you use Cygwin just like a common Windows Program(which means you don't care file mode and anything related), and run it as Windows Administrator(which is not required when Cygwin is installed as usual).
原因是:file mode
在Windows上复制文件时会丢失linux 。而这会带来很多麻烦。但是,当您像使用普通的 Windows 程序一样使用 Cygwin 时,您可能不会遇到麻烦(这意味着您不关心文件模式和任何相关的东西),并以 Windows 管理员身份运行它(这在照常安装 Cygwin 时不需要) )。
BTW: you can export the packages you installed by cygcheck.exe -c
and install them on the new Cygwin. You can also install/update Cygwin packages by Cygwin's setup-x86_64.exe
in command line like:
顺便说一句:您可以导出您安装的软件包cygcheck.exe -c
并将它们安装在新的 Cygwin 上。您还可以通过 Cygwinsetup-x86_64.exe
在命令行中安装/更新 Cygwin 软件包,例如:
setup-x86_64.exe -q -P package1,package2,package3