Wednesday 19 February 2014

apt-get install debian PT4 (JDBC connector and Arduino IDE)



Here we are, today as you probably know we'll talk about installing JDBC connector for MySql/Tomcat/Eclipse and the Arduino IDE (in the top picture you can see my abnormal ability to modify images in paint).

JDBC connector:

First of all: you need to install it. To do so you tipe in a terminal: sudo apt-get install libmysql-java

This will extract the connector jar into the /usr/share/java/ directory


For install the JDBC driver into Eclipse you'll need to make it visible to Eclipse in some way.


Some guide tell you to put the jar into the Java Build Path libraries of your project. But, probably for some conflict between the CLASSPATH environment variables, in my case this does not work. Maybe it work in a non web project, but in my case with dynamic web project with tomcat as web-server it not.

So I put the jar into the lib dir of the apache tomcat's installation dir.
Doing this and run your project both on Eclipse or in the browser, the jar will be retrieved from the lib dir of tomcat instead to be retrieved from the build path.
If in the future I set the build path properly I'll either modify this post or do one new post.

Arduino IDE:


As you can see in the official website, the Arduino IDE has been packaged.
So to install it you only need to type sudo apt-get install arduino into a terminal and voilĂ , your Arduino IDE is ready to be used.
You need only to type arduino in a terminal and it will be asked to insert your user to the dialout group.
Click Add and then type the password.

After you has been inserted into the dialout group you can finally use your Arduino IDE:




At this point I don't need anything else on my new dev-machine.
If I find any other problem and relative solution I'll do another post.

See ya.
Ygy Freezone




Sunday 16 February 2014

apt-get install debian PT3 (MySql)



And finally here we are, installing dbms driver on our Debian machine.

First type this line into a terminal: sudo aptitude -y install mysql-server-5.5

Right after the download of the package it will be ask to insert the mysql root password.



At this point, to test your new MySql db type in a terminal: mysql -u root -p


If you see this line, congratulation! MySql is running on your machine!

Well, now you maybe need a workbench tool to manage your databases.
Type in a terminal: sudo apt-get install mysql-workbench

After the installation, for open your workbench you just type mysql-workbench in a terminal, and you can start manage your DB.




Now, to start developing with Tomcat and Eclipse, you need the jdbc-connector.
Type in a terminal sudo apt-get install libmysql-java , and voilĂ  you have your connector ready to use.



Next time, "how put your jdbc connector on tomcat and eclipse" & "Arduino IDE".
See ya.
Ygy Freezone.



Thursday 13 February 2014

apt-get install debian PT2 (Tomcat 7)

No post for two months and now two post in a day, sometime life if strange.
Until yesterday I cannot be able to install properly Apache Tomcat 7 service and configure it on eclipse environment. Today I've do it almost easily, just to point out the concept that life is strange. 

First of all: you need to put your user into the sudoer list by typing in a terminal the following line: sudo adduser <username> sudo

Then you must log off and again log in.
Now your user have the super user grant when you call the sudo command.

But we are here to talk about install and configure tomcat7.

You must download the tar.gz from the official website , then extract it in one directory at your choice, i choose the standard download directory in my /home/.
Then from the command line move the whole directory in the /usr/lib directory using sudo mv /path/To/apache-tomcat-7 /usr/lib

To start and stop the service now run respectively these two command in terminal: 



  • Start: sudo /usr/lib/apache-tomcat-7.0.50/bin/startup.sh
  • Stop: sudo /usr/lib/apache-tomcat-7.0.50/bin/shutdown.sh
With this method there isn't a single shell script to restart the service, you must instead manually stop and re-start with this two script or, if you are able to do it, write one script by yourself.

At this point if you type http://localhost:8080 on your browser you can see the landing page of tomcat.



Now you need to configure the admin user of the manager-pages of your server.
Open the file /usr/lib/<apache-tomcat dir>/conf/tomcat-users.xml and inside the tag <tomcat-user> put the following line:


<role rolename="manager-gui"/>
<user username="<your user>" password="<your password>" roles="manager-gui,admin-gui"/>

Stop and restart the service, and access the manager app after typing your credential when needed.



From here you can easily deploy your project without using the file manager other than manage session and project.

Configuring Tomcat as server of Eclipse:

You have just install Tomcat in the way that I described above. Now you want to use it on eclipse, right?
Nothing most simple: 
You must go to Windows->preferences->server->Runtime Environment and add your Tomcat server.
Once you have add the server you can try a simple JSP page to test it.

If you do it, remember to stop the tomcat from a terminal window, or eclipse do not take it well and cry like a little girl.


Arrived here you probably ask why I don't install Tomcat from repository.
The answer is simple: apt-get install tomcat7 allows you to use the useful commands service tomcat7 start/restart/stop but divide the tomcat directory in a lot of places, so eclipse can retrieve some of the file that he need to use the server. 
There is a lot of tutorial for fix this problem, but to me no one seems working.


In the next post I'll explain how to install and configure MySql dbms.
Ygy Freezone



Wednesday 12 February 2014

apt-get install debian PT1 (Java jdk & Eclipse)


It's been a long time since my last post, more than two months, I apologize but in this months I change company and I do not have so much time to develop my personal project, I swear ASAP I'll restart my Arduino guide.

In my personal "dev machine" until last sunday I have a development environment based on win-xp, and because, as you can probably know, Microsoft cut every support to it in the nexts month I decided to migrating my dev-laptop on linux, and after some advice from some of my linux-enthusiast friends I choose the Debian distribution.

Is important to know that I am a Win power user, and I don't know almost nothing about Linux and his terminal based management, in fact I come from an environment completely different from it, and because I think this is a good challenge for me and useful for someone else I decided to post this worklog about the installation and configuration of my good-old dev-laptop.


This is what I want on my machine:




The Installation of the new OS:

Coming from a win environment, I don't have really clear in my mind what problem can have a open source system. One of this problem is the lack of open source firmware for some of the hardware in my laptop.
For my specific case the missing firmware was for the wifi antenna and for the Ati Radeon.

To retrieve this firmware and driver after the full basic installation, you need first to modify the repository list in /etc/apt/sources.list

To do this, you must first find the repository that you need.
I use the repository list built from http://debgen.simplylinux.ch/ 

After the update of the repository list, I open a terminal (I do it as root, since my user isn't in the sudoer list and sudo command do not work. I'll add my user in the sudoer in the near future, because I do not feel good to be root every time I use apt-get) and type aptitude.





Aptitude is a package manager, and I find it very useful. 

Using some simply shortkeys you can find everything you want inside the repository.


Aptitude shortkeys:
u -> update list
U (shift + u) -> mark upgradable
/ -> find name packet (n -> next result, shift + n -> previous result)
+ -> install this packet
- -> remove this packet
g -> install/remove


After the installation of the missing firmware/driver, you can choose to change GUI of my Debian, for example KDE.
KDE is not the default gui of debian, so you must install it.
From the terminal type: sudo apt-get install kde-full



I choose to maintain the Gnome GUI style, which is the default gui of debian.



Now you have your system ready, all firmware and driver installed and the gui reflect what you want.
It's time to satisfy your first developer needs (no its neither porn nor coffee).

The Installation of the Java Jdk and Eclipse IDE:


As you can read in the Debian wiki, Debian provides several Java implementations. Each of them have a development environment (JDK) and a runtime (known as JRE, or Java Virtual Machines JVM).

Open the terminal and type sudo aptitude  then search ("/") "?provides(java-runtime)" on your system to list available packages.
I choose to install the latest OpenJDK which is based on the java 7, instead of the default jdk proposed by Debian which is based on java 6.

To install Eclipse, since on the repository i found only old and deprecated version, I choose to download directly from the website the Eclipse IDE for Java EE Developers.

Doing this, exactly like in win, you only need to extract the tar.gz file into a directory and run eclipse.
You can also configure your system in a way he can run eclipse from terminal or from the main menu ad you can see here.
Honestly, the procedure to make possible run eclipse from terminal do not work for me, it give me some error either on root or normal user. I'll study the causes in the future.
Instead the method to create a new menu item is work fine.


Yesterday I tried also to download and install tomcat, with not much success.

So next time: Installing Tomcat 7 and configuring it, associate tomcat to Eclipse and configure it.
Ygy Frezoone.