Wednesday, August 13, 2008

gcc compiler error when compiling C files: error: stdlib.h: No such file or directory

Trying to compile nrg4iso (http://code.google.com/p/nrg4iso/), I discovered that gcc does not seem to be properly installed. After some searching, I discovered that this is the problem:

http://ubuntuforums.org/showthread.php?t=441404
http://ubuntuforums.org/showthread.php?p=2642484#post2642484

The C compiler is actually split into two packages. The actual compiler (gcc) is packaged separately from the C libraries and header files (libc6-dev). To compile a typical C program, you must install both of these packages. A frequent source of confusion is installing just gcc without libc6-dev. This gives you the compiler, but none of the standard header files.

There is a "meta-package" called build-essential that depends on these packages, along with g++, make and dpkg-dev. So a quick way to get the core C/C++ compiler and libraries is to give the command:

sudo apt-get install build-essential

Saturday, July 26, 2008

How to change the default size of the terminal window in ubuntu

Use the --geometry option in gnome-terminal. So I changed the command of my Terminal launcher to be:

gnome-terminal --geometry=80x48

Friday, July 25, 2008

Setting up an ssh / sftp server in ubuntu

Using OpenSSH: http://www.openssh.com/

sudo apt-get install openssh-server


More information here:
https://help.ubuntu.com/community/SSHHowto
http://tombuntu.com/index.php/2008/02/19/installing-and-using-a-ssh-server/

Edited config file at /etc/ssh/sshd_config and set:
PermitRootLogin no
AllowUsers
Port #####

This site has good tips on SSH server security.

Command to restart ssh server:

sudo /etc/init.d/ssh restart

Setting up SFTP logging:

1) edit /etc/ssh/sshd_config
2) on the line Subsystem sftp /usr/lib/openssh/sftp-server, add a "-l VERBOSE" flag. So the entire line should look like:

Subsystem sftp /usr/lib/openssh/sftp-server -l VERBOSE

SFTP activity will be logged to /var/log/auth.log. For more logging options, see http://www.openbsd.org/cgi-bin/man.cgi?query=sftp-server&sektion=8

Wednesday, July 16, 2008

Sunday, July 13, 2008

Choosing a mouse and keyboard for my HTPC

For input devices for my HTPC, I decided to go with the Gyration Cordless Optical Air Mouse and Compact Keyboard Suite (GC1105CKM). Both the mouse and keyboard connected and worked with Ubuntu Hardy Heron right out of the box. The only thing I needed to setup was the additional mouse buttons and multimedia keyboard keys.

To utilize the extra buttons, I followed the directions here and used xbindkeys:
http://perens.com/works/software/gyration.html

1) I first created an .xbindkeysrc file in my /home directory

xbindkeys --defaults > /home/stchang/.xbindkeysrc

2) I ran xbindkeys-config and added the three additional mouse buttons using the "New" and "Get Keys" buttons in xbindkeys-config

3) For the Command box, I used xvkbd -xsendevent to execute the key sequence that I wanted. For now I have the buttons mapped to do forward/rewinding in vlc:
button3: xvkbd -xsendevent -text "\C\[Left]"
button4: xvkbd -xsendevent -text "\A\[Left]"
button5: xvkbd -xsendevent -text "\C\[Right]"

Saturday, June 14, 2008

How to move the /home directory to a separate partition (ie - a separate hard drive)

When ubuntu installs, the home directory is created on the same partition as the os. However, it would be nice to move the home directory to its own partition so that the os can be reinstalled/upgraded without affecting user files. Here's how I did it.

1) Create a new partition (see previous post about how to format and mount a second hard drive)
2) Mount new partition using mount (mount to anywhere except /home)
3) Copy user directories in /home to new partition
4) Delete everything in /home (but keep the actual /home directory)
5) Edit /etc/fstab to have new partition mount to /home
(note that you may have to update the UUID of the new partition in /etc/fstab, see previous post about adding an entry to /etc/fstab)
(another note, if the mount fails, when you try to login, you will get an error that says that the user directory cannot be found)