Add php5-cli and rsync to your esxi server

My new favorite toy is a box running ESXi.

ESXi is a strange beast. I’m used to using linux based host OS’s so the limitations of ESXi are a little frustrating. No direct access to physical drives, no direct access to USB devices, ESXi only knows how to read its own proprietary files system vmfs.
For all the headache, its much faster than a linux host and has a ton of configuration options via the vSphere client software.

The no cli thing bugs me a lot. The only supported way to interact with esxi is via the vSphere client software.
It does include sshd, but its off by default.
There are lots of articles on how to enable this mode.

Once you’ve got SSH access, you’ll quickly discover that most of the commands your used to in linux are missing.
Including perl, rsync, etc…

Since there are no dev tools, no gcc, or glib headers for this kernel, you can’t compile software directly on the host either.
Ah, but if you can build it into a static binary, it will run!

I’ve found an rsync binary and a php binary.
Installing these opens doors for writing useful scripts with esxi.

Login as root, plop these into your /bin/ directory and make them executable with a chmod a+x and your good to go.

Not quite that easy. The binaries work, just /bin doesn’t persist between reboots. You’ll need to place your utilities in a persistent storage location to keep them around.

Warning: The resulting partition is not properly aligned for best performance.

I’m adding a disk to an ubuntu machine and creating a new partition which uses the whole disk.

GNU Parted 2.2
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Error: /dev/sdb: unrecognised disk label

So I make a new dos partition

(parted) mklabel
New disk label type? msdos
(parted) print
Model: - (scsi)
Disk /dev/sdb: 53.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number  Start  End  Size  Type  File system  Flags
(parted) mkpart primary ext4 0 -1
Warning: The resulting partition is not properly aligned for best performance.

You should align the first partition at block 64
(parted) mkpart primary ext4 64 -1
mkpart syntax is: mkpartfs part-type fs-type start-mb end-mb
so this just wastes the first 64 MB of space on the disk. Setting the start at 1 avoids the error message as well.

mkpart primary ext4 1 -1

And your error free. Go forth and partition.
Thanks to Stefan.
This is why I put stuff on the internet.

Configure Crashplan on Centos 5.3

Crashplan is a backup tool similar to carbonite or mozy with one great exception: It allows pc to pc backup without a fee and they have clients for windows, mac and linux.

The configuration of this on a headless linux server is a little tricky but can be done.

The crashplan software is divided into two parts: The engine and the desktop. The desktop is the configuration gui and the engine does the work. To configure a headless server, you’ll need to use the desktop on another computer to connect to the headless one via port forwarding.

Check out the instructions

Their instructions are mac centric. Here is how to achieve same thing with windows and putty.

  1. Open putty
  2. Fill in the host and port info to connect to your server
  3. Under ‘Category’ on the left, click on ‘SSH’
  4. Next click on ‘Tunnels’
  5. Check both ‘Local ports accept connections…’ and ‘Remote ports do the same…’
  6. Enter ‘4243’ into the source port box
  7. Enter into the ‘Destination’ box.
  8. Select ‘Local’ and ‘Auto’
  9. Click ‘Add’
  10. Now click open and login to your server as normal.
  11. You’ll now be able to open the crashplan desktop and configure your server.

Before you can begin backing up to your linux machine, you’ll also need to configure your linux firewall to allow connections to ports 4200 and 4243. You’ll need to allow both tcp and udp connections on port 4200.

On centos, add these lines to your /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -p tcp -m tcp –dport 4200 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp –dport 4243 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp –dport 4200 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp –dport 4243 -j ACCEPT

Right before this line:

-A RH-Firewall-1-INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT

CentOS – Installing GNOME with yum

For me, Linux is a server os and a gui doesn’t belong on a server.
(unless its a vmware server, hense the post on installing gnome)

Here is a one-liner that will add GNOME to your box.

Log in as root and run:

yum groupinstall “X Window System” “GNOME Desktop Environment”

Note: Yum will need to download about 250MB of stuff to install via this method.