Skip to content

Instantly share code, notes, and snippets.

@cballenar
Last active August 29, 2015 14:26
Show Gist options
  • Save cballenar/4c828fb0590e4e39052e to your computer and use it in GitHub Desktop.
Save cballenar/4c828fb0590e4e39052e to your computer and use it in GitHub Desktop.
Walkthrough for setting up MediaTemple's self managed server with VirtualMin and getting your websites running.

Setting up MediaTemple Self Managed VPS

I recently moved from MediaTemple's Legacy (dv) 4.0 VPS server to their new Self Managed DV server. You get to save up some money at the expense of all the software that comes pre installed on a server. All you get when you rent one of these badboys is an empty box with your choice of OS. Sounds exciting!? You bet your ass it does! It can also be a bitch if you're not as familiar with how things work in a web server. Getting this setup helped me understand servers unlike never before and having full control over everything that happens in your box does feel kinda nice.

Installing VirtualMin

The best free application I found for managing websites is Webmin + VirtualMin. Though I would like to mention Ajenti, which looks pretty badass and seems to be in active development.

I come from Plesk which was definitely a superior tool but so far I envy nothing, there are times when I actually understand VirtualMin better. Much like Plesk, VirtualMin will allow you to create "Virtual Hosts" although they call them "Virtual Servers" and you can allow each of these servers to have sub-servers. This means that you can give a client their own account and capabilities to add more websites.

Install it

Follow the instructions in their website

Disable bloatware (?)

This step is entirely optional and will depend on the needs of your users. In my case there were a lot of things that I wasn't planning to use including email and DNS management so I just went ahead and disabled those from the System Settings > Features & Plugins menu.

Configure Account Plans and Server templates

Spend some time getting to know the options available for your virtual servers and accounts. In my case I created an admin template and account which has less restrictions than the rest. Likewise a Reseller and Client template is recommended.

Select Proper Shell and Customize

If you intend to do a lot of SSH'ing be sure to

  • Select /bin/bash from the System Customization > Custom Shells menu
  • Customize bash for all users in /etc/skel/ to look better

Creating a Virtual Server and User

The more you know...

  • When you create a new virtual server, you're creating an account in your system that can create sub-servers to manage subdomains or even other websites.
  • This virtual server will have an administrator account and group associated with it, i.e.: user:user. This is NOT an administrator to your server, in fact, it's limited to its own home directory, i.e.: /home/user/.
  • Once created the new virtual server, you can create additional users that will have access to the files in it.
  • Note that the Apache, www-data, user, will be added to the group that manages this directory, this is helpful when dealing with applications that require Apache to write inside to these documents.

How to Create a new Virtual Server and User

To create a new User and Virtual server, you just need to go to the Create Virtual Server menu.

Don't be afraid to crash

You might have to experiment a little before you're able to fully grasp how VirtualMin works. I had to reset my server back to zero and start all over again the first time I installed it. So don't be afraid to do it yourself. Remember that you're building the foundations for your server.

Migrating your websites

This is a general roadmap that MediaTemple offers. They have all the details for each step in their original post. However it does not apply to VirtualMin. So let's look at it next.

  1. Lower the TTL for the domain(s) you will be migrating. (Seriously!)
  2. Set up the new server.
  3. Back up all website content, databases, and emails from your current host.
  4. Upload files and import your databases to your new hosting service at (mt) and re-create any email accounts.
  5. Update database connection strings and system paths to match the environment.
  6. Test the site using your IP address.
  7. Rekey certificates. If you're in GoDaddy use their guide
  8. Change DNS settings.
  9. Double-check migration accuracy, cancel old service.

Managing Websites in VirtualMin

  • VirtualMin keeps website documents inside the public_html/ directory by default. This can be changed in the settings.
  • Subdomains and Subservers will be placed inside the domains/ directory. This will contain a folder with the name of the subdomain or server, e.g.: sub.mysite.com/, myclone.com/, dev.myclone.com/. And their structure of each will reflect that of the primary server.
  • In order to upload your files you can connect to your server via FTP, SFTP, or SSH.
  • For maging databases you can do so from the shell, OR you can enable PHPMyAdmin from VirtualMin.

Craft CMS Users

  • You'll need to install cURL, ImageMagick, and mCrypt. I did this from the shell.
  • Don't forget your permissions

Securing your server

As you can imagine, securing your server will be one of the most important tasks you'll need to perform. coming soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment