Thursday, June 28, 2007

Opera on Ubuntu

OperaBrowser

Instructions to install & configure Opera 9.20 in Ubuntu, based off [WWW] this Ubuntu Forum thread.

Introduction

There are two basic types of installations, static and shared:

Static version: Opera has the Qt library built in. It is a larger download, and it does not use anti aliased fonts on menus or the file chooser, and uses aliasing in the browser window and most other interface elements.

Shared version: Opera uses the Qt installation on your system. It integrates with the system, using whatever anti aliasing setting you have for other Qt applications.

Which is better? Probably the Shared version. Try the other one if you run into installation problems.

Installation

Method 1

Install deb package manually

Go to [WWW] Opera Download Site, choose your package, and pick a download mirror. This site does not offer a choice between Shared Qt and Static Qt, so if you have a preference, use [WWW] this directory (be sure to choose a .deb package). Save the file to somewhere you can find it, like the Desktop or your home directory.

Ubuntu 7.04 Feisty Fawn

Locate the .deb package and double click on it to start the Gdebi .deb installer.

Ubuntu 6.10 Edgy Eft

Locate the .deb package and double click on it to start the Gdebi .deb installer. The installer might warn you at the end of a conflict with an existing opera package installation. It seems that you can ignore the error, your package has been installed properly anyway. Just check in your Applications menu under Internet, you should see the Opera icon.

Ubuntu 6.06 Dapper Drake

Locate the .deb package and double click on it to start the Gdebi .deb installer.

Opera will take a minute to install.

If you get messages about unmet dependencies type:

sudo apt-get -f install

apt will then install the missing packages.

Method 2

Install via repository

Ubuntu 7.04 Feisty Fawn

The Opera browser is available from the Canonical commercial repository. To get it through Synaptic or apt, add the following line to your repository list (see Adding Other Repositories):

Add the following line to your repository list (see Adding Other Repositories):

deb http://archive.canonical.com/ubuntu feisty-commercial main

Alternatively, to use the opera.com repository add the following line instead:

deb http://deb.opera.com/opera/ stable non-free

After making these changes install the opera package (see InstallingSoftware).

If using the opera.com repository, it is advisable that you add the Opera GPG key. The installation steps are described [WWW] here.

Ubuntu 6.10 Edgy Eft

The Opera browser is available from the Canonical commercial repository. To get it through Synaptic or apt, add the following line to your repository list (see Adding Other Repositories):

deb http://archive.canonical.com/ubuntu edgy-commercial main

After making these changes install the opera package (see InstallingSoftware).

Ubuntu 6.06 Dapper Drake

The Opera browser is available from the Canonical commercial repository. To get it through Synaptic or apt, add the following line to your repository list (see Adding Other Repositories):

deb http://archive.canonical.com/ubuntu dapper-commercial main

However, as of 2007.05.05, only 9.10 is available. It is adviseable to install the latest version (9.20) for security reasons, so rather use Opera's own repositories by adding the following instead:

deb http://deb.opera.com/opera/ stable non-free

After making these changes install the opera package (see InstallingSoftware).

64-bit

Opera is, alas, closed source. That means that we will have a 64-bit version only when Opera Software gets around to making one. In the meantime, you can run still run 32-bit Opera in a 64-bit OS with a few extra steps.

I have had better luck with the static version of Opera. That way you don't have to worry about the 32-bit QT dependency. Install it with

sudo dpkg -i --force-architecture opera-static....deb

You will also want some compatibility-layers:

sudo aptitude install ia32-libs ia32-libs-gtk lib32asound2 linux32

Opera should work now. Now you need some plugins. There are other places to get better guides, but here is a quick run through.

  • To get Flash 9, get the "flashplugin-nonfree" package from packages.ubuntu.com, for i386. Install it with the same dpkg command as above.

  • To get Adobe acroread, get the packages "acroread", "acroread-escript", and "mozilla-acroread" from packages.ubunu.com. You will have to get the ones for Edgy or earlier because licensing changes prevent inclusion in Feisty and later. Install with the same dpkg command as above.

Making it more compatible with GNOME

Opera will now be accessible from Applications-->Internet-->Opera.

To get Opera to work better with GNOME, we're going to make sure it uses gnome-open for file-handling. Open a Terminal and type:

mkdir ~/.opera
cat >> ~/.opera/filehandler.ini

Select the following text and paste it into your terminal by pressing Shift+Ins:

Opera Preferences version 2.0
; Do not edit this file while Opera is running
; This file is stored in UTF-8 encoding
[Settings]
Default File Handler=gnome-open ,1
Default Directory Handler=gnome-open ,1

Then press Ctrl+d.

Skins for Opera

Press SHIFT+F12 and browse the available skins, pick any you like. Changing, adding, and removing them is very easy, and new ones are created very often. Below are some skins that might suit you.

The main page for Opera skins is [WWW] http://my.opera.com/community/customize/skins/.

GNOME Skins for Opera

You may preview the skins linked below:

In Opera, select "Download" to install the skin.

KDE Skin for Opera

You may preview the skins linked below:

In Opera, select "Download" to install the skin.

Integration with Gaim/Pidgin

In Tools->Preferences->Advanced->Programs, add a new protocol you want to add(eg. ymsgr for Yahoo) and select "Open with other application" and enter /usr/bin/gaim-url-handler(gaim) or /usr/bin/purple-url-handler(pidgin).

Protocol integration with KDE

In the Tools->Preferences->Advanced->Programs, add a new protocol you want to add(eg. ymsgr for Yahoo) and select "Open with other application". Then, if you want to use the default program you set in KDE, just set the handler to "kfmclient exec".

Setting Opera as default browser in GNOME

To set Opera as the system default browser and mailreader, follow these steps:

  • Go to System -> Preferences -> Preferred Applications

  • Under the Web Browser tab select "Opera" and select "Open link in new tab"

  • Under the Mail Reader tab select "Custom" and, in the Command box, enter:

opera -newmail "%s"

Troubleshooting

Missing package

If you have choosen the qt-shared version, you need the libqt-mt package. However, this trick does not work with Ubuntu 6.10 Edgy Eft.

Ubuntu 6.06 Dapper Drake

[WWW] Download the package for your architecture and double click the .deb to install.

Rerun installation of Opera and the dependancy problems will be gone.

Install Java

If you start Opera from the console you may see the following error message if java doesn't work correctly:

ERROR: ld.so: object 'libjvm.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object 'libawt.so' from LD_PRELOAD cannot be preloaded: ignored.

To fix this, correct the Java path under Tools -> Preferences -> Advanced Tab -> Content -> Java options. It should look similar to this:

/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/i386/

Your actual java runtime version could be different from this one. Changes will not take effect until the browser is restarted. Use [WWW] http://www.java.com/en/download/help/testvm.xml to test your Java Virtual Machine (JVM). You need to have Java installed for this. See Java to find out how to do that.

General Plugin Problems

In order for Opera to see a plugin, the plugin must be in Opera's plugin path. You can add directories to the plugin path with Tools -> Preferences -> Advanced -> Content -> Plugin Options. Add the desired directories and click Find Plugins. You may have to restart Opera to enable the plugin.

Some common plugin .so files:

Shockwave Flash

libflashplayer.so

Acroread

nppdf.so

GXine

gxineplugin.so

Mplayer

mplayerplug-in.so

[WWW] Opera's Linux Plugin Page.

Flash problems

Just use the latest version of flash [WWW] RestrictedFormats/Flash.

Acroread Plugin Problems

The acroread plugin did work by default in Opera 8.x. It works for recent versions so you probably do nto need following:

  • You must edit the Opera startup script for it to work. Use your favorite editor to open the opera startup script:

gksudo gedit /usr/bin/opera

Replace the lines

OPERA_LD_PRELOAD="${LD_PRELOAD}"
export OPERA_LD_PRELOAD

with

LD_PRELOAD="libXm.so.2:${LD_PRELOAD}"
export LD_PRELOAD
OPERA_LD_PRELOAD="${LD_PRELOAD}"
export OPERA_LD_PRELOAD

Start Opera and open a pdf. When it asks you what to do, click the Change button next to the Opens With. A file type association dialog should popup; choose the plugin option at the bottom (nppdf.so should be an option).

Opera Segmentation Fault and Java crash with static version problem

If your Opera browser started to segfault, or you are using the static version and having problems with java, do the following:

1. Edit the ~/.opera/pluginpath.ini, and change the lines to this

[Paths]
/usr/lib/opera/plugins=1
/usr/lib/mozilla/plugins=0
/usr/lib/netscape/plugins-libc6=0

2. Create a symlink from /usr/lib/mozilla/plugins/libflashplayer.so to /usr/lib/opera/plugins/libflashplayer.so

3. Check your ~/.opera/javapath.txt, when using blackdown java, it should be /usr/lib/j2se/1.4/jre/lib/i386

Solution from rwf, based on [WWW] this forum thread.

Video plugins

As of now (May 2007), embedded video playback does not work well in opera. The probably best plugin, mozilla-mplayer, works only partialy and requires [WWW] manual compiling. You can try vlc, gxineplugin or totem, but it is probably adviseable to just use Firefox for sites as [WWW] http://www.apple.com/trailers

Install Weekly Build

These are developement unstable version, use on your own risk!

  • Download weekly build from [WWW] http://my.opera.com/desktopteam/ and follow instructions for installing snapshot release (see above).

  • To locate libxpcom.so on your system and softlink it to /usr/lib

sudo ln -s /usr/lib/mozilla-firefox/libxpcom.so /usr/lib/libxpcom.so

Credits

Credits for the GNOME skin: [WWW] mneptok

Tuesday, June 26, 2007

Install PostgreSQL on Ubuntu

Introduction

PostgreSQL is a fully featured object-relational database management system. It supports a large part of the SQL standard and is designed to be extensible by users in many aspects. Some of the features are: ACID transactions, foreign keys, views, sequences, subqueries, triggers, user-defined types and functions, outer joins, multiversion concurrency control. Graphical user interfaces and bindings for many programming languages are available as well.

Postgresql Database Installation in Debian

If you want to install the PostgreSQL base system as well as a textual clientrun the following command from your shell

#apt-get install postgresql postgresql-client

This will install a lot of package dependencies as well. The version of PostgreSQL installed should be 7.4 on a common Debian Sarge system. If you want to check the official documentation click here.

A few questions will be asked by the configuration script. Most of them can be simply agreed, but you might want to read them to know what configuration PostgreSQL will use.

Data directory All database data will be kept in /var/lib/postgres/data by default.

Data removal policy Also by default, a PostgreSQL system removal won't remove the data (database contents).
Locale The locale should be configured to accept the character encoding you are going to use with your database system. Choose something that suits you. The list of available locales comes from the system. If you need more locales, you need to install them on the system first.

Date Choose European or US as your preferred date format.

The install continues with several default parameters, and then creates /etc/postgresql/postgresql.conf, which will hold your configuration settings.

Creating Users for your Database

The only (default) way to log into your newly created database system is to log as root, then to log as user postgres, by issuing

#su
#su postgres
#psql template1
#template1=# \q
#exit

However, you would probably like to be able to login as your unix user, or any other user you choose. There are several ways to set up these accesses, so let's decomposeAlowing local users to login is done by editing the /etc/postgresql/pg_hba.conf file (a complete documentation of this file is available here). There, you have to retrieve a series of lines like the following ones

local all postgres ident sameuser
#
# All other connections by UNIX sockets
local all all ident sameuser
#
# All IPv4 connections from localhost
host all all 127.0.0.1 255.255.255.255 md5
# All IPv6 localhost connections
host all all ::1 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff ident sameuser
host all all ::ffff:127.0.0.1/128 ident sameuser
#
# reject all other connection attempts
host all all 0.0.0.0 0.0.0.0 reject

This file has limited accesses but we will come back here later.Now what we have told PostgreSQL is that all users on the local machine should be able to access all databases, using their UNIX login and passwords. You need to restart your database to take new changes effect

Restart postgresql using the following command

#/etc/init.d/postgresql-8.2 restart

Now the problem is that you have authorized users to log into the database, but they will only be able to log in if they also exist in the database. So you need to create accounts with their usernames. This is done by issuing the createuser command as user postgres as follows

#su postgres
#createuser firstuser
#exit

The createuser command will ask you if the user should be able to create databases or create new users. Answer truly.

Now you have a new user in the database, and you should be able to connect as this user (let's call him firstuser) like this:

#su - firstuser
#firstuser@localhost:~$ psql -W template1
#template1=# \q
#exit

The -W parameter is to ask for a password prompt. You should enter your system password when asked.
So that's it, we got the first part of this installation running. Now let's prepare this for the web.

If some of your web scripts are going to need a connection to the database, you will need to grant them some access via a new user, reserved for this web usage.

Let's first create this new user (as user postgres). Let's call him webuser.

#su postgres
#createuser webuser
#exit

Now you want to give him access to one or several databases (let's say you will let him access the databases which name is web). To do this, you need to edit once more the pg_hba.conf file. Retrieve the first line below and write the second one just beneath the first.

host all all 127.0.0.1 255.255.255.255 md5
host web webuser 127.0.0.1 255.255.255.255 md5

Would you like to give this user access from any computer on the sub-network 192.168.0.xxx, you would have to add the following line

host web webuser 192.168.0.1 255.255.255.0 md5

You have to grant him access to the host as it will probably use the TCP/IP protocol to get a connection to the database, and that's what host is for. But as you have given him an md5 authentication type, you need to give him a password as well. In order to do this, you need to connect to the database and issue a special command, all as postgres user:

#su postgres
#postgres@localhost:~$ psql template1
#template1=# alter user webuser password 'some_password';
#ALTER USER
#template1=# \q
#exit

Now the user should have a nice 'some_password' password that you can use after restarting PostgreSQL to make it remember your changes to pg_hba.conf.

Restart postgresql using the following command

#/etc/init.d/postgresql-8.2 restart

And you should be able to create his own database if you gave him the permission

#createdb -h localhost -U webuser -W web

And connect to this newly-created database using the following command

#psql -h localhost -U webuser -W web

As you might have noticed, we use -h localhost here. This is to force the PostgreSQL client to use TCP/IP instead of UNIX sockets. If you don't want is, you need to add a new line into the "local" category of pg_hba.conf for the user webuser to connect via sockets.The line would be something like

local web webuser md5

Using SQL

The first important command you might want to know is

#psql -h localhost -U webuser -W -l

This will give you a list of available databases.

Now connect to the PostgreSQL database using the psql client, and let's create a small table, just after a few tests

web=> SELECT version();
web=> SELECT current_date;
web=> SELECT 2+2;
web=> \h
web=> \d
web=> \dt
web=> CREATE TABLE weather(
web=> city varchar(80),
web=> temp_lo int, -- low temperature
web=> temp_hi int, -- high temperature
web=> prcp real, -- precipitation
web=> date date
web=> );
web=> INSERT INTO weather (city, temp_lo, temp_hi, prcp, date)
web=> VALUES ('San Francisco', 43, 57, 0.0, '1994-11-29');
web=> INSERT INTO weather (date, city, temp_hi, temp_lo)
web=> VALUES ('1994-11-29', 'Hayward', 54, 37);
web=> SELECT city, temp_lo as 'Lowest Temperature', temp_hi as 'Highest Temperature' FROM weather;
web=> SELECT city FROM weather WHERE temp_lo < 40;
web=> SELECT max(temp_lo) FROM weather;
web=> UPDATE weather SET temp_lo = 41 WHERE city = 'Hayward';
web=> SELECT * FROM weather;
web=> DELETE FROM weather WHERE prcp IS NULL;
web=> SELECT * FROM weather;
web=> \q

Now you've had a nice overview of several SQL statements and how to use them in PostgreSQL.

Later, you might want to create a table with a numerical sequence as an index. This link will help you get through this step which I find counter-intuitive and user-unfriendly at will. You might as well know of a shortcut. If you want to create a default auto-incremental key that will be used by your table, you need to define (for every table) a SEQUENCE. This id done, for the weather table above, like this (with the help of user comments here):

web=> CREATE SEQUENCE my_table_pk_sequence;
web=> CREATE TABLE weather(
web=> id int not null default nextval('my_table_pk_sequence') PRIMARY KEY,
web=> city varchar(80),
web=> temp_lo int, -- low temperature
web=> temp_hi int, -- high temperature
web=> prcp real, -- precipitation
web=> date date
web=> );

And then insert elements as before, ignoring the id field

web=> INSERT INTO weather (date, city, temp_hi, temp_lo)
web=> VALUES ('1994-11-29', 'Hayward', 54, 37);
web=> SELECT * FROM weather;

This should have inserted an auto-incremented id.

If you want to install ODBC Support follow this

First install ODBC support packages in debian

#apt-get install odbc-postgresql

This should need about 1 MB on your system's hard drive.This should be enough to form a DSN name in order to connect to your table. A good source of information on the topic can be found here.

Using the parameters we used here above, you should be able to connect with something like:

Server=localhost{ or the IP address of your PostgreSQL server};Database=web;Uid=webuser;Pwd=some_password"

Note that we use MD5 encryption, so you might need to specify that somewhere (and encrypt your password before you put it in the connection string).

If you don't want to do this through command line no problem you can use web interface tools for postgresql.If you want to use this click here

Sunday, June 24, 2007

Netbeans JSF!!!!

public DataModel getTbcompanys() {
EntityManager em = getEntityManager();
try{
Query q = em.createQuery("select object(o) from Tbcompany as o ORDER BY o.id");
q.setMaxResults(batchSize);
q.setFirstResult(firstItem);
model = new ListDataModel(q.getResultList());
return model;
} finally {
em.close();
}
}

trong file Controller

Saturday, June 23, 2007

rar archive!

sudo apt-get install rar
sudo ln -fs /usr/bin/rar /usr/bin/unrar

Multimedia

Ubuntu strives to make all software that meets the licensing terms in the [WWW] Ubuntu License Policy available. However patent and copyright restrictions complicate free operating systems distributing software to support proprietary formats.

Ubuntu's commitment to only include completely free software by default means that proprietary media formats are not configured 'out of the box'.

Ubuntu can play the most popular non-free media formats, including DVD, MP3, Quicktime, Windows Media, and more by following the instructions below. If this seems like unnecessary work, remember that Ubuntu is limited by patents and license restrictions in some countries, which make it illegal for Ubuntu to include them. Avoid formats suppressed by DRM (Digital Rights Management, or Digital Restrictions Management), as they are often unplayable.

See Ubuntu's [WWW] Free Software Philosophy and the Free Formats page for a more comprehensive discussion of these issues.

  • Legal Notice Patent and copyright laws operate differently depending on which country you are in. Please obtain legal advice if you are unsure whether a particular patent or restriction applies to a media format you wish to use in your country.

Playing Restricted Formats

Follow these steps to play most common multimedia formats, including MP3, DVD, Flash, Quicktime, WMA and WMV, including both standalone files and content embedded in web pages.

MovieTrailer+SeeDiscussionPage.png

Ubuntu 7.04

  • Click Applications → Add/Remove. In the top right, change the setting to All available applications. Then select Other in the left panel and then select the Ubuntu restricted extras package. Click OK.

  • To play most DVDs you'll need the libdvdcss2 package. This package is available using Medibuntu. This is a third party package, and not supported by Canonical.

Note: If DVD playback fails, and you've never played any DVD before on your system, you may need the regionset package to initially set the drives region.

  • Some external codecs may be needed in order to play certain proprietary formats such as Apple Quicktime or RealVideo. These external codecs are available in the third-party repository of Medibuntu.

Ubuntu 6.06 and 6.10

Install the following packages to play most proprietary formats using the Totem and Rhythmbox applications, both of which are included in Ubuntu by default. Since the version of Totem that comes with Ubuntu does not yet play DVDs, the list below also includes packages for the GXine and Ogle players, which do.

  • Ensure the relevant repositories are enabled. Click System → Administration → Synaptic Package Manager → Settings → Repositories and then click Add. Check the Community maintained (Universe) and Non-free (Multiverse) boxes. When you close the window, click Reload.

  • Install the packages. While you could install packages individually using Synaptic, here is one case where any Ubuntu user can save a lot of time by using the command line. Quit out of Synaptic, then click Application → Accessories → Terminal and paste the following command:

sudo apt-get install gstreamer0.10-pitfdll gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gxine libxine-main1 libxine-extracodecs ogle ogle-gui
  • To play most DVDs you'll need the libdvdcss2 package. This package is available using Medibuntu. This is a third party package, and not supported by Canonical.

Note: If DVD playback fails, and you've never played any DVD before on your system, you may need the regionset package to initially set the drives region.

  • Some external codecs may be needed in order to play certain proprietary formats such as Apple Quicktime or RealVideo. These external codecs are available in the third-party repository of Medibuntu.

  • Users of x86 systems may also install Adobe Flash Player.

Detailed Instructions and Troubleshooting

Audio

DVD

Web

Video

Other

The Ubuntu and Kubuntu Media Players

  • Ubuntu 6.06 LTS (Dapper Drake) comes with Totem (a movie player) and Rhythmbox (a music player)

  • Kubuntu 6.06 LTS and Kubuntu 6.10 include Kaffeine (a multimedia player) and AmaroK (a music player)

These media players support free formats (Ogg Vorbis, Ogg Theora, and similar formats) 'out of the box'. However, they can also play most non-free media formats if you install the additional gstreamer (for Ubuntu only) or libxine1 (for Kubuntu only) packages listed above.

Alternative Media Players

  • The best support for MPEG-1, MPEG-2, MPEG-4 (for example, encoded with DivX, XviD or FFmpeg MPEG-4), QuickTime and other proprietary or non-free media formats is currently provided by Totem-xine, Kaffeine, gxine, and MPlayer. Playing Windows Media Video (WMV) or RealVideo files requires a software library that Ubuntu cannot distribute due to licensing restrictions (see Medibuntu for more information).


  • Additional Ubuntu Players

    Totem-xine or gxine are recommended for most users; MPlayer provides some of the most comprehensive Free Software support for free and non-free media formats and is highly recommended, but the setup and configuration are slightly more complicated, particularly for Ubuntu Breezy users.

The two default media players for Kubuntu (Amarok and Kaffeine) both use xine by default. There are other applications that uses xine as a backend. For any xine based players, some packages need to be installed to play most media formats (MP3, DVD, etc.). These packages are:

  • libxine1-ffmpeg (Support for playback of MPEG formats (i.e. MP3) and other formats.)

  • libdvdread3 (For DVD playback.)

  • libdvdcss2 (For encrypted DVD playback.)

libdvdcss2 is not in the Ubuntu repository for legal reasons. This package is available using Medibuntu. This is a third party package, and not supported by Canonical.

Additionally, there are some formats that do not have implementations in xine yet. Non-native codecs can be used to play such formats. These codecs are available using Medibuntu. These codecs are not supported by Canonical.

  • A good media player, who allows the great functionality available in AmaroK at Kubuntu / KDE, is provided in the Gnome media player BMPx. It is currently only available in Feisty, but has to this point the most functionality of all Gnome media players, especially for those who switch from Kubuntu.

    • Ubuntu 6.06 LTS (Dapper Drake)

      • Install the following packages

        • totem-xine

        • gxine

        • libxine-extracodecs

        • mplayer

    • Ubuntu 5.10 (Breezy Badger) and earlier

      • Install

        • totem-xine

        • gxine

      • Note for Ubuntu 5.10: See MPlayer/Breezy for details on how to install and configure MPlayer for your computer architecture.


  • Additional Kubuntu Players

    • In addition to the default Kaffeine player, you could try KMplayer and Codeine.

    • Kubuntu 6.06 (Dapper Drake) and Kubuntu 6.10 (Edgy Eft)

      • Install

        • kmplayer

        • [WWW] codeine

        • mplayer

        • xine-ui

        • libxine-extracodecs

eyes.png See Multimedia Applications for an overview of the most popular media players for Ubuntu and Kubuntu.

Warning Regarding Alternative Installation Methods

Warning: EasyUbuntu and Automatix are third-party utilities for installing the most commonly requested applications in some Debian-based distributions. They are not supported or recommended by Ubuntu. While they work well for many users, they have also been known to corrupt systems and leave them in a state where they cannot be upgraded to a later Ubuntu release.

Wine Instructions!

Wine allows you to run many Windows programs on Linux. Its homepage can be found at [WWW] http://www.winehq.org. If you are running the latest release of Wine, you can get further assistance on the #winehq IRC channel.

Installing Wine

A moderately recent version of Wine is available from the Ubuntu universe software channel. It is always recommended that you only install software from the official channels, but you also have the option to install the latest version from WineHQ's unofficial repository.

Ubuntu versions of Wine (Recommended)

  1. Add the Universe repository (see Repositories if you need help)

  2. Update the package listing.

  3. Install the wine package. (see InstallingSoftware if you need help).

Note: If you are looking for AMD64 wine packages, go to this page: WineForAMD64

Newer versions of Wine (Not Recommended)

[WWW] WineHQ provides the newest versions of Wine packaged for Ubuntu. To use these, you need to add the WineHQ repository and then install Wine with Synaptic. For help on adding repositories, see the Repositories page.

  1. Add the repository:

    • For Ubuntu 7.04 (Feisty Fawn): Add the following repository, deb http://wine.budgetdedicated.com/apt feisty main

    • For Ubuntu 6.10 (Edgy Eft): Add the following repository, deb http://wine.budgetdedicated.com/apt edgy main

    • For Ubuntu 6.06 LTS (Dapper Drake): Add the following repository, deb http://wine.budgetdedicated.com/apt dapper main

  2. Add the repository key by typing the following into a terminal:

    • wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -

  3. Update the package cache using sudo apt-get update or by clicking 'Reload' in Synaptic

  4. Install wine

Note: If a source repository is desired, simply add the repositories as above except, replace deb with deb-src or follow the instructions on [WWW] http://winehq.org/site/download-deb.

Installing Windows Applications Using Wine

To install Windows applications using Wine, follow these instructions:

  1. Download the Windows application from any source (e.g. download.com). Download the .EXE (executable).

  2. Place it in a convenient directory (e.g. the desktop, or home folder).

  3. Open the terminal, and cd into the directory where the .EXE is located.

  4. Type wine the-name-of-the-application.extension (e.g. wine realplayer.exe).

This will start the .EXE d using Wine. If it is an installer, it should then run as it would in Windows. If the application asks for a directory to install the application to, select put it under C:\Program Files. The fake C drive is createunder .wine after a user runs wine in the terminal for the first time. As a hidden folder, the .wine folder is hidden by default. To have it appear, go to the home directory, and press CTRL-H, or go to View > Show Hidden Files.

To start/run Windows programs using Wine

After installing an application using the directions above, those applications can be started and used by entering wine programname.exe (e.g. wine realplayer.exe). When done, close the application as one would normally. You must run the installed executable, which will by default be in the virtual Windows drive created by Wine, at ~/.wine/drive_c. Generally programs will install themselves somewhere under Program Files inside the virtual Windows drive, following Windows conventions.

You can also use the Wine file browser, by running winefile in a terminal. Clicking the C:\ button in the toolbar will open a window where you can browse the virtual Windows drive created in .wine. Doubleclicking an executable in the Wine file browser will run it in Wine.

Instead of having to always enter the terminal or use the Wine file browser, you may also create a, for example, desktop icon, and start a Wine application using that icon. To do this, right click on the desktop and select "Create a launcher." If you wish, select an icon from the list of available icons (or browse to an icon you would like to use), fill out other information that is requested (Name, generic name, etc.). For the command, type in wine the-location-of-the-program.exe (e.g. wine /home/john/.wine/realplayer.exe). The most important part of creating a launcher is the command, and a few other pieces of information are not necessary (e.g. generic name). Make sure not to select "Run in terminal." This completes the process.

If you desire to have an icon on a panel, create a launcher on the panel of choice. Do this by right-clicking the panel, selecting "Add to Panel," and selecting "Custom Application Launcher." This will ask you for the same information as before.

Uninstalling Wine Applications

Open up a terminal window and type "uninstaller" - this will open up a program similar to Windows' "add/remove programs" control panel, allowing you to uninstall applications from a Wine installation. Running uninstall programs directly via Wine should also work normally. Alternatively, you could also simply delete the folder of the application. However, as when done in Windows, this method will be "unclean" and will not remove the program's configuration from the Wine registry like using an uninstaller will.

Configuring Wine

On the command line or in Run Application, type winecfg.

Adding CD and DVD drives to Wine

Go to the drives tab in winecfg. Hit the Autodetect button.

If you find that this does not work correctly for you, then follow these instructions:

  1. Run winecfg

  2. Navigate to the drives tab

  3. Click on Add...

  4. In the path bar, type /media/cdrom

  5. Click Show Advanced button below the Browse... button and set the Type to CD-ROM

  6. Click OK

If you have more than one CD/DVD device you will need to identify each one differently. Use /media/cdrom0 for the first CD/DVD device, /media/cdrom1 for the second one, and so on. If in doubt, type ls -la ~/.wine/dosdevices/ in a terminal to check your CD/DVD device details after Wine is installed.

Adding applications to the menu

It is good procedure before setting up the menu entry to launch the new Windows program from the command line to make sure the program runs properly. To do this type wine "C:\PATHTOPROGRAM\Program.exe" in the command line. (eg. wine "C:\Program Files\World of Warcraft\WoW.exe" ) Once you are satisfied that you have the correct details, use the normal menu editing process to add a new entry. When you get to the Command field of the entry editor be sure to copy and paste the line you used to launch the program from the terminal. Finish and save the new entry. Test to make sure the new Windows program loads via the menu.

Changing application specific settings

  1. Type winecfg at the command line

  2. Click on Add Application...

  3. Navigate to where the exe is and choose that program

  4. The dropdown at the bottom allows you to choose which version of Windows Wine should emulate. Also, any changes to the Libraries and Graphics tabs will only affect the chosen application in the Applications tab.

Using Windows Themes/Skins In Wine

Color Scheme

You can change the wine color scheme to closely match the default ubuntu colors

gedit ~/.wine/user.reg

Replace the [Control Panel\\Colors] section with

[Control Panel\\Colors] 1176981676
"ActiveBorder"="239 235 231"
"ActiveTitle"="239 235 231"
"AppWorkSpace"="198 198 191"
"Background"="93 77 52"
"ButtonAlternativeFace"="200 0 0"
"ButtonDkShadow"="85 85 82"
"ButtonFace"="239 235 231"
"ButtonHilight"="255 255 255"
"ButtonLight"="255 255 255"
"ButtonShadow"="198 198 191"
"ButtonText"="0 0 0"
"GradientActiveTitle"="239 235 231"
"GradientInactiveTitle"="239 235 231"
"GrayText"="198 198 191"
"Hilight"="246 200 129"
"HilightText"="0 0 0"
"InactiveBorder"="239 235 231"
"InactiveTitle"="239 235 231"
"InactiveTitleText"="255 255 255"
"InfoText"="0 0 0"
"InfoWindow"="255 255 166"
"Menu"="239 235 231"
"MenuBar"="239 235 231"
"MenuHilight"="246 200 129"
"MenuText"="0 0 0"
"Scrollbar"="239 235 231"
"TitleText"="255 255 255"
"Window"="255 255 255"
"WindowFrame"="0 0 0"
"WindowText"="0 0 0"
Using Theme/Skins

Wine has basic handling for Windows theme/skin files in the "msstyles" format. There is a large number of these themes on [WWW] Deviant Art. To use these you must make a folder in Wine's virtual Windows drive, then tell Wine to use the theme.

Firstly go into Wine's virtual drive, which is usually ".wine/drive_c" in your Home folder (this is hidden, you may need to select View->Show Hidden Files in the file manager). Inside this folder go into the "windows" folder then make a new folder in there called "Resources". Enter this new folder and make a new folder called "Themes". Inside here you should make a folder for each theme you want, and put the files ending in ".msstyles" directly into them. For example, the full path to a theme file called sample.msstyles might be "/home/username/.wine/drive_c/windows/Resources/Themes/Sample/sample.msstyles".

Next you need to tell Wine to use your theme, so run winecfg. In the configuration window select the tab "Desktop Integration" and check out the "Theme:" box, which should now have your theme in it's menu. After selecting the theme click "Apply" at the bottom to see how it looks (they don't always display properly), then if you are happy click "OK" and you are done.

Fullscreen issues with overlapping Panel

Sometimes the Panel overlaps your fullscreen application you're running in wine. The solution I've used is to remove the panel prior starting the fullscreen app and restarting it afterwards. In Ubuntu the commands are gnome-session-remove gnome-panel and gnome-panel & respectively. In Xubuntu I understand they are killall xfce4-panel and xfce4-panel.

Instructions for specific Windows programs

Some Windows programs have been tested on Ubuntu. They are listed below:

Also, see Wine's Application Database at [WWW] http://appdb.winehq.org/

Creating file associations

If you want certain files to open in a windows application by clicking on them, the best way is to create a script. For example I want Adobe Flash project files (*.fla) to open in Adobe's Flash editor if I double click it.

You can for example create a file gedit ~/.wine/Flash\ 8. Now paste the example script in it, save and close gedit.

Example script:

#!/bin/sh

QUICKPARLOCATION="c:\\Program Files\\Macromedia\\Flash 8\\Flash.exe"
PARAM=`winepath -w "$*"`
wine "$QUICKPARLOCATION" "$PARAM"
exit 0

Make sure the file is executable chmod +x ~/.wine/Flash\ 8

After you completed this go to an *.fla file right click it, properties, go to the “open with” pane, click add, paste '/home//.wine/Flash 8' in the command line and select the radio bullet. Now if everything went ok, you can doubleclick the file and it will be openend in Flash 8.

Unhandled Page Fault

If you get the error message 'wine: Unhandled page fault on read access', try updating to wine 0.9.31, from [WWW] http://wine.budgetdedicated.com/archive/index.html (Download, then install with sudo dpkg -i ./wine_0.9.31~winehq0~ubuntu~6.10-1_i386.deb)

On my computers, at least, this fixes the problem. I'm using 32-bit P4 machines, running Edgy. Wine hasn't worked for me (with any application, even winecfg, or putty.exe) since about wine 0.9.20, but everything is great in 0.9.31

Setup postgreSQL in Ubuntu

How to install and set up a PostgreSQL 8.1 server in ubuntu.

Introduction

PostgreSQL is a powerful object-relational database management system, provided under a flexible BSD-style license.[1] PostgreSQL contains many advanced features, is very fast and standards compliant.

PostgreSQL has bindings for many programming languages such as C, C++, [WWW] Python, Java, PHP, Ruby... It can be used to power anything from simple web applications to massive databases with millions of records.

Installation

Dapper

To install PostgreSQL 8.1 you may use the command line and type :

 sudo apt-get install postgresql-8.1

pgAdmin III is a handy GUI for PostgreSQL, it is essential to beginners. To install type at the command line :

 sudo apt-get install pgadmin3

You may also use the Synaptic package manager from the System>Administration menu to install these packages.

Breezy

The PostgreSQL version included in this release is version 8.0, which has some significant differences with 8.1. You will want to use ubuntu Backports in order to get version 8.1. You may than install PostgreSQL the same way you would under Dapper.

Basic Server Setup

Set password

To start off, we need to change the PostgreSQL postgres user password, we will not be able to access the server otherwise. As the “postgres” Linux user, we will execute the psql command, in a terminal type :

 sudo -u postgres psql template1

Then at the new prompt, type these two commands, replacing <***password***> with the new password (keep this safe ;) ) :

 ALTER USER postgres WITH PASSWORD ' <***password***> ';
\q

Create database

To create the first database, which we will call "mydb", simply type :

 sudo -u postgres createdb mydb

Using pgAdmin III GUI

To get an idea of what PostgreSQL can do, you may start by firing up a graphical client. In a terminal type :

 pgadmin3

You will be presented with the pgAdmin III interface. Click on the "Add a connection to a server" button (top left). In the new dialog, enter the address 127.0.0.1, a description of the server, the default database ("mydb" in the example above), your username ("postgres") and your password.

With this GUI you may start creating and managing databases, query the database, execute SQl etc.

Managing the Server

Managing users and rights

PostgreSQL has a not really easy way to manage users. To manage users, you first have to edit /etc/postgresql/8.1/main/pg_hba.conf and modify the default configuration which is very protective. For example, if you want postgres to manage its own users (not linked with system users), you will add the following line:

8<-------------------------------------------
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
host all all 10.0.0.0 255.255.255.0 password
8<-------------------------------------------

Which means that on your local network (10.0.0.0/24 - replace with your own local network !), postgres users can connect through the network to the database providing a classical couple user / password.

To create a database with a user that have full rights on the database, use the following command:

sudo -u postgres createuser -D -A -P myuser
sudo -u postgres createdb -O myuser mydb

The first command line creates the user the no database creation rights (-D) with no add user rights -A) and will prompt you for entering a password (-P). The second command line create the database 'mydb with 'myuser' as owner.

This little example will probably suit most of your needs. For more details, please refer to the corresponding man pages or the online documentation.

Further reading

If you are not familiar with [WWW] SQL you may want to look into this powerful language, although some simple uses of PostgreSQL may not require this knowledge (such as a simple [WWW] Django project).

The [WWW] PostgreSQL website contains a wealth of information on using this database.


[1] You do not have to pay in order to use PostgreSQL for some applications, such as commercial closed source software, contrary to other well known open source databases.

Gõ tiếng Việt trong Ubuntu 6

Phần mềm quan trọng nhất nhì với người Việt Nam ta ấy chính là bộ gõ tiếng Việt. Không có bộ gõ tiếng Việt trên máy thì quả thật làm việc gì rồi cũng thấy… bế tắc. Gõ tiếng Việt trên Linux cũng có nhiều cách nhưng cách thông dụng và thân thuộc nhất là dùng xvnkb, một bộ gõ tiếng Việt mã nguồn mở khá có tiếng trong thế giới Chim cánh cụt. Nó hoạt động như Vietkey hay Unikey trên Windows vậy. Mình cũng đang gõ bài post này bằng xvnkb :-D .

1. Cài đặt trình biên dịch

Chúng ta sẽ biên dịch từ mã nguồn (đảm bảo nhất) nên sẽ cần tải xuống trình biên dịch. Cái này cũng cần cho những đồng chí lập trình viên nào nuôi ước mơ lập trình trên Linux.

Chọn menu Application > Accessories > Terminal để mở cửa sổ dòng lệnh. Sau đó gõ lệnh sau:

sudo apt-get install build-essential

Chờ cho trình cài đặt tải xuống và giải nén tất cả các gói xong là được. Tuy nhiên xvnkb khi biên dịch cũng yêu cầu phải có thêm gói xorg-dev nữa. Các bạn gõ thêm lệnh sudo apt-get install xorg-dev để cài đặt gói này.

Vậy là xong bước 1.

2. Tải xuống mã nguồn và cài đặt

Trong cửa sổ dòng lệnh gõ wget http://xvnkb.sourceforge.net/xvnkb-0.2.9a.tar.bz2 để tải xuống mã nguồn chương trình. Sau đó giải nén bằng lệnh:

tar -xvf xvnkb-0.2.9a.tar.bz2

Chuyển vào thư mục vừa giải nén và biên dịch, bạn thực hiện tuần tự những lệnh sau:

cd xvnkb-0.2.9a/

./autogen.sh

./configure --use-extstroke

Đến đây phải chỉnh file config.h một chút. Bạn gõ gedit config.h và chỉnh nội dung file thành:

#define __VK_CONFIG_H
#define VK_CHECK_SPELLING
#define VK_USE_EXTSTROKE
#define VK_NEED_UCHAR

(bỏ đi một vài dòng bị lỗi)

Sau đó gõ tiếp các lệnh sau:

make

sudo make install

Chúc mừng, bạn đã cài đặt thành công xvnkb. Bây giờ để khởi động chương trình bạn gõ xvnkb từ cửa sổ dòng lệnh là xong. Nhắp phải chuột lên hộp chương trình của xvnkb để xem menu tuỳ chọn. Nhắp trái chuột để bật tắt tuỳ chọn gõ tiếng Việt.
Nếu muốn xvnkb tự động chạy lúc khởi động, bạn vào menu System > Preferences > Sessions, chọn New và nhập vào ô Command như sau: xvnkb --method=telex --charset=utf8 (trong đó method là telex, vni hoặc viqr; charset là utf8, tcvn, viscii, vps hoặc viqr). Bây giờ xvnkb sẽ khởi động mặc định với kiểu gõ (method) và bảng mã (charset) mà bạn đã chọn.