Debian/Ubuntu Sysadmin

From Liki

Jump to: navigation, search

Contents

Debian/Ubuntu Notes

Generic instructions for install / configuring package

An example:

apt-get install dhcpd3-server
dpkg-reconfigure dhcpd3-server

Syncing ubuntu packages from old install to new install=====

Get list of packages on old install

dpkg --get-selections > selections.txt 

Note: If the system is being upgraded to a new install, you do not want to just proceed with this. Repeat the above command on the new install, merge the files (you will get a lot of older stuff...e.g. the new install, say ubuntu 7.10, will have gcc4, the old, say ubuntu 6.10, will have gcc3, and by merging these files, you will have gcc3 and gcc4---however, this may prove useful in the future (trust me on this one). If this is uncool for you, just edit the merged files, but that is tedious.

dpkg --set-selections < selections.txt 
dselect update 
apt-get dselect-upgrade 

a2ps doesn't print so well

The right (or left) margin goes off the paper, and we are sure we have the right ppd for the printer.

Student finds -M Letter works...for some reason a2ps picks a4 even though the printer default is Letter.

Hack---just redefine a4 in /etc/a2ps.cfg with the same units as Letter:

#Medium: A4	    595     842
Medium:  A4         612     792
#Medium: A5	    420     595
#Medium: B4	    729    1032
#Medium: B5	    516     729
Medium: Letter	    612     792

Attack of the cloning program

WARNING: USE AT YOUR OWN RISK

partimage CAN NOT network transmit file sizes greater than around 2Gb.

To copy and clone you need a bootable image, the Ubuntu cd works great as you can apt-get partimage easily (after selecting the universe option in /etc/apt/sources.list).

Getting and runing partimage is easy the first time around. To set up the server, edit /etc/partimaged/partimagedusers and add a user. Put the image in the directory, and give user partimag ownership of that directory and its contents:

chown partimag.partimag *
chmod 0700 *

On the client, adjust the partitions per the golden client:

fdisk

Set up these partitions

mkswap /dev/sda1
mkfs -t ext3 /dev/sda2
mkfs -t ext3 /dev/sda3

You might have to reboot.

Finally, run partimage, supply the ip, etcetera. Works beautifully.

Oh, and don't forget to also restore the mbr (Master Boot Record). Ubuntu live cd has /dev/sda in use for some reason, so I had to copy the mbr from the golden client:

dd if=/dev/sda of=mbr.img bs=512 count=1

On the client (how you get it there is up to you, I just put it on the web and do a wget):

dd if=mbr.img of=/dev/sda

doesn't take dhcp hostname

Not sure about this, did everything in the HOWTO properly but workstation doesn't know its own hostname from DHCP.

I'll have to come back to it later (when I reinstall the dhcp server) but for now fixed with script. I found the following cool command to get the ip address from the ['http://www.forbiddenweb.org/viewtopic.php?id=101254' web]:

perl -le '/inet (?:addr:)?(\S+)/
and $1 ne "127.0.0.1" and push @a,$1 foreach `ifconfig -a`; print "@a"'

Or

for i in $(ifconfig -a); do echo $i | awk -F "addr:" '$2 != "127.0.0.1" &&
$2 > 0 {print $2}'; done

It is usefull anyway, so I make the file /usr/bin/ipwho

#!/bin/sh
perl -le '/inet (?:addr:)?(\S+)/
and $1 ne "127.0.0.1" and push @a,$1 foreach `ifconfig -a`; print "@a"'

To set the hostname i now simply add to /etc/rc.local (in one line):

perl -le '/inet (?:addr:)?(\S+)/ and $1 ne "127.0.0.1" and push @a,$1 foreach `ifconfig -a`;
$out=readpipe "grep '@a' /etc/hosts"; @ar=split(/ /,$out); chomp($ar[1]); system("hostname $ar[1]")'

I probably should see what is the problem with the hostname, but whatever. If it works, it works.

g++

Get this odd error in compilation:

checking for C compiler default output... configure: error: C compiler cannot create executables

Solution:

apt-get install g++

Do same for g77 and gcj

installing debs

dpkg -i ../liki.deb

Emacs

Crl c f doesn't work in Emacs

apt-get install tcsh

Ubuntu printing

Get:

sysadmin@xphy7:/etc/cups$ lpq
lpq: lp: unknown printer

In /etc/printcap I change:

optra|optra:rm=localhost:rp=optra:
lp|optra:rm=localhost:rp=optra:

It works, but the new problem is that cups will reload the old one each time it restarts. Well i installed

apt-get install printtool

And that fixed the problem. That is good enough for me for now.

Dahh..This fixes it:

lpadmin -x optra; /usr/sbin/lpadmin -p optra -E -v socket://129.25.7.170:9100 -P /root/optra.ppd; lpadmin -d optra

Package search/install

apt-cache search emacs

When you find the package...

apt-get install emacs21

To force yes, use -y.

Maple 10 install

Trying to insall maple from CD, I first get:

xphy6:/media/cdrom# ./installMapleLinuxSU
bash: ./installMapleLinuxSU: /bin/sh: bad interpreter: Permission denied

It needs to be root running the sh so use instead:

sh ./installMapleLinuxSU

Works.

Vpython

Easy!

apt-get install python-visual
apt-get install idle

In the share directory will be vpython, find that and move it to /usr/bin.

However, I changed

$PYTHON $IDLE

to

$IDLE

to get this to work.

cups

Oops, must have forgotten to install this. This worked:

First, what is there?

apt-cache search cups

Ahhh, get it all:

apt-get install cups*

Also

apt-get install foomatic*

For linuxprinting.org printer support.

Now find the ppd:

locate .ppd | grep Lexmar

In my case I go to:

/usr/share/ppd/linuxprinting.org-gs/Lexmark

Run gzip -d on the file and then install the driver using the gnome gui.

Now lp still doesn't work. Problem and solution here [1].

lp does see stuff:

xphy6:/etc/init.d# lpstat -a
Optra-T614 accepting requests since Sat 01 Jul 2006 11:10:18 AM EDT

I just changed Optra-T614 to OptraT614 throughout. Now it works perfectly. Odd bug.


For more hardcore sysadmins, you could run the command, e.g.

/usr/sbin/lpadmin -p WS704 -E -v socket://129.25.7.170:9100 -P /etc/cups/ppd/printer.ppd

NIS setup

First install the required packages

apt-get install nis

Your nis domain goes in:

/etc/defaultdomain

It should have one line, e.g.

blah.yada.net

Finally tell Debian which server you are using

/etc/yp.conf

Should have the line

ypserver 192.ABC.Y.Z

Finally, start up the server

/etc/init.d/nis start


gimp print

apt-get install gimp-print

Init Scripts

Ubuntu has a nice management system for init scripts called rcconf:

apt-get isntall rcconf

Run rcconf as root (or using sudo) and you will be greeted with a nice ncurses based screen you simply toggle which services you want to start and boot time and which you do not. The scipt will take care of creating the proper entries in /etc/rc*.d

If you want to write in an entry manually, make a link in the rc*.d pointing to your unit script starting with an 'S' for starting and a 'K' for killing (shutdown), then a number which places it in the proper order and arbitry name. For example, suppose network is at number 35 and I want to have ssh starting right after I would have

cd /etc/rc0.d
link -s ../init.d/ssh S36ssh

and that's all.


pythonmatlib

Need apt packages (or compile)

python-numpy
pythonmatlib
dvipng

Source: OYUN OYNA Source: 3D OYUNLAR

Personal tools