Acquiring A Slice of The Internet

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Acquiring a slice of the internet

Lease a server
Leasing a server from Hostwinds is pretty straightforward. First, visit the Hostwinds page for
leasing an unmanaged Linux VPS and click the "Order" button for their cheapest package; you'll
have to make an account in the usual way to check out. Once you've done that, you should see a
page where you can select some options for your server. There are a few important ones:

1. Under "Location", select Dallas or Seattle; I accidentally forgot to do this, so my server is


in Amsterdam, I don't really notice a speed difference though...
2. Under "Operating System", select the highest version of Ubuntu available
3. Under the "Optional Add Ons" section, uncheck the box for "Cloud Backups"

Finally, put in your card information and verify that the total is what it should be (less than
$5.00). Once you click the "Complete Order" button, they will send your server login
information to the e-mail address you made your account with.

Connect to the Server


In order to access and interact with your server, you will need an FTP & SSH client. Please
follow my instructions in getting_connected_with_ftp_and_ssh.pdf if you haven't ever used these
tools before. Once you've done that, use your SSH client to connect to your server with the login
information provided to you in the e-mail from Hostwinds, namely:

• Your server's IP address


• Your username (likely "root")
• Your password (an ugly string of random characters)

Install Node, NPM, and the http-server package on your


server
You can update your server's OS and install Node and NPM by issuing the following
commands on your server via SSH:

sudo apt-get update


sudo apt-get upgrade
sudo apt-get install nodejs
npm install -g http-server
sudo reboot
When you issue the last command, your server will restart and you will be disconnected. After
waiting a minute or two for the server to reboot, reconnect with SSH to ensure everything went
smoothly. You may want to change the login password as I had at least one student's server get
hacked in the past using the default Hostwinds password. If you do change it though, make sure
to use a good, long password. The command to change your password is just passwd.

Serve the "Hello World" Page from Your Server


Next, connect to your server using FileZilla and locate your "website" folder that you created
when you set up your local web dev environment in FileZilla's left pane. See
setting_up_your_local_web_dev_environment.pdf. Once you have found it, transfer the whole
"website" folder into the "/root" folder of your server.

Next, SSH into your server again and move into the "website" folder with the command cd
website ("cd" = change directory). Then start the HTTP server with

http-server -p 80

If everything has gone correctly, you should now be able to put your server's IP address into your
address bar followed by a slash and whatever you named your "hello world" file and that page
should come up.

If you close your SSH window at this point, the http-server will die and you won't be able to
access you page anymore. You can keep your HTTP server running after you close your SSH
connection by doing the following:

• Hit Ctrl-z to suspend the http-server


• Enter the command bg %1 to make the http-server run again, but in the background
• Finally, enter disown -h %1 to detach the http-server from your SSH session

Make sure that you can still access your page via your server's IP address after you close
your SSH session to ensure that the http-server is, in fact, still running.

If you need to restart the http-server later, you'll first have to stop the one that is already running.
You can do this with the command killall http-server once you've SSH'd into the server
again.

Buy a Domain Name & Set Up DNS


I highly recommend that you buy your domain name from namecheap, but you are welcome to
shop around. Nonetheless, the instructions that follow for setting up DNS will be for namecheap,
so if you use something else you'll have to figure that out on your own. So, go find and buy a
domain name for yourself. On namecheap, you can just click around until you find a top level
domain that you like and is inexpensive, then just search for your desired domain name and see if
it is available.
Note, the .dev domain requires that you implement HTTPS before it will work. As such, if
you want to buy a .dev domain for professionality reasons, buy a .xyz domain too (they're like a
buck) and then set that up first. Once we switch over to using HTTPS later in the semester, you
can then set up your .dev domain too; nothing wrong with having two domains point to the same
site.

Once you've purchased your domain name verify your e-mail with namecheap! If you don't
your domain name could be unexpectedly suspended.

Next, log in to namecheap and click on the "Domain List" tab off to the left. Click the "Manage"
button for your domain and then select "Advanced DNS" from the top menu. You should see two
or three records there that namecheap auto-generated for you. Delete them.

Next, create two A-records appropriate for your site using the IP address for your server. Make
sure you create two A-records, one for "www" and one for "@". Be extra careful to enter all the
information into your A records correctly since it can take a while for changes to propagate
through the DNS infrastructure.

Once you've done that, you should wait a couple of hours and then try to access your site via
your domain name! Assuming that you see the same "Hello World" page you saw when you
accessed your server via its IP address, then you are finished setting up your server. Congrats!
You own your very own slice of the internet.

You might also like