Thursday, March 27, 2014

How to map Google Drive on CentOS



I am learning around with grive, a third party Google Drive client.  It’s pretty cool, but the instructions are based on an Ubuntu install.  I had an interesting time setting it up on CentOS 6.3 64bit, so I decided to share what I learned.

First, get connected EPEL and all repositories,

#yum update
#yum install json-c* expat* curl* 
# rpm -i http://www.mirrorservice.org/sites/dl.atrpms.net/el6.3-x86_64/atrpms/testing/cmake-2.8.4-1.el6.x86_64.rpm
# git clone git://github.com/Grive/grive.git
# cd grive
# cmake .
# make

If there are errors, just install new Boost version follow:

http://thoaimedia.com/install-boost-1-55-0-version-on-centos/

after that you give build again:
#cd ./grive  # grive repo is already checked out here
#git clean -fdx
#cmake .
#make


[root@mrcool]# cp ./grive/grive /home/mrcool/GoogleDrive/
[root@mrcool]# cd /home/mrcool/GoogleDrive/
[root@mrcool GoogleDrive]# ./grive -a

Please go to this URL and get an authentication code:

https://accounts.google.com/o/oauth2/auth?........




Please input the authentication code here: 
xxxxxx
Reading local directories
Synchronizing folders
Reading remote server file list
Synchronizing files
sync ./grive doesn't exist in server, uploading

Finished!

Install Boost 1.55.0 version on CentOS

Boost

Issue the following commands in the shell (don't type $; that represents the shell's prompt):
$ cd path/to/boost_1_55_0
$ ./bootstrap.sh --help

Select your configuration options and invoke ./bootstrap.sh again without the --help option. Unless you have write permission in your system's /usr/local/ directory, you'll probably want to at least use
$ ./bootstrap.sh --prefix=path/to/installation/prefix

to install somewhere else. Also, consider using the --show-libraries and --with-libraries=library-name-list options to limit the long wait you'll experience if you build everything. Finally,
$ ./b2 install

will leave Boost binaries in the lib/ subdirectory of your installation prefix. You will also find a copy of the Boost headers in the include/ subdirectory of the installation prefix, so you can henceforth use that directory as an #include path in place of the Boost root directory.

 

My complete commands:
wget http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download
tar -xvzf boost_1_55_0.tar.gz
cd boost_1_55_0/
./bootstrap.sh --with-libraries=atomic,date_time,exception,filesystem,iostreams,locale,program_options,regex,signals,system,test,thread,timer,log
./b2 install

Install qmake on CentOS

CentOS 6.4


cd /etc/yum.repos.d
nano qk.repo


# Place this in a file in your /etc/yum.repos.d/ directory with a qt.repo extension

[epel-qt48] name=Software Collection for Qt 4.8 baseurl=http://repos.fedorapeople.org/repos/sic/qt48/epel-$releasever/$basearch/ enabled=1 skip_if_unavailable=1 gpgcheck=0 [epel-qt48-source] name=Software Collection for Qt 4.8 - Source baseurl=http://repos.fedorapeople.org/repos/sic/qt48/epel-$releasever/SRPMS enabled=0 skip_if_unavailable=1 gpgcheck=0

yum install qt48-qt-webkit-devel

ln -s /opt/rh/qt48/root/usr/include/QtCore/qconfig-64.h  /opt/rh/qt48/root/usr/include/QtCore/qconfig-x86_64.h

source /opt/rh/qt48/enable

export PATH=/opt/rh/qt48/root/usr/lib64/qt4/bin/${PATH:+:${PATH}}

Friday, March 21, 2014

Apache Tomcat 7.0 (on Windows) install guide

Apache Tomcat is a widely used open-source implementation of the Java Servlet and JavaServer Pages (JSP) technologies.






Visit the Apache Tomcat homepage. Then, click the "Download" link for Tomcat 7.0 on the left.






Download the "32-bit/64-bit Windows Service Installer".






Run the installer.











Remember the HTTP connector port. Also, pick an administrator login and password.






Specify the patch to the Java Runtime (JRE) if it is not already detected.






Take note of the location where your Tomcat server is being installed.






A tray icon will appear for the service monitor!






Right click on the monitor tray icon. Observe if the Tomcat service is already stated.






Click "Configure..." to open the service properties window. Make sure the "Startup type" is set to "Manual". Also, stop the service if necessary.







That's it! You're done.

Java Development Kit (JDK) install guide

This tutorial will step you through getting the Java Development Kit (JDK) installed on your computer, which you will need to compile Java programs. This is different from the Java Runtime Environment (JRE) which is used to run Java programs. The JRE will also be installed as part of this process.





Check if it's installed


First you should check if you already have it installed on the computer you are working on.

Open the Windows "Control Panel" and click "Programs and Features".






Look for both of these items. If they are present, you already have JDK and JRE.






Check processor type


You need to know your processor's architecture in order to continue.

Go back to the "Control Panel" and click "System".






Under the "System type" field, see if you're using a 64-bit or 32-bit processor.






Downloading the installer


* Link to download page *











Make sure to select the correct download based on your processor's architecture.






Running the installer







Take note of the location of the JDK installation. You will need it later.











Take note of the location of the JRE installation. You will need it later.












That's it! You're done.

Eclipse + JavaServer Pages (JSP) beginner's tutorial

Eclipse is a widely used open-source integrated development environment (IDE).






Visit the Eclipse download page. Find the download for "Eclipse IDE for Java EE Developers". Select the appropriate version for your computer (it must match the JDK/JRE you have installed)!






Extract the archive's contents. There is no need to run any setup program.






Navigate to the newly extracted 'eclipse' folder and run 'eclipse.exe'.











The workspace directory is where Eclipse will store all your projects.






Let's make a new project! Click "File", then "New", then "Other..." (or press Ctrl+N).






If you don't see "Dynamic Web Project" the most common cause is because you did not download the "Java EE" edition of Eclipse.






Since this is the first JSP project, Eclipse doesn't know about the Tomcat installation. After configuring a "New Runtime" it should be available in the dropdown menu for future use.






Don't check "Create a new local server".






Remember where you installed Tomcat? Enter that path or browse to it.






Tomcat should now be an option :^)






A blank canvas awaits you...






Let's make our first JSP page. Right click on the 'WebContent' folder.






We want JSP - not HTML - since we are going to have some dynamically generated content. Although there is nothing wrong with using pure HTML files for static content.






Recall that files named 'index.*' will be the default "home page" served up by the webserver.






There are some predefined templates available. You don't have to use them, but they are convenient.






Enter the example code highlighted in yellow. What do you think it will do?






Click the green run button on the toolbar so we can find out.






Once you confirm your selection here, Eclipse shouldn't ask you again for this project.






Create a new Tomcat server on your localhost for development of this project.






Your project will be built and a Tomcat server will be started (see the "Servers" tab.)

Your default page will be loaded inside Eclipse's internal web browser!

If you see "4" (the result of "2+2") then you have successfully generated a dynamic page!






Browse to your local Tomcat instance in a "real" web browser.






View the source code of the page.






Check it out... you only see the result of the code executed between the start and end of the JSP tags. The actual source code is not revealed to the client.






Shut down your Tomcat server from within Eclipse by clicking the red stop button.







Further Reading


There are a number of JSP tutorials (of varying quality) freely available online.

Here's a decent one I stumbled across: http://www.jsptut.com/

I definitely suggest you read both tutorials and a JSP reference to understand the features, power, and flexibility of the language. Remember: it doesn't matter if you are outputting HTML, XML, JSON, whatever... it's all delivered over HTTP.

That's it! You're done

Friday, March 7, 2014

How To Install Tomcat 7.0.52 Server on CentOS & RedHat 5/6

Apache Tomcat is an opensource webserver product of Apache Foundation like Apache HTTP server. It is used to deploying Java Servlet and JSP applications. To deploy any application in Tomcat we can simply create a war file and deploy them. For more details about you can visit apache official site http://tomcat.apache.org/ .

tomcat-apache-software-foundation

This article will help you to install Apache Tomcat 7 on CentOS/RHEL servers. We are using CentOS 6.5 and installing Apache tomcat 7. To read more about this release read Tomcat Release Notes.
Step 1: Check JAVA

JAVA is the first requirement of tomcat installation. Use following command to check if you have java installed already on your system.
# java -version

If you do not have java installed, Use this guide to install Java.
Step 2: Download and Extract Tomcat Archive

Download Apache tomcat archive file from Apache tomcat official site using below download url
Download URL: http://tomcat.apache.org/download-70.cgi
# cd /opt
# wget http://www.eu.apache.org/dist/tomcat/tomcat-7/v7.0.52/bin/apache-tomcat-7.0.52.tar.gz

After competed download extract archive file in /opt directory. You may change this location as per your setup.
# tar xzf apache-tomcat-7.0.52.tar.gz

Step 3: Start Tomcat Service

Tomcat is very easy to use, There are no need to compile its source. You simple extract the archive and start the tomcat server. Tomcat by default start on port 8080, So make sure no other application using the same port.
# cd apache-tomcat-7.0.52
# ./bin/startup.sh

[Sample Output]
Using CATALINA_BASE:   /opt/apache-tomcat-7.0.52
Using CATALINA_HOME: /opt/apache-tomcat-7.0.52
Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.52/temp
Using JRE_HOME: /usr
Using CLASSPATH: /opt/apache-tomcat-7.0.52/bin/bootstrap.jar:/opt/apache-tomcat-7.0.52/bin/tomcat-juli.jar

Step 4: Access Tomcat in Browser

Tomcat server works on port 8080 default. Access tomcat on web browser by connecting your server on port 8080.
http://svr2.tecadmin.net:8080

apache-tomcat-setup
Step 5: Setup User Accounts

Finally we need to create user accounts to secure and access admin/manager pages. Edit conf/tomcat-users.xml file in your editor and paste inside <tomcat-users> </tomcat-users> tags.
# user manager can access only manager section.
<role rolename="manager-gui" />
<user username="manager" password="_SECRET_PASSWORD_" roles="manager-gui" />

# user admin can access manager and admin section both.
<role rolename="admin-gui" />
<user username="admin" password="_SECRET_PASSWORD_" roles="manager-gui,admin-gui" />

I hope above steps will help you to setup tomcat on your server.

Thanks