Jaime Frutos Morales's blog

30/03/2011

Tip: Learning VIM with vimtutor

Filed under: Linux — acidborg @ 12:41

If you are interested in learning VIM (VI iMproved) basics, you should try vimtutor,an easy and nice VIM tutorial.

Installation:

  • Debian based distros: apt-get install vim vim-runtime
  • Red Hat based distros: yum install vim-enhanced

Use:

  • Just type vimtutor to get started.
  • You can also specify the language in which the tutorial is written using vimtutor [2-letters language code]. Example: vimtutor es

Enjoy VIM!

07/03/2011

TIP: Configuring a scanner in VirtualBox

Filed under: Virtualization — acidborg @ 13:32

Yesterday, I spent a couple of hours finding out why a HP Deskjet 2050 wasn’t working on a virtualized Windowx XP using VirtualBox. It seems that VirtualBox’s scanner support is far from complete, so some scanners aren’t supported at all. I was lucky and I could manage my scanner to work.

TIP: If you disable the “Enable USB 2.0 (EHCI) Controller”, some scanners may run on a virtualized Windows XP.

VirtualBox disable EHCI USB 2.0 (EHCI) Controller option

30/12/2010

How to connect to Cisco devices via serial port using GNU/Linux

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

Description: to connect your computer to a Cisco device via its console port, you usually need a RJ45 rolled cable. You can use a RJ-45 to DB-9 Female if your computer has a serial port.

RJ-45 to DB-9 Female

To communicate through the serial port with the Cisco device, you need Minicom, a terminal emulator software.

Installation:

  • Debian/Ubuntu based distros: sudo apt-get install minicom
  • Red Hat/Fedora based distros: sudo yum install minicom

Steps:

  1. Check whether your serial port is detected by the kernel: dmesg | grep ttyS

    [ 0.485378] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
    [ 0.485739] 00:07: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
  2. Run Minicom: sudo minicom
  3. Press Ctrl+A Z to enter Minicom’s menu.
  4. Press O to enter configuration submenu.
  5. Enter the serial port setup.
  6. Set the serial device (/dev/ttyS0 in this example).
  7. Press E to set the “Bps/Par/Bits”.
  8. Press C (9600 bps) and Q (8-N-1).
  9. Set software flow control to NO.
  10. Save the configuration as “cisco” (for example)
  11. Press Q to quit Minicom
  12. Run Minicom with the new configuration: sudo minicom cisco

Tip: if you need to send a “Break” through Minicom (on a password recovery operation, for example), use Ctrl+A F .

22/12/2010

How to force a file system check on the next reboot on GNU/Linux

Filed under: Linux, SysAdmin — acidborg @ 14:52

Description: sometimes you need to force a file system check after you reboot your computer. This can be done in two ways:

If you are going to reboot right now:

  • Execute this command (the -F argument forces a file system check): sudo shutdown -Fr now

If you aren’t going to reboot right now:

  • Execute this command: sudo touch /forcecheck
  • Next time you reboot or start your computer, a file system check will be performed.

Alternatively, if you want to avoid a file system check, use this command to reboot your machine: sudo shutdown -fr now

19/12/2010

I passed my CCNA exam!

Filed under: Studies, SysAdmin — acidborg @ 18:19

Last Friday, I passed my CCNA exam.

CCNA certification

I would like to thank GNS3‘s developers and community for their great work.

15/12/2010

The Humble Indie Bundle #2

Filed under: Linux — acidborg @ 00:37

The Humble Indie Bundle strikes back. As I did before, I’ve already contributed by purchasing my copies of their cross-platform games (GNU/Linux, Windows, Mac).

I totally recommend them.

14/10/2010

How to bind a process to a specific CPU(s) on GNU/Linux

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

Disclaimer: This recipe is focused on SMP computers only.

Description: CPU affinity is a scheduler property that binds a process to a given set of CPUs on the system, so that the system scheduler won’t run this process on any other CPUs. By default, the scheduler tries to keep processes on the same CPU as long as it makes sense for performance reasons, so forcing CPU affinity is useful only in some cases (per processor licensing, testing, broken hardware, etc).

CPU affinity is represented as a bitmask (given in hexadecimal), with the lowest order bit corresponding to the first logical CPU and the highest order bit corresponding to the last logical CPU. Examples:

  • CPU #0: 0x00000001
  • CPU #1: 0x00000002
  • CPU #2: 0x00000004
  • CPU #3: 0x00000008
  • CPU #0 and CPU #1: 0x00000003
  • CPU #2 and CPU #3: 0x0000000C
  • All CPUs: 0xFFFFFFFF

Taskset is a command used to set or retrieve the CPU affinity of a running process given its PID or to launch a new command with a given CPU affinity.

Installation:

  • Debian/Ubuntu systems: sudo apt-get install util-linux
  • Red Hat/ Fedora systems: sudo yum install util-linux

Usage:

  • Retrieve the CPU affinity of a running process: taskset -p PID
    Example:
    taskset -p 1276
    pid 1276's current affinity mask: 3
  • Set the CPU affinity of a running process: taskset -p MASK PID
    Example:
    taskset -p 0x00000001 9030
    pid 9030's current affinity mask: 3
    pid 9030's new affinity mask: 1
  • Run a new command with a given CPU affinity: taskset MASK COMMAND

You can check if taskset is working using top and pressing “1” to show all CPUs.

13/10/2010

How to configure mod_deflate for Apache on Ubuntu 10.10

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

Description: mod_deflate is an Apache module which “provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.” (from its web). This means that you save some bandwidth in exchange for some CPU cycles compressing the data your Apache server sends.

Installation: If you have Apache installed, you don’t need additional packages, because this module belongs to the package “apache2.2-common“.

Configuration:

  1. Enable the mod_deflate module: sudo a2enmod deflate
  2. Edit /etc/apache2/mods-enabled/deflate.conf with the following content:
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript application/javascript application/ecmascript application/rss+xml text/x-js
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  3. Restart Apache: sudo /etc/init.d/apache2 restart

NOTE: There are some old versions of some browsers which don’t support this kind of compression, although it’s included in RFC 2616 (HTTP/1.1). http-compression.com has more info about it.

11/10/2010

How to upgrade from Ubuntu 10.04 (Lucid) to Ubuntu 10.10 (Maverick)

Filed under: Linux, Ubuntu — acidborg @ 11:47

The upgrade is similar to the previous ones:

  1. Replace “lucid” for “maverick” in /etc/apt/sources.list : sudo sed -i 's/lucid/maverick/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

08/10/2010

How to install and configure Ganglia on Red Hat Enterprise Linux 5

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

Description: Although Gangliais a scalable distributed monitoring system for high-performance computing systems such as clusters and Grids” (from its web), I’m going to explain how to set up Ganglia as a monitoring system for a group of computers which are neither part of a cluster nor a grid. Ganglia has very low per-node overheads and high concurrency, which makes it perfect to monitor a huge group of servers. I’m going to use one server to collect all data from the nodes. The collector server will run the web front-end for simplicity reasons, although you can install the web front-end on any other server if you need it.

Installation:

  1. Add the EPEL repositories to your systems.
  2. Install the data collector (gmetad), the monitoring daemon (gmond) and the web front-end on the collector server: yum install ganglia ganglia-gmetad ganglia-web ganglia-gmond
  3. install gmond on each node you want to monitor: yum install ganglia ganglia-gmond

Configuration on the collector server (for example: collector.mycompany.com):

  1. Edit /etc/gmetad.conf and modify the line which begins with “data_source“. Example:
    data_source "my servers" 60 localhost

    This will collect data from the groups of machines tagged as “my servers” every 60 seconds. It will use localhost as the source of the info.

  2. Edit /etc/gmond.conf and modify the following part:
    cluster {
    name = "my servers"
    owner = "unspecified"
    latlong = "unspecified"
    url = "unspecified"
    }
    udp_send_channel {
    host = collector.mycompany.com
    port = 8649
    }
    udp_recv_channel {
    port = 8649
    }
    tcp_accept_channel {
    port = 8649
    }

    This allows collector.mycompany.com to receive monitoring data from every node on port 8649(UDP).

  3. Restart the collector daemon (gmetad): service gmetad restart
  4. Restart the node daemon (gmond): service gmond restart

Configuration on each node you want to monitor (except collector.mycompany.com):

  1. Edit /etc/gmond.conf and modify the following part:
    cluster {
    name = "my servers"
    owner = "unspecified"
    latlong = "unspecified"
    url = "unspecified"
    }
    udp_send_channel {
    host = collector.mycompany.com
    port = 8649
    }
    /*udp_recv_channel {
    }
    tcp_accept_channel {
    }*/

    This tells gmond to send the info to collector.mycompany.com on port 8649(UDP).

  2. Restart gmond: service gmond restart

After a few minutes, you will have your monitoring data available through: collector.mycompany.com/ganglia .

Older Posts »

Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 41 other followers