Modifying files on remote Ubuntu server from Windows PC - windows

I am developing some Python programs that I'm running on a remote Ubuntu Linux server (hosted on Slicehost). I would like to work on the source in an IDE on my Windows Vista PC, and have all file modifications sent directly to the Linux box without my intervention (i.e. without having to manually SFTP the files each time I change them). What is the very easiest way I can do this?

WinSCP includes a basic remote file editor, though if you want to use a proper IDE for your development this won't be much help.
I'd suggest you run a version control system like subversion, which would allow you to write a post-commit hook to automatically rsync your code the server with each commit.

Use PuTTy and SFTPDrive.
PuTTy is an SSH client, and SFTPDrive ($39 USD) will allow you to mount your remote file system locally as a drive letter.

Install Samba and OpenVPN on the server, and OpenVPN on the client. Setup Samba to share the directory tree you're interested in, and access it over the VPN for security. Perhaps Vista has non-sucky WebDAV support by now, and you could use WebDAV over HTTPS, but it was always crap under XP.
Ben's suggestion of a local dev environment using a VM is also a winner.

You could install cygwin and then have rsync run on cron every minute.
Or you could use Netdrive to access the server via FTP like a local disk:
http://tech.xptechsupport.com/netdrive-turn-your-ftp-into-a-drive-letter.html
Or you may be able to achieve something similar using cygwin and FUSE - you can on linux, but never tried it on cygwin.
Also, would it not be easier to set up a full dev environment locally? Maybe using a virtual machine? It'll be much quicker for testing. And then you can set up a shell script to transfer the current version to the slicehost server.

Related

How to transfer a file from unix server to windows pc

Right now I am using winscp to manually copy files from unix server to my windows desktop.
I Would like to automate the same by running some script in unix.
Can someone please help?
-Sajith
The simple answer is: run an FTP server on Windows and write a simple FTP client script on Unix.
For Windows, you can use
IIS (built in to all versions of Windows, but switched off by default)
Filezilla -- free https://filezilla-project.org/download.php?type=server
one of the many proprietary FTP server programs. See http://en.wikipedia.org/wiki/List_of_FTP_server_software
At the Unix end, write a script to control the built in FTP client.
Another answer is: use IIS on Windows as a file uploader/downloader by writing a really simple Web site. Use wget or curl at the Unix end.
Another answer is: implement SAMBA on Unix, so that it joins your local Windows network. Copy files using standard shell commands.
Another answer is: use Dropbox and transfer files via the cloud.
I could probably think of more, but that's enough.

How to run Git server on Windows?

How can I share a Git repo on Windows? The "correct" ways appear to be to run "git-daemon" (unix specific) or run ssh (unix specific) or run an http front end for Git. If I just have two Windows boxes and don't feel like installing Unix just to run Git, what is the optimal way to share the repos between the two boxes?
If both machines are in the same LAN, you can put the repo in a directory shared via the regular Windows network protocol (SMB).
(Disclaimer: I'm not certain about locking semantics for SMB, so it could be that simultaneous writes to the repo could corrupt it. Then again, the same probably holds for Unix.)
If you want easiest way, you have to see at SCM-manager
The easiest way to share and manage your Git, Mercurial and Subversion
repositories over http.
In order to have http-served repository with nice Web-frontend and management you have to have only Java (Java, not JRE)
Another alternative instead of running a virtual machine is to run all the Unix stuff in Cygwin. With Cygwin you can set up an ssh server on your windows machine as well as gitolite. And it runs natively on your hardware instead of a virtual machine.
Cygwin installation is very straight forward. It's just a single executable that downloads the packages you need. Keep the installer around because it's what you'll use to add and remove software in Cygwin.
Running gitolite on Cygwin is not as simple but just google "cygwin gitolilte" and you'll find lots of tutorials.
Git is a distributed version control system. So, in most situations, you don't need a dedicated program to serve the content in the repository, you just need a way to access the repository from both machines. One way of doing this is like #thomas suggested and placing a clone of the repository in a shared network location.
Another way that I have found successful in the past as a broke graduate student, is to use Dropbox as the "master" repository. Basically, you git clone your repository into your Dropbox directory, then you can setup Git on both machines to push/pull from the Dropbox repository. Dropbox will do the syncing magic in the background. This only works for mildly active repositories.
What I have done in the past is just run a VM with a small linux client on one machine through virtual box. You only need to port forward the ssh port and you're good to go - no need for configuring the network to something complicated on the VM.
This will allow you to run things like gitolite to manage users.
For this and many other reasons, I've switched to running Linux for all my machines and just run windows in a VM when I need to do Windows development. Lots of great services that you can run on Linux are more easily connected to from the guest OS than the other way around.
If you will have only the 2 windows machines, you can add a url to the remote, but ensure it is done via the file protocol. ie:
git remote add origin file:///\\some-server/share/repo.git
Some people claim that if you use just a path, git will try to make hard-links between the 2 repos. AFAIK, msysgit does not do this and you can use a path with no file protocol:
git remote add origin /z/somepath/repo.git
if z is mapped to a share on the other machine. I didn't need to run a server in your scenario.

executing command on a Windows Machine from a UNIX/LINUX Machine

is it possible to execute a command (ex: launching a .bat file located on the remote machine) on a Windows Remote Machine, using a UNIX or Linux Machine ?
Is there something like a scp/ssh mechanism or at least a way to connect to a Windows Machine passing through the network ?
Thanks for your help.
By default, recent Windows versions only support the Remote Desktop protocol. As far as I know, client versions only allow a single user, while server versions with installed Terminal Services allow for multiple simultaneous users.
Windows Server versions also support the Telnet protocol, but the server is disabled by default - it may not even be installed. Therefore you will have to enable it manually. Do you really want to use Telnet of all things, though? Just the security concerns are enough to make it mostly useless.
There is also a version of OpenSSH for Windows, that uses the Cygwin DLL. I have not tried it, but using an SSH implementation from the Unix world does have its appeal (and probably a few disadvantages). See also this.
EDIT:
Recent Windows versions also support the Windows Remote Management system, which allows you to launch an interactive session throuh a bit of trickery.
You may want to try Vandyke VShell.

Best way to interface between Windows dev platform and Linux test platform?

my project is a PHP web application. This applies to my test server (local), not production server! I am also the solo developer on this project (however, that may change in the very far future). Also, all my source code is committed to a repository and the production server gets the source code from the repository.
I do my development in Windows while my test server runs on Ubuntu (perhaps you can also recommend me another distro that is easy to use and can serve as a good web server). I need an elegant way to interface between the two environments. Currently, I do my coding in Windows and then FTP the changed files to the test server. However, this is quite cumbersome and tedious since I have to manually go to my FTP client each time. Suggest me something elegant please! Perhaps FTP sync? or OpenVPN (where the root www directory on test server is acts like a folder in Windows)? Thanks for your awesome time!
Easiest would be in Ubuntu, right click a folder then click "Sharing Options", then share the folder. In Windows, connect to the share, and work on that copy.
If you're using version control, using continuous integration like Hudson ( http://hudson-ci.org/ ) would help if you create a task that builds/exports the website for the testing server. This approach would be better in the long term, but you'll waste a day setting it up initially.
I prefer SFTP to FTP.
That said, ExpanDrive lets you map SFTP servers to local drive letters, which then means you can use any text editor to access your files directly on the test server, or use other mechanisms to keep the files in sync. Since they show up as two local drives, you can use just about any product out there.
If you want to use FTP, you can just map the drive in Windows Explorer. If you open up My Computer, then go to Tools > Map Network Drive, you can map a FTP server folder to any local drive. Just type in the address as the folder, ie. ftp://mscharley#192.168.0.10/htdocs
This will atleast save you a trip to the FTP client...
Is there any reason you couldn't just test on your local computer? At my job, we all develop and do developer testing locally, most of us using Windows. Our production and test servers are all linux based. Working locally is really nice, because you don't need to worry about making changes on the server with every small change.
Another option would be to create a checkout or working copy of your code on the server, and then run svn up or svn export (or equivalent using your version control software) each time you change the code on the server (assuming you are sshd into the server). This is kind of slow, but it's easy. The other option would be to write a script that goes through the svn logs for the recent commit and only exports or updates the ones that changed. This is much faster, and for all I know, there is already something out there that this.
Finally, some IDEs allow you to edit files live over ftp\sftp. Basically the IDE downloads a copy of the code and then reuploads it when you save.
Currently I develop on windows (PHP) as well and deploy on a Linux box for testing and production. This is how I do it.
Set up a local development server with e.g. WAMP.
Set up your code base in version control, e.g. Subversion.
Checkout your code base onto the testing/staging server, not just only on your local dev. environment.
In the early stages of development you want to deploy to the testing environment A LOT to sort out any discrepancies between your windows and linux environments. When your programming efforts turn more into program flow type programming this constant testing will probably slow down. But still take the effort to test on a regular basis.
To test your code base on staging do an svn update. I just log in with an SSH session to do this. A key thing here to note is that you do not have to make any config changes to your code base. If you do need to make config changes to your environment on staging it worth while spending the time to SCRIPT this process rather than this being a manual process.
Do the same for production. I use an Subversion check out on production as well. Make sure you set you .htaccess file to deny access to your hidden .svn folders and script the deployment especially if there a config changes necessary.
Some ideas:
Use a server environment under windows (e.g. EasyPHP).
Use a development tool that can save over FTP (e.g. ultra edit).
Use a network drive connected to the remote machine via FTP.
Use a network drive connected to the remote machine via Samba.
Run a linux distro inside a virtualization tool (e.g. virtual box) and write from the windows host to a share directory of the guest host.
Use dropbox to sync files between machines (there is more a hack than an "enterprise" solution).

What tools do you use to upload files to amazon ec2 Linux instances?

I am using the standard fedora AMI with the LAMP stack bundled and I want to upload files onto the server from my Windows desktop.
What is the "normal" approach for this? I am not a UNIX admin by any stretch, although I am more than comfortable with FTP and the basics of a BASH shell.
As far as I can see there is no FTP server installed by default on the remote virtual machine, and I am unable to open one up at my end because of firewall restrictions. I looked at WinSCP, but before I go to the lengths of installing and configuring that I wondered what the expected means of doing this might be. In any case I don't see how WinSCP or any other FTP based tool can work without the target machine listening, which implies something like and FTP server.
Is there anything like a Windows remote desktop connection?
I could mount an S3 elastic storage volume from within EC2, but it is a bit of a sledgehammer to crack my little nut of just wanting 100k of files copied up to the server.
This is a different question to getting my web application running on the virtual server to save files locally, which is what the other SO questions in a similar vein seem to be asking.
Any ideas welcome.
I use putty's psftp, which uses ssh. If you can ssh into the box, then psftp should work.
http://www.chiark.greenend.org.uk/~sgtatham/putty/
You will first need to convert your pem private key to a ppk using puttygen for psftp to use the keyfile for authentication because it only uses ppk format and not pem format, as far as I know.
You've made the right choice with WinSCP. SCP is based on SSH, not FTP, and SSH and SCP are standard on Linux servers. So, WinSCP takes a bit of configuration bit its the simplest. Your alternative would be to install and maintain and FTP server - a lot more work there! There are equivalents to Remote Desktop but they're way more complicated to setup.
If you're having trouble with configuring your SCP program with your key but you have the ability to "shell" in, you could create a new linux user on the server with a password, then you can use that password instead of the key in WinSCP which is easier.
"In any case I don't see how WinSCP or any other FTP based tool..."
SCP (and SFTP, for that matter) is an entirely different protocol from FTP. Data is transferred over an SSH channel. If you have SSH access to your virtual machine, SCP/SFTP should work.
If you prefer a graphical tool, have a look at the S3Fox Firefox plugin (my choice), or peruse this list of standalone graphical S3 browsers.
For S3 I use Cyberduck (on Mac) and S3Fox. For mass uploads (in scripts) I use s3sync. I manage EC2 Instances with ElasticFox and original ec2 Tools from Amazon.

Resources