Jaime Frutos Morales's blog


How to automatically start KVM virtual machines on boot

Filed under: Linux, SysAdmin, Virtualization — acidborg @ 13:18

Description: when you have a host machine running KVM and it runs several guests (virtual machines), it’s very useful to make them start on boot so that you don’t have to start them manually.

Just execute the following command for each guest you want to autostart on boot: virsh autostart guest_name .



How to synchonize your Ubuntu 10.04 desktop with a NTP server

Filed under: SysAdmin, Ubuntu — acidborg @ 12:21

Description: On my previous post, I explained how to install and configure a NTP server on your local network. Now I’m going to explain how to synchronize an Ubuntu 10.04 computer with your local NTP server.

Installation: apt-get install ntpdate


  1. Create the file /etc/cron.d/ntpdate.cron with the following content (modifying “your-ntp-server” with the name or IP address of your NTP server):
    15 */1 * * * root /usr/sbin/ntpdate your-ntp-server &> /dev/null
  2. This will synchronize your computer’s clock with the NTP server every hour. If you want to increase the synchronization period, increase the “/1”. For example: Use 15 */6 * * * root /usr/sbin/ntpdate your-ntp-server &> /dev/null to synchronize your computer’s clock every 6 hours.
  3. Set the proper owner and permissions for the created file: chmod 600 /etc/cron.d/ntpdate.cron && chown root:root /etc/cron.d/ntpdate.cron


How to install and configure a NTP server for your network on Ubuntu Server 10.04

Filed under: SysAdmin, Ubuntu — acidborg @ 13:29

Description: The Network Time Protocol (NTP) is a protocol for synchronizing the clocks of computer systems over a network. It is very useful if you want all the computers on your network to share the same time because file accesses, logs, tasks, etc will be synchronized. I’m going to explain how to install a NTP server on your network so that the rest of computers can synchronize with it.

Installation: apt-get install ntp


  1. Go to www.pool.ntp.org, select your continent on the Active servers list and your country (or the nearest one) on the next list.
  2. You will be given a list of public NTP servers to synchronize your server with. For example, if you live in Spain, you will be given the following list of NTP servers: server 2.es.pool.ntp.org , server 0.europe.pool.ntp.org , server 2.europe.pool.ntp.org .
  3. Edit your /etc/ntp.conf file using the list of servers you were given:
    server 1.es.pool.ntp.org
    server 0.europe.pool.ntp.org
    server 2.europe.pool.ntp.org
    restrict -4 default kod notrap nomodify nopeer noquery
    restrict mask nomodify notrap noquery
    driftfile /var/lib/ntp/ntp.drift
  4. Change the line “restrict mask nomodify notrap noquery” with your subnet IP and netmask.
  5. Restart your NTP server: /etc/init.d/ntp restart

Some seconds later, your NTP server will begin to synchronize with the external time servers. It may take a couple of minutes to get your computer’s clock synchronized, so please be patient. You can check your NTP server’s stats and status with the following command: ntpq -p .

NOTE: your NTP server must be reachable on port 123 (UDP) from the remote time servers, so make sure your firewall allows it.

On my next post, I will explain how to synchronize your GNU/Linux computers with the NTP server you have just installed.


How to install and configure Apt-Cacher NG on Ubuntu Server 10.04

Filed under: Linux, SysAdmin, Ubuntu — acidborg @ 13:34

Description: Apt-Cacher NG is a caching proxy specialized for package files from GNU/Linux distributors, primarily for Debian and Debian based distributions (like Ubuntu). This means that if you have many Debian/Ubuntu machines on your network, you just have to download the deb packages (new software, updates, distro upgrades, etc) from the internet once and the rest of the Debian/Ubuntu machines get them from Apt-Cacher NG cache, saving time and internet bandwidth. To install it, follow these simple steps:


  1. Installation: apt-get install apt-cacher-ng
  2. Configuration: Edit /etc/apt-cacher-ng/acng.conf with the following content:
    CacheDir: /var/cache/apt-cacher-ng
    LogDir: /var/log/apt-cacher-ng
    Remap-debrep: file:deb_mirror*.gz /debian ; file:backends_debian
    Remap-uburep: file:ubuntu_mirrors /ubuntu ; file:backends_ubuntu
    PidFile: /var/run/apt-cacher-ng/pid
    ExTreshold: 4
  3. Restart Apt-Cacher NG: /etc/init.d/apt-cacher-ng restart
  4. Create on the rest of the Debian/Ubuntu machines on the network the file /etc/apt/apt.conf.d/02proxy with the following content:
    Acquire::http { Proxy "http://your-apt-cacher-ng-server:3142"; };

Next time any of your machines needs a deb package, it will ask Apt-Cacher NG for it. If this package was asked previously by any of the other machines, Apt-Cacher will have a copy and will deliver it. Otherwise, it will fetch it from the internet repositories, keep a local copy and deliver it.


How to lock a RPM package installed on Red Hat 5

Filed under: Linux, SysAdmin — acidborg @ 13:17

Description: if you have a RPM package installed and you want to lock its version (you don’t want to update it even if a newer version is available), there is a yum plugin which can do this for you: yum-versionlock


  1. Install the plugin: yum install yum-versionlock
  2. Enable it: make sure enabled = 1 appears in /etc/yum/pluginconf.d/versionlock.conf
  3. Add the packages you want to lock to /etc/yum/pluginconf.d/versionlock.list , including version and architecture. For example: nagios-plugins-1.4.11-1.el5.rf.x86_64
  4. Test it by trying to update a locked package: yum update nagios-plugins


Book Review: Samba 3 by Example

Filed under: Books, Linux, SysAdmin — acidborg @ 20:57

Last week, I finished reading “Samba-3 by Example. Practical exercises in successful Samba deployment” by John H. Terpstra.
Samba 3 by example
What makes this book worth reading is the approach that the author makes to the different configurations of a Samba network depending on the users’ requisites, the available hardware and the expertise of the sysadmin. He starts with a basic Samba installation on a simple network, with a few users and no security and he evolves this study case until it reaches advanced topics like migrations from Windows and NetWare networks to Samba or integrating Samba with Microsoft’s Active Directory).

I strongly recommend this book if you are a Samba sysadmin or you are thinking about deploying Samba on your network, because it contains many tips and ideas to design your Samba network or improve your existing one.

You can download it (PDF format) from here for free.


The Humble Indie Bundle

Filed under: Linux — acidborg @ 20:17

As I did on this previous post, I’d like to support this cross-platform games initiative called “The Humble Indie Bundle“. It sells 5 cross-platform games (GNU/Linux, Windows, Mac) and you can pay whatever you want for them. You can even choose if you want to donate part of the money (or all of it) to Child’s Play charity or Electronic Frontier Foundation.

I think it’s worth it.


How to upgrade from Ubuntu 9.10 (Karmic) to Ubuntu 10.04 (Lucid)

Filed under: Ubuntu — acidborg @ 20:03

This post is a modified “déjà vu” of a previous one.

  1. Replace “karmic” for “lucid” in /etc/apt/sources.list : sudo sed -i 's/karmic/lucid/g' /etc/apt/sources.list
  2. Upgrade your system: sudo apt-get update && sudo apt-get -y dist-upgrade
  3. Reboot: sudo shutdown -r now


How to automatically download your favourite TV series on Ubuntu 9.10

Filed under: Linux — acidborg @ 21:00

Description: I’m going to explain how to automatically download your favourite TV shows using showRSS, Transmission and Flexget.


  1. Register at showRSS and add your favourite TV series.
  2. Go to the “feeds” section and generate your feed address.
  3. Download the latest transmission-common and transmission-gtk packages from here.
  4. Install them: sudo dpkg -i transmission*.deb
  5. Modify $HOME/.config/transmission/settings.json with the following values:
    "watch-dir": "\/home\/your_user\/Downloads",
    "watch-dir-enabled": true
  6. Go to flexget‘s web and download it.
  7. Install it: sudo easy_install FlexGet*.egg
  8. Edit flexget’s config file: vi $HOME/.flexget/config.yml
    flex's config.yml content
  9. Initialize flexget: flexget --initdb
  10. Edit your crontab to check your feed every hour: crontab -e
    0 * * * * /usr/local/bin/flexget


How to install and use Fabric on Ubuntu 9.10

Filed under: Python, SysAdmin, Ubuntu — acidborg @ 10:59

From its web: “Fabric is a Python library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks. More specifically, Fabric is:

  • A tool that lets you execute arbitrary Python functions via the command line;
  • A library of subroutines (built on top of a lower-level library) to make executing shell commands over SSH easy and Pythonic.

Naturally, most users combine these two things, using Fabric to write and execute Python functions, or tasks, to automate interactions with remote servers.


  1. Download the package from here
  2. Install it: sudo dpkg -i fabric*.deb


  1. Follow this short tutorial to learn the basics.
  2. Create a file called fabfile.py
  3. Fill it with your customized functions. For Example:
    from fabric.api import env, run, sudo
    env.hosts = ['ubuntu1', 'ubuntu2', 'ubuntu3']
    def upgrade_hosts():
    sudo('apt-get update && apt-get dist-upgrade ')
  4. Run fabric: fab upgrade_hosts

I find Fabric very useful and time-saving when maintaining similar servers, because you can design a task and run it automatically on all the servers.

« Newer PostsOlder Posts »

Create a free website or blog at WordPress.com.