CentOS Grails installation tutorial for newbs – CentOS 6.x

centos grails

centos grails installation tutorial for newbs. for CentOS 6.x (And probably for older/later)

 

Prerequisities

You have to install Groovy (which require JDK). If you don’t have Groovy (And JDK) installed follow those instructions.

  • Java SDK 1.4+ for Grails 1.0.x and 1.1.x
  • Java SDK 1.5+ for Grails 1.2 or greater (For this tutorial make sure you have JDK 1.5+ installed)

 

Install Grails

Option 1: Using GVM (Recommended)

If you’ve installed groovy using GVM, you can use the GVM to install grails too. use:

gvm install grails
centos grails

centos grails

Option 2: Manual Installation

We’d go by the official Grails manual:

The folder we’ll install Grails is: /usr/grails, but you can choose any other as you like.

Init Folder

cd /usr
mkdir grails
cd grails

Here we’ll put the grails files by version.

Visit the download page to get the latest version. as for now it’s 2.3.7

wget http://dist.springframework.org.s3.amazonaws.com/release/GRAILS/grails-2.3.7.zip
unzip grails-2.3.7.zip
rm grails-2.3.7.zip

Install wget & unzip if you don’t yet have them install by: yum install wget unzip

add the following to your ~/.bash_profile or ~/.bash_rc (or wherever you init your user environment):

# grails
export GRAILS_HOME=/usr/grails/grails-2.3.7
export PATH=$PATH:$GRAILS_HOME/bin

That’s it

Option 3: Using GIT

If you want to be updated with latest patches (and bugs) you can clone the git repo.

Prerequisities: you should have JDK installed, your JAVA_HOME set and GIT installed (yum install git).

For the 2.0.x and the ‘master’ branch:

cd /usr
git clone https://github.com/grails/grails-core
cd grails-core && ./gradlew install

and set your GRAILS_HOME in the ~/.bash_profile (or ~.bash_rc):

# grails
export GRAILS_HOME=/usr/grails-core
export PATH=$PATH:$GRAILS_HOME/bin

If you want to install older branch read here.

 

Testing grails

Type at command:

grails --version

You should get something like this output (depend on version)

grails-version

 

That’s It! you have centos grails installed.

Cheers!

CentOS Groovy installation tutorial for newbs – CentOS 6.x

CentOS Groovy

CentOS Groovy installation instruction for newbs.

 

Prerequisities

JDK

To install Groovy you have to install the JDK. If you don’t have JDK installed yet follow those instructions by RaveMaker.

 

Groovy Installation

There are several mothods (as always) to install groovy into your CentOS box.

 

Option 1: GVM

The simplest is using the GVM, tool for managing parallel Versions of multiple Software Development Kits on most Unix based systems. It provides a convenient command line interface for installing, switching, removing and listing Candidates.

GVM is a powerful tool to install Candidates and switch between them (on current terminal, or by default). reading the full intro to GVM is recommended.

to install GVM use the command:

curl -s get.gvmtool.net | bash

This will quickly install GVM into your system

gvm-install

Run the following command as required or log again to the system, as GVM is adding this line to your ~/.bash_profile file:

source "/root/.gvm/bin/gvm-init.sh"

which should return nothing. now you are ready to install groovy by:

gvm install groovy
centos groovy install

centos groovy install

Notes:

  • This will installed groovy version 2.2.2. you can use GVM to install specific groovy version, or multiple versions (read the manual).
  • GVM will create the ~/.gvm directory with all the assets inside (~/.gvm/groovy/2.2.2).

that’s it.

 

Option 2: Manual Installation

It’s always recommended to manually install every peace of code to fully understand what going on there. Following the official installation guide,

Download binary

Download binary for groovy from the download page (check if there is newer version, or specific version you need other then 2.3.0-beta-2 shown here):

cd /usr
mkdir groovy
cd groovy
wget http://dl.bintray.com/groovy/maven/groovy-binary-2.3.0-beta-2.zip
unzip groovy-binary-2.3.0-beta-2.zip
rm groovy-binary-2.3.0-beta-2.zip

This will create a /usr/groovy/groovy-2.3.0-beta-2 folder with the files packed inside.

* If you don’t have wget installed use then ‘yum install wget’ command to install it.
* If you don’t have unzip installed use then ‘yum install unzip’ command to install it. 

TIP

Create a symlink to that folder named ‘latest’ which you can change later when you’ll update your groovy installation without the need to update the environment variables.

ln -s groovy-2.3.0-beta-2 ./latest

Set-up environment

Last thing you need is to:

  • set your GROOVY_HOME environment variable to the directory you unpacked the distribution
  • add GROOVY_HOME/bin to your PATH environment variable

Edit your ~/.bash_profile file and append the following lines:

# Groovy
export GROOVY_HOME=/usr/groovy/latest
export PATH=$PATH:$GROOVY_HOME/bin

or, if you didn’t created the latest symlink, use:

# Groovy
export GROOVY_HOME=/usr/groovy/groovy-2.3.0-beta-2
export PATH=$PATH:$GROOVY_HOME/bin

 

Test Groovy

groovy -e ‘println(“Hello, World!”)’

centos groovy

centos groovy

 

And that’s it! You have Groovy Installed.

Cheers!,

 

grails-logo    Do you need Grails framework for Groove? Read my walkthrough tutorial.

 

CentOS golang Installation Instructions – for CentOS 6.x

CentOS golang

CentOS golang Installation Instructions – for CentOS 6.x.
In the following tutorial I’ll show how to install and run “Hello, world!” script with golang on CentOS 6.x

 

CentOS golang Installation Instructions – for CentOS 6.x

Install EPEL

If you haven’t install EPEL repository yet, you’ll need it now. follow those instructions.
If you want newer versions of golang you might want to try the hop5.in repository but I haven’t tried.

 

Install golang

Simple as:

yum install golang

you may want to install hg also, you’ll probably will need it later for the ‘go get’ command:

yum install hg

 

Hello, World!

create a file named ‘hello.go’ and fill it with:

package main
import "fmt"
func main() {
     fmt.Println("Hello, World!")
}

run the script using:

go run hello.go
centos-golang

centos-golang

You can first build to a binary executible with:

<div class="codecolorer-container text railscasts" style="overflow:auto;white-space:nowrap;width:555px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer">go build hello.go</div></td></tr></tbody></table></div>

and then run with:

<div class="codecolorer-container text railscasts" style="overflow:auto;white-space:nowrap;width:555px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer">./hello</div></td></tr></tbody></table></div>

 

$GOPATH

The ‘Hello, World!’ is a very basic example, but in real-world you may need to install packages and libraries for more complex applications.

The $GOPATH environment variable specifies the location of your workspace. It is likely the only environment variable you’ll need to set when developing Go code.

If your project for example is located at $HOME/go, you should create a variable like:

export GOPATH=$HOME/go

For convenience, add the workspace’s bin subdirectory to your path:

export PATH=$PATH:$GOPATH/bin

Now, your project environment variables are set and you can download packages with the simple command: (for example – the Google OAuth 2.0 library)

go get code.google.com/p/goauth2/oauth

 

What’s next

Web Applications using Go

  • Writing Web Applications tutorial.
  • Bones – A project template for Go webapps.
  • Gorilla web toolkit.
  • Revel – A high-productivity web framework for the Go language. Deploy Revel.
  • Martini – Classy web framework for Go.
  • sawsij – lightweight, open-source web framework for building high-performance, data-driven web applications.

Template Engines for Go

Web Applications in Production

 

 

That’s it!, Cheers!

CentOS Clojure / Leiningen / Luminus / http-kit Installation and sample tutorial

CentOS Clojure

CentOS Clojure installation and sample tutorial.
In the following post I’ll show how to install and configure Clojure on you CentOS box with sample web server example.

Also,, weI’ll use leiningen for manage the Clojure app and http-kit for deployment.

 

CentOS Clojure Installation

First, Clojure requires only Java 1.5 or greater, if you don’t have the JDK installed yet on your CentOS box please follow this instructions by ItekBlog writer – Adam to install Oracle Java on your CentOS box.

Download Clojure

Before you continue, check the Downloads page to install the latest version.

To download Clojure use:

# if you don't have wget installed - use: yum install wget
# if you don't have unzip installed - use: yum install unzip
cd /opt
wget http://repo1.maven.org/maven2/org/clojure/clojure/1.5.1/clojure-1.5.1.zip
unzip clojure-1.5.1.zip
rm clojure-1.5.1.zip

to bring up a simple read-eval-print loop (REPL) use:

cd clojure-1.5.1
java -cp clojure-1.5.1.jar clojure.main

try:

user=> (+ 1 2 3)
6
user=> (javax.swing.JOptionPane/showMessageDialog nil "Hello World")

Try Clojure Online

  • TryClojure provides a brower-based Clojure REPL
  • Himera provides a browser-baed ClojureScript REPL

Community Resources

Community volunteers maintain Getting Started documentation for a number of different tools and approaches.

 

Leiningen

Leiningen is the easiest way to use Clojure. With a focus on project automation and declarative configuration, it gets out of your way and lets you focus on your code.

Installing Lieningen

to install Lieningen you need to download the lein script place it on your $PATH (eg. ~/bin) and set it to be executable:

cd ~/bin
wget https://raw.github.com/technomancy/leiningen/stable/bin/lein
chmod a+x ~/bin/lein

you can read the tutorial by running lein help tutorial.

The tutorial is the best place to start. It does not cover learning the language itself; good Clojure documentation can be found.

Running lein help faq will get you the FAQ. Documentation for each individual task is available via lein help $TASK. You can also see the sample project.clj file containing a reference of most project settings by running lein help sample.

 

Creating a Project

Creating a new project is easy:

cd ~/
lein new app my_first_app
cd my_first_app
find .

In this example we’re using the 

1
app

 template, which is intended for an application project rather than a library. Omitting the app argument will use the default template, which is suitable for libraries.

Directory Layout

The output of the find command is:

leiningen_find

Here you’ve got your project’s README.md file, .gitignore file for you all GIT users, a src/ directory containing the code, a test/ directory, and a project.clj file which describes your project to Leiningen. The src/my_stuff/core.clj file corresponds to the my-stuff.core namespace.

Running Code

let’s start our code running:

lein run

 

centos clojure

centos clojure

 

For extended information and documentation about Leiningen and the REPL Read here.

 

FAQ: Set LEIN_ROOT to disable this warning.

leiningen_error

 

If you want to run LEIN using root, you should add to your ~/.bash_profile :

export LEIN_ROOT="Something"

rem

ember to touch the file:

. ~/.bash_profile

 

Frameworks

Luminus

Luminus is a micro-framework based on a set of lightweight libraries. It aims to provide a robust, scalable, and easy to use platform. With Luminus you can focus on developing your app the way you want without any distractions.

create a new project:

    lein new luminus myapp
    cd myapp
    lein ring server

the app is now available at 

1
localhost:3000

luminus-welcome

 

Clojure Deployment

When you’re ready to deploy your app, you have many web servers such as: nginx, http-kitimmutant, tomcat, JBossPallet, GlassFish, Jetty, Netty, Grizzly, etc.

 

using nginx

You can use nginx-clojure to run your clojure project inside of nginx server.

In Clojure web server benchmarks, this server achieved the highest performance.

20140121-14-30

read this tutorial for more information about nginx/clojure implementation.

 

using Tomcat

To install Tomcat server follow those steps.

You need to package the application as a WAR archive, to do that run:

lein ring uberwar

then simply copy the resulting myapp-0.1.0-SNAPSHOT-standalone.war to the webapps folder on Tomcat, eg:

cp target/myapp-0.1.0-SNAPSHOT-standalone.war ~/tomcat/webapps/myapp.war

Your app will now be avaliable at the context /myapp when Tomcat starts. To deploy the app at root context, simply copy it to webapp as ROOT.war.

 

HTTP Kit – HTTP client/server for Clojure

HTTP Kit is a minimalistefficientRing-compatible HTTP client/server for Clojure. It uses a event-driven architecture to support highly concurrent a/synchronous web applications. Feature a unified API for WebSocket and HTTP long polling/streaming

<div class="codecolorer-container text railscasts" style="overflow:auto;white-space:nowrap;width:555px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer">          [http-kit "2.1.16"] ; Add to your project.clj.</div></td></tr></tbody></table></div>

Check this great example of a websockets app with Clojure and http-kit.

 

That’s It!

 

Cheers!,

CentOS PostgreSQL Installation Tutorial – (Centos 6.x)

CentOS PostgreSQL Installation tutorial

CentOS PostgreSQL

centos postgresql :

PostgreSQL is a powerful, open source object-relational database system.
In the following tutorial I’ll show how to install PostgreSQL on your CentOS box

 

CentOS PostgreSQL Installation

We can install PostgreSQL in (at-least) two ways:

  • Using YUM
  • Compile from source

 

Install from repository

yum install postgresql-server
this will install the package postgresql-server, also: postgresql and postgresql-libs.
centos postgresql

centos postgresql

Install from source

If you want to install the latest version of PostgreSQL you should compile from source. it’s recommended for advanced users and one may argue it’s recommended too for production.

Anyway, this article from DigitalOcean covers this area well (and more). If you want to compile using source you better move to that article. If you prefer or installed using repository (yum), continue…

 

PostgreSQL Service

if you’ll try to start PostgreSQL using the service command, you will see an error tells you must init the db first and create the db files in: /var/lib//pgsql/data

posgresqlerror

so,

to init on centos postgresql service use:

service postgresql initdb

posgreinit

This created a data folder in /var/lib/pgsql. You can’t run this command again without deleting first this folder (and all your data).

Also, when you called the initdb command above from RedHat’s init script configured permissions on the database. These configuration settings are in the pg_hba.conf file inside the data folder.

By default all permissions are ‘Ident’,

pgsql-ident

means the only user that can get in initially is user “postgres”, so if you’ll try ‘psql’ from root you’ll get error:

psql: FATAL: Ident authentication failed for user “root”

If you want to login and use postgres with other users than `postgres` you can change the permissions method in pg_hba.conf. change from ‘ident’ to ‘md5’ is recommended.

If you want to use phpPgAdmin (described later) you should change from ‘Ident’ to ‘md5’ or else it won’t login to your system.

 

Set port and Listen Addresses

If you need to change the default port (5432 by default) and Listen Addresses (localhost by default), you can set those vars inside the postgresql.conf inside /var/lib/pgsql/data folder.

#listen_addresses = 'localhost'
#port = 5432

 

Start service

and then, to start on centos postgresql service use:

service postgresql start

postgrestart

to make centos postgresql load on boot use the chkconfig command as follows:

chkconfig postgresql on

 

and That’s it!

 

What next?

 

Managing from Command line

login to postgres

As I mentioned, default setup has ident authentication means the only user that can get in initially is user “postgres”, so if you haven’t changed permissions scheme you should su to postgres before.

to start ‘psql’ as postgres:

# change user to postgres
su - postgres
# start psql manager
psql
# CTRL + D twice to exit both psql and su.

# You can also short the two commands into:
# su postgres -c psql

Add (or create) a user with permission to specific database?

Read this great tutorial.

 

PhpPgAdmin

PostgreSQL visual interface similar to phpMyAdmin? – in short, if you know phpMyAdmin and want phpPgAdmin, you need to add the EPEL repositories, Apache (yum install httpd) and then install using:

If your permissions scheme is currently ‘Ident’ you might need to change that to ‘md5’ as PhpPgAdmin requires it.

yum install phpPgAdmin

Then visit in your browser: http://localhost/phpPgAdmin

centos phppgadmin
centos phppgadmin

Remote connection

Edit /etc/httpd/conf.d/phpPgAdmin.conf if you want to allow access remotly and restart httpd (service httpd restart).

do you use pgsql, postgres, root, administrator as login or even user without password?
if you do, set the $conf[‘extra_login_security’] entry to false in your et/phpPgAdmin/config.inc.php.

 

Change default Postgres user password

If you really want to use the “postgres” role, make sure you set it up a password and $conf[‘extra_login_security’] is false.

use the command:

passwd postgres

to change the system user password and

ALTER USER Postgres WITH PASSWORD 'password';

That alters the password for within the database. To change the password inside Postgresql. there is also short code (inside psql):

\password

Which will ask from you a new password to set.

 

 

Cheers!

Linux ACL Permissions

Overview

“Access Control List (ACL) provides an additional, more flexible permission mechanism for file systems.
It is designed to assist with UNIX file permissions.
ACL allows you to give permissions for any user or group to any disc resource.” (Wikipedia)

Enable ACL on file system

Most likely is that the ACL option is already enabled on your file system but to be sure you can verify using the next command:

#make sure to replace sda2 with the name of your device
tune2fs -l /dev/sda2 | grep options

The output should be:

Default mount options:    user_xattr acl

In order to enable ACL on a file system use tune2fs command:

#make sure to replace sda2 with the name of your device
tune2fs -o acl /dev/sda2

View Linux ACL Permissions

ls command

With ls command you can see if there are any ACL permissions on a file, you will see a ‘+’ sign:

ls -l /folder-file

#Output:
-rw-rwxr--+ 1 root root 0 Mar 15 05:27 folder-file

Now we use getfacl command to see the ACL permissions.

getfacl command

You can use getfacl to view the current ACL permissions of a file or folder.

getfacl /folder-file

#Output
# file: folder-file
# owner: root
# group: root
user::rw-
user:nfsnobody:rwx
group::r--
mask::rwx
other::r--

setfacl command

#setfacl -m u:username:permissions /folder-file
setfacl -m u:bob:rwx /folder-file

#setfacl -m u:uid:permissions /folder-file
setfacl -m u:12345:rwx /folder-file

#setfacl -m g:groupname:permissions /folder-file
setfacl -m g:company:rx /folder-file

#setfacl -m g:gid:permissions /folder-file
setfacl -m g:12345:rx /folder-file

Remove all ACL permissions:

setfacl -b

Remove a specific ACL entry by username, uid, group or gid:

setfacl -x "bob"

Enjoy!

Test firewall with netcat

Overview

“The nc (or netcat) utility is used for just about anything under the sun involving TCP, UDP, or UNIX-domain sockets.
It can open TCP connections, send UDP packets, listen on arbitrary TCP and UDP ports, do port scanning, and deal with both IPv4 and IPv6. Unlike telnet nc scripts nicely, and separates error messages onto standard error instead of sending them to standard output, as telnet does with some.” (NetCat Manual)

You can use netcat to listen on any available port and connect to it from a remote client, this way you can test that the firewall actually allows you to pass.

netcat installation

On CentOS you just need to use:

yum install nc -y

Test firewall with netcat

netcat server

Run netcat server on port 12345:

nc -v -l 12345

You should receive a blank line.
During connection you will see “Connection from 10.0.0.2 port 6666 [tcp/ircu-2] accepted” and whatever you write on the server will appear on the client.

netcat client

Connect to port 12345 on a remote server 10.0.0.1:

nc 10.0.0.1 12345

You should receive a blank line and whatever you write on the client will appear on the server.

netcat man page

Enjoy!

chmod suid sgid sticky bit

Overview

Linux chmod has a few options that can make your life a lot easier when managing a shared storage.
The most needed are chmod suid sgid sticky bit.
Also the impact of each one is different between files and folders.

chmod suid sgid sticky bit

SetUID and SetGID

SUID (SetUID) and SGID (SetGID) has different affects when used on files or on folders.

suid and sgid on files

When suid is set on an executable that means the file will run with the owner user permissions when run by a different user.
When used you will have the letter ‘S’ specified in the files permissions.
When you will have a lower-case ‘s’ that means it hides the permission ‘x’ of user so it means ‘t+x”

Apply SUID on ‘run.sh’:

chmod u+s run.sh

Apply SUID with 777:

chmod 4777 run.sh

Output SUID with 777:

-rwsrwxrwx.

Output SUID with 677:

drwSrwxrwx.

When sgid is set on an executable that means the file will run with the owner groups permissions when run by a different user.
When used you will have the letter ‘S’ specified in the files permissions.
When you will have a lower-case ‘s’ that means it hides the permission ‘x’ of group so it means ‘t+x”

Apply SGID on ‘run.sh’:

chmod g+s run.sh

Apply SGID with 777:

chmod 2777 run.sh

Output SGID with 777:

-rwxrwsrwx.

Output SGID with 767:

drwxrwSrwx.

suid and sgid on folders

suid and sgid on folders means inherit permissions for newly created files.
sgid will set the owner group permission of all new files the same as folders owner group.

Linux ignores the suid permission on folders.

Sticky-Bit

“When the sticky bit is set, only the item’s owner, the directory’s owner, or the superuser can rename or delete files.” (Wikipedia)

Sticky_bit is mostly applied to folders, it has a few uses on files but that not in the scope of this tutorial.

When used you will have the letter ‘T’ specified in the folders permissions.
When you will have a lower-case ‘t’ that means it hides the permission ‘x’ of others so it means ‘t+x”

Output sticky bit with 777:

drwxrwxrwt.

Output sticky bit with 776:

drwxrwxrwT.

Apply sticky bit to ‘/folder’:

chmod +t /folder

Apply sticky bit with 777:

chmod 1777 /folder

Enjoy!

CentOS xrdp HowTo

Overview

xrdp is a free open-source remote desktop server for Linux.
Installing xrdp on CentOS might be a little tricky since CentOS repositories does not contain the xrdp package.
Even the EPEL repository (Extra Packages Enterprise Linux) only contains an old version of xrdp.

CentOS xrdp HowTo

Add EPEL repo

First you need to add the EPEL repository that has an older version of xrdp.

rpm -Uvh http://ftp.uni-bayreuth.de/linux/fedora-epel/6/i386/epel-release-6-8.noarch.rpm

Install xrdp from EPEL repo

yum install xrdp -y

Install dependencies

yum install tiger-vncserver autoconf automake libtool openssl-devel pam-devel libX11-devel libXfixes-devel -y

Download and install xrdp from source

Now that you have the older version of xrdp installed you can easily compile the latest version on top of the old one.

Download xrdp from sourceforge http://sourceforge.net/projects/xrdp/files/ to /opt folder.

extract the content of the file

tar -xvzf xrdp-v0.6.1.tar.gz

compile and install xrdp:

cd xrdp-v0.6.1
./bootstarp
./configure
make
make install

start xrdp and make sure it is set to run at startup:

service xrdp start
chkconfig xrdp on

Customize xrdp settings

The xrdp service config files are located at ‘/etc/xrdp/’:
We will edit these three:

/etc/xrdp/xrdp.ini
/etc/xrdp/sesman.ini
/etc/xrdp/startwm.sh

Remove login options

Edit ‘/etc/xrdp/xrdp/ini’ and delete from xrdp2 block to the end of the file leaving only the xrdp1 option.

Limit access to certain group

Edit ‘/etc/xrdp/sesman.ini’ and change ‘TerminalServerUsers=tsusers’ to the group name you wan to allow access.
If unset or set to an invalid or non-existent group, login for all users is enabled.

Add environment variables

xrdp has a different set of environment variables than regular bash session.
Edit ‘/etc/xrdp/startwm.sh’ and add at the beginning of the file the environment variables you want.
for example add ‘/bin’ and ‘/sbin’ to the PATH variable:

export PATH=$PATH:/bin:/sbin

Set session limits to avoid login failed error

Edit ‘/etc/xrdp/sesman.ini’ and change ‘MaxSessions=10’ to ‘MaxSessions=100’
 
 
 
xCentOS xrdp HowTo

Enjoy.

ydpg17 reset

ydpg17 reset – going back to factory defaults

ydpg17 reset

ydpg17 reset – You may know this console as YinLips, Innova or whatever your country importer decides.

 

ydpg17 reset

to reset your YDPG17 android box – Start your YDPG17 games console with ‘POWER‘ + ‘M‘ buttons pressed. after the console start loading leave the power button and continue holding the M button until you’ll get into the menu.

ydpg17 reset

ydpg17 reset

 

to navigate in the menu (it may be different for your console):
use the wheel to move between options and power button to select.

Choose (3) Only format data and cache area.

 

ydpg17 reset

ydpg17 reset

ydpg17 reset

 

that’s it.. you’ve reset your ydpg17 game console back to default.

 

Cheers!,

LuaJIT

CentOS LuaJIT Installation instructions

centos luajit installation instructions

centos luajit

centos luajit installation instructions – In the following tutorial I will show you how to install and use the LuaJIT Compiler on your CentOS box.

Before you continue you should already know what is Lua and JIT Compiler.

 

What is LuaJIT?

LuaJIT is a Just-In-Time Compiler (JIT) for the Lua programming language.

LuaJIT has been successfully used as a scripting middleware in games, appliances, network and graphics apps, numerical simulations, trading platforms and many other specialty applications. It scales from embedded devices, smartphones, desktops up to server farms. It combines high flexibility with high performance and an unmatched low memory footprint.

LuaJIT has been in continuous development since 2005. It’s widely considered to be one of the fastest dynamic language implementations. It has outperformed other dynamic languages on many cross-language benchmarks since its first release — often by a substantial margin.

LuaJIT is Copyright © 2005-2014 Mike Pall, released under the MIT open source license.

from LuaJIT website

 

Prerequisities

you need to install a package for GCC before compiling LuaJIT, you can do that by:

yum install gcc

or better, install the development tools:

yum groupinstall “Development Tools”

 

centos luajit installation instructions

Check the LuaJIT download page to check if newer version available. The next insructions are for the latest stable version currently available – LuaJIT-2.0.2

cd /opt
wget http://luajit.org/download/LuaJIT-2.0.2.tar.gz
tar -zxvf LuaJIT-2.0.2.tar.gz
cd LuaJIT-2.0.2
make && make install
# or sudo make install if you are not 'root'

Option 2: using git

OPTIONALLY, you can install LuaJIT using GIT. choose this method only if you want to be updated with the latests patches and updates and your don’t care about the risk of bugs. (NOT FOR PRODUCTION) 

cd /opt
git clone http://luajit.org/git/luajit-2.0.git
cd luajit-2.0
make && make install 
# or sudo make install if you are not 'root'
centos luajit

centos luajit

Running LuaJIT

That’s it. you have luajit installed.

consider the file ‘test.lua’:

print ("Hello, world!")

You can run (interpret) the file using

luajit test.lua

Save bytecode to test.out

luajit -b test.lua test.out
luajit test.out

more information about running luajit here.

 

 

That’s it! you have centos luajit installed.

Cheers!.