Security alert. Cross Site Request Forgery. More info here, fixed release available. [25] (what's this?)
 

Question:Restore a dump onto an empty hard disk

Answer: Use restore rf dumpfilename

Want to make a “ghost” of a linux / fedora / centos / redhat EL system that used Logical Volumes. By using the dump utility and restore it is possible to transfer all the contents of a hard disk to another one of a different size etc… dd might also do this but may be a bit tricky if the disks are different sizes.

The major issue is keeping all the disk labels and logical volume and group names the same to avoid having to edit the /etc/fstab

To restore a dump of a working Centos / Redhat EL - linux OS onto a new drive / machine

Assuming the default redhat partitioning of

/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2

1 Make the dumps (one for each partition)

dump 0fj mynewdumpfile / dump 0fj mynewdumpfileboot /boot

transfer them to somewhere the new system will be able to access (USB External drive)

2 Boot the new system / drive from rescue disk

# fdisk the new drive 
#
#eg 3 partitions , boot, root, swap 
# set types as Linux EXT2, Linux LVM , Linux Swap

# for the boot one 

mke2fs -j /dev/hda1 
e2label /dev/hda1 /boot

mkdir /mnt/boot
mount /dev/hda1 /mnt/boot

cd /mnt/boot
restore rvf mynewdump.boot 


# for the root partition - a bit trickier - need to make the lvm stuff as well

mkdir /mnt/root 


# create the physical volume
lvm pvcreate /dev/hda2
# display it with size 
lvm pvscan 
# create the volume group  - assign pv to it 
lvm vgcreate VolGroup00 /dev/hda2 
# create the logical volume - must specify size 
lvm lvcreate VolGroup00 -n LogVol00 -L 37G
# just in case its not active 
lvm vgchange -ay


#If you reboot and lose the lvm settings / devices  you may need to do these command to get the /dev/mapper devices made 

lvm lvscan
lvm vgchange -ay
lvm vgmknodes -v

# the commands lvm vgcfgbackup -f filename 
# and  lvm vgcfgrestore -f filename 
# MAY be useful - not sure if they save doing all the create commands above ? 
# no they dont seem to do anything useful - they reference the PV uuid so if that is recreated the restore wont match anything  !
# probably useful if it is a more sophisticated lv - with stripes etc...


# now make the fs
mke2fs -j /dev/mapper/LogVol00-VolGroup00

# restore the dump from the USB drive or whatever 
mount /dev/mapper/LogVol00-VolGroup00 /mnt/root
cd /mnt/root
restore rvf mynewdump

#write the grub boot stuff mbr etc 

umount /mnt/boot
mount /dev/hda1 /mnt/root/boot

grub-install --root-directory=/mnt/root  /dev/hda


# cant find dev if you do this, it seemed like a good idea  ! chroot /mnt/root

exit 

# now reboot it - it will do a fsck on the new partition - probably a good thing 

If have trouble manually loading kernel and init from grub at boot fixed it for me - then once system is booted just do grub-install /dev/hda again and it will be ok.

Mine stopped at grub 1.5 - but I didnt do the chroot grub-install correctly - might try it again today just to see. Second attempt following above worked fine

lvm and lots of other good stuff at http://dailypackage.fedorabook.com/index.php?/archives/159-System-Recovery-Week-Using-LVM-In-Rescue-Mode.html

Question:Centos 4 Installation

Sat, 09 Apr 2005 00:49:12 +1000

Downloaded Centos 4 and created CDroms

Installed onto Pentium III 800, 128 Megs RAM. 14 Gig hard disk

Chose WORKSTATION installation.

then used security settings in X to allow web,smtp,ssh, port 177 UDP

Then to allow Cygwin remote X desktop had to edit /etc/X11/gdm/gdm.conf

uncommented two lines

RemoteGreeter=/usr/bin/gdmlogin

change false to true

[Xdmcp]
Enable=true

For chooser function (when using multiple X servers) can add

[chooser]
Hosts= 192.168.54.3

restart X to get option

Configured fetchmail to get emails, made local accounts and set forwarding rules. (copied fetchmail scripts from old server /etc/fetchmail.rc and /etc/rc.d/init.d/fetchmaild

added custom lines to .bashrc

alias l="ls -altr"
alias pg=more
alias r="fc -s"

Download and install

webmin

From CENTOS CD install

SAMBA - copy config over and make directories

/etc/samba/smbusers

apache = list of usernames 

/etc/samba/smbconfig

install apache (httpd package - edit /etc/httpd/conf/httpd.conf to change port)

(Remember to open the firewall for each of these things !!!)

Install squirrelmail and dovecot (dovecot does IMAP and POP) squirrelmail links into web for webmail.

install named (bind)

download and install dokuwiki, restore funstuff, check permissions.

Copy over root scripts, add to cron for backup etc…

Setup for rsync, firewall set so only local hosts can access (just in case)

# cat /etc/rsyncd.conf
  [rsync]
    path = /
    use chroot = no
    max connections = 4
    auth users = root
    secrets file = /etc/rsyncd.secrets
    uid = root
    gid = root

rsyncd.secrets stores username/password used for sync, then on 2nd server run

rsync -vx --password-file=/root/bin/jetcentos.passwd -az jetcentos::rsync/ /mnt/volgroup00/

where jetcentos.passwd stores matching password pair

CENTOS 5

gdm.conf no longer there - now edit

File now in /etc/gdm/custom.conf


[security]
AllowRoot=true
AllowRemoteRoot=true

[xdmcp]
Enable=true


second install notes

Then installed 2nd server, (twice - once in same partition structure as master once into second partition - just to create the partitions) and then made 2nd partition boot and used rsync to make first partition copy of real running server, have offline backup of real server. Needed to edit the fstab file after sync so that the mirror version boots with correct partitions, also needed to add extra entry to grub.conf. After updating mirror systems mirroring OS had to make copy of boot files from older version so it would boot.

didnt include kernel source and then wanted to add it BUT the levels of dependencies had me frustated then realised that by using the –aid option to rpm to automatically install dependencies (and making a link so my copies of the rpms was in the right place) and it just did it.

I had copied all the rpms over to /var/local/rpms

 mkdir -p /home/buildcentos/CENTOS/en/4.0/i386/CentOS
 ln -s /var/local/rpms  /home/buildcentos/CENTOS/en/4.0/i386/CentOS/RPMS
 rpm -i -aid  ../kernel-sourcecode-2.6.9-5.0.3.EL.noarch.rpm

Question:Upgrading from Fedora RC1 to CENTOS

Answer: Tried using yum, in the end used CD's

Wanted to upgrade a system from Fedora RC1 to Centos 4 - ideally wanted to have a way of doing over the net for remote upgrade but no luck on that yet.

Boot of CENTOS cd1 - choose linux upgradeany (not listed anywhere as an option but found reference to it on fedora.org)

This upgraded all packages but didnt add any new ones that I could see. Then tried to get YUM to work but even after swapping yun.conf still got reference to null NULL as the distribution

baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

resolved to 

http://mirror.centos.org/centos/Null/os/

This meant that got error 404 


The $releasever variable was being set to Null rather than 4 - worked out that the package missing was centos-release-4-0.1

so downloaded (hacked yum repo to hard code 4 and then chose did a yum install centos-release) and installed that package. Then put repos file back as defautl and did yum update seems to be working.

then wanted to updater clamav - needed to follow instructions at

http://crash.fce.vutbr.cz/yum-repository.html

then edit repos file to put 3 as version number !

then yum update clamav worked !

Question:Sendmail - root mail not masqueraded

Answer: Exposed user

Comment out

EXPOSED_USER(`root')dnl

fixes it

Set to Masquerade

MASQUERADE_AS(`mydomain.com')dnl
dnl #
dnl # masquerade not just the headers, but the envelope as well
dnl #
FEATURE(masquerade_envelope)dnl
dnl #
dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well
dnl #
dnl FEATURE(masquerade_entire_domain)dnl
dnl #

Question:Script to download a test file. Log the speed

cat test_speed.sh

#/bin/sh
#
# script to download a test file and record the speed
#
cd /tmp
wget --delete-after -o tmp1.log http://www.nano-tera.com.au/public/dokuwiki/media/cef_dokuwiki-2005-02-18.tgz
grep " saved " tmp1.log >> /var/log/testspeed.log
rm tmp1.log

Question:rpm --aid option where does it get the suggested files

rpm -i --aid package

Perhaps the –aid switch is a redhat only thing ?

using centos or other new redhat/linux distributions rpm has the option aid –aid for automatically install dependents I assume. This seems great that any package that wont install because of failed dependencies can be installed as the rpm program will find the needed suggested packages.

I needed this when after install centos we wanted to add X windows and Gnome but the number of dependencies was a bit daunting. But using the –aid switch and pointing it at a location containing all the rpms shipped with the system meant that once we had almost any X package installed we should have a running GUI system.

But it expects it to be in an “unusual” location. I suspect it also looks in the current directory. To change the location it will install the packages from your need to change this file

/etc/rpm/macros.solve



%_solve_pkgsdir /home/buildcentos/CENTOS/en/4.0/i386/CentOS/RPMS/

put the location that you keep your rpms (I tend to copy them into /var/rpms so I dont need to find the CD again, and then any I download go in /var/rpms/download

to help this be found by someone who it bothers !!!

What seemed like a long google search finally found a posting at http://groups.yahoo.com/group/rpm-list/message/22158 that explained it. I thought a posting with the key words of rpm package aid –aid (not sure how to search for – in google) package dependencies rpm aid it will usually suggest the package(s) need to resolve the dependency default location for packages rpm install aid automatic install depencies dependency

SAMBA and Active directory

A good howto here http://www.enterprisenetworkingplanet.com/netos/article.php/3487081


	 cd /tmp
	 rpm -qa > rpmlist.txt
	 grep krb rpm8
	 grep krb rpm*
	 man yum 
	 yum list all > yum_lis_al.txt
	 grep krnb yum_lis_al.txt 
	 grep krb yum_lis_al.txt 
	 cd /usr/sbin
	 smbd -b | grep LDAP
	 smbd -b | grep KRN
	 smbd -b | grep KRB
	 smbd -b | grep ADS
	 smbd -b | grep WINBIND
	 cd /tmp
	 vi /etc/krb5.conf 
	 kinit adminusername
         klist -e
	 vi /etc/samba/smb.conf
	 testparm

	 service smb restart
	 service winbind restart
	 net ads join -U administrator 

	 vi /etc/nsswitch.conf 


	 service smb stop
	 service winbind stop

	 service winbind start

	 service smb start
	 wbinfo -g
	 wbinfo -u
	 getent passwd


http://www.flatmtn.com/computer/Linux-SquidNT.html

smb.conf

add line for debug logging

log level = 1 

Squid and ntlm

### JET 2008 problem with ntlm
auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp -d=3 -l=/var/log/samba/ntlm_auth
auth_param ntlm children 30
auth_param basic children 5
auth_param ntlm max_challenge_reuses 0
auth_param ntlm max_challenge_lifetime 2 minutes
auth_param basic program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-basic -d=1 -l=/var/log/samba/ntlm_auth

external_acl_type ntgroup_helper %LOGIN /usr/lib/squid/wbinfo_group.pl
acl proxyfullaccess external ntgroup_helper DOMAIN\ALLOW-INTERNET-ACCESS
http_access allow all proxyfullaccess

Good guide here - http://mkeadle.org/index.php?p=13


Problem with winbind

  winbindd version 3.0.10-1.4E.9 started.
  Copyright The Samba Team 2000-2004
[2008/09/12 01:15:52, 0] tdb/tdbutil.c:tdb_log(725)
  tdb(/var/cache/samba/winbindd_idmap.tdb): rec_read bad magic 0x42424242 at offset=44656
[2008/09/12 01:15:52, 0] nsswitch/winbindd_util.c:winbindd_upgrade_idmap(983)
  Upgrading winbindd_idmap.tdb from an old version
failed to copy /var/cache/samba/winbindd_idmap.tdb
[2008/09/12 01:15:52, 0] nsswitch/winbindd_util.c:winbindd_upgrade_idmap(989)
  Could not backup idmap database
[2008/09/12 01:15:52, 1] nsswitch/winbindd.c:main(897)
  Could not init idmap -- netlogon proxy only

fixed by removing all samba cache 

think problem was with /var/cache/samba/winbindd_idmap.tdb

[root@proxy2 samba]# cd /var/cache/samba
[root@proxy2 samba]# l
total 152
drwxr-xr-x  11 root root   4096 Nov 15  2006 ..
drwxr-xr-x   4 root root   4096 Sep 12 01:19 old
-rw-r--r--   1 root root   8192 Sep 12 01:19 winbindd_idmap.tdb
-rw-r--r--   1 root root   8192 Sep 12 01:19 gencache.tdb
-rw-------   1 root root   8192 Sep 12 01:21 share_info.tdb
-rw-------   1 root root   8192 Sep 12 01:21 registry.tdb
drwxr-xr-x   2 root root   4096 Sep 12 01:21 printing
-rw-------   1 root root   8192 Sep 12 01:21 ntprinters.tdb
-rw-------   1 root root    696 Sep 12 01:21 ntforms.tdb
-rw-------   1 root root   8192 Sep 12 01:21 ntdrivers.tdb
-rw-------   1 root root   8192 Sep 12 01:21 group_mapping.tdb
-rw-------   1 root root   8192 Sep 12 01:29 netsamlogon_cache.tdb
-rw-------   1 root root    696 Sep 12 01:29 messages.tdb
-rw-------   1 root root  20172 Sep 12 01:29 winbindd_cache.tdb
-rw-r--r--   1 root root    696 Sep 12 01:29 sessionid.tdb
-rw-r--r--   1 root root    696 Sep 12 01:29 locking.tdb
-rw-r--r--   1 root root   8192 Sep 12 01:29 connections.tdb
-rw-r--r--   1 root root    696 Sep 12 01:29 brlock.tdb
drwxr-x---   2 root squid  4096 Sep 12 01:29 winbindd_privileged
-rw-r--r--   1 root root   8192 Sep 12 01:29 unexpected.tdb
-rw-r--r--   1 root root    156 Sep 12 01:30 browse.dat
   kinit username@COM.AU
   klist -e
   klist -e
   wbinfo -t
   wbinfo -u
   wbinfo -u
   wbinfo -g
 
faq/centos.txt · Last modified: 2010/02/16 19:07 by 58.6.19.20
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki