Sometimes it’s necessary to install a piece of software from source. This is normally an awkward process when you’ve had a package manager taking care of all your software needs when you’re faced with the proposition of installing something that the package manager is unaware of. Another concern is that some software developers don’t do the simple things well - some makefiles won’t even offer you the ability to uninstall a piece of software leaving you to try to remove the files that have been peppered into your system directories.
In today’s post, I’ll walk through a sample usage of the application CheckInstall for Debian based Linux distributions.
CheckInstall keeps track of all the files created or modified by your installation script (“make” “make install” “make install_modules”, “setup”, etc), builds a standard binary package and installs it in your system giving you the ability to uninstall it with your distribution’s standard package management utilities.
The thing I love about the Debian distribution is the stability of the packages in its repositories. Sometimes, it’s also what I’m not to fond of as software vendors are bringing out new versions of their software and they don’t make it into the stable repositories until they’re deemed stable (which takes ages!) or they may never make it into the repositories.
Using CheckInstall
I’ve used CheckInstall for quite a few packages in the past. Just recently, I’ve used it to manage the installation of SDL2 onto my system.
# extract your source package$ tar-zxvf SDL2-2.0.1.tar.gz
# configure and build as usual$ cd SDL2-2.0.1
$ ./configure
$ make
# use checkinstall on the installation step$ sudo checkinstall make install
After this process had finished, a deb file was created for me which represented the files that had been installed on the system and the deb itself had been applied to the system.
The idea here is that it simplifies re-installation and removal by proxy of the generated deb package.
Today’s post will just be a walk through of the steps required to install Hadoop 2 on Debian Linux. Please note that this is for a single node installation only. This guide is heavily based on the Ubuntu instructions found here.
Install Java
# install the java jdk$ sudo apt-get install openjdk-7-jdk
# make a jdk symlink$ cd /usr/lib/jvm
$ ln-s java-7-openjdk-amd64 jdk
# make sure that ssh server is installed$ sudo apt-get install openssh-server
Add Hadoop Users and Groups
# create a new group for hadoop$ sudo addgroup hadoop
# create the hduser and put them in the hadoop group$ sudo adduser --ingroup hadoop hduser
# add them to the sudo group also$ sudo adduser hduser sudo
Now login as “hduser”.
SSH Certificates
# generate your key$ ssh-keygen -t rsa -P''# set your public key as authorized$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
# test out ssh$ ssh localhost
Download Hadoop
# downoad the package$ cd ~
$ wget http://mirror.rackcentral.com.au/apache/hadoop/common/hadoop-2.2.0/hadoop-2.2.0.tar.gz
# extract the package$ sudo tar vxzf hadoop-2.2.0.tar.gz -C /usr/local
$ cd /usr/local
$ sudo mv hadoop-2.2.0 hadoop
# get the hduser to take ownership$ sudo chown-R hduser:hadoop hadoop
Lua is a programming language that has seen increased popularity from the game development industry. It’s put to use in the disciplines of providing configuration data all the way through to scripting automated character actions.
In today’s post, I’ll walk you through the setup process of the libraries up to writing your first testing application within a Linux environment.
Library Installation
Before you get downloading and building this library, you’ll just need to ensure that you have a build environment installed and are able to compile.
At the time of writing this article, the Lua website had 5.2.3 as their latest release. From their downloads page, grab the latest tar.gz archive and extract it onto your machine. Following along with their building instructions, issuing “make linux test” whilst in the extracted folder did the trick. It built Lua ready for me to use. A nice convenience of the make file was the “make local” option. Upon issuing this request, the make system will prepare an installation folder that is suitable for you to use locally (i.e. not installed to the system).
When it comes to downloading the latest versions of libraries, I’ll rarely install these to my system. Rather, I drag them around for each project that needs them so that the project determines its dependencies as opposed to my system.
From here, I prepare a distributable directory of development files that I know that each of my project needs. In the case of Lua, I create the following structure:
I have all of the development headers available (under the “include” folder) and a static version of the Lua library (under lib).
Building applications
When building Lua applications, you’ll need to specify the libraries and include folders to your compiler so it knows where to find them. For a test application that I’d written, the following command line compiled an application for me without any trouble.
You can see at the end there, mention of both the “lua” and “dl” libraries.
Test application
A very simple test to start will be creating a program that will execute a Lua script, pull out on of its global variables and display it to screen.
Here’s our Lua script:
x=10
Pretty simple. We have one variable x set to 10. Now here’s the C++ code that we use to read that one variable out and present it to screen.
#include<iostream>
#include<lua.hpp>intmain(intargc,char*argv[]){// create a new lua context to work withlua_State*L=luaL_newstate();// open any library we may useluaL_openlibs(L);// read the Lua script off disk and execute itif((luaL_dofile(L,"test.lua"))!=0){// handle any errors std::cout<<"unable to load test.lua"<<std::endl;return1;}// put the value of X at the top of the stacklua_getglobal(L,"x");// interpret the value at the top of the stack // as an integer and put it in the variable "val"intval=(int)lua_tointeger(L,-1);// pop the value of X off the stacklua_pop(L,1);// write the value outstd::cout<<"Value of X: "<<val<<std::endl;// finish up with the Lua contextlua_close(L);return0;}
I think that the source code above (paired with the documentation on the Lua website) should make things pretty straight forward.
That’s it for today. This is only scratching the surface on what Lua can do. For my purposes right now, I just need to feed configuration values into programs, this fits the purpose really well.
SDL2 was released a little while ago, but still hasn’t made it into the stable repositories of some Linux distributions. After doing a big of digging, it’s not too hard to get this installed yourself - most of the advice offered in this post comes from an answer on the Ubuntu forums here.
In today’s post, we’ll install SDL2 on a Debian/Ubuntu style distribution from source.
Dependencies
First thing before we download and compile the SDL2 source is to get some of the dependencies installed on your system. The following install line will put all of the libraries that SDL2 requires:
Once all of these have installed successfully, you’ll need to download a copy of the source. All downloads can be found here. This guide will assume that you’ll download the .tar.gz source archive.
Compilation and Installation
Extract the package into a directory under your home directory, somewhere . . .
$ tar-xzf SDL2-*.tar.gz
$ cd SDL2-*
Next we’ll configure, build and install the libraries.
$ ./configure
$ make
$ sudo make install
Once compilation and installation have complete, you’ll need to update your library links/cache. Do this with the following command: