Monday, October 26, 2009

Ubuntu mini tips and tricks

This is a list of little pesky tricks I have been using to solve problems: 1. Make a shell-script with relative paths run the same no matter where it is launches from - i.e. change the working directory to the path of the script itself:
# /bin/bash
cd `dirname $0`


2. Enable CRONTAB log to its own file:
#cd /etc/rsyslog.d/
#sudo touch ./cron.conf
#sudo *editor* ./cron.conf
ADD: "cron.* -/var/log/cron" /var/log/cron being the log-file
#sudo touch /var/log/cron
#service rsyslog restart


3. Firefox32 can't find "libqtcurve.so":
-download http://packages.ubuntu.com/jaunty/i386/gtk2-engines-qtcurve/download
-extract it using "sudo dpkg -x gtk*tab* ./gtk2" from the directory you downloaded it.
-press f5 to reload the current directory
-open the gtk2 directory we made, go into the lib directory
-f4 to bring up a terminal
-"sudo cp *current-location*/ /usr/lib32/"
-go up one level, go into the share directory
-"sudo cp *current-location*/ /usr/share/"
-restart firefox32, it should work great


4. Mount a disk on startup
-type "sudo crontab -e"
-add this line: "@reboot mount *device* *mount-point*"
For me this is: "@reboot mount /dev/disk/by-id/dm-name-pdc_dhbhddfagc4 /Data" which mounts my 4th partition, /dev/disk/by-id/dm-name-pdc_dhbhddfagc4 to /Data. Note that your partitions are probably under /dev/sda* or /dev/hda* - use "sudo fdisk -l" to list your disks.


5. Install microsoft fonts
-type "sudo apt-get install msttcorefonts"
-your done.


Ubuntu cheatsheet pages

In my research to fix problems, I have often run across one page which does an excellent job of providing a solution to my problem. Often, this page is actually official Ubuntu documentation, but usually I have a hard time finding it. Detailed here is a list of extremely useful URLs and what they are about:
AMD64/FirefoxAndPluginsextremely useful page showing how to install 32-bit firefox and java on x64 Ubuntu
FontsFonts page includes large .fonts.conf text, for making all those pesky fonts look sharp, clean, and windows-like
CronHowtoHandy reference on setting up CRON tasks.
How to mount disks


Hope this helps someone, and if not, I know I will be going back through this list when I need help.

-Robbie

Sunday, October 25, 2009

Runescape HD on (K)Ubuntu

One of the games I play is Runescape. It is a 3d Java MMORPG, and has both software-rendered(SD) and hardware-rendered(HD) versions. One of the problems I have so far had in switching my main computer to Ubuntu is that I couldn't get HD working - SD takes up way too much CPU and is not nearly so nice graphics wise. I would simply get a "Graphics mode not supported" error.
I did some research, and found that the problem is that I was using a 64-bit version of Ubuntu. Runescape only works on 32-bit Java, at least on Ubuntu.

So, what I did is as follows:
1. Installed the KUbuntu 9.10 RC from Here
2. I used the "Hardware drivers" control panel to install a proprietary graphics driver - NVIDIA in my case
3. I then followed the tutorial for installing 32-bit Firefox and plugins here.

I restarted, then opened up a terminal and typed "firefox32 &". Firefox 32bit started, and I was able to run Runescape.

There are two "issues" at this point:
One, you are probably going to want to create a shortcut to "firefox32 &" if you use it a lot.
Two, there is a minor issue involving the GTK libs - Firefox 32 is looking for the 64 bit libs and failing to load them, so the chrome is a bit blocky. I tried one fix, but haven't gotten anything working yet.

Hope this helps someone!

Monday, October 19, 2009

Linux Cheetsheet

This is a simple cheatsheet of stuff I am using a lot, administrating a CentOS4 server. Also some stuff I use with Kubuntu on my laptop.


Tar
Syntax: tar *options* *zip-file* *files to add*
Common options:
- c=create, x=extract, t=list, r=add more files to an archive
- z=Gzip
- j=bzip2
- v = dunno, but used in a lot of commands
- f=filename. Put at the end of the options


Vim
Syntax: vim *filename*
When your in VIM:
*ESC* brings you to command mode
I brings you from command mode to insert mode
:w write file from command mode
:q quit from command mode
:q! quit without saving from command mode


Find
syntax: find *folder* *options*
-name '*pattern*' - Name pattern, * is OK.
-(i)regex 'pattern' - (case insensitive)regular expression.
-size *number*[kMG][+-] - searches for files with *number* size(suffix k, M or G for kilobytes, Megabytes, Gigabytes), and if you add a + or - you will get all files larger or smaller than size respectively.


Chown/Change Owner
syntax: chown [-R] *newowner* *filenames*
The -R option makes Chown change the permission on files that are in the sub-directories of the directory that you are currently in.
*newowner* is the name or alias you want the files to change to
*filenames* are the file(s) that you want to change permissions on.