Showing posts with label Red Hat Linux Commands. Show all posts
Showing posts with label Red Hat Linux Commands. Show all posts

Friday, February 17, 2012

HOW TO do Remote Access to Computers

There are several commands to do remote access to computers.

Telnet - The least secure, unencrypted.

SSH - Secure Shell

Putty - SSH emulator for Windows.

VNC and RDP will be discussed in more detail below.

VNC
Virtual Network Computing. You have to use the vnc viewer to emulate a workstation display over a remote login connection.

The local machine will run the vnc server
vncserver is used to start a VNC (Virtual Network Computing) desktop. vncserver is a Perl script which simplifies the process of starting an Xvnc server.

The remote computer will run vnc viewer
At the pop up the command is issued, local ip: channel ID

Launching vncviewer
This is a good summary of using vnc from the real authors.

To close the vnc window
usage: service vncserver stop

To port the display over
setenv DISPLAY server2:1.0
setenv DISPLAY localhost:1.0

RDP
Remote Desktop Protocol. More to follow!

Thursday, February 16, 2012

Are you ready for Rsync?

How many times have you set up a file transfer by FTP over the weekend because it was a massive file that would take four days, and you find out that somwhere along the way there was an unexplained drop in the network connection, and your file transfer is incomplete with bits lost in the ether.

Enter rsync and you'll be much happier with the delivery guarantee. What do you call this UDP or TCP? Tricky... must be TCP because you're looking for better late than never, as opposed to be never than late.

Rsync is actually a backup/mirroring tool, but I suppose it is also good for a one time transfer.  Step by step instructions are here.

http://www.thegeekstuff.com/2010/09/rsync-command-examples/
http://everythinglinux.org/rsync/

Do I need a Host Table?

I didn't quite see the need to create the host table for the little lab network with a data server talking to a recording device, because I thought the switch in between would be enough. Anyway I decided to do some digging.

Linux
Obviously the host table is located in the “/etc/hosts” file, containg IP addresses and hostnames. Here's a sample below:
$ cat /etc/hosts
# Table of IP addresses and host names
127.0.0.1 localhost
192.168.1.2 myserver aliasname anotheralias

Windows
Windows 95/98/Me c:\windows\hosts
Windows NT/2000/XP Pro c:\winnt\system32\drivers\etc\hosts
Windows XP Home c:\windows\system32\drivers\etc\hosts
The host table is useful when you have a small number of servers in the group and you want to use some alias, and/ or there is no DNS or connection to the internet. The host table simple converts IP addresses to host names and the reverse.

It gets tricky when the host table is long and it gets messy.

Thursday, February 9, 2012

HOW TO change file permissions on LINUX

To change file permissions on Linux is easy stuff that should just fly off your fingertips, but just in case you forgot or someone asks you a question and you want to just send them a summary.

To change file ownership
usage: chmod +x thefilename

File permissions
666 means the sign of the devil! And also that the owner is allowed to read and write, group is allowed to read and write, and everyone is allowed to read and write. Well what good is that if you can't run it?

777 means read, write and execute for the owner, group and everyone respectively.

123 means owner can execute, group can write, everyone else can write and execute

321 means owner can write and execute, group can write, everyone else can execute

4321 same as 321, except that "4" is a special mode bit for "Set User ID" on execution

Using grep
searching for a file containing a certain string
usage: grep string filenames | more
means look for this string within these names of files, could be 2* (for example a bunch of log files beginning with 2012-month-day etc) pipe to more

Verifying process ID
usage: ps -ef | grep theprocessIDnumber

Wednesday, January 25, 2012

HOW TO Remote Network Installation of Red Hat Linux

This is a summary of commands and tools I found useful to do the  Network Installation in a Diskless Environment

Kickstart is an automated installation tool set used by Red Hat Linux to perform automated or unattended OS Installation and Configuration. Process in simplified steps
1. Boot the machine from a CD/DVD, USB device or over the network using PXE, DHCP or TFTP
2. The Kickstart file shall be located on the boot media, accessible over the network, and will be downloaded
3. Linux OS installation is launched, the system will consult the kickstart file for the location of the Installation Tree file.
4. After accessing the installation tree, the rest of the configuration information should be in the kickstart file without too much need for user intervention.

Jumpstart is similar to Kickstare, for Solaris OS. Easier to manage multiple system installations with the same configuration over time (meaning you probably can't do them all simultaneously) but I could be wrong.
1) Move and Expand Files Required on the TFTP Server
Red Hat AS 5 Operating System, example: rhas5_u2.tar
Rebuild Server Kickstart file, see AS5_U2ks.cfg
DHCP configuration file, see dhcpd.conf

On the host asting as the NFS and TFTP server, create a directory called /apps/LINUX
Place the rhas5_u2.tar file there
Expand the file: tar -xvf rhas5_u2.tar

2) Edit the DHCP Configuration File
The host which is to host the NFS mounted OS files and conifguration files must provide dynamic hosting of the IP addresses.
Copy the dhcpd.conf file to the /etc
Type: dhcpd service reload
Type: dhcpd service restart

3) Place RedHat in the NFS mount directory
Make the RedHat installation files in a directory that can be NFS mounted by the client host. Add this line to the /etc/exports file using a vi editor.
/apps/LINUX 192.168.2.1 (sync) *(ro)
Note, please use your own specified IP address. This is the host which is the client PXE booting the requested O/S.  This allows the host to PXE boot and access the NFS mounted files also called kickstart and linux images.

The NFS server must be restarted with the command issued in terminal window:
service NFS restart

4) Enable TFTP
To list the status of all the services (user should be logged in at runlevel 5)
in  a terminal window  type the command :   ntsysv

A window opens with an alphabetical (a-z) list of services. Use the  Down arrow key to scroll to  “iptables”  . If there is an asterix next to “iptables” this means it is selected to start at reboot. The “iptables” service is for the firewall and it should be off.   Use the  spacebar to toggle the asterix off so that the “iptables” service is inactive at startup.


Use the Down arrow key to scroll to “tftp” service . Use the spacebar to toggle the asterix on  so that the “tftp” service is active at startup.

Use the TAB key to highlight “OK” button and select Enter to dismiss the window.

5) Disable Selinux
In a terminal window  type the command “sestatus” to display the security status.
SELINUX status should be displayed as   DISABLED.

 If it is enabled , edit the /etc/selinux/config  file  and change the line from: selinux=enabled   to: selinux=disabled

Save the file

6) Reboot/ BIOS settings for PXE Network Enabling
Reboot the server .

When the BIOS is displayed (DELL Logo) press F2  (Setup).
The setup window will load. Using the down arrow scroll down to integrated devices.

Enable eth0  with PXE enabled.
Enable  eth1  without PXE enabled.

Press escape and save the changes.
The server will continue to boot from here.

The server can now provide DHCP related protocols on eth0.

The server which will be PXE booting to load the OS must also have eth0 enabled with PXE and have physical network connectivity to this (in this example 192.168.2.1) server.


Under construction:
7) Setup Network booting on the boot server

Sample Kickstart file

Sample DHCP Configuration File for Boot Server

Bootable CDROM install option selection/ Create the Anaconda-ks.cfg file