(mt) MediaTemple migrated my Server and broke my LEMP stack. (Part 2)

If you’re joining me from part 1thank you. If you are just joining you may want to check out part 1.

    When I last left you I had just installed MySql and setup a root user with a strong password. Now I need to get all the domain web files and MySql Databases to my new server,  perserving permissions and ownership, hopefully. Before I accomplish any of this I need to create users and all their directories that hold the public web files for each domain. I am then going to create all the same databases and import all the database dumps. Lastly, I want to start Nginx and test all my old configuration files before activating them all.

I created new users first using useradd.

$useradd jabo

I then rsync’d each users files one at a time to try and preserve permissions. Notice I said “try” I later had to chmod each users web directory so they could have the correct ownership. The more advanced Linux users will know why, the UID # of each user didn’t match the UID on the old server but that is another post. So Rsync is awesome. I mirrored all my web files and sent them via ssh to my new server. In verbose mode of course.

$ rsync -r -a -v -e "ssh -l root" --delete /old/Server/path/ newserver.net:/webroot/path/

MySql is not my favorite from the command line but since this is a new server and I was in a rush I didn’t have time to install and setup PHPAdmin. Now this did not work for me as root. I had to make a dump using each database users username and password. That also meant I had to go rooting around in some of my users WordPress installs. not to tough.

$ /usr/bin/mysqldump -u root -p --opt >/web/root/alldatabases.sql

After a quick rsync of all the database files. I logged into MySQL from the command prompt then created new databases with the same passwords and usernames. Lastly, I restored each database with their respective user.

$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 162
Server version: 5.1.41-3ubuntu12.6 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database testdb;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on testdb.* to 'dbuser1' identified by 'db_user_pw';
Query OK, 0 rows affected (0.00 sec)
mysql> quit

Restore each database with the appropriate username and password.

$/bin/mysql -u username -ppassword databasename < /tmp/databasename.sql

With all that said and done I was finally ready to test if this all worked. I checked my Ngnix configuration files visually to make sure they made sense. I almost rubber ducked them but it was 3 am at the time, so the prospect of my girlfriend waking up to me talking to myself in front of a dim lit monitor was not appealing. I ran Nginx with the -t option and everything worked out. I then started Nginx and BEHOLD I have CONQUERED!

Now it didn’t work all gravy right out of the box. I was spawning like 100 PHP processes and my VPS Memory was zooming! With some help from Google and the Nginx Wiki I was able to trim Nginx to pre-migration levels. I still have lots of tweaking to do to make it run leaner and allowing MySQL to run for a few weeks before I tune. After all that I still stayed with MediaTemple. I really didn’t want to go through all that again with another hosts control panel I am not familiar with or worse C-panel.


Funny thing but two weeks later Media Temple decided to migrate the “new” VPS they gave me. Luckily, I got some attention from support, the next migration went well, and had no issues this time around. I know now what went wrong and I know how to prevent it in the future.

(mt) MediaTemple migrated my Server and broke my LEMP stack. (Part 1)


First I have to  start by saying this is mostly my fault. (mt) MediaTemple has been good to me. They even emailed me to tell me that they where going to migrate my server to newer hardware. I should have taken the time to do it myself, but I am lazy. They also sent me an email telling me I had to do nothing. Luckily, support is very understanding and they lent me a free (VE) for 30 days to configure and migrate my configuration myself.


The Nitty Gritty

 After (mt) MediaTemple migrated my server I found all the web roots for the domains I managed changed. Blogs and php files would not load able to load properly. I also discovered that Apache was installed and Nginx was not started, although installed. I did try stopping Apache but there were still so many things going wrong I decided to start fresh. Plus it would give me a chance to upgrade my LEMP Stack to a more current version. I had two failed tries, the caveat being you had to load the stack in order. Installing Mysql before Nginx causes apt-get to install Apache. Before starting I had to secure my server by changing the /tmp directory and updating my root password. You should consider securing your server further.

I choose to break this up into two post because it would have been very long. Not to mention I took a nap in between.

Here were my steps:

    1. Install an OS. I chose Ubuntu 11.04 Natty Narwhal.
      1. I ran into an issue were I received an error updating
        1. perl: warning: Please check that your locale settings ubuntu
          1. perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = “en_US.UTF-8″, LC_ALL = “en_US.UTF-8″, LANG = “en_US.UTF-8″ are supported and installed on your system. perl: warning: Falling back to the standard locale (“C”). locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory
      2. I had to install the English base language pack
        1. apt-get install language-pack-en-base
        2. export LANGUAGE=en_US.UTF-8
      3. Then I had to change to the version of English I was using.
        1. export LANGUAGE=en_US.UTF-8
          export LANG=en_US.UTF-8
          export LC_ALL=en_US.UTF-8
          locale-gen en_US.UTF-8
          dpkg-reconfigure locales
    2. Install Nginx
      1.  apt-get install nginx
    3. Install PHP
      1. You can just install the php5-fpm package, but I am going to do some other stuff later, so I installed more packages.
        1. apt-get install php5-fpm php5-cli php5-common php5-curl php5-gd \
            php5-mcrypt php5-mysql php5-pgsql php5-sqlite php5-tidy php5-xmlrpc \
            php5-xsl php5-intl php5-imagick php5-xdebug php-apc php-pear
        2. Default is fine for now, but my default config caused my server to spawn 50 processes and consume 80% of my memory. I had to tweak it but that will be a different Blog post.
    4. Install MYSQL
      1. apt-get install mysql-server mysql-client
      2. You are required to setup a root password. Choose something Strong.
    5. I then created all my users for managing the multiple domains I have hosted.
      1. adduser myuser
        1. I gave them all the same passwords
        2. Then set sudo privileges
          1. visudo
            1. # User privilege specification
              root      ALL=(ALL) ALL
              users     ALL=(ALL) ALL

I then took a nap because I still had to rsync all the Data from my old/newly migrated server. Like I said I failed the first couple times, Nginx wouldn’t bind one time and PHP wouldn’t load another. The server has to be reset to default, that takes time. Then the OS takes time to reinstall. Factor in having to accomplish this after I got off work that evening, I was pretty exhausted. I also have to mention that it took almost all day for the new (VE) Server to be provisioned when support said it would only take 15 minutes. Please check in for Part 2.

Moving your email to Google Apps

Working in I.T. for many years the biggest energy among all users is email. From my desktop support background I can assure you that I have had my share of email problems and solutions. My favorite email solution has to be Google Apps. Google Apps is a step just above your normal Gmail email. Both are free, but Apps allows you to use a domain name that you own or gives you the option to purchase one during setup for $10 a year. Included with Google Apps is Gmail, Google Calendar, Google Docs, Google Sites, and much much more… I will go into more detail about the other services Google apps has to offer in later posts. Right now we’ll just be concerned with the initial setup of your domain and email.

You can sign up for Google Apps using the domain or website you already own, or purchase a new domain from one of Googles registration partners.

Lets get started?

  1. Go to Google Apps (for free) and click the big blue button to begin. If you are purchasing a domain you must first setup a Google Apps free account, even if you are trying to setup a Google Business Account. Google makes you get a free Apps account then you can upgrade to a free trial for Google Business. Google Business is also a great pay for service that allows you to use Outlook exchange services. $5 a year per user.
  2. Follow the instructions that appear to sign up your domain and create your Google Apps account, it is very self explanatory. The instructions are easy to follow, but there are a few things:
    • If you are setting up your own domain, you have to prove to Google that you own the domain or website. This requires that you have access to any one of the following: the domain’s or website’s DNS records (managed by your domain host or registrar), the server that hosts your domain’s web site (via FTP or SSH), or a Google Analytics account for your domain. For more details Verifying your Domain.
    • Next you need to create an email address at your domain where you’ll send and receive mail (webmaster@your_domain.com). You are going to use this email and password to log in to your Google Apps account and manage the domain to add users, as well as access your own Google Apps services.
    • You have to provide an alternate email address that’s not in your Google Apps domain. I used a gmail address that you can easily setup fro free. This is incase you forget you password  and Google needs to send you new login credentials. This should continue to be a valid address.

After you sign up, we’ll take you to your Google Apps administrator control panel. Now you can log in to your new account, verify domain ownership (if you signed up an existing domain), and continue setting up services for your users. click on the Setup link in the navigation bar and you can use the setup wizard to add users and services.

If you’d like to see more details after that, please leave a comment, and I will consider updating this post with more detailed steps.


Grease Monkey

I am a Grease Monkey. No, not the Firefox Extension. The car enthusiast, although my closer friends would say I’m more of a ape than monkey. Recently I have been having issues with the radiator in my car. At first I thought it may have been a leaky hose, eventually, the radiator developed a small pin hole that grew very large. Enough to spray steam out the top of the hood. That is how I found myself last Friday afternoon.

I am the type that likes to do things for themselves the D.Y.I guy. The idea of giving my car to a complete stranger to repair and then not walk me through step by step how they accomplished the repair, just freaks me out. I’m not questioning any reputable car mechanics competence, however, when the bill comes it makes me question my own sanity.

I don’t blame shop owners too much. They have to make a living in this economy. Lets say you get a repair for a late model car, say a Chevrolet Camaro, 1988 to be exact. The shop owner has to have a 20% mark-up on the part he bought from his distributor, shipping/handling or maybe a stocking fee. Then he has to pay his employee hourly to repair your vehicle and make it profitable for himself to repair your vehicle. In a nice world we’ll say your pay $45/ hour in labor. I could have easily paid 12 hours in labor and $250 in parts (this is a very lean estimate by the way). In the end I may have paid almost $800. Well I paid much less doing it myself and I know that it is fixed. Here is how I did it.

First, you have to assemble all your parts. This usually takes me about a week, but in this case a day was all it took. Sometimes you don’t know you need a part till you start to take things apart. I found after I took off the OEM cooling fan that it had melted from the heat from the radiator not cooling correctly when it blew. Second, you have to make sure you have the right tools. Trial and Erro, have taught me that so many trips to the store for the right tool really draws out the time of a repair. The most important is harm to your vehicle or yourself, when trying to use the wrong tool.  Once you have these two things in place it’s time to get started.

Click to Watch Video of the Radiator hissing.

Picture of Radiator with cooling fan removed.

Cooling Fan removed. Ready for the radiator.

To get started I had to make sure my cars engine was cool enough to work on by leaving it set overnight in the spot I intend to work. Anytime I work on my car I disconnect the negative battery cable. This does two things, prevents me from electrocuting myself and worse the car accidentally starting while i’m tucked in the space between the main pulley belt and the radiator. It might rip my face and arms off. Safety should always be first, use blocks behind your wheels, wear protective eyewear, and gloves.

Now that the car is cool I drain all the fluids. While they drain I loosen all the clamps on the radiator/heater hoses, the transmission cooler line, and oil cooler. The oil/transmission lines where metal and needed lubrication before they would budge. Once all the fluid is drained, I do one at a time to catch any residual water, especially the lower radiator hose. Then I removed the cooling fan. This was not easy and also the same time I find out that the fan had melted. The wire connector included, promoting me to cut out the fan. Below is the fan itself, notice the melted-warped plastic.

(Click the images to see them full size.)


A picture of the

The fan wouldn't turn any more. I wonder why?

Now I am ready to remove the radiator. This was the easiest part of the job. Slid right out no problems. There was some residual water left in the bottom, I just poured it off into my bucket.

Picture of Radiator from my car.

Old Radiator. Guess where the leak was?

Once the radiator was installed I connected the hoses, transmission, and oil cooler lines. I also had to replace the heater hose. the previous owner had bypassed the heater and instead of using one piece of hose, they jointed two pieces with a union. Needles to say, most likely the cause of this whole predicament since the last owner. In my defense it was on my list of things to fix and I had stock piled most of the parts not expecting the radiator to blow through. Next I fitted on the replacement cooling fan. I recommend finding an original replacement. The aftermarket cooling fans you find are more universal than replacement fans. Their is some “customizing” I completed to get the fan mounted and secure enough for it to be safe. Finally, I filled it with Radiator Fluid. Always buy one more than you think. I did this time and good thing because that extra one came in handy.


Picture of My Radiator and Cooling Fan removed.

I keep singing Johnny Cash's "One piece at a Time"

The last thing to do was connect the negative battery cable. I then started the car and let it run for about 15 minutes and shut it off. I topped it off with more fluid to bring it to the top and made sure the over-flow reservoir was at the correct level. then I just let it run. Went on some errands and sat outside with the car for a good 2 hours. I wanted to make sure the fan didn’t come lose or I had a leak some where, once it cooled I checked the levels again and that was it.

Picture of my New Radiator

Finished product. Notice the celebration on the right?

Please leave a comment and share this on your favorite social network below. The Finished Product.

Updated CV

I have updated my Resume and CV. If you haven’t checked it out in awhile or ever please Click Here.

I have a new Blog post in the works about setting up your own domain to use Google Email and setting up Google Apps. Stay tuned.

Here is a video I am using to test the Youtube plugin Smart YouTube.



Return top