Archive

Archive for the ‘BASH’ Category

Create Red Hat Enterprise Linux Kickstart CD ISO

January 15, 2011 Leave a comment
I had a requirement to create a kickstart CD, so I thought I’d post the basics:
[root@localhost ~]# cd /tmp
[root@localhost tmp]# mkdir bootiso
[root@localhost tmp]# mkdir bootisoks
[root@localhost tmp]# cd /media/CentOS_5.5_Final/images
[root@localhost images]# mount -o loop boot.iso /tmp/bootiso
[root@localhost images]# cp -r /tmp/bootiso/* /tmp/bootisoks
[root@localhost images]# cd /tmp/bootisoks
Kickstart file (ks.cfg) created by me & copied to /tmp/bootisoks/isolinux.
install
cdrom
key --skip
# Localisation
lang en_GB.UTF-8
keyboard uk
timezone --utc Europe/London
# Display
xconfig --startxonboot --resolution 800x600
# Network
network --device eth0 --bootproto dhcp
# Security
rootpw --iscrypted <GetYourOwnDamnedHash!>
firewall --enabled --port=22:tcp
authconfig --useshadow --enablemd5
selinux --enforcing
# System
bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
#clearpart --all --initlabel
#part /boot --fstype ext3 --size=50
#part / --fstype ext3 --size=3000 --grow --maxsize=4000
#part swap --size=1024 --grow --maxsize=2048
#part /home --fstype ext3 --size=1000 --grow
%packages
@X Window System
@GNOME Desktop Environment
@Graphical Internet
@Development Tools
python
Creating the ISO:
[root@localhost bootisoks]# mkisofs -o bootks.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T isolinux/
INFO:   UTF-8 character encoding detected by locale settings.
Assuming UTF-8 encoded filenames on source filesystem,
use -input-charset to override.
mkisofs 2.01 (cpu-pc-linux-gnu)
Scanning isolinux/
Excluded by match: isolinux/boot.cat
Excluded: isolinux/TRANS.TBL
Writing:   Initial Padblock                        Start Block 0
Done with: Initial Padblock                        Block(s)    16
Writing:   Primary Volume Descriptor               Start Block 16
Done with: Primary Volume Descriptor               Block(s)    1
Writing:   Eltorito Volume Descriptor              Start Block 17
Size of boot image is 4 sectors -> No emulation
Done with: Eltorito Volume Descriptor              Block(s)    1
Writing:   Joliet Volume Descriptor                Start Block 18
Done with: Joliet Volume Descriptor                Block(s)    1
Writing:   End Volume Descriptor                   Start Block 19
Done with: End Volume Descriptor                   Block(s)    1
Writing:   Version block                           Start Block 20
Done with: Version block                           Block(s)    1
Writing:   Path table                              Start Block 21
Done with: Path table                              Block(s)    4
Writing:   Joliet path table                       Start Block 25
Done with: Joliet path table                       Block(s)    4
Writing:   Directory tree                          Start Block 29
Done with: Directory tree                          Block(s)    1
Writing:   Joliet directory tree                   Start Block 30
Done with: Joliet directory tree                   Block(s)    1
Writing:   Directory tree cleanup                  Start Block 31
Done with: Directory tree cleanup                  Block(s)    0
Writing:   Extension record                        Start Block 31
Done with: Extension record                        Block(s)    1
Writing:   The File(s)                             Start Block 32
Total translation table size: 4925
Total rockridge attributes bytes: 1307
Total directory bytes: 0
Path table size(bytes): 10
Done with: The File(s)                             Block(s)    4674
Writing:   Ending Padblock                         Start Block 4706
Done with: Ending Padblock                         Block(s)    150
Max brk space used 0
4856 extents written (9 MB)
Advertisements
Categories: BASH, Linux, Red Hat, RHCE, RHCT

Tips: Handy Linux Commands

January 15, 2011 1 comment

This is by no means an exhaustive list, merely commands that I use on a daily basis that will be updated periodically as I can be bothered.

Use root complete with variables & script access:

sudo -

Renew DHCP lease:

dhclient -r

Restart networking:

 /etc/init.d/network restart

Check CPU usage/processes:

top

Find commands:

apropos <command-or-pattern>
man -k <command-or-pattern>

Find files & directories:

locate <pattern>

Display PCI devices:

lspci

Display USB devices:

lsusb

Display storage devices:

fdisk -l

Check for new hardware (Happens at boot time automatically):

kudzu --probe

Check for new hardware & test kudzu (requires rhpxl package):

ddcprobe

Gather information from the BIOS:

dmidecode
biosdecode
ownership #(Compaq specific)
vpddecode #(IBM specific)

List drivers/kernel modules:

lsmod

Manually load a module and its dependencies:

modprobe <modulename>

Display information about a specific module or modules:

modinfo <packagename>

Launch the HAL device manager to examine all devices HAL knows about:

hal-device-manager
Categories: BASH, Linux, Red Hat, RHCE, RHCT, Tips

Add SSH user to Cygwin

January 14, 2011 Leave a comment

I had a requirement to grant some users SSH access to a server running Cygwin:

  1. Click Start –> Programs –> Accessories
  2. Right click on the Command Prompt icon.
  3. Select Run As.
  4. Click on “The following user”.
  5. Enter the user account and its associated password.
  6. Once in the DOS window, open a Cygwin shell by typing c:\cygwin\cygwin.bat.
  7. At the Cygwin $ prompt, type id to confirm you’re logged in as the required user

Once you’ve confirmed that you’re logged in as the required user complete the following steps:

$ ssh-user-config
Shall I create an SSH1 RSA identity file for you? (yes/no) no
Shall I create an SSH2 RSA identity file for you? (yes/no) yes
Generating /home/userid/.ssh/id_rsa
Enter passphrase (empty for no passphrase):<passphrase>
Enter same passphrase again: <passphrase>
Do you want to use this identity to login to this machine? (yes/no) yes
Adding to /home/userid/.ssh/authorized_keys
Shall I create an SSH2 DSA identity file for you? (yes/no) (yes/no) no
Configuration finished. Have fun!

Categories: BASH, Cygwin, Linux, Security, SSH