Welcome to my blog!

 

September 2010
M T W T F S S
« Mar    
 12345
6789101112
13141516171819
20212223242526
27282930  

Archives

Flash 10 on Fedora 10 x86_64

How I setup Flash on my fresh Fedora 10 x86_64 install.

Close Firefox

Change to the Firefox plugins directory:
cd /usr/lib64/mozilla/plugins/

Download the Flash plugin:
wget http://download.macromedia.com/pub/labs/flashplayer10/libflashplayer-10.0.d20.7.linux-x86_64.so.tar.gz

Extract the plugin:
tar -xvzf libflashplayer-10.0.d20.7.linux-x86_64.so.tar.gz

Remove the .tar.gz as you now have the plugin extracted:
rm libflashplayer-10.0.d20.7.linux-x86_64.so.tar.gz

Open Firefox & you should be away!

Fedora 10!

Finally got around to upgrading to Fedora 10 this week.  I have an issue with downloading podcasts using Amarok, but other that that all is good.  Impressed.  Looking forward to playing with my new install further!

Delete mail from an exim mail queue

Here is a quick HowTo / TechTip for deleting all the mail from an exim mail queue!

After the issue I blogged about the other day, where a webserver was being used to generate spam, we were left with a lot of spam email in the servers mail queue awaiting delivery.

Amongst other things, this was then causing a performance hit on the server sending messages. I decided that the few real emails in the queue were on no importance and to just delete the whole lot.

Chances are as a sysadmin, its a job you may have to do at some point. This is how I cleaned out the exim queue on the webserver and then the one on the outbound mail server.

First off, take a look at your queue:

[user@www user]# exim -bp
As the mail is spam we want to delete it, not empty the queue via SMTP as all the spam will sent to people and our server may be blacklisted.

Delete all the mail in the queue run:

[user@www user]# exim -bpru | awk {‘print $3′}
| xargs exim -Mrm > deletedmail.txt
We can now check how many mails were removed by running:

[user@www user]# wc -l deletedmail.txt
13416 deletedmail.txt
[user@www user]#
We have now deleted all 13416 mails in the queue and the server is as good as new. (Remember to fix the loop hole first, if you don’t you will soon have alot of spam in the queue again!)

The deletedmail.txt file will look something like this:

Message 1K3FYb-0000wH-CF has been removed
Message 1K3FYb-0000wH-6l has been removed
Message 1K3FYb-0000wH-3r has been removed
Message 1K3FYb-0000wH-1d has been removed
On the mail server, we want to remove all mail from the webserver only. To do this we modify the command line to grep for the sending address.

[user@mail user]# exim -bpru | grep “” |
awk {‘print $3′} | xargs exim -Mrm > deletedmail.txt
[user@mail user]# wc -l deletedmail.txt
73012 deletedmail.txt
[user@mail user]#
So we have now removed 73012 mails from the mail servers queue. This means in my example here, we have saved the internet from 86428 spam emails.

A few other useful exim queue commands include:

# exim -q # Flush waiting mail
# exim -qf # Flush all mail
# exim -qff # Flush even frozen mail
To remove frozen mail from the local spool, try this…

# exim -bpru | grep “*** frozen ***” | awk {‘print $3′} |
xargs exim -Mrm > deletedmail-frozen.txt

How to clone a VMware Server virtual machine

Here is a quick guide on how to clone a VMware Server Virtual Machine and bring it up as a new VM in its own right. This allows you to build one base line image and then produce several separate servers from it, or for example, to clone a production VM to test installing a software upgrade on it.

1. First off, you need to have built your source server
2. Now ensure it is shut down & VMware Server shows it as powered off.
3. Next copy the VM’s folder to a new folder eg: copy c:\Virtual_Machines\CentOS_5.1\ to c:\Virtual_Machines\devel-server\
4. Now we need to rename the VMware config file, change into your new VM’s directory and rename the .vmx file. eg: from centos.vmx to devel-server.vmx
5. You now need to change the name of the VM in the config file. Open the .vmx file in a text editor and edit the display name line as required. Ensure this does not clash with any of your other VMs.
eg: form this: displayName = “centos” to this: displayName = “devel-server”
6. You can also rename the disks if you need to, you will also need to change the disk names in the config file. However, I normally setup the disks myself when i create the machine as disk1 disk2 etc and when I clone the server all its disks are duplicated in the new folder, that way i don’t need to rename them and they are completely seperate servers. Nice and clean way of doing things. If your unsure leave your disk files and their entires in your config file alone.
7. Now open VMware Server Console, and connect to your server
8. Then click on File, Open, Browse and locate your new VMX config file in your new VM’s folder.
9. Now you should be able to power up your new VM.
10. You will now need to tell it to create a new UUID when asked

This also works on linux but your server VM path will be more like: /var/lib/vmware/Virtual Machines

Other things to think about, the hostname of your server, and its IP address. These are the two issues people have once they have cloned a server, if its DHCP, your ok, if its static, boot only one at a time.

The first time you boot your new system (The clone) set its hostname and IP configuration.

Stay tuned for my next post: Delete mail, exim mail queue

VMware Server, on a Laptop

This week I needed to do some testing on two different server setups and did not have any spare boxes handy. I have found in the past that i have spent a lot of time getting hardware together, plugging it in and finding install CD’s.

I set about trying an easier way of testing, and having a good spec laptop which I use day to day, I decided to install VMware Server on it. Then I created a Virtual Machine and installed a clean CentOS 5.1 build on it.

I needed two systems for my testing so decided to keep this install as my “template” or “clean base” and clone it. I would then have “clean”, “server1″ and “server2″. When I finished my testing I could delete the two server VM’s and would be ready to start again next time.

It worked great and I would highly recommend it. (Plus its Free!)

Stay tuned for my next post on: How to clone a VMware Server virtual machine!

HTML Redirector Page Code

This code can be used as a HTML Redirector when a page or website has moved.

  1. <meta http-equiv=”Content-Language” content=”en-gb”>
  2. <title>http://www.YOUR-NEW-SITE.co.uk</title>
  3. </head>
  4. <p>This page has moved to: <a href=”http://www.YOUR-NEW-SITE.co.uk” >http://www.YOUR-NEW-SITE.co.uk</a></p>
  5. <p> </p>
  6. <p>Please update your records, you will now be redirected…</p>
  7. <meta HTTP-EQUIV=”REFRESH” CONTENT=”5;URL=http://www.YOUR-NEW-SITE.co.uk”>
  8. </body>
  9. </html>

Squid Proxy Tip

Do you run a squid proxy? I do, and have been restarting squid to apply config changes for ages. Turns out that you can just run “service squid reload”, users have no down time and your config changes get applied. Great. Wish I had thought to check that before now….. :-)

(This works on RHEL/CentOS, but any install of squid is capable of this via one command or another)

Exim on CentOS

This is my quick guide to do an install and basic setup of exim on CentOS. This is not meant as a fully inclusive guide but it will get you on the way. Following this you should get a working exim install.

I will assume you have built a CentOS 4 / 5 Server, have yum working and have logged in as root.

You may want to make sure your up to date…
yum update

Install exim and mail switching tools
yum install exim
yum install system-switch-mail

Switch your MTA & set exim to start on boot
system-switch-mail
service sendmail stop
service exim start
chkconfig exim on
chkconfig sendmail off

Add a root alias, eg: “root: me@example.com”
vi /etc/aliases

You may also wish to add some config to your routers section like this, if you want to relay through a smart host.
vi /etc/exim/exim.conf

Then add this before the “dnslookup:” section.

to_smart_host:
driver = manualroute
domains = ! +local_domains
transport = remote_smtp
route_list = “* mail1.example.com:mail2.example.com;”

Restart exim
service exim restart

To test, send an email
echo “test” |mail -s “$HOSTNAME” me@example.com

Then you can flush the Exim Que and watch the log like this
exim -qff ; tail -f /var/log/exim/main.log

Good luck!

IE8, Standards Mode

IE8 (Due out later this year), will render in “Standards Mode” by default.

Web developers of pages that work nicely in IE7 and nothing else can request IE8 to use IE7’s mode via the “http header/meta tag approach”. Hopefully this move will enable much better cross browser and developers of troubled sites will invest the time in becoming standards compliment.

A big thank you to the IE team for doing the right thing for the future of the Web.

More Info:

Firefox Add-ons

I like to browse with Firefox from both Windows & Linux, and find a number of plugins useful. I have just installed these on my freshly reloaded laptop and that reminded me to share them with you all.

  • British English Dictionary – Allows spell checking of forms and text fields
  • IE Tab – Windows only but good for viewing sites that rely on IE’s rendering engine (EG: OWA)
  • SwitchProxy Tool – Great for testing Proxy Servers
  • HTML Validator – Useful for checking web code
  • Firebug – Edit, debug, and monitor CSS, HTML, and JavaScript live in any web page
  • FaviconizeTab – Allows you to reduce tab to favicon size, ideal for email etc

Updated: 2009-02-17 to include Firebug
Updated: 2009-08-25 to include FaviconizeTab