You are currently browsing the System Administration category
Displaying 11 - 20 of 21 entries.

GRUB: Change Splash-screen

  • Posted on July 26, 2014 at 02:37

SPLASH-SCREEN

  • Make sure you make it with GIMP Creating with Photoshop and saving (in different formats) never worked for me. Even opening the Photoshop-image with GIMP and saving it afterwards was not good enough for GRUB.
  • You can place the image everywhere. If you want to place it with the original grub-splashes, this is a good place: /usr/share/images/desktop-base.
  •  Then edit /etc/default/grub. Add the line:
GRUB_BACKGROUND="your_image.jpg"
  • Update GRUB
# update-grub2

 

GRUB-MENU

  •  Create a file called /boot/grub/custom.cfg and add the lines:
set color_normal=light-black/black
set color_highlight=white/black

 

MENU-ENTRIES

Maybe you would like to change the menu entries:
Edit /etc/grub.d/10_linux
(You can find them starting with title=. I added LISA for this example)

linux_entry ()
{
  os="$1"
  version="$2"
  recovery="$3"
  args="$4"
  if ${recovery} ; then
    title="$(gettext_quoted "LISA %s, with Linux %s (recovery mode)")"
  else
    title="$(gettext_quoted "LISA %s, with Linux %s")"
  fi

 

And then when you reboot things may look like this:
(If you’re lucky)

lisa_grub_splash

 

REFERENCES

 

 

Clone Debian over SSH using Rsync

  • Posted on January 5, 2014 at 03:11

A simple walk-through

On the target machine:

  • Net-install the same Debian-distro with Graphical User-Environment and SSH-Server
  • Boot that the new installed Debian OS
  • Install some tools:
    # apt-get install rsync parted htop xfsprogs
  • If you feel like it: Make a separate /home – partition, mount it, and add it to you /etc/fstab
  • Secure your fstab:
    # cp /etc/fstab /boot/_etc_fstab
  • Start the SSH-Server:
    # /etc/init.d/ssh start
  • Get the target IP:
    # ifconfig -a eth0

 

On the original machine:

  • Go cloning:
    # rsync -aAXv --delete --progress --exclude={/boot/*,/dev/*,/mnt/*,/proc/*,/sys/*,/tmp/*,/run/*,/media/*,/lost+found} --rsh='ssh -p22' /* root@ip-target-machine:/

 

Go back to your target machine and copy back your fstab and reboot:

  • Restore your fstab:
    # cp -f /boot/_etc_fstab /etc/fstab
  • Reboot:
    # shutdown -r now

Have fun with your fresh Debian install!
Well fresh… “Your already configured Debian install”.

Don’t forget to re-install your VMware-Tools! Your GRUB may needs updating for some extra kernel-parameters.

 

ZFS: Deduplicating is not a myth!

  • Posted on February 9, 2013 at 20:44

Long time no see!

After having it put away for, I guess almost 2 years, I took a look at ZFS again.
In ‘the early days’ ZFS only had a Linux-implementation using FUSE. An implementation which I liked from a Nerdish point-of-view, but not so much as a serious replacement for XFS on my operational Linux machines.

Since SSD is commonly available now, and all my operational servers have at least 16 cores, it was time to reevaluate the possibilities of ZFS on Linux again.

I was not disappointed! My oh my…

 

The ZFSonLinux Gentoo 64bit Walk-through:
(Using VMware Fusion 5)

  • Create a Gentoo Linux 64bit VM, add 4GB RAM at least, and the disks:
  • 1 Boot disk, 80GB
  • 4 Data disks, each 2TB. Single file, Do not Preallocate diskspace! Important!
  • 1 Cache disk, 20GB. Preallocating is advised. Not necessary.
  • Install Gentoo
  • Install sys-fs/zfs sys-fs/zfs-kmod
  • add ‘modules_3_6=”zfs”‘ to /etc/conf.d/modules
  • insmod /lib64/modules/3.6.11-gentoo/addon/zfs/zfs/zfs.ko
  • zpool create deduptestvol raidz -f /dev/sdf /dev/sdg /dev/sdh /dev/sdi
  • zpool add -f deduptestvol cache /dev/sdj
  • zfs set atime=off deduptestvol
  • zfs set dedup=on deduptestvol

The ZFS-volume, named deduptestvol, should be up and running right now. Typically it is mounted automatically under /.
Let’s check:

 

Testing the dedup-capabilities

  • I made one volume, with the same size, also RAIDZ
  • Created one file of exactly 1000MegaBytes
    (# dd if=/dev/random of=/data bs=100M count=10)
  • Copied that file over for 32 times
  • Then I copied that whole directory to the volume with deduplicating switched on.
  • On my host machine, I took a look a the disk space consuming.

Some proofs

Some recursive MD5’s over both volumes:

 

Conclusion

For saving 32Gigabyte of data in traditional RAID5:

The ‘normal’ ZFS-Volume consumed 44G of virtual disk-space.
The Deduplicated ZFS-Volume consumed 3.6G of virtual disk-space.

“ZFS is the shit!”

PostgreSQL, Perl and Ubuntu

  • Posted on December 25, 2011 at 22:59

Make it work

# apt-get install postgresql postgresql-contrib
# apt-get install libpq-dev
cpan> install DBD::Pg
$ sudo su postgres -c psql template1 template1=# ALTER USER postgres WITH PASSWORD 'password'; template1=# \q
$ sudo passwd -d postgres
$ sudo su postgres -c passwd
$ sudo su postgres -c psql < /usr/share/postgresql/8.4/contrib/adminpack.sql

Knowing your dynamic IP-address

  • Posted on July 25, 2011 at 18:53

The troubling situation
Being a nerd, there is nothing more frustrating than having a dynamic IP-address.
Being a nerd and doing some hosting locally actually makes it even wors!

There’s not much use to running services like Apache or Sendmail with an IP-address that changes at random times.
Random in this particular case means: “When we of Ziggo want it to!”.

Alert by email
So what you basically want is to be alerted whenever you IP has changed.
I wrote some perl-code that does exactly that! And as a bonus, it does some handy logging.
The script can be initiated from command-line, but the best way is making a cronjob of course.

Realworld example
I created two new e-mailadresses; newipkrusjme@gmail.com and newipkrusjme@hotmail.com. Both addresses are now configured on my iPhone to receive all mail automatically,
In the cron, I set it to run as an hourly-job,
And then I did “the Dutch approach“…

Sourcecode
Thanks to Vim it was quite easy to make the sourcecode readable using :TOhtml.
If you love to see the amazing Vim-output or you’re actually seriously interested: You can find the sourcecode here: http://www.krusj.nl/files/newip-2.0.pl.html
Download directly: http://www.krusj.nl/files/newip-2.0.pl

Installing

  • download the script, (for example to /usr/local/bin)
  • change the email-addresses to your preferred ones,
  • change the interface-card, (eth1, eth0 or whatever)
  • mkdir /var/log/newip /var/newip,
  • chmod 755 /usr/local/bin/newip-2.0.pl,

Testing / Forcing
If you want to test it, just run the script from command-line using:
# /usr/local/bin/newip-2.0 --force-mail

Processes and ports

  • Posted on July 19, 2011 at 08:04

Ever wondered which process is behind which port? Well, I do pretty often!
And also pretty often I have to look it up again…
Let’s change that for once and for all!

Here’s a really obvious example with port number 80 in use by Apache. (Such a surprise!)

Netstat: The syntax
# netstat -a -n -p | egrep 'Proto|LISTEN' | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1840/apache20

 

Forcing open doors
This output shows that Apache2.0 runs with PID 1840 and it’s listening to port 80.

After this I did a ‘ps aux | grep 1840’ and it turned out to be true! 🙂

 

 

CPAN, MacPorts and Eclipse: The hard-life

  • Posted on January 24, 2011 at 10:21

Developing machine configuration
My workstation is an Apple MacPro, running Snow Leopard. And I do my developing in Eclipse. For me undoubtedly the number one IDE. The Perl-support is really fantastic.
Unless you installed MacPorts!

Description
Although I was sure I installed the used CPAN-Modules, Eclipse kept complaining about not able to find them, blablabla….
Eclipse Error: Can't find CPAN Module

Cause
MacPorts installed it’s own Perl! Although not necessarily, it can happen easily. With a little bit of playing around in MacPorts, it’s quite probable than MacPorts installed it’s own Perl. Although it really isn’t a big issue in everyday use. (I never ran into any trouble, so far) it may result in Eclipse fooling you.
Because since my OS now by default uses the MacPorts version of Perl, it will also use the CPAN that’s installed by MacPorts. And, once again: It works just fine!
The only trouble is Eclipse. Eclipse, or actually E-P-I-C, still only looks in the default Perl search-paths.
So if you install a new module using CPAN when MacPorts has installed Perl, it will install that new module in the MacPorts-CPAN-Path, and not in the default OSX-CPAN-Path. That’s all!

Remedy
Just install your CPAN module also in the default OS X-Path using the absolute path.
Example:
$ sudo /usr/bin/cpan
cpan> install Archive::TarGzip
cpan> reload cpan
cpan> exit

Now restart your Eclipse….
Problem solved!

/etc/fstab and bind-mount

  • Posted on January 17, 2011 at 03:22

I use a Software RAID0 for data
And on this software-raid-volume, there are my MySQL-Databases, /home and other stuff that should be fast…
And, like all volumes, this software-raid-volume is mounted during boot-time.
But since my /home is also on that volume, it should be mounted using a bind-mount.
So first there is a mount using a mdadm: /dev/md127 -> /mnt/data,
And second there is a mount using bind-mount /mnt/data/home -> /home

It took me quite a while to figure out how to get this done at boot-time, but I managed!
Here’s what my /etc/fstab looks like:

# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed; notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.


# <fs>            <mountpoint>    <type>        <opts>        <dump/pass>


# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
LABEL=boot        /boot        ext2        noauto        1 2
#/dev/sda3        /boot        ext2        noauto        1 2


LABEL=root        /        ext3        defaults    0 1
#/dev/sda4        /        ext3        noatime        0 1

# DATA
LABEL=data        /mnt/data    ext3        defaults    0 1

# HOME (bindmount)
/mnt/data/home         /home        bind        defaults,bind    0 0


# SWAP like RAID0. The higher the value the higher the priority. (max=32767)
/dev/sda5        none        swap        sw,pri=1    0 0
/dev/sdb5        none        swap        sw.pri=1    0 0

#/dev/cdrom        /mnt/cdrom    auto        noauto,ro    0 0
#/dev/fd0        /mnt/floppy    auto        noauto        0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink).
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
#  use almost no memory if not populated with files)
shm            /dev/shm    tmpfs        nodev,nosuid,noexec    0 0
proc            /proc        proc        defaults        0 0

For the attentive readers:
Yes, I did put my boot on a separate partition. And getting this done on a PowerMac G5 is quite an exhibition! Maybe someday, someday I’m gonna blog about that too!

rsync and cp -r

  • Posted on January 12, 2011 at 16:34

Since I lately had to do a lot of data-migrating stuff, I made myself an alias for rsync and I use it as recursivecopy-command. Works great! Write this down… 🙂

Alias
# alias rcp='rsync --owner --group --perms --times --archive --recursive --progress'

Some advantages

  • No worries about accidentally overwriting important files
  • No struggle with long syntaxis anymore
  • Same syntaxformat as cp
    Example: # rcp -v /home/user1/* /home/user2/*
  • Progress indicator
  • Retaining file permissions and ownerships
  • Very forgiving with interruptions!
    You can hit CTRL-C without any risk. Just restart your rcp-action. And it will continue where it left of…

And sure you can add this alias to the bashrc, the .bash_profile, and so on….

SABnzbd and Gentoo

  • Posted on January 11, 2011 at 01:15

Apparently the portage-tree doesn’t contain SABnzbd. Too bad! I really needed some binary newsgroup downloader. And I did have some experience with running it on my local machine, a MacPro. Wonderful App! Or tool, or server, or whatever…

But there I was, left alone, helpless and disillusioned…
What to do now?

Well, basically…… This!
(keep in mind, I’m using a PPC64)

Installing
Edit /etc/portage/package.keywords, and add:
# SABnzbd
dev-python/* **
app-arch/par2cmdline *

And now run (not specifically in this order):

# emerge dev-python/pysqlite
# emerge dev-python/cheetah
# emerge dev-python/pyopenssl
# emerge sqlite
# emerge par2cmdline
# emerge unrar

Download the SABnzbd-sources:

# wget http://sourceforge.net/projects/sabnzbdplus/files/sabnzbdplus/sabnzbd-0.5.6/SABnzbd-0.5.6-src.tar.gz

Unzip/Unpack SABnzbd.zip to an appropriate directory,
cd into newly made directory,
Edit /.sabnzbd/sabnzbd.ini, and change the host-value ‘localhost’ to 0.0.0.0,
Now run SABnzbd.py and you can configure the rest of SABnzdb using your browser, (Ahhhhh….)

# ./SABnzbd.py

Security
Although this post isn’t about security, be aware that in this particular example SABnzbd is now running as root. And that ain’t necessary at all!

It is possible, and advised by me ;-), to create a sabnzbd-user, and let it run under that newly created sabnzbd-account.
Naturally, you have to do some chowning to the SABnzbd-directory. (Also to the .-directories which are ignored by default by chown!)

Fun stuff
Further more a tip for extra fun and carefree usage:
Create a SABnznbd-writeable directory /var/log/sabnzdb,
In the sabnzbd.ini in the ./sabnzbd-dir: Change the logdir (logs) to /var/log/sabnzbd

You are maybe asking yourself: “What’s the fun of that?”
Well, just take a look at xtail.pl, and you’ll find out!