Tag Archives: centos

soup to nuts mirroring of centos

I run a CentOS mirror. Have for a couple years.

But I never stopped to see just how long it takes to start becoming a mirror.

In case you wanted to know, I created a quick DO VM and ran the rsync mirror job yesterday. The results? At ~2.5MB/s, it took just over 8 hours to download 79GB of CentOS repositories.


Results came from running:
time rsync -azHv --delete us-msync.centos.org::CentOS /root/centos

Of course, if you want to mirror it “for real”, you should use ‘q’ instead of ‘v’ as an argument for rsync, and you should give it a better path than /root/centos.

You should also setup a webserver to offer the media out to others.

Now you know. And knowing is half the battle.

setting-up etherpad in centos 6

To add to my tutorial collection, here’s how to setup EtherPad on CentOS 6 (x64). As in the IRC tutorial, I used a Digital Ocean VM for this 🙂

What is EtherPad? It’s an open-source collaborative text editor that works like Google Docs – ie, all editors/viewers can see changes from everyone else in realtime.

Here’s how I did it: (props to the EtherPad docs and this other tutorial on Node.js)

  • acquire a CentOS server – I used Digital Ocean
  • make sure you have enough swap space (if you use the smallest Digital Ocean “droplet”, you really need to give yourself 2-4G swap)
    • dd if=/dev/zero of=/swapfile bs=8192 count=524288
    • mkswap swapfile
    • swapon swapfile
    • add this line to the end of your /etc/fstab:
      • /swapfile swap swap defaults 0 0
  • run the following as root:
    • yum -y install gzip git-core curl python openssl-devel && yum groupinstall
    • yum -y install screen gcc gcc-c++ make wget curl
      • note – it’s not always called “gcc-c++”; make sure you use the correct package name for your platform
      • you can find out the correct package name by doing a `yum provides */g++` search
    • yum -y upgrade
      • bring everything up to date – it’s equivalent to `yum -y update –obsoletes`
    • adduser etherpad
    • su – etherpad
    • git clone git://github.com/ry/node.git
    • cd node && ./configure && make && make install
    • cd
    • git clone git://github.com/ether/etherpad-lite.git
    • cd etherpad-lite
    • screen bin/run.sh
  • load in your browser (substitute the IP/DNS name of your server as appropriate – mine was
  • for maintenance purposes, you should also do a `git pull origin` for EtherPad periodically

Some notes on the above:

  • if you already have swap space and/or don’t want to worry about it (though I recommend you do), you can skip it
  • I’ve put the `-y` option after every `yum` call presuming you really mean to run it, and you don’t care about dependencies
    • if you aren’t using a fresh server (EtherPad certainly doesn’t require it’s own), you may want to be a little more cautious about the `yum` commands 🙂
  • you should create a start-up script to ensure EtherPad is running if you need to reboot
  • the EtherPad docs have all kinds of further things you can do – this is just a “get it going and start using it” tutorial 🙂

automatically extract email attachments with common linux tools

I had need to automatically process emails to a specific address to pull attachments out, and this is how I did it:

$ yum install mpack

$ cat extract-attach.sh 
rm -rf ~/attachtmp
mkdir ~/attachtmp
mv ~/Maildir/new/* ~/attachtmp
cd ~
munpack ~/attachtmp/*
rm -rf ~/attachtmp

$ crontab -l
*/5 * * * *	~/extract-attach.sh

Why, you may ask? Because I get a report a few times per day to the email address in question.

Note – this runs in my crontab every 5 minutes on a CentOS 6 x64 server; I’m sure the process is similar/identical on other distros, but I haven’t personally tried.

network install of centos 6

I wanted to try something different when playing with CentOS 6 recently, so I did a network install. Other than one very small detail, the install is identical to installing off a normal ISO.

Here’s the difference:

  1. use the netinstall.iso (eg http://centos.datente.com/media/6/isos/x86_64/CentOS-6.4-x86_64-netinstall.iso)
  2. when it asks for the URL to grab your image from, use something like http://centos.datente.com/media/6/os/x86_64 (make sure it’s the full path (this example is off my mirror for an x64 install))
  3. proceed as usual 🙂