How to DHCP server on Ubuntu




$ sudo apt-get install dhcp3-server

Now edit the /etc/dhcp3/dhcp3d.conf

The default config file supplied with the dhcpd package is some what cumbersome. I replaced it with the following simple file


# dhcpd.conf config file.

authoritative;

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.20 192.168.0.250;
option domain-name "mynet.local";
option domain-name-servers 192.168.0.1;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
# next-server 192.168.0.1;
# get-lease-hostnames true;
option subnet-mask 255.255.255.0;

}


Then I restarted the server .

$ sudo /etc/init.d/dhcp3-server restart


The above configuration file will serve IP range from 192.168.0.20 to 192.168.0.250. If you have a different IP scheme modify the values as required. In fact , there are several other options for dhcpd which you can control. The original config file has some examples settings explained in it.

If you have multiple interfaces on the machine, modify /etc/default/dhcp3-server file to specify which interface the server should run.

How to beat proxy using ssh


In most of our schools and offices several websites are blocked. Most of these offices and schools are using a proxy server such as squid along with squidguard or danceguardian to achieve access restrictions on users. Most often, the sys admins forget to block internet traffic using other protocols such as ssh , ftp etc. You can beat the web filtering scheme of your network administrator if you can access a machine on internet via ssh. Open ssh server can act as a socks proxy.

So . install open ssh server on your home machine and leave it connected to internet. Note down the ipaddress of your home machine. If it uses DHCP , you can install some thing like dyndns client and keep track of the IP address. From your office/school connect to the home machine as below.

$ ssh -D 2345 ipaddress _of_home_machine

( You can use any other unused port no. instead of 2345. You may not be able to connect to home if the admin has blocked ssh port on the firewall. You can try running ssh server at home on a different port)

Open your firefox browser and select file=>preferences->advanced->network-settings. Fill in 127.0.0.1 against the Socks host column and enter 2345 as port. Click ok to save.
All your webtraffic will now be tunneled to your home machine beating the local proxy. Enjoy unrestricted internet.

How to update a distro's iso to new one with zsync

zsync is a file transfer program. It allows you to download a file from a remote server, where you have a copy of an older version of the file on your computer already. zsync downloads only the new parts of the file. It uses the same algorithm as rsync. However, where rsync is designed for synchronising data from one computer to another within an organisation, zsync is designed for file distribution, with one file on a server to be distributed to thousands of downloaders. zsync requires no special server software — just a web server to host the files — and imposes no extra load on the server, making it ideal for large scale file distribution.

More here

to install it on ubuntu

$ sudo apt-get install zsync



Suppose u have the alpha version of karmic koala and kept it as karmic.iso in your home folder. 



For updating this image to the final  release I typed the following command.

$ zsync -i karmic.iso http://releases.ubuntu.com/karmic/ubuntu-9.10-desktop-i386.iso.zsync




How to Rebuild a deb package from an installation

If you have an ubuntu/debian system , you can rebuild the deb file of any installed package. For this install the dpkg-repack package.

# apt-get install dpkg-repack

Suppose you have aspell installed on you system . Rebuild the package as below.

# dpkg-repack aspell

Now look at your current directory. You will see

aspell_0.60.6-1_i386.deb

dpkg-repack will work only as root.

[ How to ] Automatically unlock the gnome keyring


Installing the Package
We’ll need one tiny package for this to be supported. Using your favorite package manager install libpam-keyring, or use the following command:
sudo aptitude install libpam-keyring
Configuring PAM
Once this is installed we need to add a few lines to a configuration file. Follow this next step carefully. If you put the line in the wrong place it may cause problems with other parts of machine authentication.
Edit the /etc/pam.d/gdm file and append the following line to the end of the file:
@include common-pamkeyring
At this point the gnome-keyring will be handed your login password and, if they are the same, will be authenticated at login. If your login password and gnome-keyring password are different this will not work.

[How to] boot from Linux ISO FILE using Grub 2

Edit /etc/grub.d/40_custom and add the below entry

menuentry "Karmic Live CD (sdaX)" {
loopback loop (hd0,X)/my-ISO/ubuntu-9.10-desktop-i386.
iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/my-ISO/ubuntu-9.10-desktop-i386.iso
initrd (loop)/casper/initrd.lz
}


The above entry assumes that ubuntu-9.10-desktop-i386.iso is put in sdaX/my-ISO/

After making the entry run

sudo update-grub

to make the entry in /boot/grub/grub.cfg 
 
 
Credits : Kamalakar Agashe

[How to ] enable 3D effects in fedora 12 ( constantine ) on a system having ATI graphics card


Fedora 12 provides "out of the box" support for kernel mode-setting with ATI R600/700 series graphics hardware, but it does not provide 3D acceleration by default. However, Red Hat's X developers have made it very easy to enable this 3D support for the ATI Radeon HD 2000, 3000, and 4000 series hardware by just installing a special Mesa package from yum.
To enable the open-source R600/700 3D support under Fedora 12 one must simply run


yum install mesa-dri-drivers-experimental

and then reboot their system

How to change gnome keyring password

Install gnome-keyring-manager. Run it and there will be a "local password for user root." Change that and it will change your keyring password.





Quick and dirty method 
----------------------------


Delete the keyring Data file


Code:
rm ~/.gnome2/keyrings/default.keyring
or backup:
Code:
mv ~/.gnome2/keyrings/default.keyring ~/.gnome2/keyrings/default.keyring.bak





[ How to ] Linux Encrypted DVD

Suggested Reading 


http://icewalkerz.blogspot.com/2009/10/how-to-create-encrypted-partition-local.html




  1. Create an empty DVD image. The size of the image depends on the media you use (the one in the example works for DVD-R)


    dd if=/dev/zero of=dvd.img bs=1000000 count=4700
    


  2. Mount the image on a loopback device and prepare it for further use with LUKS:


    losetup /dev/loop0 dvd.img 
     
    cryptsetup -c aes-cbc-essiv:sha256 -y -s 256 luksFormat /dev/loop0
    

  3. Open the encrypted device with cryptsetup and create the file system.

     
    cryptsetup luksOpen /dev/loop0 dvd 
     
    mkudffs --media-type=dvd /dev/mapper/dvd
    

  4. Mount the device (you'll have to remount it in read-write mode).


    mount /dev/mapper/dvd /media/dvd 
     
    mount -o remount,rw /media/dvd
    

  5. Now copy your data to the DVD (/media/dvd)




  6. Close the devicemapper crypto device and the loopback device

     
    cryptsetup luksClose dvd 
     
    losetup -d /dev/loop0
    


  7. Burn the image (dvd.img) as an ISO9660 DVD-image with a DVD-burner program as for instance K3B. (You might get a warning, that this is not a valid ISO-image).



  8. Finished :) - you can now mount your dvd with pmount -r {dvd-device}.


    How to install Moblin Desktop environment on Fedora 12


    Moblin is a lightweight Linux desktop environment especially suited for small form computers (netbooks et al).
    Installation is straightforward.



    Using the command line

    1. Open a terminal (shell).
    2. Install the Moblin group: su -c 'yum install @moblin-desktop'

    Using the graphical package manager

    1. Go to System > Administration > Add/Remove Software.
      • Note: the name of the Add/Remove Software application is PackageKit.
    2. In the left side pane choose Moblin desktop.
    3. Click Apply to install the package set.

    How to install Chrome browser on Fedora


    fedora-chromiumChrome is a browser revolution from Google. It’s built from scratch by Google and has all new features and some innovative ones. Although Google has not yet officially released a Chrome browser that works on Linux, we had shared with you a few ways in which you could possibly install Chromium (the base on which Google have built the Chrome browser) on your Linux system.
    Except the Crossover Chromium, all other installs and builds of Chromium on Fedora 11 or Fedora 10 have been buggy till date. But, now we have a very decent solution for Chromium on Fedora and we will tell you how to go about installing a working build of Chrome (Chromium) on Fedora 11 and Fedora 10.
    Installation of Chromium browser can be done in both ways – either manually or using the YUM updater. These packages have been specially built for Fedora 11 and are available for both 32 bit and 64 bit systems.

    Install Using Packages (RPMs)

    RPMs of the 32 bit and 64 bit versions of both Fedora 10 and Fedora 11 operating systems are available at http://spot.fedorapeople.org/chromium/. Download and install them by either double clicking the RPMs or by using the rpm -ivh command. If you are looking for source RPMs, these can also be found at the link above.

    Install Using YUM

    One advantage of installing Chromium via YUM is that you will get updates to Chromium automatically. Also there won’t be any dependency problem while installing. All you need to do is justdownload the file: chromium.repo and save it to your /etc/yum.repos.d directory. Once done, then you can install Chromium by using the command: yum -y install chromium


    ref : http://digitizor.com/2009/06/25/how-to-install-chrome-browser-on-fedora-linux-that-works/

    How to : Time Synchronisation with NTP


    ntpdate

    Ubuntu comes with ntpdate as standard, and will run it once at boot time to set up your time according to Ubuntu's NTP server. However, a server's clock is likely to drift considerably between reboots, so it makes sense to correct the time ocassionally. The easiest way to do this is to get cron to run ntpdate every day. With your favourite editor, as root, create a file /etc/cron.daily/ntpdate containing:
    ntpdate ntp.ubuntu.com
    
    The file /etc/cron.daily/ntpdate must also be executable.
    sudo chmod 755 /etc/cron.daily/ntpdate
    

    ntpd

    ntpdate is a bit of a blunt instrument - it can only adjust the time once a day, in one big correction. The ntp daemon ntpd is far more subtle. It calculates the drift of your system clock and continuously adjusts it, so there are no large corrections that could lead to inconsistent logs for instance. The cost is a little processing power and memory, but for a modern server this is negligible.
    To set up ntpd:
    sudo apt-get install ntp-simple
    

    Changing Time Servers

    In both cases above, your system will use Ubuntu's NTP server at ntp.ubuntu.com by default. This is OK, but you might want to use several servers to increase accuracy and resilience, and you may want to use time servers that are geographically closer to you. to do this for ntpdate, change the contents of /etc/cron.daily/ntpdate to:
    ntpdate ntp.ubuntu.com pool.ntp.org 
    
    And for ntpd edit /etc/ntp.conf to include additional server lines:
    server ntp.ubuntu.com
    server pool.ntp.org
    
    You may notice pool.ntp.org in the examples above. This is a really good idea which uses round-robin DNS to return an NTP server from a pool, spreading the load between several different servers. Even better, they have pools for different regions - for instance, if you are in New Zealand, so you could use nz.pool.ntp.org instead of pool.ntp.org . Look athttp://www.pool.ntp.org/ for more details.
    You can also Google for NTP servers in your region, and add these to your configuration. To test that a server works, just type sudo ntpdate ntp.server.name and see what happens.


    ref : https://help.ubuntu.com/7.04/server/C/NTP.html

    [ How to ] solve laptop's ACPI related problems in Ubuntu (9.10)


    Laptop fan runs constantly under Ubuntu 9.10



    • Open a terminal
    sudo nano /etc/default/grub
    • Find and Edit the following line:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    
    • Add acpi_osi=Linux to the end so it looks like this:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi=Linux"
    
    • Exit Nano editor with Ctrl+X.  Answer "yes" when asked to save the file
    • Update grub: 
    sudo update-grub
    • Reboot to make changes effective


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


    Overheating Problem



    Add the following to your /etc/modules:


    battery
    ac
    thermal
    processor
    acpi-cpufreq
    cpufreq-userspace


    That's it!

    HOW TO increase available space of your partitions - tune2fs

    You have probably noticed that when you start your 'System Monitor' (System>Administration>System Monitor) there's a difference between free and available space. Reason for this is the fact that 5% of your partition is reserved for root so if the disk gets full you can boot to recovery mode and have enough room to move around. The thing is that you don't need more than 50MB for this so 5% of today size partitions is really way to much.

    I have partitions set up like following:
    - system partition 15GB
    - swap partition 512MB
    - documents partition rest of disk

    As you can see i don't use separate partition for /home. Swap partition is obviously of no meaning here so we will ignore it. On your documents partition there is no point to this reserved space so we will set it to 0%. On my system partition I have left 1% of disk reserved for root. As I said, anything more than 50MB should be enough but considering today's disk capacities set it between 100MB and 200MB. 1% of mine 15GB is 150MB and thats how much I left for root.

    Now you're probably waiting for me to tell you how to reduce this root reserved space. We will use tune2fs command. Before you can do this you will have to unmount partition you wish to edit. Your documents partition can be unmounted easily (I'll explain in a second) but your system partition obviously can't be unmounted so you'll have to use live CD to boot and do the procedure from that live CD.

    Here is how you unmount the partition, type:

    sudo unmount device_name

    where the device name of partition can be seen in 'Device' column of 'System Monitor's' 'File Systems' tab. For example:

    sudo umount /dev/sda3

    Now, to reduce the amount of space reserved for root type:

    tune2fs -m 0 device_name

    This will reduce the root reserved space to 0% or nothing. To reduce it to 2% for example type:

    tune2fs -m 2 device_name

    And thats all. Don't forget that you can't unmount system partition on which you're working at the moment so for this case use live Ubuntu CD.

    How to Setup Transparent Squid Proxy Server in Ubuntu

    Squid is a fully-featured HTTP/1.0 proxy which is almost (but not quite – we’re getting there!) HTTP/1.1 compliant. Squid offers a rich access control, authorization and logging environment to develop web proxy and content serving applications. This is a short guide on how to set up a transparent squid proxy server. Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator.

    Install Squid
    Install squid and squid-common

    sudo aptitude install squid squid-common

    Edit the squid config file.

    sudo vi /etc/squid/squid.conf

    Set the allowed hosts.

    acl internal_network src 192.168.0.0/24 (
    Where 192.168.0.0/24 is your IP range.)
    http_access allow internal_network

    Set the correct permissions.
    sudo chown -R proxy:proxy /var/log/squid/
    sudo chown proxy:proxy /etc/squid/squid.conf

    You will need to restart squid for the changes to take affect.

    sudo /etc/init.d/squid restart

    Now open up your browser and set your proxy to point to your new squid server on port 3128
    Authentication
    If you wish to use authentication with your proxy you will need to install apache2 utilities
    sudo aptitude install squid squid-common apache2-utils
    To add your first user you will need to specify -c

    sudo htpasswd -c /etc/squid.passwd first_user

    Thereafter you add new users with
    sudo htpasswd /etc/squid.passwd another_user
    Edit the squid config file

    sudo vi /etc/squid/squid.conf

    Set the the authentication parameters and the acl
    auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid.passwd
    auth_param basic children 5
    auth_param basic realm NFYE Squid proxy-caching web server
    auth_param basic credentialsttl 3 hours
    auth_param basic casesensitive off

    acl users proxy_auth REQUIRED
    acl sectionx proxy_auth REQUIRED
    http_access allow users
    So this is what your squid.conf should look like.

    acl all src 0.0.0.0/0.0.0.0
    acl
    internal_network src 192.168.0.0/24
    acl users proxy_auth REQUIRED
    acl manager proto cache_object
    acl localhost src 127.0.0.1/255.255.255.255
    acl to_localhost dst 127.0.0.0/8
    acl SSL_ports port 443 563 # https, snews
    acl SSL_ports port 873 # rsync
    acl Safe_ports port 80 # http
    acl Safe_ports port 21 # ftp
    acl Safe_ports port 443 563 # https, snews
    acl Safe_ports port 70 # gopher
    acl Safe_ports port 210 # wais
    acl Safe_ports port 1025-65535 # unregistered ports
    acl Safe_ports port 280 # http-mgmt
    acl Safe_ports port 488 # gss-http
    acl Safe_ports port 591 # filemaker
    acl Safe_ports port 777 # multiling http
    acl Safe_ports port 631 # cups
    acl Safe_ports port 873 # rsync
    acl Safe_ports port 901 # SWAT
    acl sectionx proxy_auth REQUIRED
    acl purge method PURGE
    acl CONNECT method CONNECT

    http_access allow manager localhost
    http_access allow users
    http_access allow internal_network
    http_access deny manager
    http_access allow purge localhost
    http_access deny purge
    http_access deny !Safe_ports
    http_access deny CONNECT !SSL_ports
    http_access allow localhost
    http_access deny all
    http_reply_access allow all
    icp_access allow all

    Redirect the all HTTP traffic.
    If you would like to redirect the all HTTP traffic through the proxy without needing to set up a proxy manually in all your applications you will need to add some rules

    iptables -t nat -A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.0.1:3128
    iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128

    Where eth1,eth0 are the LAN, WAN devices and 192.168.0.1 is the IP address of your LAN device.
    If you wish to monitor the performance of your proxy you can look as some log parser’s (sarg, calamaris, ect.)
    Source from here

    [How to ] Kill the System Beep

    System > Preferences > Sound > uncheck "Play alert sounds"

    You can try a reboot now .. but. Disabling the PC speaker, in favor of using external speakers, can be more tricky.

    Try by opening:-
    1.sudo nano /etc/modprobe.d/blacklist.conf

    .. and appending the lines:-
    1.blacklist pcspkr
    2.blacklist snd_pcsp

    Reboot your Ubuntu PC.

    If that doesn't cut it, open:-
    1.sudo nano /etc/modprobe.d/alsa-base.conf

    .. and add the lines:-
    1.blacklist pcspkr
    2.blacklist snd_pcsp
    Reboot the box.

    Remastersys for Ubuntu 9.10 ( Karmic Koala )

    Remastersys 2.0.13 released for Ubuntu 9.10 Karmic

    There is a new repository as well.

    For Karmic and Newer with grub2 - version 2.0.13-1 and up

    # Remastersys
    deb http://www.geekconnection.org/remastersys/repository karmic/


    The webpage has also been updated:

    http://www.geekconnection.org/remastersys/ubuntu.html

    [ How to ] open Corel Draw files ( .cdr ) in Linux


  1. sK1 illustration program

  2. sK1 is an open-source illustration program that can substitute professional proprietary software like Corel Draw or Adobe Illustrator*. Currently Linux is our main development platform, but porting on Win32 and MacOS X desktops has been scheduled. sK1 supports professional publishing features, such as CMYK color, separations, ICC color management and press-ready PDF output.
  3. UniConvertor

  4. UniConvertor is a universal vector graphics translator. It is a command line tool which uses sK1 object model to convert one file format to another. The project is a multiplatform software and can be compiled under Linux (and other UNIX-like systems), MacOS X and Win32/64 operation systems.
  5. CDR Explorer

  6. CDR Explorer is a research tool for CorelDraw file formats. It was used to create a CDR import filter for sK1 Editor and UniConvertor. This tool is written on Python and works under Linux, MacOS X and Win32.

     
    http://sk1project.org/

    [ How to ] mark or highlight lines or important points in pdf files

    Xournal

    Xournal is a GTK+ application for notetaking, sketching and keeping a journal using a stylus. It can also be used to add annotations to PDF files.
    Xournal uses the gtk-print architecture for printing. Xournal also includes a native PDF printing feature.
    Xournal includes a PDF file parser compatible with PDF format version 1.4; the compression features of PDF 1.5 are not supported. When exporting a document that uses PDF backgrounds, Xournal attempts to preserve most of the structure of the original PDF file (however, auxiliary data such as thumbnails, hyperlinks, and annotations are lost).
    Xournal has an intuitive interface.


    Features include:
    • Drawing and selection tools including:
      • Pen
      • Eraser
      • Highlighter
      • Text tool
      • Ruler
      • Shape Recognizer
    • Undo / redo
    • Button mappings
    • PDF Annotation
      • Uses the poppler library

    Ubuntu users can install Xournal by sudo apt-get install xournal

    Philosophy of free software (Video) by Richard Stallman

    Download video of Richard Stallman in 2009 FLISOL - here
    The video lasts 28 minutes and this format ogv (free technology for video compression)

    Things to do after installing Ubuntu Linux 9.10 Karmic Koala

    So you've just installed Ubuntu 9.10, the cute and cuddly Karmic Koala, but now you're confronted with a most pertinent question, "What do i do now?" Ubuntu is a very complete and full-featured Linux distribution, but no operating system can come with everything you want. There's much more fun to be had in what comes after installing the OS on your machine: now you get to set it up with all the best software it didn't already come with! This list of the top things to do immediately after installing your newly acquired copy of Ubuntu doubles as a general list of great software to try out and use, complete with links to any special instructions on how to set them up, Terminal commands for those who prefer a command-line interface (CLI), and when available, personal package archives (PPA), repositories to keep the applications at their newest version, not just the security updates provided for you by default. Repositories can be added easily by clicking the "Add..." button in the "Other Software" tab of Software Sources and entering the provided APT Line. Feel free to pick and choose; enjoy!



    Read full post here

    Changing the Plymouth Theme in Fedora 11 Leonidas

    Plymouth is the new graphical boot system introduced with the release of Fedora 10 Cambridge. It replaced the rhgb (RedHat Graphical Boot) with a snazzier boot screen that supported cool animations. The first version of Plymouth that shipped with Cambridge used a plugin system where each graphical boot animation had to be coded from scratch - something that did not encourage many people to create new boot screens. With the release of Fedora 11, Plymouth has also gone through a major change. It now supports "themes" instead of "plugins" - making it much easier for theme developers to focus on the graphical elements rather than raw coding.

    Currently there are 4 Plymouth themes in the Fedora repositories.
    • Charge (Default theme in Leonidas)
    • Spinfinity (A throbber that moves in a path shaped like the infinity sign)
    • Solar (Default theme in Cambridge - the planet with exploding pulsars)
    • Fade-In (Fedora logo fading in and out in a star field)
    To check out these themes, you need to download them first.

    sudo yum install plymouth-utils "plymouth-theme-*"

    After the themes are downloaded, install them as follows:

    sudo plymouth-set-default-theme spinfinity
    sudo /usr/libexec/plymouth/plymouth-update-initrd


    Replace "spinfinity" above with the name of either one of the themes you would like to try out.

    EDIT: You can list the installed themes by running the following command
    plymouth-set-default-theme --list

    Hopefully the new theme system will encourage people to come up with new and exciting themes for Fedora boot-up.

    How to change DMA settings

    One really common solution to slow, and unreliable playback of DVD is the settings related to DMA which is turn "off" by default.

    DMA stands for: Direct Memory Access. DMA allows a piece of hardware to talk directly with the RAM, reading and/or writing independent of the CPU (Central Processing Unit). In other words the hardware can use the system memory, bypassing the CPU, allowing the device to read and write much faster.

    By default Ubuntu has DMA turned off (set to 0), this can be changed in the /etc/hdparm.conf file, like so:

    1. First make a backup of your hdparm file:

    # sudo cp /etc/hdparm.conf /etc/hdparm.conf.original
    2. Now edit the file using your favorite text editor, I'm using vi, however you can use the editor of you choice:
    # sudo vi /etc/hdparm.conf
    3. Now just add the following at the end of the file:
    /dev/cdrom {
          dma = on
          }