Jono's Linux Top Tips

 

 

Jono's Linux Top Tips
by Jono Woodhouse
-------------------------

14 May 2008 : Jono Woodhouse
Version 2.22

-----------------------------------------------------------------------------------------------------------------------------------------------

Document Title: Jono's Linux Top Tips

Handy Linux Commands.
The following is a bunch of useful linux commands and tip I have gathered over the years while I've been using an assortment of unix/linux operating systems.
Most of them should work for Slax (Slax 6 and Slax 5) and Fedora Core 8, Fedora Core 7, Fedora Core 6, Fedora Core 5, Fedora Core 4 and Fedora Core 3 builds (FC8, FC7, FC6, FC5, FC4, FC3) etc.
A number of commands and tips have also been included for the Fox Board which is an Axis Cris board capable of running cris-axis-linux-gnu.
www.capesoft.com
www.capefox.com

Source URL for this document: http://www.capefox.com/howto/JonosLinuxTopTips.htm

Contacting the Author: I have a gmail account, which starts with jonoistall, then the at sign - you should be able to work out the rest.

-----------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------
su and sudo
--------------
To become root:
su -
or
sudo su -

To issue commands as root
sudo <command>


-----------------------------------------------------------------------------------------------------------------------------------------------
RPM
-----
rpm --install <package-name>

-----------------------------------------------------------------------------------------------------------------------------------------------
YUM
-----
Docs on yum: http://fedora.redhat.com/docs/yum/en/

1) To import the GPG Keys
rpm --import /etc/pki/rpm-gpg/* (optional in FC6)
rpm --import /usr/share/doc/fedora-release-3/RPM-GPG-KEY* (in FC3 or above for example)

2) To check for updates:
yum check-update

3) To list packages:
yum list hddtemp
yum list available
yum list updates
yum list all
yum groupinfo "Games and Entertainment"

4) To instal
yum install mdadm

5) To update
yum update mdadm

6) To Search
yum list package_name
yum search package_name

7) To Search inside packages
yum provides program_name

8) to run yum on the cache
yum -C <command>

9) Other bits and peices / Yum GUI etc.
yum install yumex
yum install kyum
pirut (FC5+)
pup
yum install yum-utils
yumex (Yum Extender)
kyum


-----------------------------------------------------------------------------------------------------------------------------------------------
yum - Livna
--------------
rpm -ivh http://rpm.livna.org/livna-release-6.rpm
rpm --import http://rpm.livna.org/RPM-LIVNA-GPG-KEY

-----------------------------------------------------------------------------------------------------------------------------------------------
yum - Fedora Extras
-------------------------
see http://fedoraproject.org/extras/readme.extras

rpm --import http://download.fedora.redhat.com/pub/fedora/linux/extras/RPM-GPG-KEY-Fedora-Extras

To use this repository in yum add a file (fedora-extras.repo) in your /etc/yum.repos.d dir with these contents:

[extras]
name=Fedora Extras - $releasever - $basearch
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/extras/$releasever/$basearch/
gpgcheck=1
gpgkey=http://download.fedora.redhat.com/pub/fedora/linux/extras/RPM-GPG-KEY-Fedora-Extras

[extras-debug]
name=Fedora Extras - $releasever - $basearch - Debugging packages
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/extras/$releasever/$basearch/debug/
gpgcheck=1
gpgkey=http://download.fedora.redhat.com/pub/fedora/linux/extras/RPM-GPG-KEY-Fedora-Extras
enabled=0

-----------------------------------------------------------------------------------------------------------------------------------------------
yum - DAG
-----
rpm --import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
Make a file like dag.repo in your /etc/yum.repos.d with the following:

[dag]
name=Dag RPM Repository for Fedora Core
baseurl=http://apt.sw.be/fedora/$releasever/en/$basearch/dag
gpgcheck=1
enabled=1



-----------------------------------------------------------------------------------------------------------------------------------------------
Linux Directory Structure / FileSystem Structure
----------------------------------------------------------------You can google around, but these are also adequate:
http://emerald.obsidian.com.au:8083/hosts/computerbank/computerbank/tutorials/linuxdirectorystructure/
http://www.debianadmin.com/linux-directory-structure-overview.html


-----------------------------------------------------------------------------------------------------------------------------------------------
eee linux
-----------
http://wiki.eeeuser.com/
http://www.downloadsquad.com/2007/11/06/eee-pc-tips-a-crash-course-in-linux/
Terminal Ctrl-Alt-T
sudo su -

wget http://download.tuxfamily.org/eeepcrepos/key.asc
sudo apt-key add key.asc

Full Desktop - from wiki.eeeuser.com/howto:getkde
* From Easy Mode, press Ctrl-Alt-t. This will open a terminal.
OPTIONAL: this will simplify the following steps, but it means explicitly trusting the Community Repository. Type the following two lines at the prompt within the terminal, pressing Enter after each:
wget http://download.tuxfamily.org/eeepcrepos/key.asc
sudo apt-key add key.asc
* Staying within terminal, type sudo synaptic and press enter. This will open Synaptic in “Administrator” mode.
* Within Synaptic, choose Settings…Repositories
* Press New…
* Enter the URI
http://download.tuxfamily.org/eeepcrepos
* Enter the distribution: p701
* Enter the section: main (or main etch, if you want access to additional software)
* Press OK
* Press Reload
* Scroll down to advanced-desktop-eeepc – if you don't find it this way, search for it!
* Mark for installation
* If you didn't complete the optional step above, you will see a warning that the public key is not available. This is normal and you can proceed.
* Click Apply (if it's off the bottom of the screen, press and hold ALT, left-click anywhere on the window and drag it up)
* in case the installation through synaptic does not work for you, try this:
$ sudo apt-get install advanced-desktop-eeepc
* When you shut down, choose the Full Desktop option on the left of the shutdown dialog


Full Desktop - from: http://www.downloadsquad.com/2007/11/06/eee-pc-tips-a-crash-course-in-linux/
1. Open up a terminal buy pressing Ctrl+Alt+T
2. Type "sudo bash" to gain root access (Be careful what you do with root access. The only reason we're using it now is so that you don't have to type sudo before each command. But you could easily mess up your machine if you perform every command as an administrator)
3. Type "apt-get update" to make sure you have access to the most up to date packages
4. Type "apt-get install kicker" and answer "y" when asked if you want to install
5. Type "apt-get install ksmserver" and answer "y" when asked if you want to install
6. Type exit to leave the root account
7. Type exit to close your terminal window

Keyboard Layout
--------------------
Easy Mode -> Settings | Personalisation
Advanced Mode -> Launch | Control Center | Peripheral Devices | Keyboard Layout | United Kingdom | Add | Layout Variant: eeepc | Apply | Remove US | Apply

Advanced Mode - Keyboard Shortcuts
---------------------------------------------
Control Center | General Settings | Key Assignment | Keyboard Shortcuts | Command Shortcuts | Applications | System | Console | Double Click | Ctrl-Alt-T | Apply


Network Adapter (for Slax / Slackware maybe also fedora) for eee pc
----------------------------------------------------------------------
- Download http://launchpadlibrarian.net/7382416/L2-linux-driver_new.rar
- cd to src folder
make install (you'll probably get errors)
edit the at_main.c file and comment out all the bits inside functions at_restore_vlan() and at_vlan_rx_kill_vid (these are debug functions)
make install
insmod /lib/modules/<2.6.21.5>/kernel/drivers/net/atl2/atl2.ko
ifconfig -a
(the see the bit on changing network address elsewhere in this document)
See also: http://ubuntuforums.org/showthread.php?s=65589fe8e969cd5aff547ec7046973d8&t=429845#post2781580
See also: http://ihatecubicle.blogspot.com/2007/08/how-to-install-attansic-l2-network.html


-----------------------------------------------------------------------------------------------------------------------------------------------
ksensors
-----------
yum install ksensors

vmware tips
--------------
If you are running hamachi you may find your vmware virtual machines automatically bind to the 5.x.x.x subnet.
To change this run the vmware virtual network editor - Host Virtual Network Mapping (tab) |
VMnet0 - change this to the correct network adapter. There you go.

lm_sensors
-------------
A bit of a mission but here goes:
sensors-detect (then hit enter a lot). You'll want to save the output of this too.
To set this up to run often follow the instructions, otherwise for a once off run just copy the commands into a terminal window.
For example the output on my machine (beast) wants me to run:
modprobe i2c-isa && modprobe w83627ehf && /usr/bin/sensors -s
sensors
(you will now also see that ksensors can display these probes)


-----------------------------------------------------------------------------------------------------------------------------------------------
Hibernate
-----------
pm-hibernate

-----------------------------------------------------------------------------------------------------------------------------------------------
Sed
----
Simple Search and Replace
sed 's/IP/Cool/' file

Grep Behaviour
sed -n 's/IP/&/p' file

2nd DNS Server
sed -n '2 p' /etc/resolv.conf | sed ' s/nameserver //;q'

Clever Replace
sed 's/^IP=/"[0-9,.]*/"/IP=/"192.168.2.80/"/' file

Substitute "foo" with "bar" ONLY for lines which contain "baz"
sed '/baz/s/foo/bar/g'

Substitute "foo" with "bar" EXCEPT for lines which contain "baz"
sed '/baz/!s/foo/bar/g'

More:
sed /IP/d /etc/conf.d/net.eth0 | sed /NETMASK/d | sed /BROADCAST/d | sed /GATEWAY/d > /etc/conf.d/net.eth0.tmp
sed -e /IP/d -e /NETMASK/d -e /BROADCAST/d -e /GATEWAY/d /etc/conf.d/net.eth0

sed '/^IP=/"/!d s/^IP=/"//;q' /etc/conf.d/net.eth0 | sed '//"$/!d s//"$//;q' > filename

More:
sed -n '/RE/{p;q;}' file # print only the first match
sed '0,/RE/{//d;}' file # delete only the first match
sed '0,/RE/s//to_that/' file # change only the first match

sed -i -e '/^;.*/d' -e '/^$/d' $(prefix)/etc/php.ini # remove comments and blank lines (use $$ for $ in a Makefile - if you need)



-----------------------------------------------------------------------------------------------------------------------------------------------
Awk
-----
ps | grep [b]lueshark | awk '{print $1}'
ps | grep blueshark | grep -v grep | awk '{print $1}'

-----------------------------------------------------------------------------------------------------------------------------------------------
Qemu
-------
You want to download Qemu, the kqemu accelerator and the Qemu Manager.
To start the accelerator install it and then type: net start kqemu

-----------------------------------------------------------------------------------------------------------------------------------------------
Qemu Manager
------------------
- Can start the accelerator for you.
- Create a new Virtual Disk
- Then edit the properties of this Virtual Disk and choose Boot from CD-ROM and click on the Folder icon in the CD-ROM Section to specify the location of the ISO file.

-----------------------------------------------------------------------------------------------------------------------------------------------
DOS To Unix
--------------
cat helloworld.sh | tr -d '/r' > helloworld1.sh
cp helloworld1.sh helloworld.sh

-----------------------------------------------------------------------------------------------------------------------------------------------
Katapult
----------
Like QuickSilver (for Mac) or Launchy (for Windows)
yum install katapult (from Extras)
LaunchBox - is the Gnome equivalent.

-----------------------------------------------------------------------------------------------------------------------------------------------
KDE - AutoStart - like Start Group
----------------------------------------
/root/.kde/AutoStart

-----------------------------------------------------------------------------------------------------------------------------------------------
Smart
-------
smartctl -a /dev/hdd1
smartctl -t short /dev/hdd1
smartctl -t long /dev/hdd1

-----------------------------------------------------------------------------------------------------------------------------------------------
AddUser / UserAdd
------------------------
useradd -c "John Smith" -d /home/johnsmith john
passwd john



-----------------------------------------------------------------------------------------------------------------------------------------------
DNS
----
Set in the Network Configuration util it's on it's own Tab
192.168.2.202
196.43.1.13
196.43.3.206
196.25.1.9

Stored in resolv.conf like:
nameserver 192.168.2.202
nameserver 196.43.1.13
nameserver 196.25.1.9

-----------------------------------------------------------------------------------------------------------------------------------------------
Smoothwall
---------------
Smoothwall DNS - /etc/resolv.dnsmasq (Removed on next boot)
Smoothwall DNS Settings : /var/smoothwall/ethernet/settings (Used on next boot to create resolve.dnsmasq - I think)

Smoothwall Squid
squid.conf - in /var/smoothwall/proxy/squid.conf (but don't edit it - see description in this file where to put persistent changes)
Cache in /var/spool/squid/cache
e.g.
du -sh /var/spool/squid/cache



-----------------------------------------------------------------------------------------------------------------------------------------------
Network IP Address
------------------------
system-config-network
or network-admin

Fedore - you can edit this file:
/etc/sysconfig/network-scripts/ifcfg-eth0
or you can call something like this:
ifconfig eth0 192.168.2.90 netmask 255.255.255.0 broadcast 192.168.2.255 up

ifconfig eth0 192.168.2.90

In fox-board: need to also edit /etc/conf.d/net.eth0 (on the fox board)
or better - edit devboard-R2_01/packages/initscripts/net.eth0-static/conf - before making the fimage

-----------------------------------------------------------------------------------------------------------------------------------------------
Slax on a USB Key
---------------------
N.B. The Memory Stick must be formatted as FAT (or FAT16) not FAT32 !!
This will get rid of the syslinux error
could not find kernel image: linux

FAT - not FAT32

See also:
http://slax.hosting4p.com/forum/viewtopic.php?p=92334&sid=eb63d5d0121706ea072d5a08cacfa20d
http://forum.nimblex.net/viewtopic.php?t=1667
http://www.justlinux.com/forum/showthread.php?threadid=151156
http://damnsmalllinux.org/cgi-bin/forums/ikonboard.cgi?act=Print;f=17;t=3932
http://www.debuntu.org/how-to-install-ubuntu-linux-on-usb-bar-p2


-----------------------------------------------------------------------------------------------------------------------------------------------
Configuring IP in Slax
-------------------
ifconfig eth0 down # to drop any existing settings
ifconfig eth0 192.168.2.98 netmask 255.255.255.0
route add default gateway 192.168.2.202
echo "nameserver 192.168.2.202" >> /etc/resolv.conf

-----------------------------------------------------------------------------------------------------------------------------------------------
Intel PRO/Wireless 3945 WiFi Wireless Adapter in Slax
------------------------------------------------------------------
I kept getting the following errors (run dmesg):
iwl3945: Intel(R) PRO/Wireless 3945ABG/BG Network Connection driver for Linux, 1.1.17ks
iwl3945: Copyright(c) 2003-2007 Intel Corporation
iwl3945: Detected Intel PRO/Wireless 3945ABG Network Connection
iwl3945: iwlwifi-3945-1.ucode firmware file req failed: Reason -2
iwl3945: Could not read microcode: -2
iwl3945: probe of 0000:02:00.0 failed with error -2

The problem is a missing iwlwifi-3945.ucode firmware file (but in this case even the default filename needs changing too)!! - [Fixed in Slax 6.0.3]

Download the following into, for example /mnt/sda1/temp/3945
wget http://intellinuxwireless.org/iwlwifi/downloads/iwlwifi-3945-ucode-2.14.4.tgz
tar xvf iwlwifi-3945-ucode-2.14.4.tgz

cp /mnt/sda1/temp/3945/iwlwifi-3945-ucode-2.14.4/iwlwifi-3945.ucode /lib/firmware/iwlwifi-3945-1.ucode
modprobe -r iwl3945
modprobe iwl3945

With help from: http://intellinuxwireless.org/?p=iwlwifi&n=HOWTO-iwlwifi


-----------------------------------------------------------------------------------------------------------------------------------------------
WiFi in Slax
-------------
ifconfig wlan0 up
iwlist wlan0 scan
iwconfig wlan0 channel 6
iwconfig wlan0 essid NAME_OF_SSID
iwconfig wlan0 key [1] HEX_KEY_HERE
iwconfig wlan0 ap any
iwconfig
dhcpcd -d -t 15 wlan0

Some more info:
------------------
How to connect to WIFI network with WEP
If there is a native kernel driver for your WIFI card in Slax, these three simple commands should connect you to your access-point:
ifconfig eth0 up
iwconfig eth0 essid NAMEOFAP mode managed key WEPKEYINHEX
dhcpcd
If your card requires a different driver, you may use the driver for Windows, see below.

How to load Windows driver in SLAX for wifi card
In general, you need to load the windows driver by using ndiswrapper command. Then modprobe the ndiswrapper.ko kernel module and configure the card, like in the following example:
ndiswrapper -i rt2500.inf
modprobe ndiswrapper
iwconfig wlan0 ap 00:00:00:00:00:00
iwconfig wlan0 essid SomeESSID
iwconfig wlan0 key open 111x111x11
iwconfig wlan0 channel x
ifconfig wlan0 up

Finally setup the wlan0 interface the same like in the previous howto, either by starting dhcp or by ifconfig+route.

-----------------------------------------------------------------------------------------------------------------------------------------------
rdesktop (works in Slax)
-----------------------------
Grab the rdesktop module
rdesktop SERVER -f
(Then use Ctl-Alt-Enter to switch between full screen and not)

-----------------------------------------------------------------------------------------------------------------------------------------------
Slax Save & Restore in Slax 5 (Slax 6 stores changes into slaxsave.dat (by default) you can unzip this from slaxsave.zip)
------------------------
To save your settings, run "configsave" command with one argument - the storage location.
So type for example
configsave /mnt/sda1/slaxconf.mo
to save your configs in USB flash drive into slaxconf.mo file.
It will save all changed files from /root, /etc, /home and /var directories.
Note that that network settings (assigned IP address, etc) won't be saved because they are not kept in any file.
If you wish to save network settings then add apropriate commands to /etc/rc.d/rc.local.
This file will be saved/restored, and it's executed automatically (so your network settings will be set up).

To restore your previously saved backup, use "configrestore" command.
You can also save settings to the root directory of your existing disk partition (for example to /mnt/hda1/slaxconf.mo).
All settings found in the root folder of any of your disk partitions ( under the name slaxconf.mo)
will be restored automatically when SLAX boots.

-----------------------------------------------------------------------------------------------------------------------------------------------
Network Adapters in Slax
-----------------------------
ifconfig -a
(on the laptop TRL 8139 - the network adapter is eth1)

-----------------------------------------------------------------------------------------------------------------------------------------------
SSHD on Slax
----------------
1) If you get sshd re-exec requires execution with a absolute path - this means you need to start sshd with the full path. e.g.
/usr/sbin/sshd

2) If you get Could not load host key - then you'll need to
ssh-keygen -b 1024 -t rsa -f /etc/ssh/ssh_host_key
ssh-keygen -b 1024 -t rsa -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -b 1024 -t rsa -f /etc/ssh/ssh_host_dsa_key

3) /usr/sbin/sshd


-----------------------------------------------------------------------------------------------------------------------------------------------
vncserver and vncviewer in Slax 6.0
-------------------------------------------
I got error while loading shared libraries: libstdc++-libc6.1-1.so.2: cannot open shared object
so I did the following:
cd /usr/lib
ln -sf /usr/i486-slackware-linux/lib/libstdc++-libc6.1-2.so.3 libstdc++-libc6.1-1.so.2
or
ln -sf /usr/i486-slackware-linux/lib/libstdc++-libc6.1-2.so.3 /usr/lib/libstdc++-libc6.1-1.so.2

Then I got could not open default font 'fixed'
In a KDE shell type
xset q
copy the fonts path (all of them) and then edit /usr/bin/vncserver and use these in the
# $cmd .= " -fp /usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/";
as follows:
# $cmd .= " -fp /usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/";
$cmd .= " -fp /usr/share/fonts/override,/usr/share/fonts/TTF,/usr/share/fonts/misc,/usr/share/fonts/75dpi/";

vncserver
<first time>
vncserver -kill :1
edit ~/.vnc/xstartup and add the following on line 2:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

Then try: vncserver :0
</first time>


-----------------------------------------------------------------------------------------------------------------------------------------------
Slax Default Password
-----------------
root/toor

-----------------------------------------------------------------------------------------------------------------------------------------------
IPv4 Classes
---------------
Class A - Range:1-126 Private:10.x.x.x (CIDR /8)
Class B - Range:128-191 Private: 172.16.x.x - 172.31.x.x (CIDR /16)
Class C - Range:192-223 Private: 192.168.x.x (CIDR /24)

Subnet masks and Classless INter-Domain Routing notation (CIDR)
CIDR /24 = subnet mask of 255.0.0.0
CIDR /16 = subnet mask of 255.255.0.0
CIDR /24 = subnet mask of 255.255.255.0


-----------------------------------------------------------------------------------------------------------------------------------------------
Gateway
----------
To see the gateway(s) type
netstat -rn
or
route

to change the gateway type:
route add default gw 192.168.2.202

-----------------------------------------------------------------------------------------------------------------------------------------------
netstat
--------
netstat -a

netstat -b 5 > connections.txt

-----------------------------------------------------------------------------------------------------------------------------------------------
Defrag
--------
Check files for Fragmentation
filefrag *

Info: ext2 and ext3 - should keep themselves fairly defragged if there is 20% empty space
df -h (or df -hlx cifs)

Windows Defrag
--------------------
JKDefrag is prett cool.

Just remember to turn off the Windows Auto Defrag:

Windows 2000 & 2003:
The built-in defragger is not started automatically.
Windows XP:
1. Download the free * Tweak UI utility from Micorosft.
2. Click on 'General' and untick the 'Optimise hard disk when idle' box.
Windows Vista:
1. Start -> All Programs -> Accessories -> System Tools -> Disk Defragmenter
2. Untick the "Run on a schedule (recommended)" box.
(Although I also went into the scheduler and turned it off there too)



-----------------------------------------------------------------------------------------------------------------------------------------------
Desktop Color (Colour)
---------------------------
XP Color LCD
R0
G78
B152
XP - Nice one CRT
R58
G110
B165
Another Cool Blue
R35
R100
R200

-----------------------------------------------------------------------------------------------------------------------------------------------
fstab
------
Note: I've had better results with changing cifs to smbfs - as the cifs cache seems to be too strong, so that changes to the files are cached in the linux system.

Bahamas /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
//192.168.2.208/c /mnt/beach/c cifs defaults,user=UserName,password=Password 0 0
//192.168.2.199/q-drive /mnt/beast/q-drive cifs defaults,user=UserName,password=Password 0 0
/dev/hdc /media/cdrom auto pamconsole,ro,exec,noauto,managed 0 0


-----------------------------------------------------------------------------------------------------------------------------------------------
SSH Keys - To setup a machine to allow logins via SSH Keys - when you have a SSH Key
-----------
- You'll need to enter your SSH Key (which starts with something like ssh-rsa xxxx) in ~/.ssh/authorized_keys or ~/.ssh/authorized_keys2
- If you had to create the file, then apply the following - otherwise you may find ssh doesn't allow you to automatically log in.
chmod 644 authorized_keys2


-----------------------------------------------------------------------------------------------------------------------------------------------
SSH Keys - How to make a SSH Key and how to copy it to the desired host
-----------
ssh-keygen -t rsa
(Don't use a PassPhrase)

cat ~/.ssh/id_rsa.pub | ssh -l root localhost "cat - >>.ssh/authorized_keys2" (you'll want to replace localhost with the hostname)
(for fedora)
(you may need to chmod 644 ~/.ssh/authorized_keys2)

cat ~/.ssh/id_rsa.pub | ssh -l root 192.168.2.90 "cat - >>.ssh/authorized_keys"
(for fox)


-----------------------------------------------------------------------------------------------------------------------------------------------
SSH Tunneling
-----------------
From: http://www.rzg.mpg.de/networking/tunnelling.html

ssh -l myuserid -L 7777:work:22 gate cat -
ssh -p 7777 localhost uname -a
slogin -p 7777 localhost
scp -p -P 7777 localhost:data/file1.txt .
sftp -oPort=7777 localhost
ssh -l myuserid -L 7777:work1:22 -L 7778:work2:22 -L 7779:work3:22 gate cat - (muliple tunnels)


-----------------------------------------------------------------------------------------------------------------------------------------------
SSH
----
ssh [email protected] /mnt/flash/file1 (executes this file on the remote machine)

-----------------------------------------------------------------------------------------------------------------------------------------------
SSHD on Windows
---------------------
There may be some more info in this document, otherwise have a look at:
http://pigtail.net/LRP/printsrv/cygwin-sshd.html

-----------------------------------------------------------------------------------------------------------------------------------------------
SCP
----
scp file1 [email protected]:/mnt/flash (copies file1 to remote machine)

-----------------------------------------------------------------------------------------------------------------------------------------------
rsync
------
rsync -av --delete-after -e ssh dir1 root@machinename:/workdrive/tmp/dir2
-av --stats --progress --delete-after
--delete-before
rsync -av --stats --progress --modify-window=1 [email protected]:/workdrive/q-drive/ /workdrive/q-drive/

"C:/Program Files/cwRsync/bin/rsync" -av --stats --progress --modify-window=1 --delete-during '/cygdrive/q/' '/cygdrive/j/Sync/Q-Drive/'

-----------------------------------------------------------------------------------------------------------------------------------------------
xcopy (doesn't delete)
-------
xcopy q:/*.* j:/Sync/Q-Drive /D /E /H /R /G /I /K /Y /C

-----------------------------------------------------------------------------------------------------------------------------------------------
LD
--
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH my_prog (runs my_prog with . as included in the Library Path)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/lib
export LD_LIBRARY_PATH=/mnt/flash/lib:/lib
export LD_DEBUG=files
export LD_DEBUG=help

The correct thing is to have /etc/ld.so.conf setup correctly
The 2 alternates are LD_LIBRARY_PATH and linking with the -rpath option. Both of these have some severe disadvantages. Rather set up /etc/ld.so.conf

In emergencies you can specify specific libraries that must be loaded in /etc/ld.so.preload
See also: /etc/ld.so.cache

See also ldconfig which may be used to "install" new libraries
See also /lib/ld.so.1
which can be run wit /lib/ld.so.1
/lib/ld.so.1 --list clockos
/lib/ld.so.1 --library-path /usr/local/lib /usr/local/bin/sqlite3shell


To see which librares a program requires you can use either:
ldd filename
objdump -x filename
readelf -a filename

-----------------------------------------------------------------------------------------------------------------------------------------------
Lowercase FileNames
-------------------------
for f in *; do mv "$f" "`echo $f | tr '[:upper:]' '[:lower:]'`"; done (Handles files with spaces)
for f in *; do mv $f `echo $f | tr '[:upper:]' '[:lower:]'`; done


-----------------------------------------------------------------------------------------------------------------------------------------------
Bash Script
-------------

#!/bin/bash
xxxx

chmod u+x
./script
g
# if a file exists
if [ -f "$file" ] ; then
else
fi


Bash If
--------
From: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html

[ -a FILE ] True if FILE exists.
[ -b FILE ] True if FILE exists and is a block-special file.
[ -c FILE ] True if FILE exists and is a character-special file.
[ -d FILE ] True if FILE exists and is a directory.
[ -e FILE ] True if FILE exists.
[ -f FILE ] True if FILE exists and is a regular file.
[ -g FILE ] True if FILE exists and its SGID bit is set.
[ -h FILE ] True if FILE exists and is a symbolic link.
[ -k FILE ] True if FILE exists and its sticky bit is set.
[ -p FILE ] True if FILE exists and is a named pipe (FIFO).
[ -r FILE ] True if FILE exists and is readable.
[ -s FILE ] True if FILE exists and has a size greater than zero.
[ -t FD ] True if file descriptor FD is open and refers to a terminal.
[ -u FILE ] True if FILE exists and its SUID (set user ID) bit is set.
[ -w FILE ] True if FILE True if FILE exists and is writable.
[ -x FILE ] True if FILE exists and is executable.
[ -O FILE ] True if FILE exists and is owned by the effective user ID.
[ -G FILE ] True if FILE exists and is owned by the effective group ID.
[ -L FILE ] True if FILE exists and is a symbolic link.
[ -N FILE ] True if FILE exists and has been modified since it was last read.
[ -S FILE ] True if FILE exists and is a socket.
[ FILE1 -nt FILE2 ] True if FILE1 has been changed more recently than FILE2, or if FILE1 exists and FILE2 does not.
[ FILE1 -ot FILE2 ] True if FILE1 is older than FILE2, or is FILE2 exists and FILE1 does not.
[ FILE1 -ef FILE2 ] True if FILE1 and FILE2 refer to the same device and inode numbers.
[ -o OPTIONNAME ] True if shell option "OPTIONNAME" is enabled.
[ -z STRING ] True of the length of "STRING" is zero.
[ -n STRING ] or [ STRING ] True of the length of "STRING" is non-zero.
[ STRING1 == STRING2 ] True if the strings are equal. "=" may be used instead of "==" for strict POSIX compliance.
[ STRING1 != STRING2 ] True if the strings are not equal.
[ STRING1 < STRING2 ] True if "STRING1" sorts before "STRING2" lexicographically in the current locale.
[ STRING1 > STRING2 ] True if "STRING1" sorts after "STRING2" lexicographically in the current locale.
[ ARG1 OP ARG2 ] "OP" is one of -eq, -ne, -lt, -le, -gt or -ge. These arithmetic binary operators return true if "ARG1" is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to "ARG2", respectively. "ARG1" and "ARG2" are integers.



-----------------------------------------------------------------------------------------------------------------------------------------------
Date & Time
--------------
date
date -R
date -s "18:00:00" (Works on Fedora)
date -s "Dec 31" (Works on Fedora)
date -s "Dec 31 2006" (Works on Fedora)
date -s "Dec 31 18:00" (Works on Fedora)
date -s "Dec 31 2006 18:00:00" (Works on Fedora)

-----------------------------------------------------------------------------------------------------------------------------------------------
Date & Time Setting (on Fedora)
--------------------------------------
rdate -s 129.6.15.29
date; hwclock; hwclock -w; hwclock


Date & Time Setting (on Foxboard)
--------------------------------------
rdate -s 129.6.15.29
date; hwclock; hwclock -w -u; hwclock

-----------------------------------------------------------------------------------------------------------------------------------------------
Date & Time on FoxBoard
------------------------------
date 123118002007.30 (31 Dec 2007 18:00.30) - only works on Fox
date -u 011903132038.45 (Linux Y2K GMT 19 Jan 2038 03:14:07) - only works on Fox
date 123118002006.30
date 010118002007.30
(date MMDDhhmmYYYY.ss)
hwclock -w (write date to rtc chip - if you have one)

On another linux machine...
scp /usr/share/zoneinfo/Africa/Johannesburg [email protected]:/etc/localtime

Back on the Fox (you can also use time.nist.gov)
rdate -s 129.6.15.29 -t 3
rdate -s time-b.nist.gov
rdate -s time-c.timefreq.bldrdoc.gov
rdate -s nist1.symmetricom.com
rdate -s 129.6.15.29
date
/sbin/hwclock -w -u

-----------------------------------------------------------------------------------------------------------------------------------------------
Time and TimeZones
------------------------
1) cat /etc/sysconfig/clock
ZONE="Africa/Johannesburg"
UTC=false
ARC=false
2) ln -sf /usr/share/zoneinfo/Africa/Johannesburg /etc/localtime
3) date or date MMDDhhmm
4) /sbin/hwclock or /sbin/hwclock --systohc

You can check your timezone info with:
zdump -v /etc/localtime

zic - can be used to compile timezones


-----------------------------------------------------------------------------------------------------------------------------------------------
KDevelop (kdevelop)
-----------
./configure --with-qt-dir=/usr/lib/qt-3.3 (check where yours is though)

-----------------------------------------------------------------------------------------------------------------------------------------------
Find & Locate
----------------
FC5+
locate file-to-locate
updatedb file-to-locate
FC4-
slocate
slocate -u (rebuild locate database)

find . -name xxx -print
find / -name xxx -print

-----------------------------------------------------------------------------------------------------------------------------------------------
Man Pages
-------------
In Konqueror use man:man

-----------------------------------------------------------------------------------------------------------------------------------------------
Konqueror
------------
man:man
smb://spiff
media://


-----------------------------------------------------------------------------------------------------------------------------------------------
System Monitors
-------------------
ksysguard
kinfocenter
gnome-system-monitor
top
free -m (or free -mt)
cat /proc/meminfo

df -h (or df -hlx cifs)
df | grep /mnt/flash | cut -c41-50

vmstat (-a)
ps aux --sort -pmem | less
slabtop
yum install systemtap (FC4+) [Developer library I think]

-----------------------------------------------------------------------------------------------------------------------------------------------
Hard Drive Disk Temp
-------------------------
yum install hddtemp.i386
(ubuntu: sudo apt-get install hddtemp)
hddtemp /dev/hda
hddtemp /dev/hdb
hddtemp /dev/hd?
hddtemp -q /dev/sd?

-----------------------------------------------------------------------------------------------------------------------------------------------
Hard Drives
-------------
/dev/hda master device on primary IDE channel
/dev/hdb slave device on primary IDE channel
/dev/hdc master device on secondary IDE channel
/dev/hdd slave device on secondary IDE channel
/dev/sda first SCSI hard drive
/dev/sdb second SCSI hard drive


-----------------------------------------------------------------------------------------------------------------------------------------------
Keyboard Shortcuts
------------------------
Ctrl-Escape - Process Manager
Ctrl-Alt-Backspace - kills xdm

-----------------------------------------------------------------------------------------------------------------------------------------------
VNC Once-off Config
-------------------------
vncserver (starts it all and generates /root/.vnc/xstartup if needed)
vncserver -kill :1
vi ~/.vnc/xstartup (you need to uncomment the first two real lines)
vi /etc/kde/kdm/kdmrc (see below)
vi /etc/sysconfig/desktop (see below)
I've also had to tweak the following:
vi ~/.xinitrc
exec startkde
reboot
vncserver

-----------------------------------------------------------------------------------------------------------------------------------------------
Using VNC
------------
vncserver (starts server - connect to a linux machine like this machinename:1)
vncviewer

-----------------------------------------------------------------------------------------------------------------------------------------------
Other VNC options (which I don't use)
---------------------------------------------
vncpasswd (sets password)
vncconfig
Xvnc - should only be run from vncserver
/etc/sysconfig/vncservers - uncomment VNCSERVER="1:root"

-----------------------------------------------------------------------------------------------------------------------------------------------
Switching Desktops
-----------------------
See also KUbuntu
switchdesk
switchdesk kde

see also:
/etc/kde/kdm/kdmrc and change the line AllowRootLogin=true (you may need to set this in both places)
/etc/sysconfig/desktop:(you may need to add the following / or change it) (the settings in this file are used from either: /etc/X11/prefdm or /etc/X11/xinit/Xclients or ~/.Xclients) :
(remove the tabs!! - and only use the options you want from this list)
DESKTOP=GNOME
DESKTOP=KDE
DISPLAY=GNOME
DISPLAY=KDE
DISPLAYMANAGER=GNOME
DISPLAYMANAGER=XDM
DISPLAYMANAGER=KDE

kdm
gdm
startxfce4

-----------------------------------------------------------------------------------------------------------------------------------------------
Init
----
Default Init mode in /etc/inittab (id:5:initdefault:)
init 0 = halt
init 1 = single user
init 2 = multiuser no NFS
init 3 = multiuser
init 4 = unused
init 5 = X11
init 6 = reboot
See also /etc/init.d and /etc/rc.d
chkconfig --list (will list which init modes a service is started in)
chkconfig --level 5 vncserver on (must be root - although I never seem to be able to get VNC to work as a service)

-----------------------------------------------------------------------------------------------------------------------------------------------
Mail Aliases
-------------
Edit /etc/mail/aliases
root:[email protected]

run newaliases
mail -s Test root
xxxx
^D


-----------------------------------------------------------------------------------------------------------------------------------------------
Tar
----
tar zxvf xxx.tar.gz
tar jxvf xxx.targ.bz2

Create tar file...
tar cvf newfile.tar directoryname/


-----------------------------------------------------------------------------------------------------------------------------------------------
PGP / GPG
------------
% pgpk -a KEYS
% pgpv james-version.tar.gz.asc
or
% pgp -ka KEYS
% pgp james-version.tar.gz.asc
or
% gpg --import KEYS
% gpg --verify james-version.tar.gz.asc

-----------------------------------------------------------------------------------------------------------------------------------------------
TrueCrypt
------------
yum install truecrypt
rpm -i truecryptxx.rpm [install]
rpm -e truecryptxx.rpm [uninstall]

man truecrypt
truecrypt --help

truecrypt /root/volume.tc /mnt/tc
truecrypt -r /root/volume.tc /mnt/tc [read-only]
truecrypt -i [interactive mode]
truecrypt -d /mnt/tc [dismount]
truecrypt -vl [list mapped volumes]

-----------------------------------------------------------------------------------------------------------------------------------------------
TrueCrypt 5.1a Source Compile (for Slax 6)
-------------------------------------------------
See Also: http://meandubuntu.wordpress.com/2008/02/07/my-first-compile-truecrypt-50/
Download:
TrueCrypt 5.1a Source.tar.gz
wxWidgets-2.8.7.tar.gz
fuse-2.7.3.tar.gz (I didn't end up using this - as it's already in Slax)

tar zxvf wxWidgets-2.8.7.tar.gz
copy this wxWidgets-2.8.7 folder to /usr/src/wxWidgets-2.8.7

tar zxvf TrueCrypt 5.1a Source.tar.gz
cd truecrypt-5.1a-source
make WX_ROOT=/usr/src/wxWidgets-2.8.7 wxbuild
make

-----------------------------------------------------------------------------------------------------------------------------------------------
Ethernet Speeds
-------------------
ethtool eth0 (shows current settings)
ethtool -s eth0 speed 100 duplex full autoneg off
or
mii-tool eth0 (or mii-tool -v eth0)
mii-tool -F 100baseTx-FD eth0
lspci
more /proc/net/dev (network stats)

-----------------------------------------------------------------------------------------------------------------------------------------------
LogWatch
------------
Run from Cron (/etc/cron.daily folder)
Setup in /etc/log.d/logwatch.conf

-----------------------------------------------------------------------------------------------------------------------------------------------
USB Drives & Mount
-----------------------
mkdir -p /mnt/usbkey
mount -tvfat -oumask=0000 /dev/sda1 /mnt/usbkey

On Fox:
mount -t vfat -o umask=0000 /dev/sda1 /mnt/1

mount -t cifs //192.168.2.208/c /mnt/beach/c -o user=jono =o pass=Jono
//192.168.2.208/c /mnt/beach/c cifs defaults,user=Jono,password=Jono 0 0

On Fox:
mount -t jffs2 /dev/flash2 /mnt/2

On Fedora:
mount -t cramfs -o loop rootfs.img /mnt/junk

-----------------------------------------------------------------------------------------------------------------------------------------------
NTFS Mount on Linux
-------------------------
1) Check you have the ntfs driver:
dmesg | grep -i ntfs
or
grep -i ntfs /var/log/messages
and/or
cat /proc/filesystems | more
2) You may need to install the ntfs driver
yum install ntfs-3g (for read-write)
or
yum install kernel-module-ntfs (for read-only) (older fedoras)
yum install kmod-ntfs (for fc5 fc6 - will need Livna Repo)

3) mkdir /mnt/j-drive
mount -t ntfs-4g /dev/sdb1 /mnt/j-drive -o force (note this uses the force mode)
mount /dev/sda1 /mnt/j-drive -t ntfs-3g -r (for read-only)
mount /dev/sda1 /mnt/j-drive -t ntfs-3g -r (for read-only)
or
mount /dev/sda1 /mnt/j-drive -t ntfs -r (for read-only) [note: this didn't work for me in fc5]

4) (Optional0 /etc/fstab
/dev/sdb1 /mnt/j-drive ntfs-3g defaults,force 0 0 (note this uses the force mode)
or
/dev/sda1 /mnt/j-drive ntfs-3g defaults 0 0
or
/dev/sda1 /mnt/j-drive ntfs nodev,noexec,nosuid,ro,umask=222 0 0

-----------------------------------------------------------------------------------------------------------------------------------------------
Read-Only File System - how to change this to Read-Write
----------------------------------------------------------------------
mount -o remount,rw / (or whatever other devices need remounting e.g. /dev/hdd1)

-----------------------------------------------------------------------------------------------------------------------------------------------
HardDisk Parameters
-------------------------
hdparm -v /dev/hda
should give something like:
/dev/hdd:
multcount = 16 (on)
IO_support = 1 (32-bit)
unmaskirq = 1 (on)
using_dma = 1 (on)
keepsettings = 0 (off)
readonly = 0 (off)
readahead = 256 (on)

-----------------------------------------------------------------------------------------------------------------------------------------------
HardDisks - checking & info
------------------------------------
e2fsck /dev/hdb1 (Checks the harddrive)
dumpe2fs -h /dev/hdb1 (shows info) or dumpe2fs -h /dev/mapper/VolGroup00-LogVol00
dumpe2fs -b /dev/hdb1 (shows bad block info)
tune2fs /dev/hdb1 (has more options to change the auto intervals for calling e2fsck - e.g. -i 3m or -c 10)

-----------------------------------------------------------------------------------------------------------------------------------------------
HardDisks - checking for Bad Sectors
------------------------------------
badblocks (but rather use e2fsck -c) (See man badblocks for why)
e2fsck -c -k -n /dev/hdb1 (won't change filesystem - but does read-only bad disk check - will preserve last list and will add to list) or e2fsck -c -k -n /dev/mapper/VolGroup00-LogVol00
e2fsck -c -k /dev/hdb1 (read-only bad disk check - will preserve last list and will add to list) or e2fsck -c -k /dev/mapper/VolGroup00-LogVol00
e2fsck -c -c -k /dev/hdb1 (read/write check - non destructive)

-----------------------------------------------------------------------------------------------------------------------------------------------
HardDisks ext3 Formatting
-------------------------
1) Partition the disks
init 1 (optional)
fdisk -l (to see what's detected) (or you can run blkid)
fdisk /dev/hdb
(m = help, t, 1, L, fd, p, w) - by default it sets the partition type to 83 (Linux) - correct
(I created a primary partition - full size)

2) Format the ext3 disk
mke2fs -j -b 4096 /dev/hdb1

3) To check the formating before mounting--
e2fsck /dev/hdb1

4) Mount it:
mkdir /workdrive
edit etc/fstab:
/dev/hdb1 /workdrive ext3 defaults 1 2
mount /dev/hdb1 /workdrive
(or mount -a)


-----------------------------------------------------------------------------------------------------------------------------------------------
RAID 5
--------
To create the raid set:
1) Get the disks ready
init 1
fdisk -l
fdisk /dev/hdb
(m = help, [new or delete first] then t, 1, L, fd, p, w) - set the partition type to fd (Linux raid autodetect)

NB: Physically label your disks in your machine as /dev/hda1 etc. (I know from experience this is a good thing to do, when a disk fails!!!)

2) Create the Raid array
mdadm --create /dev/md0 --chunk 64 --level 5 --raid-devices 3 /dev/hdb1 /dev/hdc1 /dev/hdd1

3) Show status
cat /proc/mdstat
mdadm --examine /dev/hdb1
mdadm --detail /dev/md0

4) Format the Raid5 Array
mkswap
mke2fs -j -b 4096 -R stride=16 /dev/md0
(The -R is the same as -E - but is for older systems - which means an extended command in this case the stride=16 command - which is a RAID configuration)
(Note: stride = [mdadm -- create chunk size] / ([mke2fs -b size] / 1024)

5) To check the formating before mounting--
e2fsck /dev/md0

6) Mount it:
mkdir /mnt/raid (I changed /mnt/raid to /workdrive)
edit etc/fstab:
/dev/md0 /mnt/raid ext3 defaults 1 2 (I changed /mnt/raid to /workdrive)
mount /dev/md0 /mnt/raid (or mount -a)

7) Recovery (It's best to fail a device before removing it).
To remove a device:
mdadm /dev/md0 --fail /dev/hdd1
mdadm /dev/md0 --remove /dev/hdd1

To add a new device:
fdisk -l
You may need to partition a new drive to Linux Raid Auto Detect
fdisk /dev/hdd
(m = help, t, 1, L, fd, p, w) - set the partition type to fd (Linux raid autodetect)
mdadm /dev/md0 --add /dev/hdd1
Now if you mdadm --detail /dev/md0 you should see this drive as spare drive and further up in the output your should see the rebuild percentage.
Or you can cat /proc/mdstat and it also shows the percentage.

If you reinstalled the OS - you would probably use "assemble" to setup a raid array of existing disks
mdadm --assemble --scan
mdadm --assemble /dev/md0 /dev/hdb1 /dev/hdc1 /dev/hdd1
(-f does a force if some blocks are out of sync)
(-R attempt to run the array even if less devices are present)

8) Getting it to load on boot: (Done automatically in Fedora Core 3 - possible by a service)
mdadm --assemble --scanmd

9) Raid Monitoring
Edit the /etc/mdadm.conf file and add:
MAILADDR [email protected]
or for once off (won't remember after boot)
mdadm --monitor --mail=root@localhost --delay=1800 /dev/md0
mdadm --monitor --mail=root@localhost --delay=1800 --daemonise /dev/md0
Also see the Pam configuration

-----------------------------------------------------------------------------------------------------------------------------------------------
RAID 1
--------
Pretty similar to RAID 5 (as above)

1) Adding a new drive to a RAID 1 setup.
For example you have 2 drives configured as RAID 1, now you want to add a third drive
fdisk the new drive (as above)
mdadm --grow /dev/md0 -n3 (n3 = number of devices - set this to one more than you currently have)
mdadm /dev/md0 --add /dev/hdc1 (of whatever the new drive is called)

-----------------------------------------------------------------------------------------------------------------------------------------------
WUS - Windows Update Services
----------------------------------------
Sorry - this isn't Unix I know - just didn't have any other place to put this. hehe
from: http://www.wsus.info/forums/lofiversion/index.php?t8353.html
Make sure BITS Service is running
Stop automatic updates service
then delete the c:/windows/softwaredistribution folder,
then delete c:/windows/WindowsUpdate.log
then delete c:/windows/Windows Update.log (if it exists)
then start the service back up. Run
wuauclt.exe /detectnow
to tell it to check in right now. That should fix it.
Try reinstalling the automatic updates service first, go to a command promt and run regsvr32 /u wuaueng.dll, you will get a pompt to that the dll was unregistered.
Now that you have removed automatic updates reinstall by typing in regsvr32 wuaueng.dll.
Once this is done start the automatic updates service and run wuauclt.exe /detectnow and see if the error persists.
If that doesnt help try to repair bits by following the instructions at the following website http://blogs.msdn.com/astebner/archive/200.../06/489726.aspx
Third make sure the Cryptographic Services is running
Make sure your Content folder allows downloading on .exe extensions !!
0x8024400A
regsvr32 MSXML.DLL
regsvr32 MSXML2.DLL
regsvr32 MSXML3.DLL


-----------------------------------------------------------------------------------------------------------------------------------------------
How to start a low priority task in Windows
---------------------------------------------------

cmd.exe /c start "JkDefrag" /BelowNormal "jkdefragCmd.exe"


-----------------------------------------------------------------------------------------------------------------------------------------------
PAM
----
Config in /etc/logwatch/conf/logwatch.conf (or /etc/log.d/logwatch.conf (old FCs))
MailTo = [email protected]

-----------------------------------------------------------------------------------------------------------------------------------------------
KUbuntu
----------
sudo apt-get install kubuntu-desktop (or xcfe)
sudo dpkg-reconfigure kdm (or gdm)

-----------------------------------------------------------------------------------------------------------------------------------------------
dd
---
From: http://www.pendrivelinux.com/2007/11/22/permanently-remove-information-from-your-usb-drive/
deleted information non-recoverable:
1. Create a dummy file named junk.bin on the USB flash drive
2. Open a terminal and type sudo su
3. Type fdisk -l and locate the partition you would like to zero out
4. Type mkdir /tmp/ddusb
5. Type mount -o loop /dev/sdxx /tmp/ddsdb (replacing sdxxx with your partition)
6. Type dd if=/dev/zero of=/tmp/ddusb/junk.bin
7. Type rm /tmp/ddusb/junk.bin
Thats all. Now any empty space on this partition has been filled with zeros and the deleted information that was once on your USB flash drive has been overwritten.

-----------------------------------------------------------------------------------------------------------------------------------------------
Grub.conf
-----------
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.9-1.667)
root (hd0,0)
kernel /vmlinuz-2.6.9-1.667 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.9-1.667.img
title Fedora Core (2.6.9-1.667) Single User Mode
root (hd0,0)
kernel /vmlinuz-2.6.9-1.667 ro root=/dev/VolGroup00/LogVol00 rhgb quiet single
initrd /initrd-2.6.9-1.667.img
title Other
rootnoverify (hd1,0)
chainloader +1

(Note you can add the "single" on the fly - in Grub loader - use e to edit and add single to the kernel line - these changes aren't permanent).


-----------------------------------------------------------------------------------------------------------------------------------------------
StressLinux
--------------
(Press Space when choosing Keyboard to select the US one)

burnMMX - Intel MMX - Brings CPU usage to 100% - if your system is still running after 10 minutes - life is good.
burnBX - another Intel burn test
stress - same sort of idea:
stress -c 8-i 4 -m 2 --vm-bytes 128M --timeout 60s
stress -c 1K
smartctrl -a /dev/hda
smartctrl -t short /dev/hda
smartctrl -t long /dev/hda
smartctrl -a /dev/hda
lshw - shows a bunch of info
x86info - shows CPU info
hddtemp /dev/hda
nbench - Bench mark application (should take 10 mins or less to run)

-----------------------------------------------------------------------------------------------------------------------------------------------
Some more piping things
-----------------------------
rdate -s 129.6.15.29 -t 3 > /dev/null 2>&1


# Send errors from commands to the console.
exec 2> /dev/console


==================================================================================================
==================================================================================================
==================================================================================================
==================================================================================================


Fedora Core 7 (FC7) Installation Notes:
-----------------------------------------------
If you are looking for in-depth notes have a look at this great resource: http://www.mjmwired.net/resources/mjm-fedora-f7.html
And: http://www.mjmwired.net/resources/mjm-services-f7.html

1) My install starts off with the the usual kind of stuff - I like Logical Volumes & Grub.
2) I chose Office and Productivity, Software Development, and Web Server
3) Choose the Customize Now option - It seems to me that once installed any further updates use your Internet connection, not your installation CD.
4) Then I added the following:
Desktop Environments - KDE (ie Both Gnome and KDE)
Applications - Sound and Video - mikmod, [NB Remove totem-mozplugin (causes problems later)]
Development - You may optionally want Java, KDE Development & Ruby
Servers - Server Configuration Tools
Servers - Windows File Server
Base System - (Turn off) Dial-Up Support
Base System - System Tools (for samba client & BackupPC & ntfs-3g) & turn on fuse
Base System - NB Leave Virtualization Off (I installed Xen on FC6 and it croaked on first boot - just kept rebooting my system) - If you need Xen install it later.
5) For what I am doing (Linux on LAN), I am comfortable with turning off the firewall and Disabling SELinux
6) System User - it's worth adding 1 user in here. (be careful the username is case sensitive!)
7) add ssh keys (see below)
8) Configure sudo
su
(optional - you may or may not need this) chmod u+w /etc/sudoers
echo 'jono ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
(optional - you may or may not need this) chmod u-w /etc/sudoers
exit
9) yum install yum hddtemp katapult yumex kyum switchdesk
10) [switchdesk kde - or do this from the login menu - options]
then I move the taskbar to the left around - and make it wider (Size Large)
move the launch pager down and set the number of colums to 2 (I also only use 2 virtual windows)
change the clock's to type plain and add a date (any condensed font size size 6 works well if you are using 1024x768)
add an "external taskbar" to the top. (You may need to configure this from Control Center | Dekstop | Panels) - 90% Top Centered, Tiny (You may need to go to Control Center - Desktop - Panels)
add the following menus to the KMenu - Network Folders, Quick Launcher, Recent Documents, Settings, ShowDesktop, System Menu & Terminal Sessions
Control Center | Regional & Accessibility | Country/Region & Language - tweak date and time formats etc.
13) vncserver stuff.../
switchdesk kde
vncserver (starts it all and generates /root/.vnc/xstartup if needed)
vncserver -kill :1
vi ~/.vnc/xstartup (you need to uncomment the first two real lines)
vncserver
(you can now connect to this machine via vnc to machine:1)
*14) yum - add any extra repositories (see below)
*15) edit fstab and configure mounts
16) edit /etc/profile and add any aliases like
alias lt='ls -lrthFh'
17) Configure warning email addresses. For example:
If you are using RAID - then edit /etc/mdadm.conf (see below)
pam - email - edit /etc/logwatch/conf/logwatch.conf (see below)
MailTo = [email protected]

Optional extras:

19) Samba
yum update samba samba-client samba-common
samba - call kcmsambaconf (see below for more details)
then add it as a service using either the graphical service manager or chkconfig --level 35 smb on
if you are running the firewall - you'll need to add samba to the firewall...
20) install hamachi - if you use hamachi (see further down for details)
21) if gcc 3 is needed:
sudo yum install compat-gcc-34 compat-gcc-34-c++
22) install backuppc - if you use it
23) Read-write NTFS mounting is supported if you:
yum install fuse fuse-libs ntfs-3g ntfsprogs ntfsprogs-gnomevfs
24) Add this machine to the backup program.
25) Install Graphics Driver....

nvidia graphics driver
-------------------------
Best to look here: http://www.mjmwired.net/resources/mjm-fedora-fc7.html
Yum
The following is just a quick summary:
Use Livna Repo
rpm -ivh http://rpm.livna.org/livna-release-7.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-livna
yum install kmod-nvidia

If you are unfortunate enough to have an old nvidia card (like my old nvidia Vanta TNT2) (see: http://www.nvidia.com/object/IO_32667.html or http://www.nvidia.com/object/unix.html (look in the legacy section))
- if you installed the stuff above then: yum remove xorg-x11-drv-nvidia
yum install kmod-nvidia-legacy

I also had to tweak my /etc/X11/xorg.conf (and just when you thought setting up linux was going to be easy!! haha)

# Xorg configuration created by livna-config-display

Section "ServerLayout"
Identifier "Default Layout"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
ModulePath "/usr/lib/xorg/modules/extensions/nvidia"
ModulePath "/usr/lib/xorg/modules"
EndSection

Section "ServerFlags"
Option "AIGLX" "on"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection

Section "Monitor"
Identifier "Jono Default Monitor"
HorizSync 30.0 - 70.0
VertRefresh 50.0 - 85.0
Option "DPMS"
EndSection

Section "Device"
Identifier "Videocard0"
Driver "nvidia"
Option "AddARGBGLXVisuals" "True"
Option "DisableGLXRootClipping" "True"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Jono Default Monitor"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1152x864" "1024x768" "800x600" "640x480"
EndSubSection
EndSection

Section "Extensions"
Option "Composite" "Enable"
EndSection

==================================================================================================

Fedora Core 6 (FC6) Installation Notes:
-----------------------------------------------
If you are looking for in-depth notes have a look at this great resource: http://www.mjmwired.net/resources/mjm-fedora-fc6.html

1) My install starts off with the the usual kind of stuff - I like Logical Volumes & Grub.
2) Edit or network settings - as this allows you to turn off IPv6 if you aren't going to be using it.
3) Tip: I found that ticking on the "Fedora Extras" crashed my install.
4) Tip: I also found that clicking "Add Additional Software Repositories" also crashed my install.
5) I chose Office and Productivity, Software Development, and Web Server
6) Choose the Customize Now option - It seems to me that once installed any further updates use your Internet connection, not your installation CD.
7) Then I added the following:
Desktop Environments - KDE (ie Both Gnome and KDE)
Applications - Games and Entertainment - (Options) I turn them all on
Applications - Graphicsal Internet - (Options) thunderbird, kdewebdev
Applications - Office/Productivity - (Options) gnucash (although I've never used it seriously)
Applications - Sound and Video - k3b, mikmod
Development - You may optionally want Eclipse, Java, KDE Development, Legacy Software Development (recommended) & Ruby
Servers - Server Configuration Tools
Servers - Windows File Server
Base System - (Turn off) Dial-Up Support
Base System - Legacy Software Support
Base System - System Tools (for samba client) - (and add) rdesktop
Base System - Virtualization (Make sure this is off - I installed Xen and it croaked on first boot - just kept rebooting my system) - If you need Xen install it later.
[Base System - X Windows System - switchdesk (Why would anyone installing KDE and Gnome not want this installed by default?)]
8) For what I am doing (Linux on LAN), I am comfortable with turning off the firewall and disabling SELinux
9) System User - it's worth adding 1 user in here. (be careful the username is case sensitive!)
After Reboot
10) add ssh keys (see below)
11) Configure sudo
su
(optional - you may or may not need this) chmod u+w /etc/sudoers
echo 'jono ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
(optional - you may or may not need this) chmod u-w /etc/sudoers
exit
12) switchdesk kde
then I move the taskbar to the left around
move the launch pager down and set the number of colums to 2
change the clock's date font to a condensed size 6 font, so it fits
add an "external taskbar" to the top. (You may need to configure this from Control Center | Dekstop | Panels) - 80% Top Centered, Tiny
add the following menus to the KMenu - rk Folders, Quick Browser, Recent Documents, Settings, System Menu & Terminal Sessions
remove the word, spreadsheet, presentation buttons
Add Applet:
Quick Launcher
Recent Documents
ShowDesktop
Terminal Sessions
System Menu
Control Center | Regional & Accessibility | Country/Region & Language - tweak date and time formats etc.
13) vncserver (see below)
14) yum - add any extra repositories
15) edit fstab and configure mounts
16) edit /etc/profile and add any aliases like
alias lt='ls -lrthF'
17) Configure warning email addresses. For example:
If you are using RAID - then edit /etc/mdadm.conf (see below)
pam - email - edit /etc/logwatch/conf/logwatch.conf (see below)
MailTo = [email protected]

Optional extras:
18) yum install hddtemp katapult yumex kyum
19) samba - call kcmsambaconf (see below for more details)
then add it as a service using either the graphical service manager or chkconfig --level 35 smb on
if you are running the firewall - you'll need to add samba to the firewall...
20) install hamachi - if you use hamachi (see further down for details)
21) if gcc 3 is needed:
sudo yum install compat-gcc-34 compat-gcc-34-c++
22) install backuppc - if you use it
23) Read-write NTFS mounting is supported if you:
yum install fuse fuse-libs ntfs-3g ntfsprogs ntfsprogs-gnomevfs
24) Add this machine to the backup program.
25) Install Graphics Driver....

nvidia graphics driver
-------------------------
Best to look here: http://www.mjmwired.net/resources/mjm-fedora-fc6.html
Yum
The following is just a quick summary:
Use Livna Repo
rpm -ivh http://rpm.livna.org/livna-release-6.rpm
rpm --import http://rpm.livna.org/RPM-LIVNA-GPG-KEY
yum install kmod-nvidia

==================================================================================================

Fedora Core 5 (good install options)
-----------------
choose all 3 broad catogories & tick:
Desktop Environments:
+ KDE
Development Tools:
+ eclipse
+ Java dev
+ KDE dev
+ Ruby
Servers:
+ Server Config Tools
+ Windows File Server
Base: System tools:
+ rdesktop
+ tsclient
X Window System:
+ switchdesk


==================================================================================================

rsync GUI (on Linux)
------------------------
qsync (http://transamrit.net/projects/qsync/)

rsync server (daemon) on Windows
---------------------------
I prefer using the cygwin-rsyncd package which is available for download from: http://backuppc.sourceforge.net/
But you can also configure cwrsync from: http://www.itefix.no/cwrsync/

cygwin-rsyncd setup: (I had to add C:/ProgramData/rsyncd/rsync.exe & C:/ProgramData/rsyncd/cygrunsrv.exe to the Windows Firewall Execption list)
[c-drive]
path = c:
comment = Entire Drive
auth users = backuppc
secrets file = c:/ProgramData/rsyncd/rsyncd.secrets
# hosts allow = 172.16.0.17
strict modes = false
read only = true
list = false

Testing:
Once you've set this up you can Test it with (from your Linux machine to your Windows machine):
rsync rsync://[email protected]:873/c-drive
rsync rsync://[email protected]:873/temp
rsync -av [email protected]::temp
rsync 192.168.2.7:: (doesn't work on Windows machines)

On XP:
Had to add rsync.exe and C:/Program Files/cwRsyncServer/bin/cygrunsrv.exe to the firewall exception list - maybe this is not necc?

cwRsync setup
My rsyncd.conf file is:
[s-drive]
path = /cygdrive/j/Sync/S-Drive
read only = true
transfer logging = false

[test]
path = /cygdrive/c/Temp
read only = false
transfer logging = yes

To get SSH and RSync-Server installed on one XP machine (only on cwRsync)
1) just install the rsync-server with the OpenSSH option on. I just installed into c:/Cygwin
2) Run the install activate-user.sh script (you'll need to run a bash script first).
3) Edit your rsyncd.conf file.
4) Start both services (there are two)
5) Add the rsync.exe and the sshd.exe files to the Windows Firewall list.
6) You may want to add a key to .ssh/authorized_keys in the home directory of the user you'll use.
7) You can test your SSH connection using WinSCP - if you like
8) You can test your RSyncD using
rsync localhost::
rsync rsync://[email protected]:873/temp

==================================================================================================

Samba Config
----------------
Encrypt Passwords must be on !!
In KDE: kcmsambaconf
From Dos: net use s: /delete (may need to reboot after this)
From Dos: net use x: //penguin/x-drive /user:jono *
net use h: //192.168.2.198/home /user:jono *
smbstatus
To access another machines share in Linux use Konqueror with smb://spiff/desktop (or whatever the share is)
or you can use nautilus (File | Connect to Server)
nmblookup beach - to lookup beach's address....
smbclient -L beach -U YourUser
smbclient ////beach//Temp -I 192.168.2.207 -U YourUser


Emperor smb.conf (clip)
-------------------------
[home]
comment = Hdrive
path = /home
read only = no
guest ok = yes
force user = root
force group = root
case sensitive = no
msdfs proxy = no
create mask = 0777
directory mask = 0777


Penguin smb.conf (full)
------------------------
[global]
server string = penguin
password server = None
guest ok = yes
guest account = capesoftguest
workgroup = capesoft
local master = no
preferred master = no
username map = /etc/samba/smbusers
domain master = no
restrict anonymous = no
max protocol = NT
ldap ssl = No
server signing = Auto
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_SNDBUF=8192 SO_RCVBUF=8192
max xmit = 65535
syslog = 0
log level = 1

[tmp]
path = /tmp
read only = no
case sensitive = no
msdfs proxy = no

[p-drive]
path = /workdrive/p-drive
read only = no
case sensitive = no
msdfs proxy = no
create mask = 0777
directory mask = 0777
force group = capesoft

[x-drive]
path = /workdrive/x-drive
read only = no
case sensitive = no
msdfs proxy = no
create mask = 0777
directory mask = 0777
force group = capesoft

[linuxroot]
path = /

[s-drive]
path = /workdrive/s-drive
case sensitive = no
msdfs proxy = no
create mask = 0775
directory mask = 01775
read only = no
security mask = 0775
directory security mask = 01775
valid users = suzy,backup,backuppc,vaderbackup,brucehome,trevor,tnacompiler,jono,bruce,sean,lesley,robert,gary,paul,geoff,derek,eliza,simon
read list = suzy,backup,backuppc,vaderbackup,brucehome,trevor,tnacompiler
force directory security mode = 01000
force directory mode = 01000

[raidtest]
case sensitive = no
msdfs proxy = no
read only = no
path = /workdrive/raidtest/
block size = 4096
force group = capesoft
create mask = 0777
directory mask = 0777

[n-drive]
case sensitive = no
msdfs proxy = no
read only = no
create mask = 0777
directory mask = 0777
path = /workdrive/n-drive
force group = capesoft

[z_dont_use_q-drive-old]
case sensitive = no
msdfs proxy = no
path = /workdrive/q-drive
create mask = 0777
directory mask = 0777
force group = capesoft
comment = (Read Only - Use Beast now)

[v-drive]
case sensitive = no
msdfs proxy = no
path = /workdrive/v-drive/
read only = no
create mask = 0777
directory mask = 0777
force group = root
force user = root
comment = SVN Repositories

[u-drive]
case sensitive = no
msdfs proxy = no
read only = no
comment = Un-Backed Up Drive
create mask = 0777
directory mask = 0777
path = /workdrive/u-drive/
force group = capesoft

==================================================================================================

nbench
---------
http://www.tux.org/~mayer/linux/bmark.html
http://www.byte.com/bmark/download.htm
http://www.tux.org/~mayer/linux/results2.html
http://www.tux.org/~mayer/linux/compare/index.html
http://fresh.t-systems-sfr.com/linux/src/nbench-byte-2.2.2.tar.gz/

From the notes:
If you run all the tests (as you'll see, it is possible to perform "custom
runs", which execute only a subset of the tests) the BYTEmark will also
produce two overall index figures: Integer index and Floating-point index.
The Integer index is the geometric mean of those tests that involve only
integer processing -- numeric sort, string sort, bitfield, emulated
floating-point, assignment, Huffman, and IDEA -- while the Floating-point
index is the geometric mean of those tests that require the floating-point
coprocessor -- Fourier, neural net, and LU decomposition. You can use these
scores to get a general feel for the performance of the machine under test
as compared to the baseline 90 Mhz Pentium.

The Linux/Unix port has a second baseline machine, it is an AMD K6/233 with
32 MB RAM and 512 KB L2-cache running Linux 2.0.32 and using GNU gcc
version 2.7.2.3 and libc-5.4.38. The integer index was split as suggested
by Andrew D. Balsa <[email protected]>, and reflects the realization that
memory management is important in CPU design. The original tests have been
left alone, however, the geometric mean of the tests NUMERIC SORT, FP
EMULATION, IDEA, and HUFFMAN now constitutes the integer-arithmetic focused
benchmark index, while the geometric mean of the tests STRING SORT,
BITFIELD, and ASSIGNMENT makes up the new memory index. The floating point
index has been left alone, it is still the geometric mean of FOURIER,
NEURAL NET, and LU DECOMPOSITION.


Running on: FoxBoard
BYTEmark* Native Mode Benchmark ver. 2 (10/95)
Index-split by Andrew D. Balsa (11/97)
Linux/Unix* port by Uwe F. Mayer (12/96,11/97)

TEST : Iterations/sec. : Old Index : New Index
: : Pentium 90* : AMD K6/233*
--------------------:------------------:-------------:------------
NUMERIC SORT : 19.298 : 0.49 : 0.16
STRING SORT : 1.0669 : 0.48 : 0.07
BITFIELD : 4.5541e+06 : 0.78 : 0.16
FP EMULATION : 2.0007 : 0.96 : 0.22
FOURIER : 1.5784 : 0.00 : 0.00
ASSIGNMENT : 0.29735 : 1.13 : 0.29
IDEA : 79.239 : 1.21 : 0.36
HUFFMAN : 14.771 : 0.41 : 0.13
NEURAL NET : 0.0028459 : 0.00 : 0.00
LU DECOMPOSITION : 0.12801 : 0.01 : 0.00
==========================ORIGINAL BYTEMARK RESULTS==========================
INTEGER INDEX : 0.719
FLOATING-POINT INDEX: 0.004
Baseline (MSDOS*) : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0
==============================LINUX DATA BELOW===============================
CPU :
L2 Cache : 8 kB
OS : Linux 2.6.15
C compiler : cris-axis-elf-gcc (GCC) 3.2.1 Axis release R63/1.63
libc : ??
MEMORY INDEX : 0.152
INTEGER INDEX : 0.203
FLOATING-POINT INDEX: 0.002
Baseline (LINUX) : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38


==================================================================================================

Hamachi
----------
tuncfg
hamachi start

hamachi --help
hamachi login/logout go-online <network>/go-offline <network>

hamachi get-nicks
hamachi list

(Windows - seeing lots of orange connections? - try disabling other network adapters)

wget http://files.hamachi.cc/linux/hamachi-0.9.9.9-20-lnx.tar.gz
tar zxvf hamachi-0.9.9.9-20-lnx.tar.gz
cd hamachi-0.9.9.9-20-lnx
Run 'make install' and then 'tuncfg' from under the root account
cd ..
Run 'hamachi-init' to generate crypto identity (any account).
copy the script below to /etc/init.d/hamachi
chmod a+x /etc/init.d/hamachi
chkconfig --level 35 hamachi on
/etc/init.d/hamachi start
hamachi set-nick YourName
hamachi join <network>
hamachi go-online <network>

Other Commands:
Run 'hamachi start' to launch Hamachi daemon.
Run 'hamachi login' to put the daemon online and to create an account.
Run 'hamachi list' to list network members and their status.

!!!!!!!!!!!! ----------------------------
#!/bin/bash
#
# hamachi Startup script for the Hamachi
#
# chkconfig: - 91 35
# description: Starts and stops the Hamachi Service
#
# Version 1.20 Jono Woodhouse 18 August 2006
# Copyright (c) 2006 CapeSoft Software (Pty) Ltd
# Use a own Risk
# Permission is granted to use this script
#
# install with:
# chkconfig --add hamachi
# chkconfig --level 345 hamachi on
# chkconfig --list hamachi
#
#
RETVAL=0
#
start() {
tuncfg
hamachi -c /root/.hamachi start
hamachi -c /root/.hamachi login
}
#
stop() {
hamachi -c /root/.hamachi logout
hamachi -c /root/.hamachi stop
}
#
install() {
chkconfig --add hamachi
chkconfig --level 345 hamachi on
chkconfig --list hamachi
}
#
status() {
hamachi -c /root/.hamachi get-nicks
sleep 3
hamachi -c /root/.hamachi list
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
install)
install
;;
restart)
stop
start
;;
*)
echo $"Usage: $prog {start|stop|restart|status|install}"
exit 1
esac
exit $RETVAL



!!!!!!!!!!!! -------------------------------

==================================================================================================


TortoiseSVN
----------------------------------------------------------------------------------

Jono's SVN Notes - Subversion and TortoiseSVN

Install File: Here

----------------------------------------------------------------------------------

TortoiseSVN Installation
----------------------------------------------------------------------------------

1) Install TortoiseSVN (on Windows Machine)


2) A couple of good settings are:

2a) In TortoiseSVN | Settings | Look & Feel

- Tick on the options for Cascaded Context Menu for CheckOut, Update & Commit
- Turn off the "Fetch status for context menu" - this makes Tortoise SVN much faster.

2b) I'm using a Network Drive (Q:/) so Right-Click on a folder and Choose TortoiseSVN | Settings | Choose the Icon Overlays and add the following:

Turn on - Unversioned files mark parent folder as modified

Turn off - Fixed Drives

Include paths:
q:/*


----------------------------------------------------------------------------------

TortoiseSVN Setting up a Repository
----------------------------------------------------------------------------------

1) Make a folder where you want the Repository created. Right-click on folder and choose TortoiseSVN | Create Repository Here | FSFS
(In my case //penguin/v-drive/SVN_Repositories/ProductName)

2) Using //penguin/v-drive/SVN Layout, which contains the following empty folder structures
Trunk
Branches
Tags

Right-click on //penguin/v-drive/SVN Layout
and choose Import.
URL of Repository = file:////penguin/v-drive/SVN_Repositories/ProductName
Import Message = Repository Layout


3) Locate your source code in say: Q:/ProductName
(Note you don't use the Trunch, Branch, Tags folders in here).

Right-click on Q:/ProductName
and choose Import.
URL of Repository = file:////penguin/v-drive/SVN_Repositories/ProductName/Trunk (note the Trunk part at the end !!)
Import Message = Initial Source Import


4) In my case I want my working folder the same location as my original source, so backup and then delete the files in your original source folder.
You basically want a empty folder like this: Q:/ProductName
Then right-click on the working folder, and choose Check-Out
URL of Repository = file:////penguin/v-drive/SVN_Repositories/ProductName/Trunk (note the Trunk part at the end !!)


5) Unrecommended Extra Options A
Right-click on your Q:/ProductName folder and choose Propeties | Go to the Subversion tab and enter the following Properties
tsvn:logminsize 3 (tick on Recursive and press Set)
Optional
tsvn:lockmsgminsize 3 (you have to type in the property name, again click on Recursive and press Set)
Press OK

Now commit these changes with a Message of SVN Configuration


6) Unrecommended Extra Options B
If you want any files (.app files or graphics files) to have to be locked before they can be changed, then select a file and Right-click Properties and add the following Property
svn:needs-lock *

Now commit these changes with a Message of SVN Configuration


Other well useful commands
- Check for Modifications
- Show Log
- Lock etc.
- Add to Ignored List
- Right-click Properties - also has a TortoiseSVN tab on it
- svn:needs-lock
- tsvn:logminsize
- tsvn:lockmsgminsize
- Branching and Tagging


SVN - linux SVN Commands
--------------------------------
* To update to the latest binary
yum update subversion.i386
yum update mod_dav_svn (should be included in the above)
yum install kdesvn (optional)

* Create Repository
svnadmin create /workdrive/svn/repo1
(Tip - it's probably better to create a FSFS type repository !!)
svnadmin create --fs-type fsfs /workdrive/svn/repo1

* Import
svn import /tmp/test1 file:///workdrive/svn/repo1 -m "initial import"

* Rename
mv /tmp/test1 /tmp/.test1

* Initial Checkout
svn checkout file:///workdrive/svn/repo1 /tmp/test1
cd /tmp/test1

svn checkout file:///mnt/penguin/v-drive/SVN_Repositories/Fox/gio/Trunk /home/foxcode/gio

* Check Differences
svn diff

* Commit
svn commit -m "Version 2"

* Add & Commit
svn add * --force
svn commit -m "next version"

* Verify
svadmin verify /workdrive/svn/repo1

* Revert
svn revert -R .

* Moving Repository / Rename Repository
See: http://maisonbisson.com/blog/post/11905/moving-a-subversion-repository
svnadmin dump /path/to/repository > repository-name.dmp
svnadmin load repository-name < repository-name.dmp

==================================================================================================

Git
---
See: http://git.or.cz/
See: http://git.or.cz/course/svn.html
See: http://www.kernel.org/pub/software/scm/git/docs/user-manual.html

setup
---
git config --global user.name "Your Name Comes Here"
git config --global user.email [email protected]

git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto

new repository
------------------
git init
git add . (svnadmin create repo)
git commit (svn import file://repo)

checkout & update
------------------
git clone url (svn checkout url)
git pull (svn update)

advanced checkout
-----------------------
git checkout --track -b branch origin/branch (svn switch url)

misc commands
------------------
git help (svn help)
git status (svn status)
git tag -l
git branch
git branch -r
git diff (svn diff | less)
git diff rev path (svn diff -rrev path)
git apply (patch -p0)
git checkout path (svn revert path)
git add file (svn add file)
git rm file (svn rm file)
git mv file (svn mv file)
git commit -a (svn commit)
git commit --amend (tweak last commit)
git reset HEAD^ (reverse last commit)
git log (svn log | less)
git blame file (svn blame file)
git show rev:path/to/file
git show rev:path/to/directory
git show rev
git checkout rev (svn update -r rev)
git checkout prevbranch (svn update)
gitk
git-gui

patches
---------
see: git format-patch origin
see: git am -3 patches.mbox


==================================================================================================

rdiff-backup (Using jonordiff-backup scripts)
-------------
*** Step One ***
In FC6 you can just run
yum install rdiff-backup

Otherwise you'll need to compile it from source
First of all you need to compile librsync (0.9.7). Copy the librsync-0.9.7.tar.gz file to /home/jono/ extract to Here
(doesn't work if you nest it too far down)
./configure
make all check
make
make install
If you don't do the last 2 steps, you'll need to: cp libr*.h /usr/local/include
cp libr* /usr/local/lib (Can probably just copy .a and .la files)
cp ./libs /usr/local/lib (Can probably just copy .a and .la files)

Now extract rdiff-backup(1.03).rpm's rdiff-backup-1.0.3.tar.gz file to /home/jono/
python setup.py build
python setup.py install
rdiff-backup --version (Should show build number!!)
man rdiff-backup

*** Step Two ***
Create Mount Point folders e.g.
mkdir /mnt/beach/c
Edit fstab and add the following kind of mount points
//192.168.2.208/c /mnt/beach/c cifs defaults,user=Jono,password=Jono 0 0


*** Step Three ***
(Using jonordiff-backup scripts)
Edit the backupthis file and include all your locations
NB: Keep the last line as Place_Entries_Above_Here


*** Step Four ***
Add a KeepMeHereForBackupToRun.txt file to the folder locations of all places you want backed up.

*** Step Five ***
Configure and check Email XXXXX - needs FIXING !!! XXXXXXXXXXXXXXXXXXXXXXX
cd /etc/mail

edit /etc/mail/sendmail.mc and change this line to:
dnl # Uncomment and edit the following line if your outgoing mail needs to
dnl # be sent out through an external mail server:
dnl #
define(`SMART_HOST',`192.168.2.208')

make -C /etc/mail

Test with:
mail -s 'Subject Goes Here' [email protected]
text goes here
^D

*** Step Six ***
Example jonobackup usage:
jonobackup backup
jonobackup status
jonobackup restore "/mnt/beach/c/My Documents" now
jonobackup truncate 10B (keep at most 10 copies)
jonobackup truncate 4W (keep backups for up to 4 Weeks)
./jonobackup restore 192.168.2.55/workdrive/x-drive/InetPub/capesoft/

*** Step Seven *** XXXXXXXXXXXXXXXXXXXXXX
Add the following Cron entries:
20 4,6,8,10,12,14,16,18,20,22 * * * root /home/capesoft/jonordiff-backup/jonobackup backup >> /var/log/jonobackup.log 2>&1
10 3 * * * root /home/capesoft/jonordiff-backup/jonobackup syncbackup >> /var/log/jonobackup.log 2>&1
@daily root /home/capesoft/jonordiff-backup/jonobackup maintenance 6M 1000B /var/log/jonobackup.log >> /var/log/jonobackup.log 2>&1
@reboot root /home/capesoft/jonordiff-backup/jonobackup onboot >> /var/log/jonobackup.log 2>&1



==================================================================================================


backuppc (http://backuppc.sourceforge.net/)
-----------

BackupPC Tips
-----------------

Tip 1: If your smb (samba) smbclient backups are giving you
session setup failed: NT_STATUS_LOGON_FAILURE
(see http://www.mail-archive.com/[email protected]/msg02746.html)
Then if you aren't worried about security then add the share password after -U $userName in $Conf{SmbClientFullCmd}, for example:
$Conf{SmbClientFullCmd} = '$smbClientPath ////$host//$shareName $I_option -U $userName PASSWORD_GOES_HERE -E -N -d 1 -c tarmode// full -Tc$X_option - $fileList';

Tip 2: After editing the config file with the web editor I once got "$ENV{REMOTE_USER} is not set" errors.
Check your config.pl file. Mine had an extra
';
in it after $Conf{EMailHeaders}

Tip 3: If you are using rsync in v2.12 and are getting "fileListReceive failed", for example:
Running: /usr/bin/ssh -q -x -l root <snip...> /home/
fileListReceive() failed
Done: 0 files, 0 bytes
Got fatal error during xfer (fileListReceive failed)
Backup aborted (fileListReceive failed)
then you probably need to change the --devices to -D in your config file for the $Conf{RsyncArgs} and $Conf{RsyncRestoreArgs}

Tip 4: Windows Vista does not work with all versions of smbclient.
I am using rsync to backup all our Windows Vista machines now

Tip 5: Starting BackupPC: No language setting
In my setup I run everything on this backup box as root (holly ha... I know - but it works fine on our LAN)
Change the /etc/init.d/BackupPC file to run BackupPC as root
(alternatively - make sure you backuppc user has sufficient priveledges to be able to read your config.pl file)

Tip 6:
I like to change BackupPC_stnd.css (in /usr/share/BackupPC/html) as follows:
font-size:10pt; => font-size:11px;
then change the font size for:
.fviewheader
.fviewborder
.fview
.fviewbold
to
font-size:11px;

Tip 7:
Here's my backup exclusion list (note the forward slashes for rsync - change these to backslashes for smb):
$Conf{BackupFilesExclude} = {
'*' => [
'*.tmp',
'*.iso',
'*.obj',
'*.mp3',
'*.wma',
'*.wmv',
'*.avi',
'*.wav',
'*.mpg',
'*.rmj',
'___CustomList___.start',
'/Your Custom List In Here/*',
'___CustomList___.end',
'*/Games/*',
'/Games/*',
'*/Music/*',
'/Music/*',
'*/Downloads/*',
'/Downloads/*',
'*/My Music/*',
'/My Music/*',
'*/Google/Google Desktop/*',
'*/Google/GoogleEarth/*',
'*/Google/Picasa2/*',
'*/Microsoft/Media Player/*',
'*/My Virtual Machines/*',
'/My Virtual Machines/*',
'pagefile.sys',
'hibefil.sys',
'/Temp/*',
'/temp/*',
'*/Local Settings/Temp/*',
'*/AppData/Local/Temp/*',
'/Windows/Temp/*',
'/WINDOWS/Temp/*',
'/WUTemp/*',
'*/Temporary Internet Files/*',
'/Windows/winsxs/*',
'/WINDOWS/winsxs/*',
'/Windows/$NtUninstall*',
'/WINDOWS/$NtUninstall*',
'/$RECYCLE.BIN/*',
'/RECYCLER/*',
'/RECYCLED/*',
'/Recycled/*',
'/MSOCache/*',
'/System Volume Information/*',
'Thumbs.db']
};

==================================================================================================

BackupPC v3.00 (Gold) - Install - Notes for Fedora Core 7 - FC7
-----------------------------
1) su - (to become root if you aren't logged in already)
2) BackupPC is available when you install Fedora Core 7 (even though it says it's an FC6 rpm), I spotted this during the Fedora install and installed it, otherwise you can install it now with:
yum install BackupPC (case sensitive)
This gets the following (from 2.1.2-7.fc6):
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
BackupPC noarch 2.1.2-7.fc6 extras 472 k
Installing for dependencies:
perl-Archive-Zip noarch 1.16-1.2.1 core 138 k
perl-File-RsyncP i386 0.62-3.fc6 extras 107 k
perl-suidperl i386 4:5.8.8-10 core 57 k
----
This installs BackupPC v2.12 into:
/usr/share/BackupPC (Application)
/usr/share/doc/BackupPC (Docs)
/etc/BackupPC (Config)
/var/log/BackupPC (Logs)
/var/lib/BackupPC (Data)
3) Now we upgrade this to v3.00 (Gold)
1 - stop the BackupPC daemon
/etc/init.d/BackupPC stop
(or /etc/init.d/backuppc stop)
2 - I made a folder /root/Downloads/BackupPC_Source and copied in File-RsyncP-0.68.tar.gz & BackupPC-3.0.0.tar.gz
cd /root/Download/BackupPC_Source
3 - Install par2
yum install par2cmdline
4 - update File::RsyncP (manually or via the 'cpan' command) - if you aren't already running 0.68
(more /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/File/RsyncP.pm - to get version number you may need to change 5.8.8 to your perl version)
tar zxvf File-RsyncP-0.68.tar.gz
cd File-RsyncP-0.68
perl Makefile.PL
make
make test
make install
cd ..
5 - update BackupPC
tar zvxf BackupPC-3.0.0.tar.gz
cd BackupPC-3.0.0
perl ./configure.pl
Then answer the following question:
"Is this a new installation or upgrade for BackupPC? If this is
an upgrade please tell me the full path of the existing BackupPC
configuration file (eg: /etc/BackupPC/config.pl). Otherwise, just
hit return."
-> /full/path/to/your/current/config.pl (if you have a current config file)
(default values for other parameters should be OK - other than the following)
- I give my hostname for the machine name e.g. adam
- I run my setup as root (not the backuppc user) - this is a security risk - but saves hassels later.
- I remove one of the // in the install directory e.g. /usr/share/BackupPC
- I also put my data into /workdrive2/backuppcdata
- I also remove the double // from the CGI bin folder etc.
4) Configuration
- I also needed to edit in config.pl in the $Conf{EMailHeaders} section. And change this to read as follows:
$Conf{EMailHeaders} = 'MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
';
- In config.pl:
I had entries for //usr - so I searched and replaced all //usr with /usr
$Conf{CgiAdminUserGroup} = '*';
$Conf{CgiAdminUsers} = '*';
$Conf{BackupPCUser} = 'root';
also make sure you set: $Conf{FullKeepCnt} & $Conf{IncrLevels} & all the settings in between...
I could uncomment the --checksum-seed option... (x 3)
$Conf{CompressLevel} = 3;
$Conf{PingMaxMsec} = 500;
set $Conf{EMailFromUserName}
- then I did the following:
cp /root/Download/BackupPC_Source/BackupPC-3.0.0/init.d/linux-backuppc /etc/init.d/BackupPC
then change BackupPC to run as: root - Change this (again) in:
/etc/init.d/BackupPC (this may have been done for you when you installed if you did this correct the first time)
(warning this is a security risk - which I am not cared about but you may be)
/etc/init.d/httpd restart
/etc/init.d/BackupPC restart
chkconfig --level 35 BackupPC on
chkconfig --level 35 httpd on
cd /var/www/cgi-bin/
cp /usr/share/BackupPC/sbin/BackupPC_Admin BackupPC_Admin
chown root:apache BackupPC_Admin
chmod a+r BackupPC_Admin
chmod a+x BackupPC_Admin
chmod u+s BackupPC_Admin
- I like the following too:
I like to change BackupPC_stnd.css (in /usr/share/BackupPC/html) as follows:
(note spot the px not the pt !!)
font-size:10pt; => font-size:11px;
then change the font size for:
.fviewheader
.fviewborder
.fview
.fviewbold
to
font-size:11px;
- Now go and test your setup by connecting to (you'll need to change the IP address)
http://192.168.4.205/cgi-bin/BackupPC_Admin

==================================================================================================

BackupPC v3.0.0 (Gold or beta3) - Upgrading from v3.0.0beta2
-----------------------------------------------------------------
1 - stop the BackupPC daemon
/etc/init.d/BackupPC stop
(or /etc/init.d/backuppc stop)
2 - update File::RsyncP (manually or via the 'cpan' command) - if you aren't already running 0.68
(more /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/File/RsyncP.pm - to get version number you may need to change 5.8.8 to your perl version)
tar zxvf File-RsyncP-0.68.tar.gz
cd File-RsyncP-0.68
perl Makefile.PL
make
make test
make install
3 - update BackupPC
tar zvxf BackupPC-3.0.0.tar.gz
cd BackupPC-3.0.0
perl ./configure.pl
Then answer the following question:
"Is this a new installation or upgrade for BackupPC? If this is
an upgrade please tell me the full path of the existing BackupPC
configuration file (eg: /etc/BackupPC/config.pl). Otherwise, just
hit return."
-> /full/path/to/your/current/config.pl
(default values for other parameters should be OK)
4 - start the BackupPC daemon
/etc/init.d/backuppc start
(or /etc/init.d/BackupPC start)
NOTE: you may have to adjust file permissions for the Web GUI to work.
Take a look at your running config and take notes before you upgrade.
-- Vincent
Extra Notes:
My (Jono) web permissions needed no tweaking between upgrades, but I am sure this depends on how you've configured your web setup in the first place.
I like to change BackupPC_Stnd.css as follows:
font-size:10pt; => font-size:11px;
then change the font size for:
.fviewheader
.fviewborder
.fview
.fviewbold
to
font-size:11px;


==================================================================================================

BackupPC v3.00beta 2 - Upgrading from v3.00beta 1 (with input from Vincent Fleuranceau) - (I used FC5)
-----------------------------------------------------------------------
1 - stop the BackupPC daemon
/etc/init.d/backuppc stop
(or /etc/init.d/BackupPC stop)
2 - update File::RsyncP (manually or via the 'cpan' command)
tar zxvf File-RsyncP-0.68.tar.gz
cd File-RsyncP-0.68
perl Makefile.PL
make
make test
make install
3 - update BackupPC
tar zvxf BackupPC-3.0.0beta2.tar.gz
cd BackupPC-3.0.0beta2
perl ./configure.pl
Then answer the following question:
"Is this a new installation or upgrade for BackupPC? If this is
an upgrade please tell me the full path of the existing BackupPC
configuration file (eg: /etc/BackupPC/config.pl). Otherwise, just
hit return."
-> /full/path/to/your/current/config.pl
(default values for other parameters should be OK)
4 - start the BackupPC daemon
/etc/init.d/backuppc start
(or /etc/init.d/BackupPC start)
NOTE: you may have to adjust file permissions for the Web GUI to work.
Take a look at your running config and take notes before you upgrade.
-- Vincent
Extra Notes:
My (Jono) web permissions needed no tweaking between upgrades, but I am sure this depends on how you've configured your web setup in the first place.
I like to change BackupPC_Stnd.css as follows:
font-size:10pt; => font-size:11px;
then change the font size for:
.fviewheader
.fviewborder
.fviewborder
.fview
.fviewbold
to
font-size:11px;

==================================================================================================

BackupPC v3.00beta1 - Upgrading from v2.12 - Notes for Fedora Core 5- FC5
-------------------------------------------------------
* upgrade File::RSync to v0.64
* install XML::RSS (optional)
tar zxvf XML-RSS-1.10.tar.gz
cd XML-RSS-1.10
perl Makefile.PL
- Warning: prerequisite Test::Manifest 0.9 not found. (I just ignored this)
make
make install
* tar zxvf BackupPC-3.0.0beta1.tar.gz
* cd BackupPC-3.0.0beta1
* perl configure.pl
- Path to config.pl (I'm upgrading so I had to point it to my existing location - new installation use /etc/BackupPC/config.pl): /workdrive2/backuppcdata/conf/config.pl
- Paths: y
- Hostname:
- Root:
- Install path (Put yours in here): /home/capesoft/backuppc
- ....
* All worked very smoothly.

BackupPC v3.00beta1 - Fresh Install - Notes for Fedora Core 6 - FC6
-----------------------------

In Fedora Core 6 backuppc v2.12 is now available for download via yum
1) su - (to become root if you aren't logged in already)
2) yum install BackupPC (case sensitive)
This gets the following:
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
BackupPC noarch 2.1.2-7.fc6 extras 472 k
Installing for dependencies:
perl-Archive-Zip noarch 1.16-1.2.1 core 138 k
perl-File-RsyncP i386 0.62-3.fc6 extras 107 k
perl-suidperl i386 4:5.8.8-10 core 57 k
----
This installs BackupPC v2.12 into:
/usr/share/BackupPC (Application)
/usr/share/doc/BackupPC (Docs)
/etc/BackupPC (Config)
/var/log/BackupPC (Logs)
/var/lib/BackupPC (Data)
3) I've got an existing v2.12 Config file - so I am backing up the existing one, and then merge in my original settings.
4) However this isn't enough to get the CGI-Admin to work I needed to make the following tweaks:
(Note I'm not worried about the security of my backup machine, it runs on a LAN and is mainly for the office programmers -
if you are concerned about security read the BackupPC docs and good luck...)
- Change BackupPC to run as: root - Change in config.pl and in /etc/init.d/BackupPC
(warning this is a security risk - which I am not cared about but you may be)
/etc/init.d/httpd restart
/etc/init.d/BackupPC restart
cd /var/www/cgi-bin/
cp /usr/share/BackupPC/sbin/BackupPC_Admin BackupPC_Admin
chown root:apache BackupPC_Admin
chmod a+r BackupPC_Admin
chmod a+x BackupPC_Admin
chmod u+s BackupPC_Admin

5) ---Now we just need to update to BackupPC v3.00...
(http://heanet.dl.sourceforge.net/sourceforge/backuppc/BackupPC-3.0.0beta1_doc.html#installing_backuppc)
* upgrade File::RSync to v0.64
* install XML::RSS (optional)
tar zxvf XML-RSS-1.10.tar.gz
cd XML-RSS-1.10
perl Makefile.PL
- Warning: prerequisite Test::Manifest 0.9 not found. (I just ignored this)
make
make install
* Install par2 (cp par2 /usr/bin/par2)
* tar zxvf BackupPC-3.0.0beta1.tar.gz
* cd BackupPC-3.0.0beta1
* perl configure.pl
- Path to config.pl (Check this is correct): /etc/BackupPC/config.pl
- Paths: y
- Hostname:
- Root:
- Install path (Put yours in here): /usr/share/BackupPC
- Data directory (You may want this somewhere else):
- (Finish install)
- Then tweak the cgi-bin file again:
(I suppose you could probably tell BackupPC to use /var/www/cgi-bin as the CGI folder, and then you wouldn't need this step)
cd /var/www/cgi-bin/
cp /usr/share/BackupPC/sbin/BackupPC_Admin BackupPC_Admin
chown root:apache BackupPC_Admin
chmod a+r BackupPC_Admin
chmod a+x BackupPC_Admin
chmod u+s BackupPC_Admin
- Browse through the config file, /etc/BackupPC/config.pl,
and make sure all the settings are correct. In particular,
you will need to set $Conf{CgiAdminUsers} so you have
administration privileges in the CGI interface.
- Edit the list of hosts to backup in /etc/BackupPC/hosts.
- Read the documentation in //usr/share/BackupPC/doc/BackupPC.html.
Please pay special attention to the security section.
6) This all worked very smoothly for me.
Bear in mind that the new config.pl file is in /etc/BackupPC
And that the per machine override settings are in /etc/BackupPC/pc/<machinename>.pl
You should also no longer have a perl include at the top of this file!!
(i.e. Remove this line -- do "/etc/BackupPC/config.pl";)

==================================================================================================

Jono's rsync notes for BackupPC:
------------------------
1) Turn on the --checksum-seed option
2) Prior to 2.1.2pl2 you need to change to -D (note only one minus) instead of --devices (in $Conf{RsyncArgs} and $Conf{RsyncRestoreArgs})
3) Admin| Reload

==================================================================================================

BackupPC v2.12 - Notes for Fedora Core 5- FC5
---------------------
See below for the specifics:
* Installed Archive::Zip
* Installed File::RSync
* Installed par2
* yum install perl-suid-perl (nb: this is NB)
* tar zxvf BackupPC-2.1.2.tar.gz
* cd BackupPC-2.1.2
* patch -p0 < ../BackupPC-2.1.2pl1.diff
* perl configure.pl
- BackupPC should run as: root
- Install: /home/capesoft/backuppc
- Data: /workdrive2/backuppcdata
- cgi: /var/www/cgi-bin
- html: /var/www/html/backuppc
- image: /backuppc
* cd init.d
* chmod a+x linux-backuppc
* cp linux-backuppc /etc/init.d/backuppc
* cd /var/www/cgi-bin
* chmod u+x BackupPC_admin
* edit /workdrive2/backuppcdata/conf/configure.pl - to suit your needs:
Also change the following:
$Conf{CgiAdminUserGroup} = '*';
$Conf{CgiAdminUsers} = '*';
(next two changes not the inlcusion of the password... as in -U $userName backuppc ....)
$Conf{SmbClientFullCmd} = '$smbClientPath ////$host//$shareName'
. ' $I_option -U $userName backuppc -E -N -d 1'
. ' -c tarmode// full -Tc$X_option - $fileList';
$Conf{SmbClientIncrCmd} = '$smbClientPath ////$host//$shareName'
. ' $I_option -U $userName backuppc -E -N -d 1'
. ' -c tarmode// full -TcN$X_option $timeStampFile - $fileList';

* /etc/init.d/httpd start (also add to services if needed see below)
* /etc/init.d/backuppc start (also add to services if needed see below)
* You may want to replace the css file in /var/www/html/backuppc with Jono's one
* chkconfig --add backuppc
chkconfig --level 345 backuppc on
chkconfig --list backuppc


==================================================================================================

BackupPC v2.12 - Notes for Fedora Core 4
---------------------
- FC3 seems to be missing more modules than FC4 at the time of writing this.

* I ran a couple of yum updates
e.g. yum update httpd http-suexec http-manual gcc gcc-c++ perl python mod_python mod_ssl


*** TIP of the year: ****
yum install perl-suidperl

* Follow the backuppc instructions starting with checking for the different perl modules e.g.
tar zxvf File-RsyncP-0.52.tar.gz
cd File-RsyncP-0.52.tar.gz
perl Makefile.PL
make
make test
make install

* Download tar file
tar zxf BackupPC-2.1.2.tar.gz
cd BackupPC-2.1.2
perl configure.pl

* At this point I didn't have a par2
http://parchive.sourceforge.net
In the end used RH9 build
http://prdownloads.sourceforge.net/parchive/par2cmdline-0.4-x86-Linux-2.4.20-Redhat-9.0.tar.gz?download
Just unzipped it and put it in /usr/bin (Thanks Tiembo)
chmod a+x /usr/bin/par2

* Also to configure apache
- turn httpd service on
- run /init.d/httpd start (or restart)
Put the following into /var/www/cgi-bin/jonotest.pl (and chmod a+x it)
#!/usr/bin/perl
print "Content-type: text/html/n/n";
print "Hello, World.";


* Settings
I just ran it as root
Installed in : /home/capesoft/backup
Data in: /backuppcdata
Compression: 3
cgi-bin : /var/www/cgi-bin
Apache image directory: /var/www/html/backuppc
URL for image directory: /backuppc

* Ok, it looks like we are finished. There are several more things you
will need to do:

- Browse through the config file, /workdrive/backuppcdata/conf/config.pl,
and make sure all the settings are correct. In particular, you
will need to set the smb share password and user name, backup
policies and check the email message headers and bodies.

- Edit the list of hosts to backup in /workdrive/backuppcdata/conf/hosts.

- Read the documentation in /home/capesoft/backuppc/doc/BackupPC.html.
Please pay special attention to the security section.

- Verify that the CGI script BackupPC_Admin runs correctly. You might
need to change the permissions or group ownership of BackupPC_Admin.

- BackupPC should be ready to start. Don't forget to run it
as user root! The installation also contains an
init.d/backuppc script that can be copied to /etc/init.d
so that BackupPC can auto-start on boot. This will also enable
administrative users to start the server from the CGI interface.
See init.d/README.

* config.pl (master file)
I turned off the $Conf{SmbShareName} = 'C$';
And set SmbShareUserName and Password
(I also added a backuppc user to my Windows XP machine)

* hosts
spiff 0 [email protected] root
hobbes 0 [email protected] root


* I had to chmod a+x /var/www/cgi-bin/BackupPC_Admin
(This is not recommended for security reasons - but this doesn't faze me for this installation).

* Then copy the linux-backuppc (from your original Installation Folder area in a folder called init.d) to /etc/init.d/backuppc
then chmod a+x it

After copying it, you can test it by running these commands as root:

/etc/init.d/backuppc start
/etc/init.d/backuppc status
/etc/init.d/backuppc stop

You should then run the following commands as root:

chkconfig --add backuppc
chkconfig --level 345 backuppc on
chkconfig --list backuppc

This will auto-start backuppc at run levels 3, 4 and 5.

* You can then access it (hopefully) via http://127.0.0.1/cgi-bin/BackupPC_Admin

* I chose to create multiple config files in /workdrive/backuppcdata/conf with the following at the top
e.g. config_machinename.pl
do "/workdrive/backuppcdata/conf/config.pl";
and then link them into the PC area e.g.
ln -s ../../conf/config_machinename.pl config.pl

I changed the $Conf{SmbShareName} = 'C$';
And set SmbShareUserName and Password
(I also added a backuppc user to my Windows XP machine)

XXX - what to change

* I also changed the CSS stylesheet in the cgi directory


* File / Directory Overview
Configuration
/etc/backuppc/config.pl
/var/lib/backuppc/pc/$host/config.pl
/etc/backuppc/hosts
Data
/var/lib/backuppc/pc/$host – 1 directory per host
/var/lib/backuppc/pool – uncompressed pool
/var/lib/backuppc/cpool – compressed pool files
/var/lib/backuppc/log – log and statusl files
/var/lib/backuppc/trash – files to be deleted

Removing a client
If there is a machine that no longer needs to be backed up (eg: a retired machine) you have two choices. First, you can keep the backups accessible and browsable, but disable all new backups. Alternatively, you can completely remove the client and all its backups.
To disable backups for a client there are two special values for $Conf{FullPeriod} in that client's per-PC config.pl file:
-1 Don't do any regular backups on this machine. Manually requested backups (via the CGI interface) will still occur.
-2 Don't do any backups on this machine. Manually requested backups (via the CGI interface) will be ignored.
This will still allow that client's old backups to be browsable and restorable.
To completely remove a client and all its backups, you should remove its entry in the conf/hosts file, and then delete the /workdrive/backuppcdata/pc/$host directory. Whenever you change the hosts file, you should send BackupPC a HUP (-1) signal so that it re-reads the hosts file. If you don't do this, BackupPC will automatically re-read the hosts file at the next regular wakeup.
Note that when you remove a client's backups you won't initially recover a lot of disk space. That's because the client's files are still in the pool. Overnight, when BackupPC_nightly next runs, all the unused pool files will be deleted and this will recover the disk space used by the client's backups.

* Cleaning up
- I changed the backup share to a real share called NoWhere
- Ran a backup
- Changed :
$Conf{FullKeepCnt} = 1;
$Conf{FullKeepCntMin} = 0;
$Conf{FullAgeMax} = 1;

$Conf{IncrKeepCnt} = 6;
$Conf{IncrKeepCntMin} = 0;
$Conf{IncrAgeMax} = 1;

/etc/init.d/backuppc restart
/usr/share/BackupPC/bin/BackupPC_dump -v -f spiff_rsyncd
/usr/share/BackupPC/bin/BackupPC_nightly 0 255
/usr/share/BackupPC/bin/BackupPC_trashClean
(repeat these 3 instructions a good number of times, until it does cull the stuff)

/usr/share/BackupPC/bin/BackupPC_dump -v -f spiff_rsyncd;/usr/share/BackupPC/bin/BackupPC_nightly 0 255;/usr/share/BackupPC/bin/BackupPC_trashClean

Then restore your original settings

-------------------------------------------------------------------------------------------------------------------------------------

****************************************************************************************************************
****************************************************************************************************************
****************************************************************************************************************
****************************************************************************************************************


Understanding the Linux Kernel by Daniel P. Bovet & Marco Cesati (Oreilly) 3rd Edition
-------------------------------------------------------------------------------------------------------
- SIGTTIN / SIGTTOUT / bg / fg operations
- IPC
- signals
- semaphores [ semget() semop() ]
- message queue [ <sys/msg.h> msgget() msgsnd() msgrcv() ]
- shared memory (fastest) [ <sys/shm.h> shmget() shmat() - ipcs / ipcrm ]
- memory mapped files (or anonymously mapped filed)
- pipes [ popen() or pipe() ]
- sockets
- list_add
- asm volatile (inline assembler)


****************************************************************************************************************

Jono on Pointers : Pointer Tips
------------------------------------
int32 *pint;
int32 p;

header = malloc(sizeof(*header));
if (header == NULL) {
log_errorf("Could not allocate memory in main()/n");
return -1;
}
if (my_struct) {
memset(header, 0, sizeof(*header));
printf("&(header->x) = %d &(header->y) = %d /n", (int32)&(header->x), (int32)&(header->y));

memcpy(&(header->x), my_struct, 12);
pint = (int32*)my_struct;
printf("Jono!!!!!! X = %d [%d]/n", (int32)(*pint), (int32)pint);
pint = (int32*)((int32)my_struct + 4); // works
//pint = my_struct + 1; // this adds 22 bytes to pint!!
//pint = 1 + (my_struct); // this adds 22 bytes to pint!!
//p = (int32)my_struct; p += 4; pint = p; // works
//pint += 1; // works
//pint++; // works
printf("Jono!!!!!! Y = %d [%d]/n", (int32)(*pint), (int32)pint);

//memcpy(&(header->x), my_struct, 12); // Works
//memcpy(&(header->x), my_struct, 4); // Works
//memcpy(&(header->y), my_struct + 4, 4); // Won't work
//memcpy(&(header->z), my_struct + 8, 4); // Won't work

memcpy(&(header->x), (void*)((int32)my_struct + 0), 4); // Works
memcpy(&(header->y), (void*)((int32)my_struct + 4), 4); // Works
memcpy(&(header->z), (void*)((int32)my_struct + 8), 4); // Works
header->data_length = header->x * header->y;
printf("Creating Packet. X = %d, Y = %d, Z = %d, datalen = %d/n", header->x, header->y, header->z, header->data_length);
}

****************************************************************************************************************

fork
-----
// -- here goes our fork code ============================================================================
printf ("About to Start Child Process.../n");
signal(SIGCHLD, handle_finished_child_process); // or have done this at least once, somewhere else
parent_pid = getpid();
child_pid = fork(); // The child is given 0, the parent gets the real child pid
if (child_pid == 0) {
// -- Start Child Code ----------------------------------
xxx
// -- End Child Code ----------------------------------
exit(result); // Exit Child Process - All cool
// End Child process
}
// -- here goes our fork code ============================================================================


****************************************************************************************************************

Bit packing
-------------
struct mystruct {
unsigned int bit1:1;
unsigned int bit2:1;
unsigned int int4:4;
};


****************************************************************************************************************

Function Attributes
----------------------
See
http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Function-Attributes.html
http://www.ohse.de/uwe/articles/gcc-attributes.html

e.g. __attribute__ ((noinline)


****************************************************************************************************************

GLib Macros
--------------
http://library.gnome.org/devel/glib/unstable/glib-Miscellaneous-Macros.html


-------------------
[Document End]
-------------------


FOX Related Links: ACME Systems :: Yahoo Group :: CapeSoft

Search CapeFox.com:  
Powered by Google.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章