Donnerstag, 18. April 2013

NFS on RedHat based Servers

How to mount a folder on a RedHat based server (client) from an other server (server).

This short blog describe how you can mount a folder from an other unix server with NFS. After the mount process you got read/write access to the mounted folder.

Prerequisite
  • nfs-utils
  • rpcbind (yum install nfs-utils rpcbind)

1. Create a user on both servers with the same UID and Group

To access the mounted directory later on you have to create a user with the same UID on both server, otherwise you can't write to the mounted folder.

useradd testuser -u 1200

2. Settings for the "server" Server

Open "/etc/exports with your favourite text editor from the server.  For each directory you'd like to give access, you have to add the following line. In this example we share the "testFolder" for the client with the IP 10.2.3.4. You can use hostnames, IP's, netmasks and wildcards to identify the client
/tmp/testFolder 10.2.3.4(rw,sync)
After you added the mount points you have to reload your configuration
exportfs -ar
Now we have to start the services 
service rpcbind start
service nfs start
service nfslock start
If you like to have your services started after a reboot, you have to add them to the "chkconfig"
chkconfig --level 2345 rpcbind on
chkconfig --level 2345 nfs on
chkconfig --level 2345 nfslock on

3. Settings for the "client" server

On the client you need to start the following two services. 
service rpcbind start
service nfslock start
chkconfig --level 2345 rpcbind on
chkconfig --level 2345 nfslock on
Now you need to create a folder as a mount point and then mount the NFS Server
mkdir /tmp/myMountFolder
mount -o rw -t nfs 10.0.0.122:/tmp/testFolder /tmp/myMountFolder/
You can easy unmount the mount point
umount /tmp/myMountFolder/
If you like to have your mounts created at startup you can edit "/etc/fstab"
10.0.0.122:/tmp/testFolder   /tmp/myMountFolder/  nfs rsize=8192,wsize=8192,timeo=14,intr 0 0



Montag, 18. Februar 2013

Build your Android App with shell commands

Build your Android app with shell commands for continuous integration tools like Jenkins

Google offers a very smoth way to build your android apk's with shell commands and ant task. These four steps will guide you to get a signed apk in no-time for test distribution.
We at impac use those steps in nightly jenkins jobs which builds our android apps for our continuous integration process.


Prerequisite
  • Installed Android SDK's
  • Installed Android Targets (e.g. 4.0.3, 4.2, ......)
  • Buildable Android App Projekt

1. Create the keystore (if you don't allready have one)

keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
Above command creates the keystore file. You have to follow the prompts in your shell to complete the keygen process. We will use this file later to sign the android apk. You only have to generate the keystore file once.

2. Create the build.xml file

android update project --target <TARGET> --path <PATH> --subprojects
The update project command creates the "build.xml" file which includes all the build informations for the "ant" process. You can specify the <TARGET> version (Android Version) .To list all your installed <TARGET> versions you can call 

android list target

You need to add your project location <PATH>

3. Build the APK with ANT

ant release -Dkey.store=<KEYSTORE-FILE> -Dkey.alias=<KEYSTORE-ALIAS> -Dkey.alias.password=<KEYALIAS-PWD> -Dkey.store.password=<KEYSTORE-PWD>
This ant command builds your apk and signs it with your keystore made in step 1. You could also build a unsigned debug version with "ant debug".
On our release command you have to set the four properties for the keystore.

4. Deliver your APK to testers


The "ant" command creates the "apk" in the "bin/" folder of your project. You can now move your APK to a website or send it via email to your testers.

You could now create a Jenkins job with the steps 2-4 and trigger the job to version control commits. This gives you the possibility to always share your newest build to testers. Step 1 is only needed once and should not be located in a jenkins job.