Thursday, July 29, 2010

Dansguardian Ubuntu Linux Install how-to

If you are installing to a piece of hardware, skip the first step.

Install Ubuntu in a VM (can also be on physical machine)

Install SSH, Squid cache, and DansGuardian

  • make appropriate changes to the APT sources file
  • vi /etc/apt/sources.list
  • comment out the line starting with 'deb cdrom'
  • uncomment the bottom two lines with 'universe' at the end
  • apt-get update - after making changes to the sources.list file, you need to run update for apt-get to start using those sources
  • apt-get install ssh squid dansguardian - install openssh (optional, for remote administration), Squid cache, and DansGuardian

Configure DansGuardian

  • vi /etc/dansguardian/dansguardian.conf
  • comment out the UNCONFIGURED line
  • change the variable 'virusscan' to off - I'll do instructions soon on how to finish configuring clamav for use with DansGuardian

Add ports to firewall

  • Add ports to firewall - this part is optional, but highly recommended. There are many ways to do this, this was just my preferred way
  • copy the following to the file /etc/network/if-up.d/iptables-config
  #!/bin/bash
iptables -F
# set the default policy for each of the pre-defined chains
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# to allow incoming SSH and Proxy
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -m state --state NEW -p tcp -m tcp -s 127.0.0.1 --dport 3128 -j ACCEPT
iptables -A INPUT -m state --state NEW -p tcp -m tcp --dport 8080 -j ACCEPT
# drop everything else
iptables -A INPUT -i eth+ -p udp -j DROP
iptables -A INPUT -i eth+ -p tcp -m tcp --syn -j DROP
  • chmod +x /etc/network/if-up.d/iptables-config - makes the iptables-config script executable

Enable SSH, DansGuardian, and Squid cache on system startup

update-rc.d ssh defaults
update-rc.d squid defaults
update-rc.d dansguardian defaults

Restart the daemons

  • /etc/init.d/networking restart - restarts the networking components to firewall changes take effect
  • /etc/init.d/squid restart - restarts the squid daemons
  • /etc/init.d/dansguardian restart - restarts the DansGuardian daemons
Done
from the source: http://www.kathmannlabs.net/mediawiki/index.php/Dansguardian_Ubuntu_Linux_Install_how-to

Dansguardian Content Filtering With Transparent Proxy On Ubuntu

This summary is not available. Please click here to view the post.

Wednesday, June 9, 2010

Fstab Demystified: How to Add Partitions

Fstab Demystified: How to Add Partitions

Article by Berry van der Linden
Edited & published by Michele McDonoughon Oct 2, 2009

In this article, you will learn to understand fstab (File System Table) and its entries. We'll show you how to add a new hard drive to fstab and mount the partitions automatically on boot. We'll also explain some of the terminology used in fstab, and we take a look at the fdisk command.


Background for this Article

Please read part one of this series: How To Partition A Hard Drive In Linux

What is Fstab, and Why do I Need It?

fstabFstab (File System Table) is a file used by Linux operating systems to mount partitions on boot. It needs this because it can't guess what the partitions are and what to mount them to.

Take a look at the contents of fstab open Terminal and type:

nano /etc/fstab

There's no editing yet, so there's no need to sudo this command at this time.

See the screenshot to the left for the result of this action.

Let's pick the line for root apart.

table

The columns are as follows:

1. The device name or other means of locating the partition or data source.

2. The mount point, where the data is to be attached to the file system.

3. The file system type or algorithm used to interpret the file system.

4. Options that should be used when mounting at boot.

5. Dump-freq adjusts the archiving schedule for the partition (used by dump).

6. Pass-number indicates the order in which the fsck utility will scan the partitions for errors, when the computer powers on.

To close fstab file “ctrl+x”, “n” and “enter”.

Now let's find out what the device identifier is of the new partition. In Terminal type:

sudo fdisk -l

This is the result:

fdisk rsult

In this case the first disk sda is a 120GB disk the second sdb is a 750GB disk.

Sda has 5 partitions: sda1, sda2, et cetera.

Sdb has 3 partitions: sdb1, sdb2, and sdb3.

We will add sdb1 to the fstab file. First we need to create a mount point. Most mount points are created in /media or /mnt, they can be put in the mount point any where you want. In this case, we will use /media.

In Terminal type:

sudo mkdir /media/partitionname1

Partitionname1 is the directory name for this mount point. You can use any name you want - data, entertainment, multimedia - whatever suits your needs.

Open fstab for editing in Terminal type:

sudo nano /etc/fstab

Add the following line below to what is already there:

/dev/sdb1 /media/partition1 ext3 defaults 0 3

I'll explain:

/dev/sdb1: Dev stands for "device file system" and sdb1 the partition on the hard disk.

/media/partition1: The mount point or in other words the folder that the new partition will be mounted to.

ext3: The file system used on the partition.

defaults: Defaults will automatically define these options: rw, suid, dev, exec, auto, nouser, async. These are all the options needed to get the partition to work properly.

0: The dump frequency of all the fstabs I've seen so far don't change this setting. So I have no explanation of it at this time. I will follow up on this in another article at a later date

.

3: This sets the order of the fsck file system checking. I like all partitions checked every once in a while so I changed this to 3. If you don't want the partition checked, simply set this to 0.

Close the fstab file: “ctrl+x”, “y” and “enter”.

Check to make sure it mounts. In Terminal type:

sudo mount -a

This will mount any unmounted devices. Now, your partitions will be mounted automatically every time you boot.


Read more: http://www.brighthub.com/computing/linux/articles/13750.aspx#ixzz0qLHVjHiE

Friday, June 4, 2010

Upgrade Desktop Kernel to a Server Kernel in Ubuntu

I experience the Ubuntu 10.04 server installer didn't install on my Server PC, even I used the Alternative seems doesn't work. But previous versions of Ubuntu works on my system. As the Alternative installers didn't work, I installed the Desktop installer and it works without problems. But the PC will be used as a server, and performance wise it is better to use the Server kernel than the generic one. What i did are these steps:

1. Check first the version of the kernel by typing at the console
# uname -r
you will get similar to this
2.6.32-21-generic
2. Check repository regarding the kernel image
# apt-cache search linux-image

note:
the result give different kernel images, and check the last word for different machine to use
-ec2 Linux kernel image for ec2 machines
-generic Generic Linux kernel image
-server Linux kernel image on Server Equipment
-virtual Linux kernel image for virtual machines
-preempt Linux kernel image for Low Latency Server

x86/x86_64 signify for a 64 bit architecture

example:
linux-image-2.6.32-22-preempt - Linux kernel image for version 2.6.32 on x86_64 linux-image-2.6.32-22-server - Linux kernel image for version 2.6.32 on x86_64 linux-image-2.6.32-22-virtual - Linux kernel image for version 2.6.32 on x86/x86 _64
3. To install the server kernel, I chose linux-image-2.6.32-22-server
# apt-get install linux-image-2.6.32-22-server


4. If you want to remove the generic image from step #
# apt-get remove linux-image-2.6.32-21-generic

Alternate you can use this, to display the all images currently installed and to be installed.
# dpkg --list 'linux-image*'
Then remove one by one
# apt-get remove linux-image-x.x.xx-generic

Caution! Be careful of what you remove. Ensure that you don’t remove your current kernel, or anything that is not a linux-image. It is possible to break Ubuntu if you remove the wrong kernel.
WARNING! These examples may result into unstable system if not executed with care. Do not remove the kernel the system is currently running.

To make it safe use the GUI

To remove old kernel versions, open up Synaptic Package Manager, found in the System > Administration menu.

When it opens up, type the kernel version that you want to remove in the Quick search text field. The first few numbers should suffice.

For each of the entries associated with the old kernel (e.g. linux-headers-2.6.32-21 and linux-image-2.6.32-21-generic), right-click and choose Mark for Complete Removal.

Click the Apply button in the toolbar and then Apply in the summary window that pops up. Close Synaptic Package Manager.

The next time you boot up your computer, the Grub menu will not contain the entries associated with the removed kernel version.

5. After cleaning up, you now update the grub menu. In order to detect your currently installed kernel image.
# update-grub2


Flash Player 10 for 64-bit Linux (Ubuntu)

Now that there is a java browser plugin and a working wine for 64-bit on the Ubuntu repositories, there is not much holding back 64-bit Linux on the desktop. Maybe the only thing missing is the Adobe Flash player. Most of the time Flash is just annoying, nevertheless sometimes needed. Luckily, there is now a Flash Player release for 64-bit Linux (however, still beta alpha but stable so far) . I am pretty sure the instructions are identical for other Linux distributions.

To install it:

1. Download it from here.

2. Unpackage it using a terminal (with the assumption your firefox downloads into your Desktop as default):
cd Desktop
tar xvzf
libflashplayer-10.0.32.18.linux-x86_64.so.tar.gz

(The name of the tar.gz file may change when a new version is released, change accordingly).

3. Create a plugin directory in your $HOME (instead of a system directory):

cd
mkdir -p .mozilla/plugins

4. Move the file to the plugin directory:
mv Desktop/libflashplayer.so .mozilla/plugins

5. Restart firefox. Go to about:plugins to see if it’s enabled:
about:plugins
That’s it.

Edit: Alternatively, you can use the graphical approach:

1. go to the download pages and click on “Download 64-bit Plugin for Linux (TAR.GZ, 3.64 MB)”.
2. select “Open with ” in firefox (you have to click on open to enable the ok button) and clck on OK.
3. The archive manager will open and show you the libflashplayer.so file.
4. Click on extra and a save window will open.
5. Type ctrl + h to show hidden files. Go to .mozilla (dubble click).
6. If no “plugins” directory is present, click on “Create Folder” on the top right and type as name “plugins” (without the quotes). Press Ener.
7. Click on Extract.
8. Click on Close on the windows showing the result.
9. Close the archive manager.
10. Restart firefox.

Original Source: http://nxadm.wordpress.com/2009/04/26/install-64-bit-adobe-flash-player-on-ubuntu-904/

Thursday, May 27, 2010

How to fix lock /var/lib/dpkg/lock error

If ever you will encounter this problems

E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/)

based on my experience, I install some software when a blackout interrupted it. I could not install or issue the command apt-get install xxx and/or aptitude install xxx.

What i did to solve it just issue the command in the console

sudo killall apt-get

viola it solved the problems..

Hope it helps to your problem.