Forum Moderators: bakedjake

Message Too Old, No Replies

RH to Debian

What are the top 5 gotchas?

         

AlexK

5:03 am on Apr 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



After 2 years on RedHat 2.4 servers I am transferring Hosting provider. The new ISP advises Debian (2.4.26) and has provided a barebones virtual server for me to setup to aid transfer (whilst my own server is physically transported, then setup + installed into a new colo).

The new host has installed Apache + PHP + mysql + phpMyAdmin. My first time logged in to the temp-server I did:

# locate phpmyadmin ¦ less

... and it responded:
locate: /var/cache/locate/locatedb: No such file or directory
-bash: less: command not found
(my response: blimey, but is this barebones or what!)

I have no experience of Debian, period, and little time to explore. Any help or experience that would assist to shorten this learning period would be greatfully received.

wheel

1:01 pm on Apr 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Wouldn't:
# updatedb

fix the problem of no locate database? I don't think fresh installs of linux generally have the locate database built.

encyclo

2:15 pm on Apr 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It looks like the machine is far too "bare-bones" to be useful. The first thing you need to learn about Debian is the package management. Try typing "aptitude" to see if it is installed. Note that you'll have to be root to install anything. If you don't have aptitude (a simple command-line package management tool) then as root you should start by doing a general update:

apt-get update && apt-get upgrade

Afterwards you can install aptitude with the command:

apt-get install aptitude

You can also install programs etc. with apt-get if you know their name: go to [packages.debian.org...] for the list. As "less" seems to be missing you can try:

apt-get install less

I assume you're running "Debian stable", otherwise known as "Woody"?

Debian is good stuff: the package management makes it a breeze to administer. But you'll need to get a few more things installed first!

moltar

4:35 pm on Apr 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think if it was a fresh system install you need to run some command (as root) to initialize the
locate
database. I don't remember what the command is though.

AlexK

8:29 pm on Apr 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



wheel:
I don't think fresh installs of linux generally have the locate database built.

You are right. I got a reply from the host:
locate requires that a database be created which doesn't happen until the cron job kicks in for the first time overnight.
It is now populated.

encyclo:

It looks like the machine is far too "bare-bones" to be useful.

I don't mind the barebones... only a temp server until my main server is transferred. A useful test-bed for me to gain experience. Also, an

apt-get
just gave
Reading database ... 11248 files and directories currently installed.
so it is not quite so empty.

Try typing "aptitude" to see if it is installed. ... apt-get update && apt-get upgrade

OK, so this is #1 of the Gotchas:
apt-get
instead of
yum
. Are there any big differences between the two that I need to watch out for? (One example just discovered: my experience of
yum
is that it always asked y/n before completing, whereas just now
apt-get install joe
went ahead and did it without any intervention - is this simply a config issue?)

aptitude
is installed. I think I prefer the command line! It also messed up the primary terminal screen after quitting.

Everything (already installed) turned out to be fully updated, and

less
installed without bother. Hooray!

Many thanks for the help so far. Any more Gotchas to watch out for?

AlexK

1:24 am on Apr 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



More Gotchas discovered, in no particular order:

    2 RH8+ has apache2, Debian has apache 1.3
    3
    rm [files]
    on rh asked for confirmation of each file; Debian does not.
    4 <Home> + <End> do not work (PuTTY with std SSH terminal)

encyclo:
I assume you're running "Debian stable", otherwise known as "Woody"?

How can I tell?

AlexK

8:20 am on May 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Next Gotcha:
    5
    less
    does not work on directories

After much man-reading this was down to the pre-processor

lesspipe
. RH has
lesspipe.sh
, which seems to do it's job without complaint. So, after putting:
export LESSOPEN="¦/usr/bin/lesspipe.sh %s"

in `.bashrc' (and, incidentally, fixing Gotcha#3 by removing comments from
# alias rm='rm -i'
...etc), `lesspipe.sh' was rsync'ed across, and less now works fine on directories.

Here is the shell script for those without access to a RH distro:

#!/bin/sh -
#
# To use this filter with less, define LESSOPEN:
# export LESSOPEN="¦/usr/bin/lesspipe.sh %s"

lesspipe() {
case "$1" in
*.[1-9n]¦*.man¦*.[1-9n].bz2¦*.man.bz2¦*.[1-9].gz¦*.[1-9]x.gz¦*.[1-9].man.gz)
case "$1" in
*.gz) DECOMPRESSOR="gunzip -c" ;;
*.bz2) DECOMPRESSOR="bunzip2 -c" ;;
*) DECOMPRESSOR="cat" ;;
esac
if $DECOMPRESSOR -- "$1" ¦ file - ¦ grep -q troff; then
if echo "$1" ¦ grep -q ^/; then #absolute path
man -- "$1" ¦ cat -s
else
man -- "./$1" ¦ cat -s
fi
else
$DECOMPRESSOR -- "$1"
fi ;;
*.tar) tar tvvf "$1" ;;
*.tgz¦*.tar.gz¦*.tar.[zZ]) tar tzvvf "$1" ;;
*.tar.bz2¦*.tbz2) bzip2 -dc "$1" ¦ tar tvvf - ;;
*.[zZ]¦*.gz) gzip -dc -- "$1" ;;
*.bz2) bzip2 -dc -- "$1" ;;
*.zip) zipinfo -- "$1" ;;
*.rpm) rpm -qpivl --changelog -- "$1" ;;
*.cpi¦*.cpio) cpio -itv < "$1" ;;
*.gif¦*.jpeg¦*.jpg¦*.pcd¦*.png¦*.tga¦*.tiff¦*.tif)
if [ -x "`which identify`" ]; then
identify "$1"
else
echo "No identify available"
echo "Install ImageMagick to browse images"
fi ;;
*)
case "$1" in
*.gz) DECOMPRESSOR="gunzip -c" ;;
*.bz2) DECOMPRESSOR="bunzip2 -c" ;;
esac
$DECOMPRESSOR -- "$1" ;;
esac
}

if [ -d "$1" ] ; then
/bin/ls -alF -- "$1"
else
lesspipe "$1" 2> /dev/null
fi

(be warned that all `¦' (broken vertical lines) need to be replaced with a proper pipe character; it is a characteristic of these forum pages which causes endless grief)

AlexK

1:19 pm on May 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I seem to be treading a lonely path with this thread. Don't other webmasters use Debian? I could do with some help...

The #2 Gotcha is the most important for me at the moment:

2 RH8+ has apache2, Debian has apache 1.3

Debian does have Apache2, but within the testing [packages.debian.org] branch. There is:
apache2-mpm-worker - 2.0.54-2 - high speed threaded model
apache2-mpm-prefork - 2.0.54-2 - traditional model
apache2-mpm-perchild - 2.0.54-2 - experimental high speed perchild threaded model

As important for me as Apache is PHP, and the php installed is for 1.3. Thus, removing apache means removing php which removed phpmyadmin, and suddenly I had removed (almost) everything already installed!

When using PHP it is important to install

apache2-mpm-prefork
, since this is non-threaded (like apache1.3) and is the only version safe to use with PHP. There is a big broo-ha-ha [zend.com] going on between Apache and Zend-PHP at the moment, with PHP previously saying that Apache2 was not safe with PHP, but now saying that it is OK with the prefork model. It is not that PHP is not thread-safe (?), but rather that some (many?) of the libraries that do the back-end work are not thread-safe. Trouble is, I do not know of any listing of which libraries are thread-safe and which are not. If the PHP folks would stop whinging, perhaps they could do this instead?

Doing

apt-get install apache2-common apache2-doc apache2-mpm-prefork
then introduced new Gotchas:
    2 RH8+ has apache2, Debian-stable has apache 1.3
    2a Debian-testing has apache2, but the .conf layout is completely different
Here is the (edited) README:
Apache2 Configuration under Debian GNU/Linux
============================================

Debian's default Apache2 installation attempts to make adding and removing modules, virtual hosts, and extra configuration directives as flexible is possible, in order to make automating the changes and administering the server as easy as possible.

Files and Directories in /etc/apache2:

apache2.conf : This is the main configuration file.
conf.d/ : Files in this directory are included in to apache2.conf.
httpd.conf : Empty file.
magic : Magic data for mod_mime_magic Apache module
mods-available/ : This directory contains a series of .load and .conf files.
mods-enabled/ : Symlinks to the .load, .conf files in mods-available/.
ports.conf : Config directives for ports and IP addresses to listen to.
sites-available/ : config directives for different virtual hosts
sites-enabled/ : Symlinks to sites in sites-available/

Tools

Currently, a2enmod and a2dismod are available for enabling and disabling modules utilizing the above configuration system.

a2ensite and a2dissite have been added, which do essentially the same thing as the above tools, but for sites rather than modules.


I really thought that in a day or so I would have the server configured. Gathering all the above has taken me an entire morning.

Is there anyone actually using the above 'in anger' on a live site?

jamie

11:16 pm on May 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi alex,

i switched to debian from rh in january of this year.

the best thing about debian is that it is rock solid in the stable version. do not use anything else other than stable packages on a production server. testing is fine on your desktop. but when you start mixing versions of debian, you will only end up with broken dependancies and headaches.

so you ought to get used to apache 1.3 ;) (you can still use the latest versions of php and mysql by compiling from source - it is not that difficult and means each is compiled with only the things you need).

check the /etc/apt/sources.list and edit it to contain only stable sources, uninstall apache2 and anything else from testing and start again. it really pays to spend a bit of time reading about APT from the debian site docs.

good luck!

(one thing i found which really helped was i documented all the things i did, which made it very easy to go back and start again)

AlexK

2:57 pm on May 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



jamie:
do not use anything else other than stable packages on a production server.

Certainly my own instinct. Confirmed also by the experience of my original host putting the first site on RedHat8, which contained the first-production-use of Apache2.

so you ought to get used to apache 1.3 ;) ... uninstall apache2 and anything else from testing and start again.

Aargh! Have just spent the entire weekend setting up the .conf system for Apache2.

it really pays to spend a bit of time reading about APT from the debian site docs.
Thanks for that. Have just now completed my first read-through. Interesting to see that APT came before RH's RPM.

... use the latest versions of php and mysql by compiling from source - it is not that difficult and means each is compiled with only the things you need

I unfortunately now have lots of experience of doing this. SegFaults whilst compiling Apache is what tipped me off to a bad memory chip (now replaced). It is also the very thing that should surely be avoided on a production server!

one thing i found which really helped was i documented all the things i did
Also my instinctive reaction. I'm doing this both personally and--in an attempt to help others--in this thread.

made it very easy to go back and start again
(Shudders) I hope not!

After reflection, I am continuing with Apache2. Even PHP are using it now (US + UK sites) and, after a couple of years of development, it should now be stable. It has certainly been OK across the last 6 months on my production server (Centos1), and I cannot stand the thought of re-re-jigging all the .conf files for Apache1.3 + Apache-SSL + PHP.

Can you help with Gotcha4?:

    4 <Home> + <End> do not work on the command line (PuTTY with std SSH terminal)

encyclo

3:10 pm on May 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



AlexK, this is probably a good time (if not rather too late) to discover Debian Backports [backports.org] - a set of (unofficial) backports of more modern packages pre-compiled for Debian Stable (Woody). Includes Apache 2.0.54, MySQL 4.1... You can add the backports to your
/etc/apt/sources.list
file and update/upgrade.

Not sure about your gotcha 4: you are using bash and not sh as your default shell?

AlexK

5:31 pm on May 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



encyclo:
a good time ... to discover Debian Backports ... Includes Apache 2.0.54

Thanks for the link. Just to be pedantic, it is Apache 2.0.52-2.

Two problems with this:

    1 no PHP4.
    2 Not exactly stable (been reading through the mail-lists, and lots of problems)

you are using bash and not sh as your default shell?
It is bash, yes. Interestingly,
joe
works fine. I looked through the config file for joe (
joerc
from memory) and it has specific entries to capture the control sequences sent by these two keys. However, I put it down as a Gotcha because it works fine on the command-line in RH, but not in Debian.

AlexK

11:10 pm on May 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



4 <Home> + <End> do not work on the command line (PuTTY with std SSH terminal)

Yay! Fixed it.

After much man-reading the issue is within the

inputrc
file (config file for readline):

# /etc/inputrc - global inputrc for libreadline
# See readline(3readline) and `info rluserman' for more information.
...
# some defaults / modifications for the emacs mode
$if mode=emacs
# 2005-05-03 - BOL + EOL un-commented -AK
# allow the use of the Home/End keys
"\e[1~": beginning-of-line
"\e[4~": end-of-line

<moan>emacs is the default for Debian, so I really would have expected this to be the default settings.</moan>

AlexK

3:18 am on May 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The Gotchas with Apache-PHP continue to mount. It is now:
    2 RH8+ has apache2, Debian-stable has apache 1.3
    2a Debian-testing has apache2, but the .conf layout is completely different
    2b Debian-testing has PHP-for-apache2, but the .ini layout for extensions is different

This is from the php.ini file for Centos1:
; Note: For Red Hat Linux, packaged extension modules are now loaded via
; the ini files in the directory /etc/php.d.

This is due to the use of `
--with-config-file-scan-dir=/etc/php.d
' during compilation. Debian has the old-format from earlier versions of PHP.

jamie

10:00 am on May 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



alex,

do not use anything else other than stable packages on a production server.

;)

believe me, when i say you will only have headaches with non-stable packages. i use 100% stable apart from php, curl and mysql which i have installed from source. it is a breeze to administer and everytime a security update comes along, all i do is "apt-get update; apt-get upgrade".

i tried backports and simply got myself into problems. if you want bleeding edge software you shouldn't really be using debian.

i actually set up a mirror server at home to practice installs and reconfigs of debian - and after several failed goes using backports, i stuck with stable and have not had a problem since.

my 2c ;)

AlexK

7:45 am on May 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Final words:

After completing the initial setup I emailed my new host to say thanks, but no-thanks to Debian, I'll stick with the existing Centos, ta.

He informs me that the `Testing' section is shortly to become the `Stable' section, but that will be too late for me.

In the end it was YUM that decided it. I simply had too many problems with apt-get; far too complicated.

Many thanks to all that have helped - it was a great assistance whilst setting up the temp server.