An Ubuntu 10.4 LTS server on Openhosting

I'm in the process of upgrading my server for fun and for profit, as they say. I was on an ancient Fedora 4 system and finally I reached a point where I couldn't upgrade some of my software to work on the system at all without compiling a bunch of other requirements by hand, too. I've been with Open Hosting for a long time now. For years now, they've had a cloud service that fits my needs in pretty much the same way as their old VPS servers did, only with new and improved cloudiness. I've never been too convinced that I needed to move, but now I guess I'm gonna. Sooooo... here I go, into the jaws of the abyss.

I created one of their 5 day free trials to give myself the opportunity to move everything over without double paying for server space. They normally have the ftp and ssh ports closed on free trials so that people won't abuse the service or get all nefarious on them. I sent support an email and they were kind enough to open it all up for me so that I could ftp all my data across as well as ssh into the system instead of using VNC for all my server-connection needs. With that taken care of, I followed their advice and chose the Ubuntu 10.4 LTS pre-installed image. It makes perfect sense, since I run Mint (a fork off Ubuntu) as the main OS on my laptop.

Ubuntu Server does not come with pretty X-Windows or, really, anything but the very core operating system. You need to install everything you want piece by piece. You also need to lock the system down so that it is more secure. Here are the steps I took:

Get Started

When you get started, you will be connecting to your server with a VNC client. Follow the directions for your VNC client to connect. Just so you know, there is no ssh or ssl security on your brand-spanking-new server, so you don't need to click those boxes if they exist in your client.

When you connect for the first time, read what Open Hosting gives you as a first login message, and follow those directions. Next...

Create a user for yourself, and add it to sudoers list.

By default, the Open Hosting Ubuntu set up lets you log in as root, even through ssh. This is not safe. First things first, fix that.
adduser [username]
Answer the questions the system asks you. Then:
usermod -a -G sudo [username]
Next, if you have SSH turned on and the ports enabled, get out of there and log back in using your new username and password through SSH which is much more secure.

Then...

Get ready to install software

sudo apt-get update
OK, now you are ready to move on.

Get rid of the locale errors

This drove me batty!! Every time I hit tab or tried to pull up a man page, I'd get this awful error like
-bash: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8)

or like
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
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

and nothing seemed to fix it. A linode user rescued my day with this, though:
apt-get install language-pack-en
ahhhh... that's better!

Lock root out

You really don't want ANYONE logging in through SSH as root. There is simply no reason for it. Seriously. None at all.
sudo vi /etc/ssh/sshd_config
Now search for PermitRootLogin and change the "yes" to "no".
You'll need to restart SSH now to apply this setting
/etc/init.d/ssh restart

Newbie explanation of that, in case you don't know vi

Once your are in the file, type
/PermitRootLogin
to find that string. Then use your arrow keys or l (move right) and h (move left) to get to the beginning of the word "yes" and then type
dw
to delete that word and then type
a
to start adding text after your current cursor placement and write
no
and then hit
esc
to get out of editing mode and then
:wq
Don't forget to restart SSH!

Now you are ready to

Install your LAMP server

If you, like me, are doing all this to have a place to run a Web server with Apache, mySQL, and PHP, you can install the things you need with
sudo apt-get install lamp-server^
Notice that caret (^). You need that. Just sayin'.

This is a work in progress. I'll add bits to it as I go along.