Sync /etc/hosts file across multiple machines - configuration

Does anyone know an easy way to synchronize your /etc/hosts file across multiple machines? I use a MacBook, a MacMini, a Windows Machine as well as a Linux VM to develop websites with so it would be ideal to have all of them have the same hosts config.

Instead of having a /etc/hosts file for each machine you might instead consider using a DNS server.

You can run rsync on any of the macs/linux, and deltacopy on windows

Related

How to upload my servers on virtual machine?

I have 2 server at which I am working locally. The first is a front-end in Vuejs, and the second is back-end in Flask. From the client I request an api to the second.
I have to upload these two on a remote Linux VM (Debian), for which I have credentials and I can successfully connect it via PuTTy.
How do I transer my 2 directories to the VM?
Then, I should change the address that the client uses for api requests of the server, that is all? Or I will have to do something else?
You can copy directories by the scp or sftp protocol. In your case, this can be done most easily by the winscp software.
Both scp, sftp (implemented by winscp) and ssh (implemented by putty) use the ssh protocol. Putty is for remote terminal (i.e. you can give commands to the server), while winscp uploads, downloads and manages files on it.
If you are developing something, it is likely that you will need to this deployment more regularly. These softwares are only good for single-time deployments. In professional environments this deployment is automatized and happens quickly.
It is very likely that you also have some database in your project. Here the most common options are either some db-level synchronization, or dumping the database into files and synchronizyng on the file level. But it is already another topic.
It is also unlikely that you will need two different VMs for the vuejs and for the flask. You could wire them together to a single VM, that would make your task far more easy.
You will likely have a hard time to make your deployment on your server well working. This all is just the beginning. But don't worry, after you've learnt it all, it will be easy!

Remote access to MySQL on Amazon EC2 Windows instance

I found some solutions for Linux here.
But didn't find any solution for Windows. I don't have my.cnf on Windows. I only have my.ini. there is no bind-address in it.
I have already added an inbound rule for MySQL.
Could anybody give me some advice? Thanks a lot!!!
Here's what I would check:
Verify that the MySQL service is up and running by remote desktop'ing to the instance and trying to connect to it on the instance.
If that checks out, try modifying or disabling Windows Firewall to ensure that outside machines can connect on the relevant port. Depending on the Windows version, there might be several places that you need to fiddle with this (i.e. both Windows Firewall and Windows Firewall with advanced security).
If you're using an Asp.Net Application with Entity Framework, you will need to install the MySQL connector on the EC2 instance (I would suggest running iisreset to make sure the dll's are loaded).

Accessing Virtual Hosts from a VM (Running on the Same Box)

I am running Apache with several virtual hosts on my Mac. I think the virtual hosts have properly been configured; thus, I can access the following from the web browser:
host1.mydomain
host2.mydomain
host3.mydomain
I can also access localhost with no problem.
However, I can't access those hosts from a virtual machine (I use Parallels Desktop, running on the same box). Do I need to configure something on my virtual machine? Maybe the hosts file, etc.?
Is it also possible to hit those hosts from the virtual machine, even I am not connected to the Internet?
Thanks.
It turns out this can be solved by simply updating the hosts file in the VM.
Assuming the Mac's IP is a.b.c.d and you want to access host1.mydomain, you'd need to add this line to the hosts file (in the VM):
a.b.c.d host1.mydomain
So, when you type in host1.mydomain on the VM browser, it will get resolved to the host running on the Mac.

Development environment; Win7+Ubuntu (RoR, MySQL, PHP, Apache)

I just erased a hard drive from my old system and would like to install Ubuntu on it along with PHP, RoR, MySQL and Apache to be my development environment. My primary HDD is Win7.
If I do the majority of my work in Win7 and save to the 2nd HDD (Ubuntu), can I access my development sites on Ubuntu as if it were in a separate box? Would all my paths be by drive letter instead of by IP?
You would have to use virtualization to accomplish this. Adding another hard drive doesn't automatically give you any IPs. You still have just your regular outside-facing IP (LAN or WAN) and your loopback (127.0.0.1).
You can read these VirtualBox instructions on setting up an internal network, with each virtual guest having its own local IP. Other virtualization software has similar capabilities.
EDIT: If you just want to serve from a directory on D, you can customize DocumentRoot to be e.g.
DocumentRoot "D:/public_html"

Hudson cmd.exe running as

Where does hudson CI get user to run the cmd.exe ?
I'm trying to start and stop some remote services on various slaves and special credentials that are different than what hudson is using are needed. I can't find a place to override the user. I've tried running the server as various users, but it doesn't change anything.
Any other ideas?
Since you want to start and stop the services on the remote machine you need to login with these credentials on the remote machine, since I haven't found a way to start and stop a service on remote machine.
There are different ways to do that. You can create a slave that runs on the remote machines with the correct credentials. You can even create more than one slave for the same machine without any issues, than you can use different credentials for the same machine. These can then fire up the net stop and net start command.
You can also use the SSH plugin. This allows you to configure pre- and post-build ssh scripts. You 'just' need and ssh server on the windows machine. The password for the connection will be stored encrypted.
Use a commad line tool. So far I haven't found a Windows on board tool to have a scripted login to the remote machine. I would use plink for that task. plink is the scripted version of putty. Putty supports different connection types. So you can also use the build in telnet service (not recommended since telnet does not encrypt the connection). Disadvantage is that you will have the password unencrypted in the job configuration.
We had a similar problem, and I resorted to using PsExec. To my advantage, our machines exist on a separate LAN, within 2 firewalls, so I was OK with unencrypted passwords floating around. I had also explored SSH w/ Putty, which seemed to work, but not straightforward.
If someone can help with single line runas command, that could work too.
You don't say how your slaves are connected to Hudson, but I'll assume it's through the "hudson slave" service, since that's probably the most popular way to connect Windows slaves.
If so, the CMD.EXE is run with the same permissions as the user running the service. This can be checked by:
1. run services.msc
2. double-click hudson-slave service
3. go to Log On tab
By default, the slave service runs as "LocalSystem", which is the most powerful account on the system. It should be able to do whatever you need it to do. (i.e. start/stop services)