Posted by & filed under Debian, Linux, Puppet.

Puppet is a configuration management tool. It is open source and I am a big fan of this tool to configure all my servers. I will show you the really quick and easy way to get your puppet server setup. First of all you need a basic install of a Debian Wheezy 7.0 server, once it is setup you can start.

1. Enable puppet repository to get latest Puppet packages

wget http://apt.puppetlabs.com/puppetlabs-release-wheezy.deb
dpkg -i puppetlabs-release-wheezy.deb

2. Update the packages list

apt-get update

3. Install puppetmaster packages

apt-get install -y puppet puppet-common puppet-el puppet-testsuite \
puppetmaster puppetmaster-common vim-puppet

4. Stop puppetmaster daemon and disable it on startup

kill -9 $(ps aux | grep puppet | grep -v grep | awk '{print $2}')
sed -i "s/START=yes/START=no/g" /etc/default/puppetmaster

5. Install passenger dependency to hook puppetmaster with apache web server

apt-get install -y puppetmaster-passenger

6. Check puppet version

puppet --version

7. Ensure puppetmaster is running

netstat -a | grep 8140
# You should see the line like:  
# tcp        0      0 *:8140                  *:*             LISTEN

You can also go at the address https://your_server_ipaddress:8140/
You will see the message: The environment must be purely alphanumeric, not ” that confirms that your puppetmaster server is running.

It’s done, you are now running your own Puppetmaster server. All the configuration files and your node definition need to be done into the /etc/puppet/ folder. There is also the folder /var/lib/puppet/ that can contain some information like your SSL certificates.

Have fun!

References:
Install puppet client and connect to your puppet master
http://puppetlabs.com/
http://www.debian.org/

Posted by & filed under Virtualization, VMware.

To make it easy to install the VMware tools in a Debian Squeeze 6.0.6 server. Follow these simples steps:

  • From VMware vSphere click Inventory –> Guest –> Install/upgrade VMware tools
  • Mount the iso into Debian 
    mount /dev/scd0 /mnt
  • Copy the Vmware tools tarbal to your home folder 
    cp /mnt/VMwareTools-*.tar.gz ~
  • Install the dependencies 
    apt-get install build-essential linux-headers-$(uname -r)
  • Untar the archive 
    tar zxf VMwareTools-*.tar.gz
  • Move to the VMware tools instalation folder 
    cd vmware-tools-distrib/
  • Install the VMware tools
    • For default option 
      yes "" | ./vmware-install.pl
    • For custom option 
      ./vmware-install.pl

Have fun with VMware.

Posted by & filed under Uncategorized.

I use intensively OpenVZ for my development environment and I was looking for a way to keep track of the history of the bash command I am writing at the console from OpenVZ. I found this pretty neat hack.

Command line fun time!

# Record the bash history using vzctl enter UID
echo 'HISTFILE=~/.bash_history' >> ~/.bashrc
source ~/.bashrc
 
# Get in your home folder after entering the container using vzctl enter UID
echo 'cd' >> ~/.bashrc
source ~/.bashrc

What these to little lines do is pretty cool.

  • First we are redirecting the HISTFILE variable to .bash_history to ensure we can keep track of our command lines.
  • Second when you enter the command vzctl enter 101 you would normally get into the container at the “/” folder. I don’t like it I prefer getting in the home folder of the user. That why by issuing the “cd” within the “.bashrc” file, you are redirected into your home folder.

Enjoy!

Posted by & filed under Command line, Development, Grep, Linux, Python, xargs.

Today I remotely connected to a server I own since a very long time and I wanted to update many of the Python libraries that were installed. I was thinking of a quick and easy way. Be ready I am back at the command line fu here. First if you don’t know the Python app called yolk, it is by time to install it and see how useful it can be.

Command line fun time!

Let’s installed yolk first

pip install -U yolk
# or
easy_install yolk

Try yolk

First yolk help you to query PyPI and Python packages that are installed on your system.

# this will list all the Python libraries inside your pythonpath
yolk -l 
 
# search all the eggs for an update version
yolk -U
 
# search if an egg has an update version
yolk -U Django

Update your Python libraries using a oneliner

yolk -U | awk {'print $1'} | xargs pip install -U
# or
yolk -U | awk {'print $1'} | xargs easy_install

Have fun!

Posted by & filed under Bash, Command line, Debian, Development, DNS, Linux, Python.

I was looking for a way to test a DNS server by sending it a lot of request at the same time. The question I wanted to answer is: Does the DNS server we develop can answer to DNS queries correctly? I found a perl script called dns-grind that gives you the possibility to perform DNS queries in batch. I installed it on a Debian Squeeze box and it tooks only seconds to get it ready. Once installed I looked at the options available and the “-f” option gives you the possibility to pass a file with domain names. Where can I find a file with domain names? I immediately thought about alexa.net and their Top 1 million web site list.

Command line fun time!

First get the domain names list

# Download the zip archive
wget http://s3.amazonaws.com/alexa-static/top-1m.csv.zip
# Unzip it
unzip top-1m.csv.zip

Now what?

Now we have the “top-1m.csv” file, but if you try to open it to see what is inside, you will find something like “<website_ranking>,<domain_name>”. I am interested in the domain name only, so I had to use the “sed” command line to remove the ranking part of the file.

# Use sed to remove the ranking followed by the comma
# and echo the result to the file domainnames.txt
sed 's/\([0-9]*\),//g' top-1m.csv >> ~/domainnames.txt

We have a list of 1M domain names!

Now that I have the domain names list, I can use dns-grind.pl to dig my server with some domain names and see how it will react.

# Query time
./dns-grind.pl -f domainnames.txt A -n="192.168.1.10" -t 1 -d

Now I can test with at least a million domain names the DNS server we develop without having to change my local DNS server to that server.

Enjoy!