Michael Henley

September 30, 2009

Updating MovableType to send email via sendmail on NFS

Filed under: blogging,general tech,internet — michael @ 11:07 am

When initially setting up MovableType on my NearlyFreeSpeech-hosted site, I couldn’t find a way to get around the need for Authentication with Google Apps for email. Commenter Kevin Doyon informed me how to make this work, but as I had already finished the MT set up wizard I had to make the changes manually. I must begin by saying that I am no expert at this and am learning as I go. This is what has worked for me and might not work for you. You undertake this at your own risk, and as with any changes I advise you to make backups of everything before you start making changes.

Using your favourite FTP client (Transmit in my case), connect to the site for your MT installation. Navigate to /public/cgi-bin/mt, and find the mt-config.cgi file. Make a copy and rename it something like mt-config-old.cgi, and then open up mt-config.cgi in a text editor. At the bottom, add the following lines:

#========== EMAIL SETTINGS ===========

MailTransfer sendmail
SendMailPath /usr/bin/sendmail

Save the file back to the server, and then open up your web browser and navigate to http://domainname/cgi-bin/mt.cgi to access your installation’s control panel.

Select ‘System Overview’, and then settings:

From here you will immediately see the General Settings pane where we need to make changes. In the ‘System Email’ box, enter the email address you want to be displayed in the From: line of any emails sent by MovableType and click Save Changes.

Once it refreshes, enter an email address you have access to into the Send Email To: field and send the test. If all goes well then you will see a test email arrive in your account sent from MovableType, and the dashboard will report success:

That is it. Your MovableType installation will now be able to send emails as and when you have configured it to.

September 7, 2009

Using Google Analytics with MovableType 4.31

Filed under: blogging,general tech,internet — michael @ 10:39 pm

This is based heavily on Daniel Sirz’s useful piece for using Analytics with MT which can be found here. I found that it was missing one or two little bits which had me scratching my head for a while and so have rewritten it for the most current version of MT. This will include the Analytics code into the header template, so that it is included in every page of the blog.

Ensure that you are managing the blog, and not the global MT install. From the Dashboard, navigate to the Templates section:

Scroll down to the Template Modules section, and select Create Template Module:

Copy your Analytics tracking code from their website, and then create a new module called ‘Google Analytics’:

Save your changes, and then navigate back to the templates by clicking ‘List all templates’

Click the HTML Head Template to edit it:

Click the line below the last one currently present, and enter:

<$mt:Include module="Google Analytics"$>

Once you save, you should see this:

Head back to the main screen by again clicking ‘List all templates’. The final step is to rebuild your blog to include the new code. To do this, click the ‘Publish Blog’ button in the cross bar:

Tell it to Publish all files, and then wait while it rebuilds. When it is done you will see a box telling you that it is complete and how long it has taken. If you now go to any page on your blog and check its source, you will see that the analytics code is being included in the header and so will report back the stats.


Installing MovableType on NearlyFreeSpeech Part 2: Set-Up and Config

Filed under: Uncategorized,blogging,general tech,internet — michael @ 9:24 pm

This guide continues from a previous post which can be found here, which details the steps required to download, arrange, and set the permissions required to install MovableType onto a NFS-hosted site. The same disclaimers as posted there apply to this post.

In a web browser navigate to http://domainname/cgi-bin/mt/mt.cgi , where domainname is the domain name of your blog.

Here you will be presented with a box where you will configure the static path of the MT installation:

As with the page URL, replace domainname with the domain name of your blog, then click ‘Begin’.

If everything is as it should be you should see the following screen:

Continue to the Database config page.

Here, select MySQL Database:

Once you have selected the Database type, the window will expand to give you more options. At this point we must set a few things up on the NearlyFreeSpeech end. Don’t navigate away from the MT set up page, but in a new tab log into your NFS member area, and then click the ‘mysql’ tab. If you already have a MySQL process set up then we can just use that. If you do not, then click ‘Create a new MySQL Process’ and follow the on screen instructions.

Once created, click ‘open phpMyAdmin’ and log in with the details emailed to you by NFS when you created the process.

I like to create a new user for each database I create. This helps to keep it more secure. From the main page, click the Priviledges tab:

Then click ‘Create a New User’, and you will be presented with the new user window:

I am going to give my MT installation the username ‘moveabletype’ and have generated a secure password for it. Take note of the username and password you create as you will need to enter these into MovableType later. Select the ‘Create Database with same name’ radio button below the user credentials, and then click ‘Go’ at the bottom right. The page should refresh showing you a colourful box at the top informing you that the new user has been created. If you were to go into the databases tab of  phpMyAdmin you should also see that a new database has been created called, in my case, ‘moveabletype’. You can now log out of phpMyAdmin and head back to the MovableType installation page.

Once you clicked MySQL Database some new options will have appeared. You must fill them in as follows:

For Database Server, you must enter the process name you created at NFS. If you did not take note of this, it can be found on your NFS mysql page, and is listed as DSN. Fill in the other fields with the info you entered in phpMyAdmin when you created the new user and database. The click ‘Test Connection’. If everything goes as planned you should see the following window:

After clicking Continue, you are presented with the Mail configuration page. At this time I have not figured out how to make this work with Google Apps where I host my email on michaelhenley.co.uk, and so have chosen to skip this step simply by clicking continue. My issue is that Google Apps requires me to authenticate before they will pass on email, but the MT installation does not present me with a way to enter user details. I will update with a plugin later if I find one to make it work.

Simply clicking Continue allows you to skip this step.

[Update]: Thanks to commenter Kevin Doyon for informing me on how to make this work. Select the option to send email via sendmail, and set the path to

/usr/bin/sendmail

The test email will now send correctly even from a GoogleApps Address. If, like me, you had already skipped over this step then follow the instructions here to configure sendmail from outside the wizard.

If you have done everything correctly your MovableType installation should now be set up and you will be presented with the following window:

Once you click Continue you must set up a user for yourself:

Click Continue, and then enter your blog title, and change the paths so they point to the ‘blog’ directory:

Once you click ‘Finish install’ you will see the system initialise the database, and then you will see the Installation Complete! Screen:

Congratulations! You have now successfully installed MovableType onto your NFS-hosted site. I hope these two guides have been useful.

A few credits:

I have put this guide together based on information found at the following sites:

  1. http://blog.nearlyfreespeech.net/2007/01/28/writing-files-in-php/
  2. http://wiki.movabletype.org/Main_Page
  3. http://www.movabletype.org/documentation/installation/quick-start.html

Installing MovableType on NearlyFreeSpeech Part 1: Downloading and Permissions

Filed under: blogging,general tech,internet — michael @ 9:19 pm

I host this blog and the rest of the michaelhenley.co.uk domain on NearlyFreeSpeech and have yet to have a problem with them. However, while in California @alexmuller and @zethraeus were trying to set up the back end for MiscellanousGeekery, the tech blog which they are running, and at first decided to try to use MovableType instead of WordPress. After they spent a day getting nowhere at it they decided to go with WordPress instead and that was that. I had attempted to offer a helping hand while there, but being completely unfamiliar with MovableType and no sort of expert at configuring these things anyway I was about as much use as a chocolate teapot. This afternoon however, resolving not to be beaten by a piece of CMS Software, I decided to have a bash at it myself and see if I could make it work. After a few hours poking, proding, shouting and screaming, I finally managed to make it work.

Below is a step-by-step guide to how I made it install and run. I must preface this with saying that I am no sort of expert, nor do I claim to be. This is simply how it has worked for me and how it will hopefully work for you. Some things to note:

  1. I use a Mac and as such my main tools for interfacing with NFS are terminal SSH and Transmit. I will keep Transmit to a minimum to try to make this as universal as possible.
  2. The only configuring I will do is to install the blog.
  3. I found things a lot harder to approach than WordPress. While this is not surprising as WordPress is a little more dumbed down, this guide is the product of much Googling and I owe pretty much all of this to various guides, manuals, wikis and blogs. I will try to give credit where I can
  4. I am trying to make this as comprehensive as possible. Skip over any explanation you don’t need.
  5. Only enter commands in black. I am including the prompt in grey for clarity. The idea is that before you hit return to execute the command you should see exactly what is written on each line of the guide.
  6. This shouldn’t break anything, but if it does, please don’t sue me :) You are undertaking this at your own risk.

In your NearlyFreeSpeech control panel, create the site where you are going to install MovableType, and take note of the credentials you will require to connect to this site over SSH. If you are simply adding to an existing site then ignore this step.

Head over to movabletype.org and copy the URL to the latest distribution of MT (4.31 at time of writing). Open up the terminal and SSH into your site, and enter your NFS password when prompted:

ssh nfsusername_sitename@ssh.phx.nearlyfreespeech.net

You should then be presented with a prompt similar to this:

[sitename /home/public]$

From here you can download MT directly to the site using wget. Replace the URL with that obtained from the MT website for the latest release:

[sitename /home/public]$ wget http://www.movabletype.org/downloads/stable/MTOS-4.31-en.zip

You can follow the progress of the download on screen, and after a short while it will have downloaded. Next unzip it:

[sitename /home/public]$ unzip MTOS-4.31-en.zip

Once this is completed, if you enter the ls command at the prompt you should see that the public folder contains one file and one folder. The file is MTOS-4.31.en.zip, and the folder is simply MTOS-4.31-en. The folder contains the unzipped contents of file downloaded from MovableType.

Create a folder in public called cgi-bin, and then a folder called mt inside of it:

[sitename /home/public]$ mkdir cgi-bin

[sitename /home/public]$ cd cgi-bin

[sitename /home/public/cgi-bin]$ mkdir mt

[sitename /home/public/cgi-bin]$ cd ..

The contents of the MT download have to be split between the cgi-bin/mt folder and the public folder. At the prompt enter the following:

[sitename /home/public]$ cd MTOS-4.31-en

[sitename /home/public/MTOS-4.31-en]$ cp -rf mt-static ../

[sitename /home/public/MTOS-4.31-en]$ rm -r mt-static

[sitename /home/public/MTOS-4.31-en]$ cd ..

[sitename /home/public]$ cp -rf MTOS-4.31-en/* cgi-bin/mt

[sitename /home/public]$ rm -r MTO*

To summarise, these commands have copied the mt-static folder into the public directory of this site, and have copied the rest of the contents into the mt directory we created inside of cgi-bin. The final command is simply housekeeping to remove the downloaded zip file and the folder to which its contents were extracted.

One of the differences between MT and WordPress is that it requires the server to have the ability to write to certain folders. NearlyFreeSpeech limits how this can happen and so the permissions for the folders and files to be written must show the group as ‘web’ and allow the group to write. It also requires the blog to have its own subdirectory within the domain. I am going to assume that this directory will be ‘blog’, but if it is not then simply substitute ‘blog’ for your chosen name in any commands. Finally the world must also be able to execute files within cgi-bin/mt.

[sitename /home/public]$ mkdir blog

[sitename /home/public]$ chmod -R 775 blog

[sitename /home/public]$ chgrp -R web blog

[sitename /home/public]$ cd mt-static

[sitename /home/public/mt-static]$ chmod -R 775 support

[sitename /home/public/mt-static]$ chgrp -R web support

[sitename /home/public/mt-static]$ cd ..

[sitename /home/public]$ cd cgi-bin

[sitename /home/public/cgi-bin]$ chmod -R 775 mt

[sitename /home/public/cgi-bin]$ chgrp -R web mt

[sitename /home/public/cgi-bin]$ cd ..

At this point we should have completed pretty much everything which needs to be done in the terminal and via SSH. To disconnect from the server simply enter

[sitename /home/public]$ exit

This completes part 1. In the next part I will walk through how to configure your MovableType installation and set up MySQL database which it will use through phpMyAdmin. This can be found here.

August 30, 2007

Back to school!

Filed under: blogging,school — michael @ 10:57 pm

Well I went back to school today – I honestly have no idea where 8 weeks went but still, here we are. Odds are I will find some mildly interesting things to post about during the coming term, though thanks to work etc. the frequency of these may be a little… diminished. Regardless I hope I can keep them as entertaining as they have been (Ed. entertaining?)

August 27, 2007

First Post

Filed under: blogging — michael @ 12:35 pm

First post here… If you are reading it then you are already almost as insane as I am for writing it! Whether this will be entertaining, bemusing, or just plain dull I have no idea, but bear with me and we shall see where it goes….

Powered by WordPress