Menu bars

Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu
Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Sunday, 18 June 2017

Building a Spring boot application in Ubuntu 16.04 using gradle and Running a headless chrome from selenium

Hello everyone, this is my side by side blog on how to build my spring boot application in Ubuntu 16.04. I have already a project with basic spring boot specification which has build using gradle. This is my learning project on gradle and spring boot. So we all need a unix based os for deploying these to a cloud based hosting like digital ocean. So lets start.

These are the steps that i have already done.
1. Installed gradle in ubuntu 16.04 by following this article.
2. Copy the spring boot project to ubuntu box.
3. Installed Mongodb on Ubuntu machine by following this article
4. Installed Java 1.8

Oh.. Gradle !! Yeah it is a build automation tool that will take care of all the dependency and build tasks that we need to do while creating a project. Of course you can use other build tools like Maven,ant etc. But gradle comes with more power that other build tools in java.

Heard about gradlew ? It is worth looking into this if you are using gradle which will reduce your headache of installing gradle and will escape you from the version mismatch drama. Gradle vs gradlew ? . Gradle wrapper command will create gradlew.

Ok. lets come back to our Ubuntu Box. Our objective is to run spring boot in Ubuntu machine and the boot application is having a dependency on mongodb services. So we need to setup that as well.

You just need to go to the root directory where the build.gradle file exist and execute the command gradle bootRun. This will launch the spring boot process and you will something like below.


Yay !! spring boot has started !!.

One of my requirement for this spring boot project is that i want to run a selenium scrapper from this project that too headlessly using chrome. This link provides you more information on how can you install headless selenium.

Luckily Chrome has rolled out chrome-59 with headless feature which we can use for our experiment. Get the latest version of the chrome from this link.

So  i have installed google-chrome 59 and all ready for running my headless chrome instance with selenium with spring boot. I have tested my application code in my windows machine and it worked like a charm. Now i am testing it on my Ubuntu server. fingers crossed !

It throws me unable to start exception. Mostly its because Ubuntu server is not able to start it on a graphical way. Lets investigate.


woo.. after a long 3-4 hours i could run the chrome 59 headless from selenium. Initially i was getting the same above error whatever i changed. I did a lot of googling to find out why the same exception coming. It was due to one of my big blunder of adding the wrong system property. I was adding the actual chrome installation path in the webdriver.chrome.driver property. Everything started working once i replaced the same with chrome-driver location.

For that i have downloaded the chrome-driver from the Chromium.org download site. And i did something similar including the symlink like this.

This particular script written in Github shows all the steps that we need to do to install the Chrome+selenium combo in your Unix boxes.

So here is my complete java code that running the selenium which invoke the headless google-chrome in Ubuntu machine.


And we need to pass the extra arguments for running the chrome in headless mode(Note that this feature available only google-chrome-59 onwards). The versions of the applications that used as follows.

Java - 1.8
Selenium - 3.*
google-chrome - 59
chromeDriver - 2.3

That's it guys. We have successfully ran our spring boot application which can invoke chrome instance headless way from selenium. Tune in for more. Thanks a lot.  

Saturday, 22 August 2015

Resize HD partitions in ubuntu

Partitioning the hard disk is always an difficult task even those guys who are frequently dealing with computer especially when you in linux flavors. Here comest most friendly free software available in the ubuntu repository , gparted  for help.  Install gparted with the command

sudo apt-get install gparted
When you open gparted from your system, you will get the following screen.

Here you can see that all your partitions and corresponding file-system and all other details are given. And if you observe little more you will get confused with the logical and extended partition concept of the partitioning. The real pain comes when you realize that you can create only 4 primary partitions and if you try to create another one they wont allow you. Here we have to delete any of the partition and resize it.

When i was facing this problem this forum helped me out !!


  • The key sign near the FS wont allow us to do any of the operation on that FS, since this is in use right now.
  • If there is key sign on the linux-swap then you can choose swap-off and do the operation.
  • try to make changes to extended partition only, so that you can add many partitions here

  • EXT4 partitions means  Linux FileSystem
  • NTFS partitions means Windows Filesystem
If you want to resize the already booting FS then use a bootable usb and use gparted to change everything.

Friday, 21 August 2015

Create a github repo

Lets create a github repo. so that we can store all our code safe in the repository and share the same across.



See the first step :  (+) sign on top of right side.




Lets continue....



The repository url will be looks like this: 


after the last step it will ask your github username and password. username will be email id normally

and you will get this message at the end



Now you can check the repository created in your account.


Clone a repository

If you wanted to clone the same repo somewhere else then you can follow the following step.

git clone <repo url>

Using git

This is a good resource to look into the git command - the link 

git status
git add <file>
git commit -m "msg"
git push
git pull







Saturday, 8 August 2015

Run windows 7 in a virtualbox from Ubuntu 14.04

Step 1 : Open terminal and type,

sudo apt-get install virtualbox 
Virtualbox will get installed in 5 minutes.

Step 2 : Open virtualbox and create a new virtual machine as you want. Easy steps to be followed and will land in this state



















Step 3 : Right click on the virtual machine listed in the left panel and select settings which will land you in the following page.

Click on storage

Click on Empty

Now you will see this page.












Step 4 : Click on the cd-image on the right panel near CD/DVD


Now choose a virtual CD/DVD file

Choose your iso file

Done !!

Now go to your virtualbox and select the vm and click RUN


Get started with Drupal Installation in Ubuntu 14.04

Introduction


Drupal is a robust Content Management System that is available in the market. This uses  LAMP server and which includes MySQL and  Apache.It can host blogs, forums, and a variety of other content. It has a huge selection of modules for other functionality, such as advertising, chatbox etc. Even though there are many other CMS are available in the market, still Drupal stands out with its flexibility to adapt to any requirements. If you want to use Drupal then you have to have basic web development knowledge.  Wordpress and Joomla limits to you to stick to their standards but drupal give you the flexibility to design the blog or website as your wish.
Lets check how to install Drupal on a ubuntu 14.04 machine.

Step 1: Install LAMP server

LAMP contains Linux, Apache, Mysql, php. We need to install LAMP before we install Drupal.
sudo tasksel install lamp-server
Install tasksel if it is not installed already,
sudo apt-get install tasksel