Category

CentOS

VPS with Jelastic: CentOS, Ubuntu and Windows

By | CentOS, Jelastic, Virtual Hosting, Virtual Private Server Hosting | No Comments

Jelastic VPSMost people choose VPS (Virtual Private Server) hosting because it doesn’t have the limitations of shared hosting and it allows for reinforced security, flexibility and complete control over your environment.

Today we will review how to set up VPS using Jelastic and 3 pre-configured certified stack templates on top of 3 operating systems – CentOS, Ubuntu and Windows.

Virtual Private Servers

CentOS (Community ENTerprise Operating System) is a free community-driven project, with open source code delivered from RHEL Linux distribution.

CentOS offers enterprise-level stability strengthened by robust performance and represents a reliable, low-maintenance, secure option for running virtual private servers.

Ubuntu is one of the most popular operating systems for running virtual private servers inside the Cloud. Built over the Debian Linux distribution, Ubuntu shares its commitment to principles of open-source software and offers continually developing solutions with agile, secure and versatile performance capabilities.

Windows Server OS (2012 and optionally 2008 R2 versions are provided) allows you to run any Windows-based software on your virtual machine with support of popular tools and technologies: ASP.NET, PHP, SQL, Visual Studio, Active Directory, etc.

Due to the fact that Windows OS is a proprietary software and can’t be distributed freely (i.e. requires the license to be applied to the platform), you can be charged for using such containers (regardless of whether it’s running or stopped).

Installation

Let’s see how easy it is to install your own VPS in the Jelastic cloud.

1. Firstly, log in to your Jelastic account and access environment topology wizard.

2. Select the VPS section at the bottom left corner and choose which VPS (Ubuntu 16.04 in our example) from the expandable options list.

ubuntu vps

Specify the cloudlet limits for this node, scale it out (if required) and type the name of the environment and click on Create.

3. In a couple of minutes, your new environment with the chosen virtual server will appear at the dashboard. You’ll also receive an email notification with its administration data (i.e. login / password credentials, attached Public IP and access URL).

And it’s that simple – now your own virtual private server is up and running!

environment success

Elastic VPS Scaling

Flexibility of VPS hosting in Jelastic’s Cloud is achieved because of automatic scaling, both vertical and horizontal, that is easily tuned during creating and configuring your environment topology.

Automatic vertical scaling allows to choose your scalability limits with the appropriate settings, whilst make your hosting costs meet your budget and at the same time prevent outages during unexpected load spikes. The system will automatically provide the server with the required resources based on the load.

To scale your environment, simply increase/decrease the maximum number of available resources (cloudlets), moving the cloudlet sliders in the Vertical Scaling section.

vertical scaling

Horizontal scaling allows you to easily adjust the number of servers in your environment using the appropriate “-” and “+” buttons. Operating several same-type nodes in the confines of a single environment highly increases its management capacities – all of them can be simultaneously configured, reset to get new passwords, inspected for logs and statistics, restarted etc.

All the newly added VPS instances will clone the master node (i.e. the initially created container) with all its configurations. However, each node will have its own hostname and administration data, delivered via the corresponding emails. These are going to be independent servers that are able to handle separate applications.

horizontal scaling

Make sure to Apply changes you’ve made.

Access Your VPS

You can apply some basic settings to your VPS instance directly via the dashboard UI with a set of inbuilt tools, provided by Jelastic.

In case you want to implement more complicated configurations, simply access your VPS using:

Use Cases

To see how you can use your VPS in practice and make some widely-used configurations, review the following tutorials:

Java Console Application with CentOS VPS. Installing a sample of Java console application to your СentOS virtual private server and checking its operability.
Setting Mail Server Inside CentOS VPS. Integration of mail server to your virtual private machine, accessing the required container over SSH protocol and using the preferable connection flow.
Setting Windows VPS Roles and Features via Server Manager. Basic functionality of inbuilt Server Manager for configuring Windows VPS.

Conclusion

VPS, Virtual Private Servers, is an advanced solution to run large scale applications and ensures their simple administration at the same time. That’s why VPS hosting becomes is the preferred choice of both inexperienced and advanced users, being able to suit anybody’s needs. Try VPS with Jelastic with a free 2 week trial to see how a virtual private server solution can work for you.

How to get Tomcat running on CentOS 7.2 using privileged ports <1024

By | CentOS, Java, Tomcat | No Comments

Tomcat running on Centos using privileged portsIf you haven’t already got Java and Tomcat 7 running on CentOS 7.2, it’s pretty simple using yum. Just follow the instructions in this post.

This sets up Java to run with 8080 and/or 8443, but I want it to be my primary webserver.

Post install

I’ve been trying to get Tomcat to run under user tomcat but on privileged port 443 ( <1024 ). There is not a lot of current info on getting this working post yum installs of Java and Tomcat 7 on CentOS 7.2 , so perhaps adding it here would be good.

There is allot of misinformation out there and some of it doesn’t apply to the versions spoken about, configs in different places or not existing in the paths referenced.

A few pre-cursors

  1. I do not want to run Tomcat as root to be able to use a port <1024
  2. “setcap cap_net_bind_service+ep /path/to/bin/java” does not work. I tried everything I could.
  3. I do not want to run Apache, haproxy or NGINX running on a port <1024 as a frontend to Tomcat even though there are some advantages in doing this. Wasted overhead and another service to manage and keep updated.
  4. Using iptables or firewalld to redirect ports is not optimal IMO as restarting or changing the firewall config would stop users from reach Tomcat if the firewall stopped or had an issue which is a point of failure.

The best solution I found was:

  1. Install authbind pre-rolled as an RPM from here or use the referenced GIT project to build an rpm yourself. This installed without issue and without any dependencies.
  2. Once authbind is installed run the following depending on what ports you want to have Tomcat listening on:

sudo touch /etc/authbind/byport/80
sudo chmod 500 /etc/authbind/byport/80
sudo chown tomcat /etc/authbind/byport/80
sudo touch /etc/authbind/byport/443
sudo chmod 500 /etc/authbind/byport/443
sudo chown tomcat /etc/authbind/byport/443

  1. Default user and group when Tomcat is installed by yum is “tomcat”
  2. Modify your tomcat “/etc/tomcat/server.xml” config and change to the ports you want to use. In my case it’s 443.
  3. The tricky part was getting authbind to work with systemd. After getting Tomcat set to start when the servers starts up I have the following 2 startup files:

/etc/systemd/system/multi-user.target.wants/tomcat.service
/usr/lib/systemd/system/tomcat.service

  1. In all the other posts I read and how to’s they all reference startup.sh in this file, but this script doesn’t exist if you used the before mentioned instructions to install Java/Tomcat using yum. I opened up the 2 files above and commented out the original “ExecStart” command, duplicated the line and added authbind as follows:

#ExecStart=/usr/libexec/tomcat/server start
ExecStart=/usr/bin/authbind –deep “/usr/libexec/tomcat/server” start

  1. After that I ran:

sudo systemctl daemon-reload
sudo systemctl restart tomcat.service

Tomcat fired up listening on port 443.

<snip>
Aug 19 13:29:42 1556-109 authbind: INFO: Initializing ProtocolHandler [“http-bio-443”]
Aug 19 13:29:43 1556-109 authbind: Aug 19, 2016 1:29:43 PM org.apache.coyote.AbstractProtocol init
</snip>

Problem solved! This was a lot easier to get working that some of the other solutions which involved multiple services running etc. If you have a better method or questions, please post a comment.