Create a server in the cloud…in a breeze!

and I’ve built one in less than 90 minutes thanks to Mosso Cloud Server
Let me describe the procedure, it might be helpful for those of you willing to set-up a server instance on-demand.

Indeed, I’ve been working on a RESTful API for my wireless sensors. I was a newbie and despite many roadblocks, let me assure you that it is amazing how server/web services technologies are accessible nowadays!
Anyway, now that I have a home-brew Java web services running locally, I tried to load it on a cloud server and below is the procedure I followed.

Cloud server providers:

I’ve been looking at Amazon EC2 and Mosso. I’ve decided to go for the latter:

  • Price: Mosso provides cloud server starting at about 15$ a month for 256MB RAM or 30$ for a 512MB.
  • Ease-of-use: Creating a server instance is straight-forward with Mosso.
    Once the server is created, server informations ( login/pw/ip ) are sent over by email. SSH connection gives you root permissions.
    Whereas EC2 server configuration is more tricky
  • Reliability, scalability, security: I would discuss those topics later on since I haven’t been confronted to them yet.
    Should you have any opinion, please chime in!

Server creation with Mosso:

Launching a server instance with Mosso is a breeze. Once an account is registered, one can access a neat admin page whereby a new server instance can be created on-demand.
Several OS are available and I’ve picked up CentOS 5.2 because it was the first one in the list !
Below is a server creation page screenshot:

Mosso Cloud Server

Mosso Cloud Server


MySQL installation:

To install MySQL, just follow the procedure below:

  1. Connect to your server:
    ssh root@yourIP
  2. Download and install MySQL thanks to ‘yum” command:
    yum install mysql-server mysql mysql-devel
  3. Start MySQL:
    /etc/init.d/mysqld start
  4. Add MySQL user:
    CREATE USER 'yourUsername' IDENTIFIED BY 'yourPassword';
    CREATE USER 'yourUsername'@'localhost' IDENTIFIED BY 'yourPassword';
    GRANT ALL ON *.* TO 'yourUsername' IDENTIFIED BY 'yourPassword';
    GRANT ALL ON *.* TO 'yourUsername'@'localhost' IDENTIFIED BY 'yourPassword';
  5. That’s it!

Tomcat 6, Java 1.6 and ActiveMQ 5.2:

Although ‘yum’ could be used,  I’d rather download locally the packages for Tomact, Java and ActiveMQ.
Now, let’s schlep those packages to my cloud server:

  1. Download Tomcat 6 , Java 6 and ActiveMQ 5.2
  2. Uncompress and copy the binaries respectively under /usr/tomcat ,  /usr/java/ and usr/activemq/ as below:
    scp -r /jdk1.6.0_05 root@yourIP:/usr/java/
    scp -r 6.0.18/ root@yourIP:/usr/tomcat/
    scp -r activemq5.2/ root@yourIP:/usr/activemq

Environment variables:

Let’s create a .bash_profile file to set environment variables properly as below:
My .bash profile:

export JAVA_HOME=/usr/java/jdk1.6.0_05/
export JRE_HOME=/usr/java/jdk1.6.0_05/jre/
export CATALINA_HOME=/usr/tomcat/6.0.18/
export ACTIVEMQ_HOME=/usr/activemq/5.2/
export MYSQL=/usr/bin/
export mysql=/usr/bin/mysql
export mysqladmin=/usr/bin/mysqladmin
#export PATH

Start Tomcat and ActiveMQ:

  1. Start ActiveMQ ( if needed ):
  2. Start Tomcat:
  3. That’s it…. check whether http://yourIP:8080 loads the Tomcat admin page.


Within few steps away, one can easily create a server instance on-demand.
Mosso Cloud Server is very appealing and user-friendly. However  I am contemplating to switch over to Amazon EC2 for evaluation purposes.
The reasoning is that Mosso does not provide a way to save home-brew server configurations with specific load of applications whereas Amazon EC2 with its AMIs ( Amazon Machine Instance ) may provide this useful capability.

I’ll keep you posted!

This post is tagged , , , , ,

4 Responses

  1. daniel says:

    Just received my first bill..only 8 dollars per month for a 256 RAM server!
    Mosso is just perfect for prototyping. Kudos guys.

  2. teddyber says:

    mmh, miam! This looks yummy!

  3. daniel says:

    Note for myself:
    In Centos 5.3, do not forget to modify the iptable so as to access tomcat from an external IP.

    Enter iptables…
    Iptables is your firewall, its baked into CentOS, and its extremely powerful. I don’t know the complete depth of iptables but for this tutorial you’ll need to just get a few ports opened up and that’s it.
    # iptables -F
    # iptables -A INPUT -p udp -m udp –dport domain -j ACCEPT
    # iptables -A INPUT -p tcp –dport 22 -j ACCEPT
    # iptables -A INPUT -p tcp –dport 10000 -j ACCEPT
    # iptables -A INPUT -p tcp –dport 25 -j ACCEPT
    # iptables -A INPUT -p tcp –dport 8080 -j ACCEPT
    # iptables -A INPUT -p tcp –dport 80 -j ACCEPT
    # iptables -A INPUT -p tcp -m tcp –dport domain -j ACCEPT
    # iptables -A FORWARD -o eth0 -j LOG –log-level 7 –log-prefix BANDWIDTH_OUT:
    # iptables -A FORWARD -i eth0 -j LOG –log-level 7 –log-prefix BANDWIDTH_IN:
    # iptables -A OUTPUT -o eth0 -j LOG –log-level 7 –log-prefix BANDWIDTH_OUT:
    # iptables -A INPUT -i eth0 -j LOG –log-level 7 –log-prefix BANDWIDTH_IN:

    make sure you save your iptables configuration so you don’t have to re-edit it when you reboot your server
    # /sbin/service iptables save

    now just restart your firewall
    # /etc/init.d/iptables restart

    now you can check your configuration
    # iptables -L -v

    at this point, for good measure you might want to reboot your server
    # reboot

  4. Daniel says:

    Note for myself:
    if Java heap size encountered while running Tomcat, increase the memory allocated to Java by adding this line to
    JAVA_OPTS=”$JAVA_OPTS “-Xms512m” “-Xmx1024m”

Leave a Reply


Sense PlaNet – smart grid, internet of things, web of things, pervasive web, pervasive computing – finally, web and things get along!

brought to you by Daniel Kaplan contact: