Whenever Ubuntu makes a new release, I realize that I’m getting older…
Whenever Ubuntu makes a new release, I realize that I’m getting older…
I use VIM as the default text editor on my Ubuntu box and generally work on HTML files. It’s a common problem of developers to edit a malformed (e.g. indentations are bad, tabs are used instead of spaces) source code.
When I encounter such a situtation, I enter the following commands in VIM to make the source code more readable (I wrote html as the filetype; but of course you should change it to your needs):
- :set filetype=html
- :filetype indent on
- :e
- gg=G
These 4 commands fixes the indentations of the file; but it’s not enough. I tend to convert tabs to spaces and fix the indention to 4 columns:
- :set tabstop=4
- :set shiftwidth=4
- :set expandtab
- :retab
That’s all!
onur@grizu:~$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
onur@grizu:~$ sudo apt-get update
onur@grizu:~$ sudo apt-get install sun-java6-jdk
Before reading further, please note that by the time this failure happened, I was using Eclipse 3.3.2 (Build id: M20080221-1800) with the Subclipse 1.6.10 plugin installed, on an Ubuntu 9.10 machine.
Eclipse kept giving the following error while working on a project checked out from an SVN repository:
Failed to load JavaHL Library.
These are the errors that were encountered:
no libsvnjavahl-1 in java.library.path
no svnjavahl-1 in java.library.path
no svnjavahl in java.library.path
java.library.path = /usr/lib/jvm/java-6-sun-1.6.0.15/jre/lib/i386/client::/usr/lib/jvm/java-6-sun-1.6.0.15/jre/lib/i386::/usr/lib/xulrunner-addons:/usr/lib/xulrunner-addons:/usr/java/packages/lib/i386:/lib:/usr/lib
This error message made me understand that an *svnjavahl* file had to be somewhere (except the paths of java.library.path property) on my machine to make everything work; so I made a search and got the result:
onur@ubuntulaptop:~$ sudo updatedb
onur@ubuntulaptop:~$ locate svnjavahl
/usr/lib/jni/libsvnjavahl-1.so
/usr/lib/jni/libsvnjavahl-1.so.0
/usr/lib/jni/libsvnjavahl-1.so.0.0.0
Et voila! I had to add /usr/lib/jni path to the java.library.path property. My way (which I don’t like) to do that is to declare it in eclipse.ini by adding this line:
-Djava.library.path=/usr/lib/jni
This made Eclipse run properly. By the way, my eclipse.ini content was:
onur@ubuntulaptop:~/eclipse$ cat eclipse.ini
-showsplash org.eclipse.platform
-vmargs
-XX:MaxPermSize=256m
-Xms40m
-Xmx256m
-Djava.library.path=/usr/lib/jni
That’s it!
(Note: To test whether JavaHL Client was working properly or not, I checked the SVN interface property at “Window -> Preferences -> Team -> SVN” in Eclipse.)
Sudo is the basic mechanism on Ubuntu to perform tasks that normally are reserved for the user root only. A sudoer is a user that can use the sudo mechanism.
By default, all users of the group admin are sudoers. That means adding a user to the admin group makes him/her also a sudoer. To do that, in your root account type this in the console:
adduser <name_of_the_user> admin
If you don’t want to add this user to the admin group; but make him/her a sudoer, you have to add the user to the sudoers file via the editor visudo. This editor is used to open a temporary file with the name /etc/sudoers. In this file, you can define all sudo tasks that are available on your server. You should never open the /etc/sudoers file for editing directly; because that involves the risk of completely locking yourself out if you make an error.
Default configuration in /etc/sudoers is as follows:
# /etc/sudoers
#
# This file MUST be edited with the ‘visudo’ command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
You could add a user (named onur) to the end of this file like this:
onur ALL=(ALL) ALL
That would allow the user onur to be a sudoer (and here, who can perform all sudo commands) after you saved the file. You could also restrict commands to him by specifying each command he could use, like this:
onur ALL=/sbin/shutdown
This would only allow onur to use the /sbin/shutdown command instead of all sudo commands.
If the admin group is not present in your installation, you can create one by typing:
addgroup --system admin
This created a system group named admin and then you can manually add this line to the /etc/sudoers file via visudo:
%admin ALL=(ALL) ALL