Tuesday, April 8, 2008

Copy and Paste between Windows and Linux

Many people use Windows as primary working machine and login to remote Linux/Unix (we will use Linux as shorthand afterwards) boxes. There are times when we need to copy and paste information between Windows and Linux. Below we are going to discuss convenient ways to do so.

Tools

PuTTY and Xming are two popular programs to run in Windows host to facilitate communication to Linux. PuTTY provides console connection while Xming X Window connection. For Xming, Ensure you start Xming with parameter -clipboard (which is enabled by default). Our discussion below is focused on how to copy/paste within PuTTY/Xming. Copy/paste for other Windows applications is quite general (Ctrl+C and Ctrl+V) and should be familiar to the reader, therefore omitted.

Ways

PuTTY

Copy to clipboard: click-and-drag to highlight. Just select, no need to press any key.

Paste from clipboard: right mouse button.

Xming

For Xming applications, copy/paste follows the X window standard as discussed below.

Copy to clipboard: click-and-drag to highlight. Same as PuTTY.

Paste from clipboard: middle mouse button.

Monday, April 7, 2008

Installation of Gentoo Linux 2008.0 Beta 1 with LiveCD

I just started yet another process of installing Gentoo Linux, and following is my record of the installation step by step. Previously I preferred to install from stage 1/3 following this guide. I decided to try LiveCD this time.

1. Boot the machine.

Download the 2008.0 LiveCD from here. Burn the CD and boot the machine with it.

Caveat: in my case, the boot process is stalled. I solved it (according to this article) by appending kernel options during GRUB screen (press e to edit and append all-generic-ide irqpoll pci=nommconf).

2. Installation.

After boot, I click icon "Gentoo Linux Installation (GTK+)" in the desktop.

Partitioning: I selected Recommended Layout.

Local Mounts: accept the defaults without any changes.

Timezone: Asia/Shanghai.

Networking: Dhcp is used. Appropriate host and domain name are provided.

Users: Just add the regular user for daily usage.

Extra Packages: I selected screen and slocate. In my first installation I also selected xorg-x11, gdm, firefox etc. However the installation simply failed when emerging x11-apps/xinit (and I cannot rescue the system since even /etc/fstab is not correctly setup), therefore my second try is quite conservative.

Startup services: I selected sshd.

Other Settings: Although I have not installed X11 or Gnome yet, I selected as following:

  • Display Manager: gdm
  • Clock: local
  • XSession: Gnome

3. Post Installation.

This section is similar as what I have described for coLinux (see here), but is modified specifically for a standalone Gentoo Linux installation.

3.0 Tiny Cleanups.

After rebooting, perform the following steps. Note that if your system was stalled as described before, you can use same trick in GRUB screen and you should add the kernel options to /boot/grub/grub.conf after login.

To avoid some warning, you might need to perform following steps.

# mkdir -p /usr/local/portage

To change host name (according to Gentoo Handbook), edit file /etc/conf.d/hostname, if you call your coLinux machine as tux, then set the following line.

HOSTNAME="tux"

In addition, remove string .\O from file /etc/issue to get rid of the annoying unknown_domain in the welcome message "This is host.unknown_domain ...".

3.1 Network

We have already specified using DHCP. It works but the configuration files is using old syntax. Let's clean it up to avoid future complaints. Edit file /etc/conf.d/net as follows.

config_eth0=( "dhcp" )
3.1.1 Proxy

If you connect to Internet directly, you can skip this section.

To use proxy server, add the following lines into /etc/env.d/99local:

http_proxy="http://proxy.server.com:8080"
ftp_proxy="http://proxy.server.com:8080"

Replace the port and domain name according to your situation. Then run:

env-update && source /etc/profile

3.2 Add additional locales

Modify file /etc/locale.gen, select appropriate locales. For me, the locales are:

en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8

Then run command locale-gen.

3.3 Modify /etc/make.conf

This is specific for your computer type and other factors. Following is my configuration (I'm using a Core 2 Duo CPU). Please refer to Gentoo documentation for your own reference. GENTOO_MIRRORS reflects the fastest mirrors for my connection, as discussed below.

CFLAGS="-march=nocona -O2 -fomit-frame-pointer -pipe -fno-ident"
CXXFLAGS="${CFLAGS}"
CHOST="x86_64-pc-linux-gnu"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j3"
ACCEPT_KEYWORDS="amd64"
FEATURES="parallel-fetch"
LINGUAS="en zh zh_CN"
INPUT_DEVICES="keyboard mouse"
VIDEO_CARDS="i810"
PORTDIR_OVERLAY="/usr/local/portage"
GENTOO_MIRRORS="http://ftp.iij.ad.jp/pub/linux/gentoo/ http://ftp.kaist.ac.kr/pub/gentoo/"

USE_DEV="bash-completion doc emacs latex ruby sbcl source spell"
USE_HW="cpudetection mmx sse sse2"
USE_LIB="curl gd glibc-omitfp ncurses readline zlib"
USE_MM="aac alsa encode ffmpeg flac midi mp3 ogg pulseaudio quicktime theora xvid"
USE_PIC="gif jpeg png raw svg tiff xpm"
USE_SECURITY="crypt pam ssl tcpd"
USE_SW="bzip2"
USE_SYS="cjk nls nptl nptlonly opengl truetype unicode xinerama xml"
USE_X11="cairo gnome gtk X xft xorg"
USE="-* ${USE_DEV} ${USE_HW} ${USE_LIB} ${USE_MM} \
     ${USE_PIC} ${USE_SECURITY} ${USE_SW} ${USE_SYS} ${USE_X11}"

3.4 Synchronize Portage

Use either emerge --sync or emerge-webrsync -v to update the portage.

3.5 Mirror selection

First run emerge mirrorselect. To select the fastest mirror. I use the following command mirrorselect -D -H -s2 to select the mirror. It means that:

  • -D: actual file will be downloaded from the mirror to test speed.
  • -H: test http mirrors only.
  • -s2: only select 2 mirrors.

After running the command, original /etc/make.conf will be backed up as /etc/make.conf.backup and your selected mirrors will be reflected in make.conf. Type mirrorselect -h for details.

3.6 Update system

Run the following suites of commands (we need the -p argument to check what the commands are supposed to do since they're somehow "dangerous"):

emerge -uDNpv world
emerge -uDNv world
emerge --depclean -pv 
emerge --depclean -v
revdep-rebuild -pv
revdep-rebuild -v

Caveat: if you encounter circular dependency when emerge -uDNv world, try to remove gtk USE flag from /etc/make.conf. After successful emerging, add gtk flag again and run emerge -uDNv world again.

After update, run dispatch-conf to update the configuration files.

3.7 Install X11 and GNOME.

Run command emerge xorg-x11 to install X11. Then use xorgcfg -textmode to configure X server.

I'm using a LCD with resolution of 1680x1050, which is not listed in standard configurations. To use it, first run gtf 1680 1050 60, copy the output to the Monitor section of /etc/X11/xorg.conf, and modify section Screen to the resolution 1680x1050.

For GNOME, I prefer to install gnome-light to avoid the gigantic full GNOME installation. To do so, simply run emerge gnome-light.

If one use startx to run X11, one can simply type echo "exec gnome-session" > ~/.xinitrc to configure so.

To make gdm the default login screen, run the following commands:

# emerge gdm
# rc-update add xdm default

And then edit /etc/conf.d/xdm, changing DISPLAYMANAGER to gdm.

3.8 Install Other programs.

This section is left empty intentionally :-)


Conclusion

It is quite convenient to install with LiveCD. There are some hassles during installation, but I assume the reason is that I'm using a beta version. Since beta version is not stable, my suggestion is to install minimal components therefore you can quickly finish the installation and boot from hard drive.

Although GRP install is not so optimal, the pre-compiled packages should be quite close to optimal ones for 64-bit machines. Also as a Gentoo user, I'm always in the process of customization the OS to suit my needs, therefore a not-so-ideal-initial-setup is not an issue. In summary, livecd approach can save a lot of time, with almost similar end result as installing from stage 1/3.

Ripping CD to FLAC in Gentoo Linux

This post is just a simple note, inspired from here.

First, install cdparanoia and flac:

# emerge cdparanoia flac

Next, issue the following commands (I deleted the original WAV files after conversion). All tracks are extracted and converted to FLAC format.

# cdparanoia -B
# find . -name "*.wav" -print0 | xargs -0 flac
# rm *.wav

Then enjoy the music with your favorite player. Since I'm using mplayer, I call Ruby to generate the playlist and invoke mplayer with it (in the 1st line below, the last track number is 16. Change it according to your own situation).

$ ruby -e '(0..16).map{|i| printf("track%02d.cdda.flac\n", i)}' > pl
$ mplayer -playlist pl

Wednesday, April 2, 2008

Enable Sound for coLinux

In my previous post about installing coLinux with Gentoo, audio part is not touched. Here comes the solution on how to use PulseAudio to bridge coLinux to sound world. This is adapted from here with contents modified for Gentoo Linux.

Windows side

We need to install PulseAudio server on Windows. Frist download binaries for Windows from here. Extract to one directory (c:\bin\pulseaudio in my case).

In the directory of the binaries, create a text config file named default.pa with the content:

load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24
load-module module-esound-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24
load-module module-detect

We start PulseAudio automatically when coLinux starts, by adding the following line to the coLinux configuration file:

exec0=c:\bin\pulseaudio\pulseaudio.exe

Linux side

Install and configure PulseAudio client

Install PulseAudio by emerge pulseaudio. Then edit /etc/pulse/client.conf to set the address of the Windows host that runs the PulseAudio server:

default-server = 192.168.0.1

where 192.168.0.1 is the IP address of the Windows host.

Make sure to add USE flag alsa to /etc/make.conf. If you just add this USE flag, update your system with emerge -uDNv world. ALSA would be automatically emerged.

Install alsa-plugins

In addition, we should install alsa-plugins:

# echo "media-plugins/alsa-plugins pulseaudio" >> /etc/portage/package.use
# emerge alsa-plugins

Edit ~/.asoundrc with the following contents.

pcm.!default {
    type pulse
}

ctl.!default {
    type pulse
}

pcm.pulse {
    type pulse
}

ctl.pulse {
    type pulse
}

Test

As a final step, you can test with an ALSA player:

aplay /usr/share/sounds/alsa/Front_Center.wav

You should hear a voice saying "Front Center". Enjoy!

Sunday, March 16, 2008

Install Gentoo with coLinux

coLinux is gaining momentum as a way to run Linux programs on Windows, and I decided to try it. As a user of Gentoo, my first choice is to use Gentoo with coLinux. The following description documents what I have done to run Gentoo cooperatively in Windows laptop. I mainly follows up the Gentoo Wiki Howto article and other coLinux resources.

1. Installation

First download the latest coLinux snapshot (you can also get it from SourceForge). The file I used is coLinux-0.7.2.exe from SourceForge. Run the installer. Some notes during installation:

  • In screen Choose Components, leave the default settings on (i.e. selecting all components), but uncheck Root FileSystem image download (we will download it separately).
  • In addition, change the Destination folder to c:\bin\coLinux (note that all the description below assumes coLinux is installed into this directory. If you prefer other directory, please modify accordingly in steps below).
  • Installer prompts to download and install WinPCap separately, but my network configuration does not need WinPCap therefore I don't install it.

Then download Gentoo-colinux-i686-2007-03-03.7z from SourceForge, extract the archive into c:\bin\coLinux, with a gentoo subdirectory created during extraction. Copy file gentoo.conf in gentoo to the parent directory and modify it as follows:

kernel=vmlinux
cobd0=C:\bin\coLinux\gentoo\gentoo-root
cobd1=C:\bin\coLinux\gentoo\linux-swap
root=/dev/cobd0
hdc=\Device\Cdrom0
initrd=initrd.gz
mem=1024
eth0=tuntap
cofs0=c:\linux

Some explanations of the above file, details will be covered in later sections.

  • For mem, I set it to 1G. Choose according to your own situation.
  • For network, I only select TAP driver.
  • I shared Windows folder c:\linux to coLinux.
  • CD/DVD-Drive is mounted.

To test drive, open a command prompt, change to the directory c:\bin\coLinux, and run the following command:

colinux-daemon @gentoo.conf

coLinux console should run. If there is something wrong, please check previous steps. After some time, you are prompted for log in. You can now login as root with password. Change your password immediately.

Congratulations! You just successfully run Gentoo in coLinux! You can now fool around with the system. Type halt when you are tired. There is still a long road ahead to fully harness the power. Following is two optional steps, but highly recommended.

Run coLinux during system startup

First, we need to install coLinux as a service. Open a command prompt, change to the directory c:\bin\coLinux, and run the following command:

colinux-daemon.exe @gentoo.conf --install-service "CoGentoo Linux" 

Then open Control Panel, first select Administrative Tools, then Services, click service CoGentoo Linux, and change its Startup type to Automatic.

Enlarge the image file

The original image size is 2G. This might not be sufficient. To enlarge it, you need to download the tools from here. Extract the archive and run file toporesize.bat. Use the program to resize file c:\bin\coLinux\gentoo\gentoo-root to whatever size you want. Make sure you uncheck "resize file only no resize2fs".

2. Configuration

2.1 Timezone

Since I'm located in Beijing, I set the corresponding info as follows. The related configuration files is /etc/conf.d/clock. I changed two lines as follows.

CLOCK="local"
TIMEZONE="Asia/Shanghai"

Also run command ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime.

It is interesting that Beijing cannot manage to snap one place inside /usr/share/zoneinfo/Asia.

2.2 Network

Based on coLinux wiki article.

2.2.1 One network interface

This configuration only enable TAP, which is used to enable both the high-speed private connection between Windows host and Linux guest, and also to bridge the connection to Internet. One drawback of this setup is that when you Internet connection changes (e.g. from ADSL to WiFi, you have to adjust bridging and some parameters manually).

File gentoo.conf discussed above already contains the setup for coLinux. Next steps are as follows.

On hosting OS (Windows), configure TAP-Win32 Adapter V8 (coLinux) with following properties (make sure to leave Default Gateway as blank):

Ethernet adapter:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : TAP-Win32 Adapter V8 (coLinux)
        Dhcp Enabled. . . . . . . . . . . : No
        IP Address. . . . . . . . . . . . : 192.168.0.1
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . :

We need to bridge the Internet connection with TAP interface. For example, assume you're using an ADSL PPPoE connection. In Windows host, select Control Panel -> Network Connections, right click the PPPoE interface, and select Properties. In tab Advanced, for Internet Connection Sharing, check Allow other network users to connect through this computer's Internet connection, and for the Home networking connection, select the TAP interface (e.g. Local Area Connection 2). When Windows prompts that TAP interface IP address will be set to 192.168.0.1, choose OK.

Under coLinux, edit file /etc/conf.d/net as follows.

config_eth0=( "192.168.0.20/24" )
routes_eth0=( "default via 192.168.0.1" )
dns_servers_eth0=(" xxx.xxx.xxx.xxx " )

Please change the DNS server information (shown as xxx above) to those obtained in windows (e.g. via ipconfig).

We have to emphasize here that in this setup, Linux guest has IP address 192.168.0.20 (this is arbitrarily selected, could be other numbers like 192.168.0.x when 2 <= x <= 254), and Windows host has IP address 192.168.0.1 interfacing Linux (of course Windows host has external IP addresses as well).

2.2.2 For two network interfaces

Note this part is NOT compatible with other sections. The purpose of this section is only to document alternatives to above solution. If one interface solution is fine for you, you can skip this section.

This configuration enables both SLiRP and TAP connections. SLiRP is used to connect outside world while TAP enables the high-speed private connection between Windows host and Linux guest, which is desirable for X protocol. The benefits of this configuration includes improved security and that SLiRP can automatically use current Windows Internet connection for outgoing connections (i.e. you do not need to enter DNS server information) without reconfigurations. This works fine for Wireless LANs, but I did meet problems for ADSL and finally decided to use TAP only.

Anyway, let's look at how to setup two network interfaces.

First, we need to modify the aforementioned file gentoo.conf located in coLinux directory. Change the line eth0=tuntap with two lines as below.

eth0=slirp
eth1=tuntap

Then edit file /etc/conf.d/net on Linux guest. This enables both SLiRP and TAP.

config_eth0=( "dhcp" )
config_eth1=( "192.168.37.20/24" )

We then need to setup DHCP client as following:

emerge dhcpcd
rc-update add dhcpcd default
/etc/init.d/dhcpcd start

Since only eth0 device is generated, we need to generate eth1 device by

cd /etc/init.d
ln -s net.lo net.eth1

On hosting OS (Windows), configure TAP-Win32 Adapter V8 (coLinux) with following properties (make sure to leave Default Gateway as blank):

Ethernet adapter:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : TAP-Win32 Adapter V8 (coLinux)
        Dhcp Enabled. . . . . . . . . . . : No
        IP Address. . . . . . . . . . . . : 192.168.37.10
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . :
2.2.3 Proxy

If you connect to Internet directly, you can skip this section.

To use proxy server, add the following lines into /etc/env.d/99local:

http_proxy="http://proxy.server.com:8080"
ftp_proxy="http://proxy.server.com:8080"

Replace the port and domain name according to your situation. Then run:

env-update && source /etc/profile

2.3 Add additional locales

Modify file /etc/locale.gen, select appropriate locales. For me, the locales are:

en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8

Then run command locale-gen.

2.4 Mirror selection

First run emerge mirrorselect. To select the fastest mirror. I use the following command mirrorselect -D -H -s2 to select the mirror. It means that:

  • -D: actual file will be downloaded from the mirror to test speed.
  • -H: test http mirrors only.
  • -s2: only select 2 mirrors.

After running the command, original /etc/make.conf will be backed up as /etc/make.conf.backup and your selected mirrors will be reflected in make.conf. Type mirrorselect -h for details.

2.5 Modify /etc/make.conf

This is specific for your computer type and other factors. Following is my configuration (I'm using a Core 2 Duo CPU on 32 bit Windows). Please refer to Gentoo documentation for your own reference. GENTOO_MIRRORS reflects the fastest mirrors for my connection, so you may skip that line if your have already performed mirrorselect above.

CFLAGS="-march=prescott -O2 -fomit-frame-pointer -pipe -fno-ident"
CXXFLAGS="${CFLAGS}"
CHOST="i686-pc-linux-gnu"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j2"
ACCEPT_KEYWORDS="x86"
FEATURES="parallel-fetch"
LINGUAS="en zh"
USE="-* auctex bash-completion bzip2 cjk crypt curl doc emacs gd gif glibc-omitfp gtk \
     javascript jpeg mmx mozilla ncurses nls nptl nptlonly opengl pam png readline \
     ruby sbcl source spell sse sse2 ssl svg tcpd tiff truetype \
     unicode X xft xml xorg xpm zlib"
PORTDIR_OVERLAY="/usr/local/portage"
GENTOO_MIRRORS="http://ftp.iij.ad.jp/pub/linux/gentoo/ http://ftp.kaist.ac.kr/pub/gentoo/"

2.6 Update system

Since our original system is somehow outdated, we need to update it. First run emerge --sync or emerge-webrsync -v to synchronize portage, then run the following suites of commands (we need the -p argument to check what the commands are supposed to do since they're somehow "dangerous"):

emerge -uDNpv world
emerge -uDNv world
emerge --depclean -pv 
emerge --depclean -v
revdep-rebuild -pv
revdep-rebuild -v

Caveat: if you encounter circular dependency when emerge -uDNv world, try to remove gtk USE flag from /etc/make.conf. After successful emerging, add gtk flag again and run emerge -uDNv world again.

After update, run dispatch-conf to update the configuration files (you need to avoid the update of /bin/setfont. If you accidentally updated the file, you can remedy the situation as discussed below):

Caveat: if during booting, you meet the error message putfont: PIO_FONT: Function not supported, Solve the problem as follows (as discussed here):

First, run command mv /bin/setfont /bin/setfont.old

Create a new file /bin/setfont with the following content:

#!/bin/bash

if ! uname -r | grep -q -e "-co-"
then
        /bin/setfont.old $@
fi

and make it executable by running chmod +x /bin/setfont

3. Run X

X.org is already installed in coLinux machine when we update the system as discussed in section 2.6 (we have include X USE flag). Therefore the remaining steps are just to install X server in Windows host.

We choose Xming considering it is lightweight and widely used. To install Xming, Download Xming installer, font installer and Xming-tools-and-clients. You may use Xming-mesa installer to replace Xming installer for stable OpenGL operation (only do so if you meet problems with Xming installer).

My settings during installation of Xming are as follows:

  • Xming
    • Destination directory: changed to c:\bin\Xming.
  • Xming-fonts
    • Destination directory: changed to the same directory as Xming (c:\bin\Xming)
    • Fonts to be installed: select according to your own taste.
  • Xming-tools-and-clients
    • extract the zip file of Xming-tools-and-clients to the directory where Xming is installed (c:\bin\Xming in this case).

Settings on Windows host

For file x0.hosts in Xming directory, make sure the IP address of coLinux machines (192.168.0.20) is added.

If you want to run the tools and clients bundled with Xming in Windows host, you need to type set DISPLAY=127.0.0.1:0 in your Windows host.

Following steps are used to enable Windows fonts to be used by X application. This step is optional.

Open a command prompt window, change to directory c:\bin\Xming, and type the following commands:

mkfontscale C:/WINDOWS/Fonts
mkfontscale -b -s -l C:/WINDOWS/Fonts

Make sure that directory C:\Windows\Fonts appeared in the file font-dirs in Xming directory.

On coLinux machine

Add the following line into /etc/profile.

export DISPLAY=192.168.0.1:0

After start Xming (preferably to start it automatically when Windows start), you can simply invoke any command inside Linux console like:

xterm &

4. Miscellaneous

Change host name

According to Gentoo Handbook.

Edit file /etc/conf.d/hostname, if you call your coLinux machine as tux, then set the following line.

HOSTNAME="tux"

Edit file /etc/conf.d/net, if you call your domain as homenetwork, then set the following line.

dns_domain_lo="homenetwork"

Remove string .\O from file /etc/issue to get rid of the annoying unknown_domain in the welcome message "This is host.unknown_domain ...".

Create regular user accounts

With the following command, I created a new user named foo as a powerful user (with the ability to su to root and also invoke some portage related commands). Pleas substitute foo above with your desired user name.

useradd foo -m -G users,wheel,portage
passwd foo

Access Windows folder

When we edit gentoo.conf above, we have already enabled coLinux to share folder c:\linux. To make our regular user to access this directory in Linux, edit file /etc/fstab and add the following line:

cofs00  /home/foo/windows  cofs  uid=foo,gid=foo,dmask=0755,fmask=0644 0 0

The above line will enable the Windows folder to be shared in Linux as a folder /home/foo/windows. You can modify above line for your own user.

Additional programs

Following is a list of commands to install my own favorite programs. Your situation would be of course different.

# Some system utilities
emerge gentoolkit slocate

# Development tools
echo "dev-lang/erlang hipe" >> /etc/portage/package.use
emerge aspell ruby sbcl erlang dev-util/git maxima

# Gfx (GLEidescope is one of my favorite XScreenSaver)
emerge inkscape blender xscreensaver

# Netowork
emerge mozilla-firefox

# X tools
emerge xlsfonts xfontsel

Before emerge texlive, I have to add a bunch of keywords for dependencies in /etc/portage/package.keywords as follows.

app-text/texlive ~x86
app-text/texlive-core ~x86
dev-texlive/texlive-metapost ~x86
dev-texlive/texlive-basic ~x86
dev-texlive/texlive-documentation-base ~x86
dev-texlive/texlive-psutils ~x86
dev-texlive/texlive-langcjk ~x86
dev-tex/cjk-latex ~x86
dev-texlive/texlive-documentation-english ~x86
dev-texlive/texlive-genericrecommended ~x86
dev-texlive/texlive-latexrecommended ~x86
dev-texlive/texlive-latex ~x86
dev-texlive/texlive-texinfo ~x86
dev-texlive/texlive-latex3 ~x86
dev-texlive/texlive-htmlxml ~x86
app-text/jadetex ~x86
dev-texlive/texlive-fontsrecommended ~x86
app-text/dvipdfm ~x86
dev-texlive/texlive-documentation-chinese ~x86
dev-texlive/texlive-langmanju ~x86

Use CVS version of Emacs

Run the following commands:

echo "app-editors/emacs-cvs ~x86" >> /etc/portage/package.keywords
emerge emacs-cvs

If you want to use this bleeding-edge version only, you can uninstall the previous version of Emacs (if you have installed) and type:

echo "virtual/emacs ~x86" >> /etc/portage/package.keywords

Otherwise (i.e. you have multiple versions of Emacs), when you emerge packages requiring Emacs, a stable version (e.g. v22.1) will be installed. For the multiple-version-installation, you can use eselect emacs list to see a list of available version. To use Emacs 23 just installed, you can type eselect emacs set emacs-23. For details, please consult here.

Emacs extensions

I run the following commands to install a few Emacs extensions. Note that in Gentoo, many extensions (e.g. those related to development) are automatically installed for you when you emerge the related tools and enable emacs USE flag.

echo "app-emacs/gentoo-syntax ~x86" >> /etc/portage/package.keywords
echo "app-emacs/imaxima ~x86" >> /etc/portage/package.keywords
emerge htmlize imaxima app-emacs/gentoo-syntax keywiz

Enable SSH server

You may want to enable SSH access to your coLinux machine. There are some benefits. Examples are shown below (assuming PuTTY is used):

  • More flexibilities to configure the client (e.g. pretty fonts) and nice scrollbars.
  • The title of PuTTY indicates what coLinux is doing (such information might be useful during a long emerge process).

To start SSH server, type the following commands.

rc-update add sshd default
/etc/init.d/sshd start

When you use PuTTY client, you should fill 192.168.0.20 as the host address to utilize the high speed internal connection.

GTK configrations

Change the default GTK+ font. Edit file ~/.gtkrc-2.0, add the following line, and change the font name and size to your preferred one.

gtk-font-name = "Arial 15"

Mount CD

Simply type the following

# mount -t iso9660 -o ro /dev/hdc /mnt/cdrom

Final Words

coLinux is an interesting way to run Linux applications in Windows host. One drawback of coLinux is that the daemon process is pinned to one processor only. This avoids some bizarre issues, however it does not utilize the potentials of modern multi-core systems. This is disappointing especially for a Gentoo user who requires lots of computation power. Hope the situation could be improved in the future.

Update: please refer this post on how to enable sound.