Vill du veta mer?
Senior System Developer
+46 (0)70-218 00 84
Våra medarbetares bloggar
Configure High-Availability Clustering using TCP Unicast with JBoss EAP 6, HTTPD, mod_cluster on RHEL 6
In my previous blogs I have written about HA in JBoss EAP 6 with Apache Webserver (httpd) and that is all done with UDP multicast. In this blog I will show you how to do it with TCP unicast.
In this example we are going to run all JBoss EAP server on the same machine and we are using standalone mode for simplicity reason. But the same apply if you want to run domain mode.
First configure JGroups to use TCP unicast.
Secondly we need to configure modcluster subsystem in JBoss EAP 6 and set advertise="false" and proxy-list="127.0.0.1:80".
Now lets restart Apache Webserver (httpd) and start two JBoss server. And last you must deploy a clusterable application.
Common JBoss EAP 6 CLI Commands for Managing Domain Clusters
Add Server to ServerGroup
Remove Server from ServerGroup
Manage Server on ServerGroup
How to Set Hostname on RHEL 6
Hostname is usually set when installing the machine, but sometime you need to change it.
To print current set hostname
To temporarily change the hostname.
To permanently change the hostname, edit the /etc/sysconfig/network and set the HOSTNAME property.
After saving the configuration, you will need to reboot your machine.
How to Disable/Enable and SELinux on RHEL 6
On test laptops you are not always interesting in having all security enabled, e.g. when developing or testing a applications. And that is true for SELinux.
To see if SELinux is active
To temporarily disable SELinux - 1 (enable) or 0 (disable).
To permanently disable SELinux, edit /etc/selinux/config and set SELINUX=disabled.
After saving you need to reboot your machine.
How to setup log4j Syslog Appender in JBoss EAP 6
This solution only works for JBoss EAP 6.0.1 and higher
JBoss ships with a own logging framework and which is used via the org.jboss.logging.Logger class. I myself tend to like to use standardized solution, which is for me - log4j.
Log4j ships with some Appenders, but one especially useful for a Linux environment is SyslogAppender. Here I will show you how to setup log4j org.apache.log4j.net.SyslogAppender with JBoss EAP 6.0.1.
Log4j already is shipped with JBoss, so binaries are required for installation. The configuration is either done in standalone.xml or domain.xml.
In the above configuration I'm using a local rsyslog server listening on UDP port 514. The log4j does not have a Syslog Appender that supports TCP. To test this configuration I'm using RHEL 6 and in a default installed RHEL an UDP listener is not default configured. To activate it, open /etc/rsyslog.conf and uncomment the below.
Now restart rsyslog with:
Now start JBoss and watch logging messages in the default log rsyslog message file.
After verified the Syslog Appender, you probably want to separate JBoss logging to a separate file. How to configure that is out of the scoop for this blog, but a simplistic configuration in /etc/rsyslog.conf is:
After modification, restart rsyslog and rsyslog will automatically create the new log file.
How to Install Graphical Printer Configuration Tool on RHEL 6
When installing RHEL 6 with Desktop, you might not get all of the administration tool installed from the beginning. A common tool that is often forgotten is the Printing Configuration tool. To install do the following:
After you can open the printer configuration from System -> Administration -> Printing.
New Apache Wicket Book and Good Starting Point for Newbie
A good starting point for learning new framework is to buy a book about. The problem with books is that they get quite fast out-dated for fast developing framework and that is also true for the Apache Wicket project. But quite recently a new e-book have been published for Apache Wicket 6 and the best thing about it, it is free - http://code.google.com/p/wicket-guide/.
You can get a complete list of all Apache Wicket books here http://wicket.apache.org/learn/books/.
And if you want another book I would recommend Wicket in Action.
Another good starting point is to run the components examples (http://www.wicket-library.com/wicket-examples/index.html) on the Apache Wicket page and read the Reference Wiki pages - https://cwiki.apache.org/WICKET/reference-library.html.
The next step if you have not already done that is to start writing codes. When doing so it is good to knew that there is a very good mailing list group for Apache Wicket, which I recommend to search in, if you get stuck - http://wicket.apache.org/help/.
JBoss DatabaseServerLoginModule with Added Salt and Iteration Count
Today I came by an interesting open source project which extends default JBoss DatabaseServerLoginModule, but with the extra added functionality salted password and iteration count. Enjoy
How to Encrypt Password in JBoss 7 and EAP 6
When using a background process to connect to a server that requires some login, you have the problem to store that password securily. And the problem is that is a background process, that do have a user interaction, which supply the login credential. So the background process needs be given the login credential beforehand. Which rises the problem of storing the password not in clear text.
So how do we achieve that with JBoss 7 and EAP 6? The shipped solution is JBoss Vault. Here follows a link of using it - https://community.jboss.org/wiki/JBossAS7SecuringPasswords. A note of the example, that you might want to consider:
- The key length of 1024 bytes is quite weak, consider using a longer key.
- You probably want to increase the default validity period, with the -validity flag.
"The default implementation of the vault utlizes a Java KeyStore. Its configuration uses Password Based Encryption, which is security by obscurity. This is not 100% security. It only gets away from the problem of clear text passwords in configuration files. There is always a weak link. (As mentallurg suggests in the comments, the keystore password is the weakest link)."
"Ideally, 3rd party ISV robust implementations of Vaults should provide the necessary security."
And maybe the most obvious question is how to make it stronger. And Red Hat answer that also on the same page. Store the keystore on an external USB device which you mount on bootup and then remove it. Or use a stronger third party solution.
How to enable Tree View in File Browse Nautilus in RHEL 6
After installing RHEL 6, the default configuration for browsing files, in the file browser (Nautilius 2.28.4, https://live.gnome.org/Nautilus), is to display catalog as icon. This display have never been my favorite, because it requires a lot of mouse clicking when browsing. A better layout is using the Tree View. To use the tree view, open Nautilius and:
- Open Preferences dialog, by clicking Edit -> Preference. See picture 1.
- In first tab select the lowest option Show only folders
- In the second tab select Always open in browser windows. See picture 2.
If you want more extensions to Nautilius, check out the Nautilius extensions page - https://live.gnome.org/Nautilus/Extending.
How to Handle Character Encoding in JSP and Servlets
When writing simple web application you might not want to bother to use some web framework and simply use simple JSP and Servlet. This has been the case for me recently, but there is of course pitfalls with that as everything else in life. And one of those is to handle character encoding.
In you JSP be sure you use the below encoding settings:
These encoding settings are important if you are planning to pass get parameters in the URL and those parameters might contain character not covered in ISO-8859-1 character table. You should here be aware of how the HTTP work, that it is stateless by design, which means that the server has no way of knowing how to interpret the url-encoded GET parameters, so it assumes ISO-8859-1.
The next gotcha is when I JSP call a Servlet. Here again the server has no way of knowing how to interpret the url-encoded GET parameters, therefore you must explicitly tell the server how to url encode the passed parameters. That is done via the methods.
If you are planning to send direct HTML response from the Servlet, do not forget to set the response content type.
Problem installing Maven 3 on Ubuntu 13.04 Raring
Today I reinstalled my machine with the latest Ubuntu version 13.10 (Raring) and after installation I installed Maven 3, but run into problem.
The following packages have unmet dependencies:
maven : Depends: libwagon2-java (>= 2.2-2) but it is not going to be installed
I searched the official Ubuntu bug report site, https://bugs.launchpad.net/ubuntu/ and found the solution.
How to install IE 8 and 9 on Ubuntu 12.10
To begin with whenever you are searching for information about Ubuntu always start with a recognized site and a recognized site is http://askubuntu.com.
After that said now install IE. To begin with you need to install a platform to run you IE and the successor for Wine is PlayOnLinux (PlayOnLinux website). You install it by using Ubuntu Software Center.
Before installing make sure you have a working Internet Connection.
After successfully installed PlayOnLinux start it and you can install IE by clicking on the Install button from the toolbar and then search for 'Internet Explorer'.
How to install Swedish Spelling Checking on English Ubuntu 12.10
The most popular system language for an operating system is English when working as a system developer, but when it comes to writing document you probably need a local language spelling package. And in me previous blog I have written how to install swedish spelling package for LibreOffice, but with Ubuntu 12.10 there is a better way. Install the spelling checking package as debian package.
Afer installation you need to restart LibreOffice. Then you need to make LibreOffice aware of the the new spelling package. You do that by open Tools -> Options... -> Language Settings -> Writing Aids
Now you can change spelling checking for text or the complete document via Tools -> Language
Certified Hardware on Ubuntu, for example TP-LINK Network Card
I have been getting question about installing different network cards on Ubuntu. And for some week ago I tried to install a network card with Atheros chipset with drivers from http://wireless.kernel.org, but If you are not a very advanced Linux user and do not want to spend a lot of your spare time I would recommend you to by a new network card. Network card are really cheap and maybe the most Linux friendly network card is TP-Link. A TP-Link 1 GB card is really cheap and only cost about 9 EUR or 11 USD (http://www.tp-link.us/products/details/?categoryid=235&model=TG-3269).
To get more information about certified hardware for Ubuntu, please look at the Ubuntu homepage:
Component catalog: http://www.ubuntu.com/certification/catalog/
Certified hardware: http://www.ubuntu.com/certification/
How to Get Rid of the Close Other Tabs Warning in Firefox
Starting with Firefox 16, they added a quite annoying warning dialog when you are trying to close other tabs. What is this? And even when you click on, do not warn me again, nothing happens. But there is a hack to get around it. But should it really be this hacky. Of course not. Any way this is how you fix it.
- Open a new tab and enter about:config.
- Enter in the search field browser.tabs.warnOnCloseOther.
- Now double click on the browser.tabs.warnOnCloseOther row to turn its value to false.
Java SE 6 Reaches End of Life (EOL) in February 2013
Oracle has announced that the end of life (EOL) of Java SE 6 has been set to February 2013. Which means that if you have not already upgraded to Java SE 7, now is the time. You can read more about the Oracle Java SE Support Roadmap here.
And for you folks that think that Java SE 7 is a new thing, well, I'm afraid that you are poorly updated. The Java SE 7 was released in February 2011.
Common apt-get and dpkg commands for Ubuntu (Debian)
If you have graphical interface for Ubuntu, you probably want to run synaptic, but sometime you don't and then it is good to know you Debian packages commands.
Update local cache of available packages
Search after package
Find out if a package is installed
To install package
Get information about installed packaged
How to Install Atheros AR8161 Ethernet Controller on Ubuntu 12.10 (Quantal)
Today I had a hard time to install Atheros AR8161 Ethernet Controller on Ubuntu 12.10 (Quantal). Below I will give you a fast guiding how I did.
First a few words about some common network commands that will help you along the way.
- lspci - list all PCI devices
- lshw - list hardware
- lsmod — program to show the status of modules in the Linux Kernel
- modinfo — program to show information about a Linux Kernel module
- modprobe — program to add and remove modules from the Linux Kernel
For more detailed information, please use the man command, e.g. man lspci.
And here are a few examples of running the above commands.
Now how to solve your network problem. Whenever you have problem always try to solve it by reading the official vendor pages. I know I do the same thing ask google and millions of answer turns up, but not all of them are good. For me, I first tried to install the drivers from compat-wireless, because I was to lazy to install each official ubuntu packages and they turned up to be quite buggy. So always use official stuff, before going into more experimental things.
So lets do it the official way and that is to use http://askubuntu.com. And here the answer comes up http://askubuntu.com/questions/217361/how-do-i-install-drivers-for-the-atheros-ar8161-ethernet-controller-on-64-bit-12. AND PLEASE USE ANSWER 1, the other will lead you astray.
Installing and Using PGP with GNU Privacy Guard (GnuPG) on RHEL 6.3
In this blog I will show you how to use PGP client GNU Privacy Guard (GnuPG) on RHEL 6.3. PGP can be used to encrypt files which can be stored somewhere on remote disc or by sending as attached files.
Installation was quite smooth, except founding the missing dependency package pinentry-gtk, which should be installed automatically.
Test your installation
A simple test to see that GnuPG is installed properly is to ask for each version.
Creating Private Key Pair
The first thing to do, after installation was successful, is to generate the necessary keys used for encrypting and decrypting files. To generate you private key pair, do the following.
Exporting Public Key
To be able to receive encrypted files, you need to export your public key. The text files generated below can be emailed as attachment or more preferable distributed in a more secure way, such as manually handed over via USB memory.
Now you are ready to use GnuPG. A good tutorial guide for the most common usage can be found here http://www.glump.net/howto/gpg_intro.
How to Disable SELinux on RHEL 6.3
SELinux is a good thing, but when sitting on a test machine, you might not be interesting in configure SELinux to have you application running smoothly, without running into SELinux. So here I will show you how to disable SELinux. Remember that this is NOT recommended for a production environment.
First check the current status of SELinux.
Now to disable SELinux. Open /etc/selinux/config and edit the below.
Now restart you system and run sestatus again to verify that you configuration changes had taken affect.Reference
How to Install and Configure Subversion (SVN) on RHEL 6.3
In this blog I will show you how to install and configure Subversion (svn) on Red Hat Enterprise Linux (RHEL) 6.3.
First lets install subversion and apache web server, if you already have installed a apache web server, then leave out the httpd package below.
2.1 Create a new Subversion Repository
Now lets create a new subversion repository named 'demorepo'.
It is highly recommended to have some authentication to your subversion repository. Here I will use simple login using the built in Apache Web Server module mod_auth_basic. The module is per default installed and configured with the RHEL httpd package, we only need to add new users.
2.3 Configure Apache Web Server
Finally we need to configure the apache web server, for our new web location, but also to apply our authentication. We will facilitate the pre-configured configuration file /etc/httpd/conf.d/subversion.conf that comes with the mod_dav_svn package.
Now we only need to restart our apache web server and test our demo subversion repository - http://localhost/svn/demorepo/.
How to Setup and Use Artifactory as Proxy/Mirror for Remote Repositories
In this blog I will discuss and show you how to setup and use Artifactory as proxy (mirror) for remote repositories, such as Central Maven 2 repository or other remote repository, but also using for internal distribution for corporate releases.
First if you have not installed a Artifactory server, start with that. You can read about the installation steps in my previous blog - http://magnus-k-karlsson.blogspot.se/2013/01/how-to-install-artifactory-on-rhel-63.html.
The next step is to create a settings.xml for you company, that uses this newly installed Artifactory server as proxy/mirror. Creating you own settings.xml can be daunting task, but fear not Artifactory can create one for you. Simply open you web browser and open http://192.168.0.3:8081/artifactory/webapp/mavensettings.html. Here we will also select which internal repository we will use for internal distribution. You can create a new, but here we will use the already created repository 'libs-release'.
Then click Generate Settings and save it to ~/.m2/settings.xml. That was not so hard, lets try it out. Before you continue, make sure that you have installed Maven 3. If you are on a RHEL platform, please read my previous blog http://magnus-k-karlsson.blogspot.se/2013/01/how-to-install-maven-3-on-rhel-63.html.
Now lets create a simple project. I will use Apache Wicket Quickstart here, but you can use any maven project. Open http://wicket.apache.org/start/quickstart.html and copy past the maven command to your terminal.
As you can see that maven now request all dependency from you local artifactory server instead from a remote repository. And if you open the artifactory server log you will see that the mirrored remote repository is populated.
Now if everything is working, lets continue by adding a new remote repository. Lets log into artifactory and select the Admin tab and then Repositories from the left menu and add a new remote repository. Here I will use the new JBoss EAP 6 repository, but you can choose any valid remote repository.
Repository Key: jboss-eap-repository
Public Description: JBoss EAP Maven Repository
Includes Pattern: **/*
Checksum Policy: Generate if absent
Max Unique Snapshots: 0
Handle Releases: true
Handle Snapshots: true
Use default for the rest of the settings.
After added, we will add this remote repository to virtual repository remote-repos. The advantage of using virtual repositories, is that we do not need to updated our settings.xml. The remote-repos is already there by default.
Al right. Now lets test it. Lets open up our wicket pom.xml and add the JBoss EAP Java EE Spec dependency.
After editing you pom.xml, lets test it.
And in your artifactory server log.
How to Install Artifactory on RHEL 6.3
In this blog I will show you how to install Artifactory on Red Hat Enterprise Linux 6.3.
Artifactory comes in two flavours:
- Artifactory Open Source - http://www.jfrog.com/home/v_artifactory_opensource_overview
- Artifactory Pro - https://secure.artifactoryonline.com/home/v_artifactorypro_overview
In this blog I will show you how to install the Artifactory Open Source version. So lets get started. First download the latest RPM package from sourceforge - http://sourceforge.net/projects/artifactory/files/artifactory/. Then install it as root.
You can read more about what files are installed and where in the Artifactory Installation Guide chapter RPM Installation - http://wiki.jfrog.org/confluence/display/RTF/RPM+Installation. Or list all installed files with rpm command.
If you want more information about how to work with yum and rpm commands, please read my previous blog - http://magnus-k-karlsson.blogspot.se/2013/01/quickguide-to-most-common-yum-and-rpm.html.
If you are not happy with artifactory, you uninstall it with yum.
Now lest test our Artifactory installation. Lets first start it. After started you can access it from http://your_server_ip:8081/artifactory.
And to login use:
And if you are happy with the installation, you can set the artifactory to start automatically when booting, by reading my previous blog here http://magnus-k-karlsson.blogspot.se/2013/01/how-to-autostart-program-at-bootup.html.
How to Install Maven 3 on RHEL 6.3
In RHEL 6 there is no package for Apache Maven 3 and if you search the official repo you will end up with.
But that package does not contain any maven binaries. So since there is no official package and I do not want to clutter my RHEL installation, by adding custom repositories, we will do it manually. And that is no big thing.
First download the apache maven binaries, I downloaded the zip file. And extract it in /usr/share.
Now "install" it, i.e. create a soft link.
And finally set all needed environment variables in /etc/environment. And for my RHEL 6.3 machine they look like this.
Now test your installation of Apache Maven 3.0.4.
Scanna in QR-Koden
Msc Konsult AB - Blogg
Gemensam MSC blogg
Nu har vi fått upp en gemensam blogg för MSC där vi anställda kan skriva om intressanta saker.
Jag, Henrik Höglund har själv börjat komma igång med Mac nu eftersom det krävs på nya uppdraget. Det är annorlunda och en del är bättre men vi får se om några veckor ifall jag föredrar Mac framför Windows.
Försökte ett litet kort tag med Ubuntu också men av någon anledning funkar inte grafikkortet i min Dell ihop med nya kärnan av linux. Försökte lösa problemet ett bra tag men har inte hittat något som löser det.
// Henrik Höglund