How to upgrade MongoDB on Ubuntu Linux

I have tried a few ways to upgrade, including removing the current install, and then using apt-get to install the newest version, but the Ubuntu repositories are sometimes out of date, and also a few things have gone wrong.

Here is the method I prefer which involves manually downloading, unzipping and then copying the new binaries over the existing ones:

1.  Go to your temp directory : cd /tmp

2. Download the latest package from the MongoDB website to /tmp : sudo wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.1.tgz

3. Unzip the package:  sudo tar -zxvf mongodb-linux-x86_64-2.4.1.tgz

4. Stop MongoDb – sudo service mongodb stop

5. Go to the folder where you just unzipped the files: cd /tmp/mongodb-linux-x86_64-2.4.1/bin

6. Copy the new files and overwrite the existing files: sudo cp -i * /usr/bin

7. Start the mongo service: sudo service mongodb start

8. Check that MongoDB is running and your MongoDB version : mongo

 

How to get a list of all recipients with email addresses from a particular domain

I wanted to find out which users had email address for a particular domain on an Exchange 2010 server. There were too many users and email domains to try and do this search via the console, so i found this query that will return the users that have an email address in the particular domain.

Type the following at the Exchange Management Shell:

get-recipient | where {$_.emailaddresses -match “domain.com”} | select name,emailaddresses

This will return the users that have an email address for that domain.

How to give send on behalf permissions to a Distribution Group in Exchange 2010

I wanted to be able to send on behalf of a distribution group that i had created, so I logged into the console and right clicked on the group like I would if it was a mailbox so that I could add the permission, but it wasn’t available.
You have to do it via the Exchange Management Shell instead.
Open up the Shell and type the following

Set-DistributionGroup yourdistibutiongrouphere -GrantSendOnBehalfTo theuserwhoneedspermissionhere

You can then send on behalf of the Distribution group.

How to enable virtualization on a Dell 780 to run Hyper-V

I had used Dell Optiplex 755′s in the past for a cheap virtual host, but I recently got access to some Dell 780′s for the same purpose. The 780 can take 16GB of RAM which is also very handy when you are creating virtual machines.

You do need to make some changes though so that the Hyper-V role will work in Windows 2008 and Windows 2008 R2.

Follow the steps below:

Boot the PC and press the F12 key to enter the Boot Options menu and choose System Setup

Move into the Virtualization Support menu:

Choose Virtualization  and make sure it is set to ON (the boxed ticked)

Choose VT for Direct I/O and make sure it is set to ON (the box is ticked)

Choose Trusted Execution and make sure it is set to OFF (the box is un-ticked)

Move to the Security menu:

Choose CPU XD Support and make sure it is set to ON (the box is ticked)

Click on Apply then click on Exit.

As soon as the screen goes blank, press the power button and turn the PC off. ( you have to power it off, not just restart for it to work)

Wait 10 seconds then turn it back on again and virtualization will now work!

FYI I am running version A14 of the BIOS

How to export a users mailbox in Exchange 2010 using Exchange Powershell

Before I delete users, I always backup their mailbox to a .pst file and archive it in case anybody ever needs access to an email.

It is very easy to do this in Exchange 2010 using the Exchange Powershell. You need to know the mailbox alias name which you can get from the Exchange Management Console and you will also need a share to export the .pst file to. I simply used the share on our archive server for this.

Type the following command to export a users mailbox:

new-mailboxexportrequest -mailbox <alias> -filepath \\SERVERNAME\SHARENAME\<alias>.pst

Replace <alias>  with the alias name of the mailbox.

 

How to add a new user and give them superuser permissions in Ubuntu Linux

I wanted to add a new user who could log into Webmin on a Ubuntu Linux server.

To create this new user type the following (replace username with the name of the new use that you choose):

sudo useradd username

To set a password type the following  (replace username with the name of the new use that you choose):

sudo passwd username

And finally, to give this user superadmin permissions, type the following  (replace username with the name of the new use that you choose):
sudo adduser username sudo

 

How to step down a MongoDB Primary member of a replica set

I wanted to change the size of the Primary MongoDB server I had running on EC2. To do this safely, you need to step down the primary, so that an election is held and a new primary is elected whilst you are stopping the server, changing the instance type and restarting it.

The first thing to do is to check the current status of the replica set.

Go to the current primary and type Mongo to load the mongo shell.

Then type rs.status()

Now you will have a list of the status of the replica set.

To step down the primary, type rs.stepDown(600)

The 600 is the amount of time in seconds (the default is 60 seconds) to allow this server to be a secondary, this will give you enough time to stop your instance, change the size, re-assign the elastic IP if required and then start the instance again.