Ubuntu 16.04 VPS Public IP

I am setting up an Ubuntu 16.04 VPS in the Reclaim Cloud, and after spinning it up I can’t seem to get the public IP to resolve. To be specific, I’m migrating the ds106.club instance of an Apache/UNIX tilde space server over from Digital Ocean that is also running on Ubuntu 16.04.

I am following the tilde.club setup guide and have updated the hostname:

$ sudo hostnamectl set-hostname ds106.club

When I run the above command and reboot, the ds106.club hostnae is replaced with node366-env-7531836.us.reclaim.cloud, so it is not sticking. Although, from what I understand that might not be an issue for Jelastic, and editing the /etc/hosts file may be enough?

In that vein, I updated /etc/hosts to the following (notice Jelastic keeps a record for the original hostname in this file underneath the commented line):

127.0.0.1 localhost ds106.club
147.135.81.23 ds106.club
# Auto-generated hostname. Please do not remove this comment.
147.135.81.23 node366-env-7531836.us.reclaim.cloud node366-env-7531836

After that I am still getting nothing at the IP or domain, I went ahead and tried installing Apache2, and I get the following error:

insserv: warning: current start runlevel(s) (empty) of script `apache2' overrides LSB defaults (2 3 4 5).
invoke-rc.d: policy-rc.d denied execution of start.
Setting up ssl-cert (1.0.37) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...

I looked this up and did see a Stack Exchange post on the issue, but when I ran the recommended command to fix:

RUN printf '#!/bin/sh\nexit 0' > /usr/sbin/policy-rc.d

I got the following:

RUN: command not found

At this point I backed away slowly from command line and decided to high tail it to this part of the Reclaim Community forums to see if I can get a lifeline :slight_smile:

I just ran through this successfully on an ubuntu vps, I did have to deviate from the steps outlined a bit.
End Result: http://hostnametest.chrisblankenship.cloud/~testuser/

I spun up the Ubuntu VPS, and edited /etc/hosts to add these lines to specify the IP and hostname I’d be using:
147.135.81.26 hostnametest.chrisblankenship.cloud hostnametest
127.0.0.1 hostnametest.chrisblankenship.cloud hostnametest

This doesn’t change the hostname for the VPS itself, I’ve been having trouble with that as it will re-set each reboot, but adding these lines should be sufficient so your server is recognized with the proper hostname.

Then I created the user testuser using the adduser command, switched into the user by running su - testuser, and created a public_html dir with all the permissions and a test index file by running: mkdir ~/public_html && chmod 755 ~/public_html && echo "<h1>TESTING</h1>" >> ~/public_html/index.html && chmod 644 ~/public_html/index.html && exit

Once I was back in the root shell, then I installed apache by running: apt install apache2

Before edits can be made, it has the be run to generate the config files, so I ran systemctl start apache2

Then I had to enable userdir support using a2enmod userdir and restart apache using systemctl restart apache2

And then in the default enabled site’s file /etc/apache2/sites-enabled/000-default.conf, I added a line at the top to specify the servername: ServerName hostnametest.chrisblankenship.cloud

I gave it one more restart using systemctl restart apache2 and then I had to open up the HTTP/HTTPS ports in the Jelastic Environment Firewall

If you hit add under Inbound Rules, you can specify HTTP/HTTPS as the name, and it will autoconfigure with the ports.
image

I can now get the tilde space for the test user. I’m having some issues enabling the service to run at startup (systemctl enable apache2), but I’ll update once I figure that out.

1 Like

You are the bomb.com!

As a heads up those are Dockerfile entries so they wouldn’t apply here.

I believe there were two issues I resolved for you, one that was not so obvious.

  1. Apache wasn’t started. When I ran service apache2 status is reported that it was installed but not turned on. I ran service apache2 start to fix that.
  2. There is a firewall enabled by default. You can find the settings by going here:

    I disabled it to test and I’m showing that worked but you could keep it on and just open the necessary ports for Apache (80 and 443) and that would work as well.

and if I had scrolled up and read all of Chris’s post I would have realized he covered all that better than me :smiley:

1 Like

I get both infrastructure people on this? This whole reclaim.cloud thing has legs

3 Likes

Chris,
As a follow-up I followed your directions step-by-step and I was able to get it working, so thank you so much. Your step-by-step was excellent.

I’ll see how to force start apache2 at reboot as well, I think i did that before.

One more question, I copy over all the data cleanly with the following rsync command from /home directory in new server:

rsync -avz root@oldserverip:/home/ /home/

If you were to copy over user permissions and password information, does this guide look like it would work?

As a follow-up here, that post was perfect, and I got all the data as well as all the associated user data over cleanly. ds106.club is in the bag, pointing DNS now, and if I still drank I would be drinking!!!

1 Like