Saturday, June 23, 2012

Maven Repositories on GitHub - By http://chkal.blogspot.com




http://chkal.blogspot.com/2010/09/maven-repositories-on-github.html

https://github.com/chkal/jsf-maven-util/tree/gh-pages/repository

http://chkal.github.com/jsf-maven-util/repository/

https://help.github.com/articles/user-organization-and-project-pages


The basic idea of hosting Maven repositories on GitHub is to use GitHub Pages. This GitHub feature offers a simple but powerful way for creating and hosting web sites on their infrastructure. Fortunately this is all we need to create Maven repositories.



1
2
3
4
5
$ pwd
/home/ck/workspace/jsf-maven-util
$ cd ..
$ git clone git@github.com:chkal/jsf-maven-util.git jsf-maven-util-pages
$ cd jsf-maven-util-pages



The first step is to create a separate clone of your GitHub repository in a directory next to your primary local repository:


The GitHub Pages web site must be created as a branch named gh-pages in your repository. So lets create this branch and empty it. Refer to the GitHub Pages Manual if you are interested in the exact meaning of these commands.



1
2
3
$ git symbolic-ref HEAD refs/heads/gh-pages
$ rm .git/index
$ git clean -fdx


We will place the Maven repository in a subdirectory of this new branch:



1
$ mkdir repository




We also want to have a pretty directory listing. Unfortunately GitHub Pages doesn't have native support for this. So we will create our own directory listing with a simple bash script.
Create a file named update-directory-index.sh in the root of the new branch (next to therepository directory). This script will walk recursively into the repository directory and createindex.html files in each subdirectory. Please be careful when using this script as it overwrites all exiting index.html files it finds.




1
2
3
4
5
6
7
8
9
#!/bin/bash
 
for DIR in $(find ./repository -type d); do
  (
    echo -e "\n\n

Directory listing

\n
\n
"
    ls -1pa "${DIR}" | grep -v "^\./$" | grep -v "^index\.html$" | awk '{ printf "%s\n",$1,$1 }'
    echo -e "\n\n"
  ) > "${DIR}/index.html"
done




Congratulations! Your repository is ready. Now you will have to modify thedistributionManagement section of your pom.xml to let Maven deploy your artifacts to the new repository. Go back to your primary repository clone and edit your pom.xml:



1
2
3
4
5
6
<distributionManagement>
  <repository>
    <id>gh-pagesid>
    <url>file:///${basedir}/../jsf-maven-util-pages/repository/url>
  repository>
distributionManagement>


Now you are ready to deploy your first artifact to the repository:



1
$ mvn -DperformRelease=true clean deploy


You will see that Maven copies the artifacts to your local checkout of the GitHub Pages branch. After Maven has finished you'll have to update the directory listings, commit the changes made to the repository and push them to GitHub:



1
2
3
4
5
$ cd ../jsf-maven-util-pages/
$ ./update-directory-index.sh
$ git add -A
$ git commit -m "Deployed my first artifact to GitHub"
$ git push origin gh-pages



Now let's check the result. Please note that the first publish may take some time to appear on the web server.
Looks great, doesn't it? :-)
If you want to use your repository in another project, just add the following repository entry to the pom.xml:
?



1
2
3
4
5
<repository>
  <id>jsf-maven-util-repoid>
  <name>jsf-maven-util repository on GitHubname>
  <url>http://chkal.github.com/jsf-maven-util/repository/url>
repository>







Thursday, June 14, 2012

Install Nginx On CentOS 5.5


Installing Nginx

Nginx is not available in the official CentOS repositories, but there's a package for CentOS 5.x in the centos.karan.org testing repository. We enable the repository as follows:
cd /etc/yum.repos.d/
wget http://centos.karan.org/kbsingh-CentOS-Extras.repo
Next we open /etc/yum.repos.d/kbsingh-CentOS-Extras.repo ...
vi /etc/yum.repos.d/kbsingh-CentOS-Extras.repo
... and set gpgcheck to 0 and enabled to 1 in the [kbs-CentOS-Testing] section:
[...]
# pkgs in the -Testing repo are not gpg signed
[kbs-CentOS-Testing]
name=CentOS.Karan.Org-EL$releasever - Testing
gpgcheck=0
gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
enabled=1
baseurl=http://centos.karan.org/el$releasever/extras/testing/$basearch/RPMS/
Afterwards we can install nginx as follows:
yum install nginx
Then we create the system startup links for nginx and start it:
chkconfig --levels 235 nginx on
/etc/init.d/nginx start
Type in your web server's IP address or hostname into a browser (e.g. http://192.168.0.100), and you should see a blank page (it is blank because/usr/share/nginx/html/index.html is empty; nevertheless nginx is working because otherwise it would not have delivered this blank page):

Hosting multiple domains on the same server [DNS questions]

https://www.centos.org/modules/newbb/viewtopic.php?topic_id=24831

Hi,

my question is pretty simple actually but haven't found a clear answer yet so...

Do I need a DNS server to host multiple domains on the same box?

I've always used Plesk and now I'm trying to do without it. So I have a bunch of questions but I'm testing everything on a virtual machine at home so this particular DNS stuff is giving me a hard time.

I would say that adding VirtualHost entries on my httpd.conf would be enough to support multiple domains.


VirtualHost myip:80
DocumentRoot /www/mydomain1
ServerName mydomain1.com



VirtualHost same_ip_as_before:80
DocumentRoot /www/mydomain2
ServerName mydomain2.com



VirtualHost same_ip_as_before:80
DocumentRoot /www/mydomain3
ServerName mydomain3.com



ANSWER:
uote:

wminside wrote:

Do I need a DNS server to host multiple domains on the same box?

But I haven't tested it yet on a regular box. Is this right? I so, why would someone need a DNS server?

In your case no, because you wrote Quote:
I mean, most of my domains are on Enom.com so I use their nameservers. I just have to enter my servers' ips on the Host Records tab.

and 
Quote:
I would say that adding VirtualHost entries on my httpd.conf would be enough to support multiple domains.

you're right about this because you use DNS from your Enom provider.

Some quick guide of important things in httpd.conf don't forget to replace 111.222.333.444 with your IP:

Listen 80
ServerName 111.222.333.444

NameVirtualHost 111.222.333.444:80


and then Virtual Host configuration at the bottom:


ServerName www.example.com
DocumentRoot "/var/www/example.com/htdocs"
ScriptAlias /cgi-bin/ /var/www/example.com/cgi-bin/
# Alias /phpmyadmin/ /var/www/phpmyadmin/


        Options -Indexes
        AllowOverride All
        Order Deny,Allow
        Deny from all



    Options -Indexes
    AllowOverride All
    Order allow,deny
    Allow from all



    Options -Indexes
    AllowOverride All
    Order allow,deny
    Allow from all


RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ http://www.example.com$1 [R=301,L]

ErrorLog /var/log/httpd/error_log
#CustomLog /var/log/httpd/www.example.com_access_log combined env=!gif-image
#AddType text/html .shtml
#AddHandler server-parsed .shtml



Simply copy this and change example.com with your domain names.
Should be working if you set DNS for domains to your IP.

Install JDK 6 in CentOS 5.5




[root@www jvm]# wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2Ftechnetwork%2Fjava%2Fjavase%2Fdownloads%2Fjdk6-downloads-1637591.html;" http://download.oracle.com/otn-pub/java/jdk/6u33-b03/jdk-6u33-linux-x64-rpm.bin


[root@www jvm]# mv jdk-6u33-linux-x64-rpm.bin\?AuthParam\=1339658940_4918ae55fd15b9077dd6590269b247c6  jdk-6u33-linux-x64-rpm.bin


[root@www jvm]# sh ./jdk-6u33-linux-x64-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
  inflating: jdk-6u33-linux-amd64.rpm
  inflating: sun-javadb-common-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-core-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-client-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm
Preparing...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        tools.jar...
        localedata.jar...
        plugin.jar...
        javaws.jar...
        deploy.jar...
Installing JavaDB
Preparing...                ########################################### [100%]
   1:sun-javadb-common      ########################################### [ 17%]
   2:sun-javadb-core        ########################################### [ 33%]
   3:sun-javadb-client      ########################################### [ 50%]
   4:sun-javadb-demo        ########################################### [ 67%]
   5:sun-javadb-docs        ########################################### [ 83%]
   6:sun-javadb-javadoc     ########################################### [100%]

Java(TM) SE Development Kit 6 successfully installed.

Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Oracle products, services and training
* Access to early releases and documentation

Product and system data will be collected. If your configuration
supports a browser, the JDK Product Registration form will
be presented. If you do not register, none of this information
will be saved. You may also register your JDK later by
opening the register.html file (located in the JDK installation
directory) in a browser.

For more information on what data Registration collects and
how it is managed and used, see:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html

Press Enter to continue.....


Done.

[root@www jvm]# rpm -Uvh jdk-6u33-linux-amd64.rpm
Preparing...                ########################################### [100%]
        package jdk-1.6.0_33-fcs.x86_64 is already installed

# sh ./jre-6u30-linux-i586-rpm.bin
# alternatives --config java
There are 2 programs which provide 'java'.
  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
   2           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
Enter to keep the current selection[+], or type selection number:

Note number of versions, N, and use N+1 (if there is no output from the previous command, just imagine that N=0) - For example, if 2 versions were installed then:
# alternatives --install /usr/bin/java java /usr/java/latest/bin/java 3
# alternatives --config java
There are 3 programs which provide 'java'.
  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
   2           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
   3           /usr/java/latest/bin/java
Enter to keep the current selection[+], or type selection number: 3
# java -version
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30)
Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)



For jre;

export JAVA_HOME="/usr/java/jre1.6.0/bin"
export JAVA_PATH="$JAVA_HOME"
export PATH="$PATH:$JAVA_HOME"

For jdk;

export JAVA_HOME="/usr/java/jdk1.6.0/jre/bin"
export JAVA_PATH="$JAVA_HOME"
export PATH="$PATH:$JAVA_HOME"


When done creating or editing the file type; 

source /etc/profile.d/java.sh

Now any user root or other wise should be able to use the command;

which java

and the results should read something like;

/usr/bin/java


PS: If you want to load the environment variables within java.sh without having to restart the machine, you can use the source command as in:
$> source java.sh


Installing Maven On CentOS


http://key2start.wordpress.com/2011/04/05/maven-on-centos/

These are the simple sequences for making maven work on a CentOS machine.

Pre-requisite : Java to be installed, check using java -version

1. Download the current maven version from the prescribed repository, http://maven.apache.org/download.html. I use to work with maven version 2.0.11 and hence downloaded using,

> wget http://www.eng.lsu.edu/mirrors/apache//maven/binaries/apache-maven-2.0.11-bin.tar.gz

Please wait while it is downloaded as a tar archive.

2. Extract the archive to the desired maven home directory, which can be a common, /usr/local/

So move the downloaded apache-maven-2.0.11-bin.tar.gz to /usr/local/ path using mv command or a short way can be use the wget command told before after going to the /usr/local/ path. Any way no issues..

> mv apache-maven-2.0.11-bin.tar.gz /usr/local

> cd /usr/local

> tar -zxvf apache-maven-2.0.11-bin.tar.gz

This will extract the apache-maven-2.0.11 directory into /usr/local/

3. Create sym link..

> ln -s apache-maven-2.0.11 maven

4. Open ~/.bashrc file with vi ~/.bashrc and add the following lines to the end of the file,

export M2_HOME=/usr/local/apache-maven-2.0.11
export PATH=${M2_HOME}/bin:${PATH}

5. AT last execute the environment changes with the command,  

> . ~/.bashrc

Check the installation with,

> mvn -version

Create Rackspace DNS

http://www.rackspace.com/knowledge_center/DNS_-_Creating_a_DNS_Record


Article Id: 80 | | Article


Creating DNS records for your domain is easy to do within the Cloud Server Control Panel. In this article, we will look at creating a DNS zone for your domain and adding basic A, MX, and CNAME records using the Cloud Server Control Panel.

Contents

Log In

The first thing we have to do is log into the Cloud Server Control Panel which can be found athttps://manage.rackspacecloud.com.

DNS Panel

When you log in, navigate to your Cloud Server overview page, by selecting Hosting > Cloud Servers.
Cloud Control Panel Menu
This opens an overview page of your Cloud Servers. Click on the link for your Cloud Server. Next, click on the DNS tab at the top. This is where you will modify your DNS records.

Adding a Domain

The first step in setting up DNS is to add your domain. Click on the Add button. In the window that appears type your domain name in the Domain Name field. Do not enter www or anything like that. Press OK when you are done.

Adding an A Record

Now we need to add our first A record to the domain. Click on the domain in the Domain Management screen.
Click on the Add button to add our first record — a new window should appear. In this screen you will enter several pieces of information. For our example, A record we will be creating the contosso.com A record and pointing it to the IP of 12.34.56.78. Use the list below to help you fill them in:
·       Name - This is the fully qualified domain name. If you are creating a domain such as contosso.com you will enter contosso.com.
·       Content - For an A record this is going to be the IP address of the server. Enter 12.34.56.78.
·       TTL - This is the Time-To-Live value for the record. You may enter any value you want but we recommend using 300 (seconds).
·       Type - This is the record type. Leave it set to A.
Press the OK button to save your record.
You will see an A record listed for contosso.com pointing to 12.34.56.78.

Adding an MX Record

Now we would like to add an MX record so users of that domain can receive e-mail. For our example, we will set our MX record to mail.contosso.com. The creation process is just like it is with an A record but we need to modify the values below:
·       Name - This should match your domain. Set this to contosso.com.
·       Content - This is what your MX record will point to. Set this to mail.contosso.com.
·       Priority - This sets the priority of your MX record. For your first record set it to 10. Subsequent records will have 20, 30, 40, etc.
·       TTL - Set your Time-To-Live value to 300.
·       Type - Set your record time to MX.
Press the OK button to save your record.
You will see an MX record listed for contosso.com pointing to mail.contosso.com.

Adding a CNAME Record

Now we would like to add a CNAME record for www.contosso.com and point it to contosso.com. This will make it so people who go to contosso.com in their web browser will be able to find our website.
Click the Add button again and follow the same procedure. Use the information below to help you fill out the fields:
·       Name - This should be set to www.contosso.com.
·       Content - This should be set to the location where your CNAME should point. Enter contosso.com here.
·       TTL - Set this to 300 seconds.
·       Type - Set the type to CNAME.
Press OK and the record will be added.
You will see the new CNAME record added.
If you used your own domain for mail (like mail.contosso.com), you should also add a CNAME entry for mail.contosso.com that points to contosso.com.

Deleting a Record

If you made a mistake and would like to delete a record, clickthe check box to the right of the record and click the Delete button at the top. Accept the confirmation and the record will be deleted.

Deleting a Domain

If you would like to delete your domain entirely (and all records) you need to be in the Domain Management screen. This is the first tab you come to when you click on the DNS tab in your Cloud Server. Click on the check box to the right of the domain and click Delete at the top. Accept the confirmation and the domain will be deleted.

What are the DNS servers for my Cloud Server?

·       dns1.stabletransit.com
·       dns2.stabletransit.com
© 2011-2012 Rackspace US, Inc.

Friday, May 25, 2012

Get started on cloudfoundry.me


How to Install Ruby and RubyGems

http://docs.cloudfoundry.com/frameworks/ruby/installing-ruby.html#windows

Windows

Download and install Ruby Installer for Windows. The installer already includes RubyGems.

Be sure you use the Ruby-enabled command prompt window when you later install and use vmc. You access this command prompt from the Windows Start menu (All Programs > Ruby > Start Command Prompt with Ruby).

Finally, update RubyGems from the Ruby Command Prompt:

prompt> gem update --system

ruby 1.9.3p194 (2012-04-20) [i386-mingw32]

C:\Users\Thai Hau>gem update --system
Updating rubygems-update
Fetching: rubygems-update-1.8.24.gem (100%)
Successfully installed rubygems-update-1.8.24
Installing RubyGems 1.8.24
RubyGems 1.8.24 installed

== 1.8.24 / 2012-04-27

* 1 bug fix:

  * Install the .pem files properly. Fixes #320
  * Remove OpenSSL dependency from the http code path


-------------------------------------------------------------

RubyGems installed the following executables:
        D:/Ruby193/bin/gem

RubyGems system software updated

Installing vmc: Procedure
http://docs.cloudfoundry.com/tools/vmc/installing-vmc.html#installing-vmc-procedure

On Windows, open a command prompt in which Ruby is enabled and execute the following:

prompt> gem install vmc
Execute the vmc target command to specify the Cloud Foundry target to which you will deploy your applications:

To deploy on the PaaS Cloud Foundry, specify api.cloudfoundry.com
To deploy on your local Micro Cloud Foundry, specify api..cloudfoundry.me, where appname is the domain you registered for your application at the Micro Cloud Foundry Web site. See Installing Micro Cloud Foundry.
The following command targets the PaaS Cloud Foundry:

prompt$ vmc target api.cloudfoundry.com
To determine your current target, execute the `vmc target` command without any parameters:
prompt$ vmc target
Login using the user credentials you received via email after you registered with Cloud Foudnry. Your username is typically your email address.
prompt$ vmc login
Ensure you have successfully logged in by retrieving information about your account:
prompt$ vmc info
Change your password:
prompt$ vmc passwd
View the full list of VMC commands, along with their parameters and a brief description, by executing the vmc help command:
prompt$ vmc help
You have now successfully installed vmc and run a few basic commands.

Sunday, May 20, 2012

How can git be installed on CENTOS 5.5?




From source? From the repos? The easiest way is to use the repos: sudo yum install git should do it.
If you want to install from source, you can try these instructions. If you have yum-utils installed it's actually easier than that, too**:
sudo yum build-dep git
wget wget http://kernel.org/pub/software/scm/git/.tar.gz
tar -xvjf .tar.gz
cd 
make (possibly a ./configure before this)
sudo make install
**Substitute the portions enclosed in <> with the paths you need. Exact procedure may vary slightly as I have not compiled git from source, personally (there may be a configure script, for example). If you have no idea what I'm talking about, then you may want to just install from the repo as per my first suggestion.




[root@www local]# sudo yum install git
Loaded plugins: fastestmirror, priorities
Determining fastest mirrors
 * base: mirrors.serveraxis.net
 * extras: mirror.steadfast.net
 * jpackage-generic: sunsite.informatik.rwth-aachen.de
 * jpackage-generic-updates: sunsite.informatik.rwth-aachen.de
 * rpmforge: mirror.us.leaseweb.net
 * updates: mirror.wiredtree.com
addons                                                   | 1.9 kB     00:00
addons/primary_db                                        | 1.1 kB     00:00
base                                                     | 1.1 kB     00:00
base/primary                                             | 1.2 MB     00:00
base                                                                  3591/3591
extras                                                   | 2.1 kB     00:00
extras/primary_db                                        | 177 kB     00:00
jpackage-generic                                         | 2.3 kB     00:00
jpackage-generic/primary_db                              | 1.0 MB     00:01
jpackage-generic-updates                                 | 2.3 kB     00:00
jpackage-generic-updates/primary_db                      |  12 kB     00:00
rpmforge                                                 | 1.9 kB     00:00
rpmforge/primary_db                                      | 6.8 MB     00:04
updates                                                  | 1.9 kB     00:00
updates/primary_db                                       | 376 kB     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
--> Processing Dependency: git = 1.7.6.1-1.el5.rf for package: git-daemon
--> Processing Dependency: git = 1.7.6.1-1.el5.rf for package: perl-Git
---> Package git.x86_64 0:1.7.10.1-1.el5.rf set to be updated
--> Running transaction check
---> Package git-daemon.x86_64 0:1.7.10.1-1.el5.rf set to be updated
---> Package perl-Git.x86_64 0:1.7.10.1-1.el5.rf set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch          Version                  Repository       Size
================================================================================
Updating:
 git               x86_64        1.7.10.1-1.el5.rf        rpmforge        8.0 M
Updating for dependencies:
 git-daemon        x86_64        1.7.10.1-1.el5.rf        rpmforge        317 k
 perl-Git          x86_64        1.7.10.1-1.el5.rf        rpmforge         28 k

Transaction Summary
================================================================================
Install       0 Package(s)
Upgrade       3 Package(s)

Total download size: 8.3 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): perl-Git-1.7.10.1-1.el5.rf.x86_64.rpm             |  28 kB     00:00
(2/3): git-daemon-1.7.10.1-1.el5.rf.x86_64.rpm           | 317 kB     00:00
(3/3): git-1.7.10.1-1.el5.rf.x86_64.rpm                  | 8.0 MB     00:00
--------------------------------------------------------------------------------
Total                                           6.4 MB/s | 8.3 MB     00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : git                                                      1/6
  Updating       : perl-Git                                                 2/6
  Updating       : git-daemon                                               3/6
  Cleanup        : git-daemon                                               4/6
  Cleanup        : perl-Git                                                 5/6
  Cleanup        : git                                                      6/6

Updated:
  git.x86_64 0:1.7.10.1-1.el5.rf

Dependency Updated:
  git-daemon.x86_64 0:1.7.10.1-1.el5.rf   perl-Git.x86_64 0:1.7.10.1-1.el5.rf

Complete!