Set up a new Ubuntu server for the first time.

Dave O'Dea
Kitchen to Keyboard
4 min readApr 22, 2017

This is part 2 in “How to set up your own cloud based web server

  1. Create a server.

2. Setup the server ← You are here !

3. Install the LAMP stack.

4. Setup a domain name (i.e. www.myDomain.com).

5. Getting files on the server.

So, now that you have created your server or droplet on DigitalOcean — lets go ahead and go through some basic setup steps in preparation for launching our website for the first time !

After we created our droplet in step 1 above, we would have received some credentials via email which would have included details such as our droplet’s name, IP address and password.

In order to connect to your server we will need to use SSH — a protocol which enables you to remotely log in to the command line of your new server.

MacOS devices (which I use)each come with a builtin application called Terminal which provides native SSH capability, you’ll find in your applications directory.

Windows users, unfortunately, don’t have such a luxury. So there are a couple of options, one of the most popular being PUTTY — an SSH and TELNET client for Windows. You can read more about getting PUTTY set up here .

The rest of the screenshots will be from my Mac, but the steps are identical, once you get logged into your server if you are using PUTTY.

Ok, lets start issuing some commands (I have left my server IP visible as I will be destroying it after writing this, but I advise you not to share it online for security purposes):

  1. To connect to your server:
ssh root@yourServersIP

You will see something similar to, type ‘ yes ’:

After typing ‘ yes ’ — you should paste in your password, this will not appear on the screen, so don’t worry — just paste (CMD + V) and hit return.

You will then be logged in to your server and see the following:

Paste, again, your password, hit return and you will be prompted to enter a new password and confirm it:

Great, you are now logged in, lets get cracking !

2. The current user, root , has unrestricted privileges to do whatever they wish on our system. We want restrict this potential for disaster by creating a new user.

In our command line, lets type:

adduser newUser

We can add this new user to the group of users who have admin privileges — sudo . Users in this group may execute restricted tasks after entering their admin password.

usermod -aG sudo newUser

3. Don’t close the current connection just yet — instead open a new tab in your command line and try to login with:

ssh newUser@yourServerIP

If you can log in, great! — if not, please go back over step 2 above.

After completing the above steps, you will now be able to log on as your new user, instead of root.

Now, this would be a good time to beef up our security and add SSH key pairs on both our local machine and server, I am going to cover this in a future post on server security, which will also include other topics such as disabling root login, setting up firewalls etc. — so as to keep this post concise.

… so, awesome — you’ve no successfully logged in remotely to your server, set up a new user.

Next up, we are going to run through how to install the LAMP stack, the technology which will serve our webpages to our site visitors !

Lets do this …

--

--