Locking APT packages to spesific version

17/11/2009

I never knew this until i was really need this. My Firefox automatically upgraded and some of the add-on became incompatible.

If you are using synaptic, you can force a package to specific version. Select

Packages -> Force Version

Then, you ll be given option to use which version to use.

To lock the package from being upgraded. You can lock the package by select the specific package, then select

Packages -> Lock Version

Quite simple and useful. However only do this when u are really needed to.


CentOS: YUM from CDROM

16/11/2009

This is just a small fix.

Currently I wish to install my packages from CDROM, but no luck. Seems there something wrong with it. I have to use it because Internet is something I can’t always have at home. And if i have it, the connection is too slow.

Therefore, I’ve investigate the problem, then I found the problem. A tiny fix will do.

The original configuration in /etc/yum.repos.d/CentOS-Media.repo is something like this

[c5-media]
name=CentOS-$releasever – Media
baseurl=file:///media/CentOS/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

This is wrong, as the cdrom is mounted at /media/CentOS_5.4_Final not /media/CentOS. Therefore correction should be made. Something like this

[c5-media]
name=CentOS-$releasever – Media
baseurl=file:///media/CentOS_5.4_Final/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

There you go. Installing packages using Yum from CDROM should be no problem.

[anakin@localhost ~ ]$ sudo yum –disablerepo=\* –enablerepo=c5-media install <package>


Installing GNU Screen in ESX server

28/08/2009

Today, I am forced to login into my ESX servers. Some accidents happened and my virtual servers went down. Seems to much snapshots i have made using a scheduler and fill up my datastore entirely.

There is only 2GB left from 500GB of storage. Therefore my machine cannot boot anymore. I tried to use VMware Virtual Client to move some of virtual disks but seems my network was so intermittent and the operations failed over and over.

Well I need to go inside the ESX and manually move the virtual disks. but that the problem, my network is not reliable. I can just let my ssh sessions interrupted while copying the disks.

And worse, ESX does not have screen installed. Hello! that is my favorite tool while playing in CLI. Seems I have to install one, so I can work anywhere as I in the server myself.

I tried to use Yum. But the Yum in ESX is just meant to use for updates only. What a lame!

More research comes up with ESX is built on RH3. That just cool! Just find any rpm that suite that distros, I think it will fit ESX.

And i found it in rpm.pbone.net! the link is:

http://rpm.pbone.net/index.php3/stat/4/idpl/5245464/com/screen-3.9.15-10.i386.rpm.html

and with a dependency that needed:

http://rpm.pbone.net/index.php3/stat/4/idpl/5246885/com/utempter-0.5.5-1.3EL.0.i386.rpm.html

Now, I have it installed and ready to move my virtual disks to external drive I attached to my ESX server!


Dhcpd service went haywire

11/03/2009

I am having big headache today. My first dhcp servers with failover went into some problem. This is due to unproper shutdown last night. Tenaga Nasional Berhad (TNB)  should inform us that their maintenance took lot of time yesterday. As our UPS batteries is limited to 30-45 minutes, all servers died unexpectedly.

I have two dhcp server running side by side with failover mode. Next day, when everybody just started their working hours ,  i realized then the dhcp service for master server was down.

Tried to troubleshoot, I got this message over and over again. Quite dissappointed because the web is not helping and Uncle G lost his touch today.

Mar 11 19:53:13 ns3 dhcpd: failover peer dhcp-failover: I move from communications-interrupted to startup

Mar 11 19:53:13 ns3 kernel: [   45.856222] dhcpd3[3869]: segfault at 0 ip b7ea329b sp bfd155b0 error 4 in dhcpd3[b7e82000+94000]

Much has been done. I reinstalled the service, fallback to old config, use vmware to fallback to previous states, but i failed.

Until 6 hours later i found the problem. The clock differs a lot. Such a little error and it have the service mess up.  The date between the two servers differs 12 hours.

A very short command recovered the date correctly.

# sudo date 03111451

After that i restart the service and everything when to normal. Such a headache solved with the simplest command.


Ubuntu 8.10: Squid3 with pam_auth revisited

26/12/2008

It has been a long time I have not touch the squid configuration and installation. Recently, when I tried to install it again, I found that the howtos in Internet was a little bit confusing and I did not manage to setup. Until I viewed the log file (/var/log/auth.log) then I understood what went wrong and managed to solve the problem.

My  objective is to create a new proxy server with limited access controlled by using PAM authentication. The original howto is from this page.  I modified it to suit my environment which is using Ubuntu 8.10 server installed on my ESX server (Virtualization is awesome!).

The steps i did:

1. Update the APT installer to find the latest packages

$ sudo apt-get update

2. Installed your squid and any dependencies.
In Intrepix Ibex, they use squid3 name instead of just squid. It made me mistakenly edited the wrong files several times.

$ sudo apt-get install squid3

3. Edit the main configuration files
We need to add 2 entry here to enable PAM authentication and force the PAM authentication. edit the squid.conf.

$ sudo vi /etc/squid3/squid.conf.

and add this lines to enable PAM authentication

auth_param basic program /usr/lib/squid3/pam_auth
auth_param basic children 5
auth_param basic realm Squid
auth_param basic credentialsttl 2 hours

And add this to force authentication to every user using it

# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
acl pam proxy_auth REQUIRED
http_access allow pam

4. Configure the pam modules for Squid
Create a new file with name squid in /etc/pam.d/ and populate with this entry.

$ sudo vi /etc/pam.d/squid

Add the below lines. This is the alteration i did from the previously mentioned  howto.

auth             required        pam_unix.so
account         required        pam_unix.so

5. Start the squid service

$ sudo /etc/init.d/squid start

The service should starts smoothly if you are using the same distro and packages that i used. Actually configuring squid is quite straightforward but maintaining and managing different distros with different styles and packages versions is the confusing part.