If you have a good browser then use CTRL-f to find what you want
As always this page will grow and change as time goes by
I have gathered this information from a lot of places around the Internet and from my own experience. Feel free to pass on any tips or corrections you may have.
apt-get install gcc-3.4 g++-3.4 uuid-dev zlib1g-dev libsdl1.2-dev build-essential apt-get install libasound2-dev bridge-utils qemu vde
auto lo eth0 br0 iface lo inet loopback iface br0 inet dhcp bridge_ports eth0 bridge_maxwait 2 #kvm has to have this set to 0.0.0.0 to work... not sure why #not sure if promisc is necessary up /sbin/ifconfig eth0 inet 0.0.0.0 promisc #set to something random, br0 initialization will undo this iface eth0 inet static address 172.16.5.0 netmask 255.255.255.0 then restart networking
tar -xzvf kvm-27.tar.gz ./configure --prefix=/usr/local/kvm make make install modprobe kvm-intel
cat /etc/qemu-ifup #!/bin/sh #sudo -p "Password for $0:" /sbin/ifconfig $1 172.20.0.1 # modified to bridge everything /sbin/ifconfig $1 up /usr/sbin/brctl addif br0 $1
qemu-img create /some/path/to/the/image/file/centos5-64.img -f qcow 6G /usr/local/kvm/bin/qemu-system-x86_64 -hda centos5-64.img -cdrom /some/path/to/the/iso/file/CentOS-5.0-x86_64-bin-DVD.iso -boot d -m 384
/usr/local/kvm/bin/qemu-system-x86_64 -m 384 -net nic,vlan=0 -net tap,vlan=0 /some/path/to/the/image/file/centos5-64.img
#!/bin/bash #Load things and start kvm echo "Loading modules" modprobe kvm-intel modprobe tun echo "Sleeping to set things up" sleep 3 echo "Changing permissions etc on devices" chgrp kvm /dev/kvm chmod 0660 /dev/kvm chgrp kvm /dev/net/tun chmod 0660 /dev/net/tun echo "set max-user-freq to stop kvm complaining" echo 1024 > /proc/sys/dev/rtc/max-user-freq echo "All done"
apt-get install kernel-package libncurses5-dev fakeroot wget bzip2
cd /somewhere/useful wget http://www.kernel.org/pub/linux/kernel/v2.6/[kernel that matches the patch below].tar.bz2 tar xjf [kernel version].tar.bz2 cd into the kernel source directory # Get the patch from openvz.org download page gzip -d patch-?????-combined.gz patch -p1 < patch-?????-combined make menuconfig # Select load an alternate configuration file # make other changes as required for the system make-kpkg clean time fakeroot make-kpkg --initrd --revision=OpenVZ.[kernel version] kernel_image kernel_headers cd .. dpkg -i [debian kernel package].deb shutdown -r now
deb http://debian.systs.org/ stable openvz
apt-get update apt-get install vzctl vzquota
cd /vz/template/cache wget http://download.openvz.org/template/precreated/[template name]tar.gz
vzctl create 1?? --ostemplate [template name without .tar.gz] --config vps.basic vzctl set 1?? --onboot yes --save vzctl set 1?? --hostname host.name.com --save vzctl set 1?? --ipadd 192.168.x.y --save vzctl set 1?? --nameserver 192.168.x.z --save vzctl start 1??
vzctl exec 1?? ps fauwx vzctl exec 1?? passwd vzctl status 1?? vzctl stop 1?? vzlist -a
cat /proc/user_beancounters
vzctl set 1?? --[name from /proc/user_beancounters] xxx:yyy --save
apt-get install debootstrap debootstrap --arch i386 [ubuntu version] /vz/private/1?? http://archive.ubuntulinux.org/ubuntu vzctl set 1?? --applyconfig vps.basic --save Set the name of the template: echo "OSTEMPLATE=ubuntu-?.?" >> /etc/vz/1??.conf # Ignore this if it shows - Warning: configuration file for distribution ubuntu-?-? not found default used vzctl set 1?? --ipadd 192.168.x.y --save vzctl set 1?? --nameserver 192.168.x.z --save Update the sources list in /vz/private/1??/etc/apt/sources.list if needed vzctl start 1?? vzctl exec 1?? apt-get update vzctl exec 1?? apt-get -u upgrade vzctl exec 1?? apt-get install ssh libedit2 openssh-client openssh-server vzctl exec 1?? sed -i -e '/getty/d' /etc/inittab vzctl exec 1?? rm -f /etc/mtab vzctl exec 1?? ln -s /proc/mounts /etc/mtab ### Now the vps is ready to either run or to create a template vzctl set 1?? --ipdel all --save vzctl stop 1?? cd /vz/private/1?? tar czf /vz/template/cache/ubuntu-?.?-minimal.tar.gz . # now cleanup vzctl destroy 1?? To deploy use - vzctl create 10? --ostemplate ubuntu-?.?-minimal --config vps.basic
mount -o dev /mnt/??? chroot /mnt/??? lilo
modprobe md modprobe raid1 mdadm /dev/md? --run /dev/sd?? /dev/sd?? mount /dev/md0 /mnt/md0
mdadm --examine --scan /dev/hd?? >> /etc/mdadm/mdadm.conf vim /etc/mdadm/mdadm.conf # edit file to remove rubbish mdadm --assemble --scan
mdadm --stop --scan
RewriteCond %{REQUEST_URI} ^/admin-portal$ [OR] RewriteCond %{REQUEST_URI} ^/admin-publish$ RewriteRule (.*) $1/ [L,R]
/path/to/share 192.168.0.0/255.255.255.0(rw,no_root_squash,sync) /path/to/share2 192.168.0.0/255.255.255.0(rw,anonuid=123,anongid=321)
mount -t type /dev/hd[abcd] /place/to/mount mount -o remount ro /mnt/point umount /mnt/point
kernel /boot/kernel_name root=/dev/hda? initrd /boot/initrd_name (optional?) boot
grub-install --root-directory=/mnt/hda1 /dev/hda
# grub grub> root (hd0,0) grub> setup (hd0) grub> root(hd1,0) grub> setup (hd1) grub> quit
# Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/sda2 # initrd /initrd-version.img #boot=/dev/sda #default=0 default saved fallback 1 2 3 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz #hiddenmenu title Debian Openvz-2.6.18 root (hd0,0) # see note above about relative path kernel /vmlinuz-2.6.18-028stab035 ro root=/dev/sda? initrd /initrd.img-2.6.18-028stab035 savedefault fallback title Debian root (hd0,0) # see note above about relative path kernel /vmlinuz-2.6.17-2-686 ro root=/dev/sda? initrd /initrd.img-2.6.17-2-686 savedefault fallback title Debian Rimuhosting root (hd0,0) # see note above about relative path kernel /vmlinuz-2.6.9-34.EL ro root=/dev/sda? panic=30 initrd /initrd-2.6.9-34.EL.img title CentOS-4 i386 (2.6.9-34.EL) root (hd0,0) kernel /vmlinuz-2.6.9-34.EL ro root=LABEL=/ initrd /initrd-2.6.9-34.EL.img
L number Usually media failure LI 1st stage OK, 2nd stage no go. Geometry mismatch or can't find /boot/boot.b LIL Can't laod map file - usually media failure LIL? 2nd stage loaded at incorrect address - see LI LIL- Corupt description table, geometry mismatch or can't find map file
route add -net 10.0.0.0 netmask 255.0.0.0 gw 192.168.100.100 route del -net 10.0.0.0 netmask 255.0.0.0 gw 192.168.100.100 route add -net 192.168.171.0 netmask 255.255.255.0 gw 192.168.0.250 route add default gw 192.168.100.254 route del default gw 192.168.100.254
###PORT STATE GENERATED USING AUTOSAVE-ONCE### ###AUTOSAVE-ONCE### #KERNEL /dev/ttyS0 uart undefined port 0x03f8 irq 4 baud_base 921600 spd_normal skip_test /dev/ttyS1 uart 16550A port 0xccb8 irq 169 baud_base 115200 spd_normal skip_test /dev/ttyS2 uart 16550A port 0xcca8 irq 169 baud_base 115200 spd_normal skip_test
/etc/udev/rules.d
/dev/hda1 / ext3 errors=remount-ro 0 1 /dev/hda2 none swap sw 0 2 /dev/hdc2 /mnt/mail reiserfs defaults 0 2 proc /proc proc defaults 0 0 /dev/fd0 /floppy auto user,noauto 0 0 /dev/cdrom /cdrom iso9660 ro,user,noauto 0 0 /dev/sda1 /mnt/usb auto rw,user,noauto,noatime 0 0
auto eth0 iface eth0 inet static address 192.168.1.1 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.254 auto eth1 iface eth1 inet dhcp
From command line - ethtool -s eth0 speed 10 duplex full autoneg off On boot in Centos add this to /etc/sysconfig/network-scripts/ifcfg-eth0 ETHTOOL_OPTS="speed 10 duplex full autoneg off"
awk '{sub(/#.*$/,""); if(NF>0) print}' < filename
echo /a/b/c echo !$:h gives - /a/b echo /a/b/bob.c echo !$:r gives - bob echo /a/b/bob.c echo !$:t gives - bob.c
function mx() { for host do echo "---- $host ----" dig +short "$host" mx | sort -n done }
do_some_command with arguments || { echo "Error message" exit 1 }
file /proc/[0-9]*/exe | grep '(deleted)'
find / -user root -perm -4000 -ls
find / -user root -perm -6000 -ls
find . -mtime +5 -type f -exec rm \{\} \;
find / ! '(' -fstype proc -o -fstype nfs ')' '(' -nouser -o -nogroup ')' -ls 2>/dev/null >>/some/file/to/save
find . -type f \( -name \*.200??????? -o -name \*200????? \) -exec rm {} \;
find . -type d -exec du -sh \{\} \; | grep [0-9]G
for f in *; do sed 's/DO_TRANSPORT=1/DO_TRANSPORT=0/'< $f >bobit; mv bobit $f; done
tar -czf - . | ssh user@host "cat >/export/home/user/baldrick/opt-partition.tar.gz"
find . -type d -exec du -sh \{\} \; | grep [0-9]G
grep ^cp releaseOP2187.0.sh | grep -v { | awk '{print $4}' | xargs -i chown nobody:nogroup \{\} grep ^cp releaseOP2187.0.sh | grep -v { | awk '{print $4}' | xargs -i chmod o-r \{\}
cat releaseOP2112.0.sh.orig | perl -ne '(/^cp.(\".*\})$/) ? (print "cp -p $1\n") : (print $_)' >releaseOP2112.0.sh
alias ff "find . -name '*\!{*}' -ls"
find . \( -type d -a -exec chmod 771 {} \; \) -o \ \( -name "*.BAK" -a -exec chmod 600 {} \; \) -o \ \( -name "*.sh" -a -exec chmod 755 {} \; \) -o \ \( -name "*.txt" -a -exec chmod 644 {} \; \)
find . -type d -print | sed 's@^@/new/dir/tree/@' | xargs mkdir
alias find. 'find . \( -type d ! -name . -prune \) -o \( \!* -print \)' alias find.ls 'find . \( -type d ! -name . -prune \) -o \( \!* -ls \)'
restore -i -f ufsdump_filename
restore -x -a -f ufsdump_filename path/and/file/to/restore
ntpdc -c monlist
ntpq -pn
hwclock --utc --set -date "yyyy-mm-dd hh:mm" or use --localtime instead of --utc
ntpdate serveraddress; hwclock --adjust --systohc
ftp stream tcp nowait root /usr/sbin/tcpd /usr/sbin/in.ftpd
hdparm -Tt /dev/hda - This will display data about the transfer rates for the
>>>boot dka4 -flags 0
>>>boot dka0 -flags 0
perl -MCPAN -e shell
perl -MCPAN -e 'install Mail::Mailer'
perl -le 'print scalar localtime shift' xxxxxxx
NameVirtualHost * #### NOTE!!! This entry must be first so any connection that does # not match a virtualhost name will match the default (first) server.ServerAdmin webmaster@domain.com DocumentRoot /path/to/doc/root/for/this/server ServerName www.domain.com ServerAdmin webmaster@otherdomain.com DocumentRoot /path/to/other/domain/root ServerName www.otherdomain.com ServerAdmin webmaster@moredomains.com DocumentRoot /path/to/you/know/where ServerName www.guesswhere.com
# added to reject sus looking connections # notify_classes = bounce disable_vrfy_command = yes smtpd_recipient_restrictions = reject_invalid_hostname, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unknown_client, reject_unknown_sender_domain, reject_unauth_destination, permit_mynetworks, permit smtpd_client_restrictions = reject_unknown_client, permit smtpd_sender_restrictions = reject_unknown_sender_domain, reject_invalid_hostname, reject_non_fqdn_hostname, reject_non_fqdn_sender, permit unknown_address_reject_code = 554 unknown_hostname_reject_code = 554 unknown_client_reject_code = 554 smtpd_helo_required = yes strict_rfc821_envelopes = yes maximal_queue_lifetime = 1d unknown_local_recipient_reject_code = 554
postqueue -p
postqueue -f
postsuper -d
smbpasswd -A username
[stuff] comment = stuff path = /stuff public = no writable = yes read only = no create mask = 0600 [bkup] comment = bkup path = /bkup public = yes writable = no read only yes
mount -t smbfs -o username=????,password=?????? //computer/sharename /mnt/mountdir
cdrecord dev=ATAPI:0,1,0 -scanbus
cdrecord blank=fast dev=ATAPI:0,1,0
cdrecord speed=x dev=ATAPI:0,1,0 -data /path/to/iso/file
unpack the sources cd to dir make clean make mrproper # this will delete the old config file so save it if you need it make menuconfig make make install # this may already be done for you config grub/lilo
Get the kernel package kernel-source-2.4.20 etc make sure you have the following packages kernel-package debhelper dpkg-dev libncurses5-dev and then - make oldconfig make menuconfig make dep make-kpkg clean make-kpkg --initrd --revision=2:hostname.1.0 kernel_image
apt-get install mdadm lvm2 dmsetup mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdc
pvcreate /dev/hda3 vgcreate xen /dev/hda3
lvcreate -L5000 -ndom1 xen
lvcreate -L500 -nswap1 xen
lvcreate -s L1000 -nbackup /dev/xen/name_of_existing_lv_to_take_snapshot_of
Install iSCSI Enterprise Target stuff for current system and kernel Edit /etc/ietd.conf to have at least this (modify for your own likes)-
Target iqn.2007-06.com.example:stuff.iscsi0 Lun 0 Path=/dev/stuff/iscsi0,Type=fileio
yum install iscsi-initiator-utils
DiscoveryAddress=192.168.x.y
Use fdisk to create the partition on the blank block device.
mkisofs -J -R -v -T -o dvd.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 8 -boot-info-table directory/
mke2fs /dev/fd0
cat /home/user/stuff/files/eb-5.0.8-rtl8139.lzdsk >/dev/fd0
dd if=/dev/fd0 of=boot.img bs=18k
mkisofs -r -b boot/boot.img -c boot/catalog -o bootcd.iso .
dd if=/home/user/stuff/files/name_of_disk.fd0u1680 of=/dev/fd0u1860
dd if=/dev/fd0/u1680 of=/tmp/name_of_file.fd0u1680
quotacheck -cv[m] /dev/hda? The m option is used if using the root file system quotaon /dev/hda? edquotarepquota -a to get a report of file usage.
edquotarepquota -a to get a report of file usage.
sendmail -bv user@host
sendmail -bt /parse user@host /quit
while true; do date;netstat -nt | awk '/^tcp/ {print $6}' | sort | uniq -c| sort -k2; sleep 5; done
zpool create stuff c0d0s0 zpool create stuff mirror c0d0s3 c1d0s0 zfs create stuff/www zfs set mountpoint=/var/www stuff/www zfs create stuff/home zfs set mountpoint=/export/home stuff/home zfs create stuff/home/peter zfs create stuff/home/paul zfs create stuff/home/mary zfs set compression=on stuff/home zfs set quota=5g stuff/home/paul zfs set reservation=10g stuff/home/mary zfs set sharenfs=rw stuff/home zpool scrub stuff zpool add stuff mirror c3d0s4 c4d1s2
At grub screen type e to edit select entry to boot edit and type e add -s to end, exit edit mode and reboot
To start the console - platform console To power on/off the system - platform set power state on platform set power state off To display the mac address - platform get mac
To set static ip address - log in cd /SP/network set pendingipaddrss=x.x.x.x set pendingnetmask=255.255.255.x set pendinggateway=y.y.y.y set commitpending=true show /SP/network To get to the console - start /SP/console To exit from console - ESC-SHIFT-9 To power on/off and reset the system - start /SYS stop /SYS reset /SYS show /SYS To reboot the ilom - reset /SP
Make the block device with loviadm: lofiadm -a /path/to//file.iso /dev/lofi/1 Mount the image as a read-only filesystem: mount -F hsfs -o ro /dev/lofi/1 /mountpoint
isainfo -v
prtvtoc /dev/rdsk/c?t?d?s? | fmthard -s - /dev/rdsk/c?t?d?s?
Grep for filename in - /var/sadm/install/contents
Control Break (CTRL-a f in minicom)
at the ok prompt type
/etc/hosts /etc/inet/ipnodes
/etc/defaultrouter
/etc/hosts /etc/nodename /etc/hostname.{interface name}
prtconf -D | grep network
fconfig bge0:1 plumb ifconfig bge0:1 192.168.1.2 ifconfig bge0:1 up use it ifconfig bge0:1 down ifconfig bge0:1 unplumb
format
fdisk -b /usr/lib/fs/ufs/mboot /dev/rdsk/c?t?d?p?
/sbin/installgrub -m /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c?t?d?s?
metadb -a -f c?t?d?s? Need more than one copy. Spread accross disks/controllers etc - see docs for details metadb -a -f c?+1t?d?s?
metainit -f d10 1 1 c?t?d?s?
metainit d20 1 1 c?t?d?s?
metainit d0 -m d10
metaroot d0
reboot
metattach d0 d20
metastat
To delete an SDR metadb -d -f c?t?d?s? Detach a mirror from an array metadetach d0 d10 Take mirror off line metaoffline d0 d20 Put mirror back in array and resync metaonline d0 d20 Create a UFS file system on the new array newfs /dev/md/dsk/d? Backup your metadb information metastat -p > /etc/lvm/md.tab
Create the new boot environment
lucreate -c "be1" -m /:/dev/md/dsk/d10:ufs,mirror -m /:/dev/dsk/c?t?d?s3:attach -m /:/dev/dsk/c?t?d?s3:attach -n "be2" Above does: - Create new boot environment be2 - Name existing environment be1 - create raid array called d10 and make it ufs - add c?t?d?s3 of two disks to the array
lustatus
luactivate be2 init 6
/mnt/Solaris_11/Tools/Installers/liveupgrade20 -noconsole -nodisplay
luupgrade -u -n be2 -s /mnt
luactivate be2 init 6
fstyp -v /dev/md/dsk/d0 | head -20
show int status | inc connected