Marcos Placona Blog

Programming, technology and the taming of the web.

Category: Linux (page 1 of 3)

My findings about Linux, as well as some hints and tips on bash and terminal

Managing your dotfiles the right way

Reading time: 3 – 4 minutes

It’s no secret that on the UNIX world, dotfiles play a very important part when it comes to making your terminal look good. Be it on Linux, be it on a Mac. Dotfiles are there so you can configure your favourite software to look just the way you like it.

I especially use dotfiles to customize the look on my terminal, and to manage bundles I use with Vim. One thing that normally annoys me, is the fact that whenever I rebuild my machine (or build a new one) I need to copy over my dotfiles, and obviously make sure they are kept up-to-date on all my devices when I change something.

I’ve heard about people adding their dotfiles to GitHub, and even noticed GitHub themselves encourage you to do the same. I decided to give it a go, and will describe here what you need to do in order to have your dotfiles stored there, and most importantly, how to quickly load them up on any other computers boxes you may have.

Start by creating a folder called “dotfiles” on your home directory, and move all your dotfiles into it.

In the example above, I’m only covering my vim and bash dotfiles. You can cover as many as you like by simply moving your files into the dotfiles directory.

Now it’s time to create your install script also under our ~/dotfiles directory. You should use this script every time you want to install your dotfiles on a given machine. So let’s open vim (or your favourite text editor) and create the following file:

The file is pretty simple, as it contains a list of files which you want to have copied, and a loop to put them on the right location and create symlinks on your home directory.

Now, it’s really important that you name this file correctly, as you want to be able to execute it. And after having created it, we need to give it execute permissions, as we want to be able to run it

If you run this file now, you should see the following happening on your screen:

Good. We’re ready to push this to GitHub, so we never have to go through this process again.

Go ahead and create  a new repository on GitHub called dotfiles.

Now, back to your terminal and run the following commands:

From top to bottom we’ve done the following:

  1. navigated to our newly created directory
  2. turned it into a local git repository
  3. added all the files it contained into our local Git repository
  4. committed all the added files into the new local repository
  5. hooked up our local git repository with the GitHub repository
  6. pushed our files to the remote (GitHub) repository

If everything went OK, you should now be able to browse your remote repository (mine is https://github.com/mplacona/dotfiles) and see all your dotfiles (as well as your installer) listed there.

Now, the beauty of it, is the fact that whenever you want your dotfiles in any other box, you can simply do the following:

All your settings will be copied and applied.

As previously mentioned, my dotfiles are in https://github.com/mplacona/dotfiles, so fell free to fork it, modify and maybe even collaborate.

Getting serial ports to work on Linux

Reading time: 1 – 2 minutes

Migration in actionPhoto by: lilit

I’ve recently been “forced” to move my desktop from Windows to Linux again. Basically my current desktop “decided” it won’t support Windows anymore, and any attempt to start it ends up in a BSOD, and I just got fed-up of trying to get it to work.

In fact, all of my development at home is done on Linux anyway, and I was just using windows as my dummy operating system, and using virtualization with my development environment. move to Linux works just as well.

As usual the move to Ubuntu 10.4 was a breeze, and I didn’t even have to download any of the drivers for things like graphics card, wireless or external hard-drives. everything worked straight away.

However, after I started to play with my “new” box, I noticed that my external serial ports were not working properly. They were passing the right signal and voltage, but somehow not being able to receive any feedback.

Continue reading

CrunchPad turns into Joo Joo

Reading time: 1 – 2 minutes

Crunchpad is now JooJoo
(Photo: nDevilTV)

I’ve been following the recent news about CrunchPad, and for all of our disappointment, it’s been discontinued due to a “misunderstanding” between the guys from TechCrunch and Fusion Garage, who were developing this together.
Now, today it’s been announced that the CrunchPad has been reborn (as Joo Joo), and will indeed be released by the guys over at Fusion Garage. Apparently the whole deal was because Fusion Garage decided to ditch Techcrunch, and release it alone.
I strongly disagree with this kind of behaviour, and really hope the guys over TechCrunch find a way to stop it.
It’s due to go on sale on the 11th of December, with a price tag of $499. You can read more about it on Engadget’s website.

IPTABLES – Opening server ports to specific IP addresses

Reading time: 1 – 2 minutes

Iptables shell script
(Photo: Jordan W)

I have been doing some housekeeping on my VPS, and decided there’s a few ports that should only be accessed by certain IP addresses for security purposes.
My VPS uses Linux, so I had to find a way to somehow changing my iptables settings to block the specific ports to every IP address, except for the ones I specified.
It’s pretty straight forward, and here  how you can block a specific port to everyone except for some IP addresses (the instructions are for Centos 5.5, but should work for other distros without problems):
Open our iptables settings file:

sudo nano /etc/sysconfig/iptables

Continue reading

Updating Java on Centos

Reading time: 3 – 5 minutes

Java on Centos
(Photo: tutchiio)

I’m only writing this blog post because I usually try to keep my VPS up to date, and usually one of the things I have to do to accomplish such thing is updating the Java version.
I always need to do a little bit of “googling” in order to find my way around this, as there’s a few steps that need to be taken, so you can make sure that your classpath is correct, and that the newly installed Java is running as your default installation.
I start by going to the Java website and downloading the most recent version.
It can be a bit tricky to download Java using wget, as Java’s wesbite uses your session in order to download the file, so if you try something like:

wget http://link_to_new_java_update

You will end up with a file called something like:

http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u16-linux-i586.bin?BundledLineItemUUID=ovdIBe.mkHUAAAEjoKEu23n3&OrderID=7iFIBe.
mxpUAAAEjiKEu23n3&ProductID=Dx1IBe.prBgAAAEirRcTvuC_&FileName=/

I’ve just downloaded the file to my downloads folder.
It’s got everything you need, but a big name you don’t need, so let’s simply rename it, and move it to where we want it to be installed.
If you want to find out where your java installation is, simply execute the following command:

which java

In my case I normally install things in “/opt/soft”, so I simply issue the following command:

sudo mv *.bin /opt/soft/jdk-6u16-linux-i586.bin

This will move everything with a .bin extension to the place where I like to install my software. Notice that as I’m moving it to a protected folder “/opt”, I need to use sudo in front, so I have the necessary permissions to create files.
The file should now be called “jdk-6u16-linux-i586.bin” and be located at “/opt/soft” in my case, so:

cd /opt/soft

We then need to give it some permissions, as we are going to have to call this file as an executable:

sudo chmod a+x jdk-6u16-linux-i586.bin

If you execute ls-l on the command line, you should now see that this file has execute permissions.
You can now execute the file by issuing:

./jdk-6u16-linux-i586.bin

It will then ask to read a bunch of terms & conditions, and you are going to have to type “yes” to accept it.
Once you’ve accepted it, you will have to change your classpath, so your system becomes “aware” that a new java version has been installed, and is going to be used.
Create or edit the file /etc/profile.d/java.sh:

sudo nano /etc/profile.d/java.sh

This file must have the following code:

export JAVA_HOME=/opt/soft/jdk1.6.0_16/
export PATH=$JAVA_HOME/bin:$PATH
export PATH=$PATH:$JAVA_HOME/bin

In this case we are updating to JDK 1.6 release 16, but you should replace it with whatever versio you are installing.
By running:

java -version

You should see that the current version is the one you’ve just installed. If it’s not, it means you’ve done something wrong, so just repeat all the steps carefully, and you should be ok.

Older posts