19
06
2009
I found myself in a situation where I had a cd-less client with 512mb HDD and FAI didn’t work.. So I some how had to install a minimal system from a usb-live USB stick.
The following steps work quite nicely…
create new client with debootstrap
• boot from a live cd (debian, sidux, lxce, ubuntu, whatever)
• create partitions on HD: fdisk /dev/hda
• format (mind the swap space!): mkfs.ext3 /dev/hda1; mkswap /dev/hda2
• install debootstrap: apt-get install debootstrap
• mount partition: mount /dev/hda1 /mnt
• debootstrap: debootstrap lenny /mnt
• mount proc to chroot env: mount -t proc proc /mnt/proc/
• chroot : LANG=C chroot /mnt/ /bin/bash
• make devs: cd /dev; MAKEDEV generic
• edit fstab: /dev/hda1 / ext3 relatime,errors=remount-ro 0 1
• setting time zone: dkpg-reconfigure tzdata
• configure network auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
• edit resolv.conf if necessary
• edit hostname: echo “min-virtual” > /etc/hostname
• edit /etc/hosts
127.0.0.1 localhost min-virtual
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
• configure apt
deb http://ftp.nl.debian.org/debian lenny main
deb-src http://ftp.nl.debian.org/debian lenny main
deb http://security.debian.org/ lenny/updates main
deb-src http://security.debian.org/ lenny/updates main
• run apt update: aptitude update
• install locales: aptitude install locales
• configure locales: dpkg-reconfigure locales
• edit /etc/kernel-img.conf
# Kernel image management overrides
# See kernel-img.conf(5) for details
do_symlinks = yes
relative_links = yes
do_bootloader = yes
do_bootfloppy = no
do_initrd = yes
link_in_boot = no
• install a kernel (apt-cache search linux-image |grep x86): apt-get install linux-image-486
• install bootloader: apt-get instal grub
• install grub to disk: grub-install /dev/hda
• update menu.lst: update-grub
• install extra packages: apt-get install htop openssh-server tshark elinks
• create /media dir and symlinks
cd /media
mkdir cdrom0
ln -s cdrom0 cdrom
cd /
ln -s media/cdrom
If you booted from a live cd, say sidux, and you want the hd install to contain the same, you can you dpkg –get-selections to get a list of installed packages on the live-cd. Output this list to a file within the chroot env. chroot to the env and then install the packages with
dpkg --get-selections < filename
apt-get dselect-upgrade
Mind that this will NOT transfer any config!!!
Based upon:
http://www.debian.org/releases/stable/i386/apds03.html.en
http://www.debian-administration.org/articles/426
Comments : No Comments »
Categories : Coagulations
12
03
2009
I found this font, and again, its pcf… Thats should be hard right, installing a font? I’m running ubuntu!
hmmm…..no.. its hard.. but you DO have to know what to do!
cp fonts.pcf.gz ~/.fonts
sudo apt-get install xfs
xset fp+ ~/.fonts
xset fp rehash
sudo dpkg-reconfigure fontconfig-config
Chose: Autohinter, Automatic, Yes
sudo dpkg-reconfigure fontconfig
fc-cache -f -v
sudo /etc/init.d/gdm restart
(Thanks jbo5112!)
Comments : 2 Comments »
Categories : ubuntu
16
01
2009
define client : the machine that needs access to the remote machine
define server: the remote machine
You need to add the public-key from the client to the authorized keys of the server.
so, in one line:
client machine (edit the server var):
server=<IP/HOSTNAME>; ssh-keygen -t rsa ; scp .ssh/id_rsa.pub $server:.ssh/ ; ssh $server "cat .ssh/id_rsa.pub >> .ssh/authorized_keys"
which does:
generate keypair; scp pub file to server; ssh to server: execute remote cmd to cat pub key to autorized_keys:
Comments : 2 Comments »
Categories : Coagulations
14
08
2008
vi… g/^.*.[0-9]$/d or g/[0-9]$/
delete all lines ending in a number..
g/^.*.humbs.*.$
delete all lines containing “humbs”
Comments : No Comments »
Categories : Coagulations
1
08
2008
The question:
You have 1 line of the password file in a variable, and you need only the username, how would you do this?
My answer:
I’d use a sed, or a awk with a “:” as a field seperator, since the password file is colon seperated
Their next question:
And how would you do it in 1 procces? since now you need to launch sed or awk?
Errmm, I dunno?
Turns out, echo can do string manupulation! doh?!!
test="this:is:a:test"
echo ${test#*:}
# everything after the first colon, outputs is:a:test
echo ${test#*:}
# everything after the last colon, outputs test
echo ${test%:*}
## everything before last colon, outputs this:is:a
echo ${test%%:*}
## everything before firstcolon, outputs this
echo ${PWD##*/}
# everything after the last /, outputs basename of current dir
${var%Pattern}, ${var%%Pattern}
{$var%Pattern} Remove from $var the shortest part of $Pattern that matches the back end of $var.
{$var%%Pattern} Remove from $var the longest part of $Pattern that matches the back end of $var.
Some more parameter substiution magic
Comments : No Comments »
Categories : Coagulations
1
08
2008
list all files NOT starting with “a”ls -l [^a]*
list all files that DO start with “a” ls -l [a$]*
list all files ending with “k” to “z” ls -l *[k-z$]
list all files NOT ending with “k” to “z” ls -l *[^k-z]
you can offcourse use rm , cp or mv just as easily as ls with this neat little trick!
Comments : No Comments »
Categories : one liners
31
07
2008
Say what!!?
ever found yourself retyping commands because of a typo?
Sure, in bash you can press page up, edit the command and <enter> it again. But thing can be done quicker! (as always)
you can use “!!” to repeat the last command.. and not only that, you can add or edit whatever is in !! !
Say, your logged on as a user, and you want to restart mysqld
/etc/init.d/mysqld restart
Doh! im not root!
sudo !!
Ah! much better…
sudo vu /etc/hosts
Doh! typo!
!!:s/vu/vi
Tsjatsjing!
isnt that great? I think it is..
Comments : No Comments »
Categories : Coagulations
28
02
2008
how about getting a detailed listing of your hardware?
(hwmgr on Tru64 )
sudo lshw
You can get specific details by using the -C flag, this will list all you hard disks:
$sudo lshw -C disk
It create an html page with your hardware details if you do a:
$sudo lshw -html > your-file-name.html
Thanks Carthik
Comments : No Comments »
Categories : ubuntu
22
02
2008
I’ve updated the .netrc page, on How To add a GUI to your FTP scripts.
its right here..
Comments : 1 Comment »
Categories : Coagulations
22
02
2008
ls -la |awk ‘ /<USER>/ {cmd=”rm “$9; print “removing : “cmd; system(cmd)}’
delete any files of user <USER>.
Comments : 1 Comment »
Categories : one liners, scripts