Sunday, May 2, 2010

Linux DEbian useful commands

The network manager in debian is the GUI based application for configuring networks.

To Stop Network Manager :-

nm-applet --sm -disable

To see the available interfaces

ifconfig

To make an interface up or down:-

ifconfig eth1 up/down

To configure network interface:-

nano /etc/network/interfaces

if you want to configure an interface as static:-

auto eth0

iface eth0 inet static

address <ip address>

netmask 255.255.255.0

gateway 10.205.15.1

broadcast 10.205.15.255

network 10.205.15.0


 

if you want to configure an interface as dhcp:-

auto eth0

iface eth0 inet dhcp

To restart networking from command line after editing interfaces file:-

/etc/init.d/networking restart

Configure Nameservers

Nano /etc/resolv.conf

To include proxy server information

#export http_proxy="10.205.3.101:8080"

#export ftp_proxy="10.205.3.101:8080"

To include proxy server information for apt to update packages

Create a new file called proxy

#nano /etc/apt/apt.conf.d/proxy

Type the following info in this file

Acquire::http::Proxy <space> "http://10.205.3.101:8080";

Save and close the file

To install ssh and SFTP services

Apt-get install ssh

Activate sftp in sshd-config

Nano /usr/lib/openssh/sftp-server

To install Apache

Apt-get install apache2

Default webroot of Apache is /var/www.

To change default webroot to some other path

Nano /etc/apache2/sites-available/default

And change /var/www to whatever path you wish

Setting up DHCP Server

Apt-get install dhcp3-server

After initial setup, the dhcp server may not turn on, then, edit the dhcpd.conf as shown below and uncomment the lines in this file as per your choice. Then, try starting the server

To configure DHCP server

Nano /etc/dhcp3/dhcpd.conf

To Start/Stop/Restart DHCP Server

#/etc/init.d/dhcp3-server start/stop/restart


 

Setting up TFTP server

#apt-get install tftpd-hpa

To configure TFTP boot file path (default /var/lib/tftpboot), we have to use the internet superserver configuration file inetd.conf, scroll down to the tftp entries

#nano /etc/inetd.conf

To switch on TFTP daemon, change the run daemon from "no" to "yes"

# nano /etc/default/tftpd-hpa

To Start/Stop/Restart TFTP Server

#/etc/init.d/tftpd-hpa start

To remove a package

#apt-get<space> remove <space> <package_name>

To remove a package along with all associated config files

#apt-get <space> --purge <space> remove <space> <package_name>

To Stop GNOME Display Manager (I.e., to unload X)


 

# update -rc.d <space> -f <space>gdm <space> remove


 

TO Load GDM on boot


 

# update -rc.d <space> -f <space>gdm <space> defaults


 

I made changes to some critical system files, but, upon reboot, system does not boot properly and gives Kernel Panic. How do I undo the changes?

  1. Remove the disk
  2. Insert it into a working system
  3. Mount the disk to a folder in the working system
  4. Chroot into the path as follows

    # chroot /test /bin/bash

  5. CD <space> ~
  6. Then, undo changes to any files and save


 

Database Path for postgre sql is /var/lib/postgres/data


 

Connecting and External SCSI hard disk to workstation

  1. Zero fill the entire disk to remove SGI partition or any other partition

    dd if=/dev/zero of=/dev/sdb count=1

  2. fdisk /dev/sdb (to partition hard drive)
  3. Create primary partition # 1
  4. Start cylinder=1 (default)
  5. Last cylinder=last cyl (default)
  6. Write changes to disk (w)
  7. Verify that the partition type is 83 (Linux) using p command
  8. The HDD would be visible as single partition /dev/sdb1
  9. Format an ext3 file system

    # mke2fs <space> -j <space> /dev/sdb1

  10. Mount the disk

    # mount /dev/sdb1 /test


     

No comments: