Code Ghar

Code Ghar Official Linux Desktop

Posted in configuration, discussion by hs on November 3, 2009

So I decided to take the plunge and use Linux on the desktop. This post describes how the first ever official Code Ghar Linux desktop was created. As I make changes to the computer, I will keep this post updated.

Distribution

I first installed Fedora Rawhide (nightly build) using ext4 as the filesystem. After a couple days, I decided to add more memory to the system. Once this memory was installed successfully, the OS would not boot at all. I decided to not risk things further and went with Debian testing (Squeeze) instead. I am more comfortable with a Debian based system anyways so the choice wasn’t hard. I chose the netinstall CD and only installed the command line (did not choose the Desktop option during install).

Desktop Environment

I wanted to make best use of the 3GB RAM in my system. So I chose to install LXDE as my desktop environment. Since I was only running command line, I ran the following command to install LXDE.

sudo aptitude install xorg gdm lxde

Wine

I needed to run three main applications. I could either install a virtual machine running Windows to run these apps or install Wine. I decided to try out Wine. To install Wine, I ran the following command.

sudo aptitude install wine

Once installed, all you have to do is run the exe file to install your desired application and Wine takes care of the rest. But make sure you have searched that application on the Wine Application Database.

Virtualization

However much I want to move away from Windows, I just can’t because of some applications. I chose to use VirtualBox although I have been using VMware on Windows and Mac for a couple years now. To install VirtualBox on Debian, I followed their Wiki (VirtualBox Installation). Following are the commands I ran.

sudo aptitude install virtualbox-ose virtualbox-ose-modules-$(uname -r)

sudo invoke-rc.d udev reload

sudo modprobe vboxdrv

sudo addgroup vboxusers

sudo adduser codeghar vboxusers

I then logged out and logged back in for VirtualBox to be ready to be used.

Remote Access

To allow remote access to my machine using VNC, I chose to use X11VNC. To install it, I ran the following command:

sudo aptitude install x11vnc

To invoke it for my user (since I have a single-user machine), I ran the following command once I logged in. This command is all on one line (in case the formatting of the blog makes it appear different)

x11vnc -display :0 -xkb -bg -forever -passwd mypassword

What this does is that it allows you to access your actual desktop on port 5900, runs in the background (bg flag), does not stop after first remote client disconnects (forever flag) i.e. keeps running, and assigns a password (passwd) which must be used to authenticate yourself. The xkb flag was used because for some reason the shift key did not work when I ran a VNC client from another machine into this one. I forgot which resource I used to fix this issue but I will put up the link once I can find it again.

If my computer is restarted, I will have to run the same command again for me to be able to use VNC. This is why you need access to at least SSH to be able to run this command and start VNC. I added the following alias at the end of my ~/.bashrc file. This way I don’t have to retype the command all the time.

alias myvnc="x11vnc -display :0 -xkb -bg -forever -passwd mypassword"

Flash for Iceweasel (Firefox)

To install Adobe Flash, I followed the instructions on How to Install Adobe Flash in Debian Etch/Lenny/Sid. As they were very generic, I took only what I needed and did the following.

First I downloaded the debian-multilemedia-keyring package on the desktop. Then I ran the following command to add it to aptitude.

sudo dpkg -i ~/Desktop/debian-multimedia-keyring_2008.10.16_all.deb

The I modified my /etc/apt/sources.list and added the following line:

deb http://www.debian-multimedia.org testing main

I then ran the following command to update aptitude and then install Flash.

sudo aptitude update

sudo aptitude install flashplayer-mozilla

Remote File Access with SSHFS

I used the guide at Mount a remote file system through ssh Using sshfs to get this working. I strongly recommend that you read it thoroughly for better information. To install SSHFS, you also need to install FUSE, as below.

sudo aptitude install fuse-utils sshfs

Now you need to do two things: load the FUSE module (as below)

sudo modprobe fuse

and also add your user to the fuse group (as below)

sudo adduser codeghar fuse

I then had to log out and log back in for my user to be recognized as part of fuse group.

I then created a mount directory in my home folder, created folders for all remote file systems I need to access, and created aliases for mounting and un-mounting SSHFS “shares”.

mkdir /home/codeghar/.mount/
mkdir /home/codeghar/.mount/server1
mkdir /home/codeghar/.mount/server2

To mount server1, I ran the following (also added this as a bash alias to save typing):

sshfs codeghar@10.10.1.101:/home/remoteuser/ /home/codeghar/.mount/server1

To unmount server1, I ran the following (also added this as a bash alias to save typing):

fusermount -u /home/codeghar/.mount/server1

Miscellaneous Applications

Following are the applications I also installed.

OpenOffice: sudo aptitude install openoffice.org
Wireshark: sudo aptitude install wireshark
gvim: sudo aptitude install gvim
VNC client: sudo aptitude install vncviewer
Grsync: sudo aptitude install grsync
Pidgin: sudo aptitude install pidgin
PDF: sudo aptitude install epdfview
Samba: sudo aptitude install samba samba-client smbfs

Tagged with:

Openfiler: Network Access Configuration Changes Disappear

Posted in configuration by hs on October 19, 2009

One day suddenly I could not copy files to my SMB share. I got an error that “the specified network name is no longer available”. I looked in /var/log/messages and one repeated error was rps.statd can’t decode rpc message. I tried to search for its cause and could not find anything that would solve my problem with not being able to copy any files to the share.

After mucking around the system, I noticed that in Network Access Configuration (in the web GUI), one by one all the entries started to disappear (on each refresh). If I tried to add them back, they would not stick and on refresh would disappear again. Googling revealed a very helpful resource: Network Access Configuration Changes Don’t “Stick”. According to it, the error could be caused by logs filling up the whole filesystem. I looked in /var/log/ and saw that the raa folder was taking in excess of 1.3 GB in a root partition of 2 GB (df -h and du -ah revealed this to me). Navigating to the raa folder showed that two files were approximately 600 MB is size: lighttpd.access.log and web-access. I removed these files and then restarted the machine (thinking on the next boot these files would be generated again).

Upon successful reboot, I was able to add entries to Network Access Configuration and everything was back to normal.

Bonus tips: To display all volume groups in command line, use vgdisplay. To display all logical volumes, use lvdisplay. To remove a logical volume via command line, when they can’t be deleted from the web GUI, use lvmremove. Hat tip to Can’t delete volume group.

Tagged with:

Install Trac on Debian Squeeze

Posted in configuration by hs on October 14, 2009

This post aims to provide a step-by-step on how to install Trac in Debian and get it working. These “instructions” were created exactly the way I setup my server. So paths and setup information can be modified for your project. The idea was this: there are many guides out there which provide the same information but in a more generic way; this post provides exact path information and such so that there is concrete, real world example of what needs to be done.

CAUTION: This post is a work in progress so there are many things which might not be properly documented and could have adverse effect.

Install Necessary Applications

sudo aptitude install trac bzr trac-bzr trac-spamfilter postgresql python-psycopg2 apache2 libapache2-mod-wsgi

Prepare Database

sudo vim /etc/postgresql/8.4/main/pg_hba.conf
Add following lines:
local tracdb tracuser password
host tracdb tracuser 127.0.0.1/32 md5
host tracdb tracuser 192.168.1.0/24 md5

psql template1 -W postgres
create database tracdb with encoding = 'utf8';
create user tracuser password 'password';
grant all on database tracdb to tracuser;
sudo /etc/init.d/postgresql-8.4 reload

Prepare Directories

cd /media/shared/Admin/
cd /home/codeghar/
mkdir /home/codeghar/trac
cd trac
cd /home/codeghar/trac/
mkdir repo env
cd /home/codeghar/trac/repo/
bzr init

Create Trac Project

cd /media/shared/Admin/env/
cd /home/codeghar/trac/env/
trac-admin $(pwd) initenv
trac-admin /home/codeghar/trac/env/ initenv
Project Name [My Project]> codeghartrac
Database connection string [sqlite:db/trac.db]> postgres://tracuser:password@localhost/tracdb
Repository type [svn]> bzr
Path to repository [/path/to/repos]> /media/shared/Admin/trac/repo

Enable Bazaar with Trac

To get Trac working with bzr, edit the trac.ini file (Hat tip: bzr – trac integration)
vim /media/shared/Admin/trac/env/conf/trac.ini
And add the following two lines, if they don’t already exist
[components]
tracbzr.* = enabled

First Test

Check if everything is working as it should be

tracd --port 8000 /media/shared/Admin/trac/repo/

Trac with WSGI and Apache

cd /media/shared/Admin/trac/www/
trac-admin /media/shared/Admin/trac/env/ deploy /media/shared/Admin/trac/www/
trac-admin /home/codeghar/trac/env/ deploy /home/codeghar/trac/www/

Put the following in your Virtual Host:

WSGIScriptAlias / /home/codeghar/trac/www/cgi-bin/trac.wsgi

<Directory /home/codeghar/trac/www/cgi-bin/trac.wsgi>
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>

And then reload Apache. Your site is now available at http://yourip/

Hat tip: View of /packages/trac/trunk/debian/README.Debian; bazaar & trac-bzr; Recipe Installing Trac with PostgreSQL on CentOS4.2; Trac and mod_wsgi;

Tagged with: ,

Use rsync to Backup Your MacBook

Posted in configuration by hs on September 13, 2009

I have a MacBook running OS X 10.4 (Tiger) which I needed to backup to an external USB hard drive. The simplest way for me to backup was using rsync. After plugging in the external drive, look for it under Volumes:

ls /Volumes/

You should see two or more drives listed, depending on what kind of setup you have. Once should be the default Machintosh HD and one should be your external drive; mine was called Mac. I had partitioned my external drive into two, one for Windows and one for Mac, and named them accordingly.

I wanted to backup my home directory under /Users. Say my username was macbook, then I wanted to backup /Users/macbook/. I used the following command:

rsync -vhrpEtlb /Users/macbook/ /Volumes/Mac/macbook-data/

The destination directory was macbook-data on the external drive in case different users wanted their own directories within the external drive. But what options did I use? v means verbose; h means human readable format; r means recursively backup data by going into subdirectories; p means preserve permissions; E means preserve the ability of executable files to be executed; t means preserve modification times of the files; l means preserve symbolic links; b means backup;

I also backed up my Applications directory, containing all installed applications, like so:

rsync -vhrpEtlb /Applications/ /Volumes/Mac/macbook-applications/

Tagged with:

Debian Boot Messages

Posted in configuration by hs on September 9, 2009

Want to see the messages flying on the screen when your computer boots after it has completed started? There are two things which will help you: dmesg and bootlogd. dmesg prints out the bootup messages. As far as I understand, it stores messages for the last boot only. Once you reboot, the last messages are replaced by messages of the new boot. But dmesg doesn’t show all messages. So you have to look at bootlogd, which does record all boot messages. To enable it in Debian Squeeze, edit the /etc/default/bootlogd file

sudo vim /etc/default/bootlogd

and change

BOOTLOGD_ENABLE=No

to

BOOTLOGD_ENABLE=yes

On your next boot (or reboot), boot messages should be available at /var/log/boot.

Hat tip to Where is the boot log in debian sarge ??

Tagged with:

VMware ESXi License Expiration

Posted in configuration by hs on September 3, 2009

After installing ESXi and connecting to it with VI client, a message is displayed: your license will expire in 180 days. Getting rid of this message entails entering the license key you received from VMware (when downloading ESXi) into the server. Since I learned of this from ESXi Managment, I thought it appropriate to quote the exact words I learned from: Using your vSphere Client, connect to your ESXi installation -> visit Inventory -> select your ESxi server from the left hand side -> Configuration -> Licensed Features -> click “Edit…” in the upper right -> Select “Assign a new license key to this host” -> Click “Enter Key” -> type in the license key that you got from VMware. This way you can renew license for ESXi.

Tagged with: