Java
2007.12.13 16:44

Java communication API in Linux

조회 수 33763 추천 수 0 댓글 2
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form
java.sun.com 사이트에서 Java Communication API 를 다운 받는다.

comm3.0_u1_linux.zip 파일을 압축을 풀면 commapi 이라는 디렉토리가 생긴다.
commapi 디렉토리안에 docs, examples, jar, lib 디렉토리가 있다.

[wittgens@fedora java_packages]$ unzip comm3.0_u1_linux.zip
...
  inflating: commapi/lib/libLinuxSerialParallel.so
  inflating: commapi/lib/libLinuxSerialParallel_g.so
[wittgens@fedora java_packages]$ ls
comm3.0_u1_linux.zip  commapi
[wittgens@fedora java_packages]$ cd commapi/
[wittgens@fedora commapi]$ ls
docs  examples  jar  lib
[wittgens@fedora commapi]$ sudo cp docs/javax.comm.properties $JAVA_HOME/jre/lib/
[wittgens@fedora commapi]$ sudo cp lib/*.so $JAVA_HOME/jre/lib/ext/
[wittgens@fedora commapi]$ sudo cp jar/comm.jar $JAVA_HOME/jre/lib/ext/

[wittgens@fedora examples]$ cd Simple/
[wittgens@fedora Simple]$ java SimpleWrite
port /dev/term/a not found.

위와 같은 에러가 발생할 것이다. linux에서는 시리얼 포트가 /dev/ttyS0, /dev/ttyS1, ... 으로 잡히기 때문에 SimpleWrite.java 파일을 편집하여 /dev/term/a 라는 부분을 /dev/ttyS0로 변경해준다.

[wittgens@fedora Simple]$ javac SimpleWrite.java
[wittgens@fedora Simple]$ sudo java SimpleWrite
Found port /dev/ttyS0
Exception in thread "main" java.io.IOException: Not all params are supported by kernel
        at com.sun.comm.LinuxSerial.nativeSetSerialPortParams(Native Method)
        at com.sun.comm.LinuxSerial.setSerialPortParams(LinuxSerial.java:346)
        at SimpleWrite.main(SimpleWrite.java:93)

변경해 줘도 위와 같은 예외가 발생한다.
무시한다.ㅋㅋ 이와 관련하여 리눅스 포럼에 많이 나와있을 것이다. 참조하여 해결하기 바란다.ㅋ


  • ?
    비트겐스 2007.12.13 16:48
    이벤트 리스너로 처리하지 않으면, 시리얼로 부터 read시 데이터를 읽어버리는 경우가 발생하여
    이벤트 리스너를 추가하여 하나의 SerialPort를 wrapping 한 클래스를 만들었음.
  • ?
    비트겐스 2007.12.27 13:35
    finally { } 블록을 추가하여 한번더 setSerialPortParams를 호출해준다.

Linux
2007.12.05 10:11

프로세스 상태 플래그

조회 수 27619 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form
PROCESS STATE CODES

Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to
describe the state of a process.

D    Uninterruptible sleep (usually IO)
R    Running or runnable (on run queue)
S    Interruptible sleep (waiting for an event to complete)
T    Stopped, either by a job control signal or because it is being traced.
W    paging (not valid since the 2.6.xx kernel)
X    dead (should never be seen)
Z    Defunct ("zombie") process, terminated but not reaped by its parent.



TAG •

조회 수 26045 추천 수 0 댓글 1
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form
Fedora core 6을 7로 업그레이드 하는 방식과 동일하다. fedora-release, fedora-relase-notes 패키지의 URL만 다를 뿐이다.

아래 1~5번은 root 권한으로 셸(shell)에서 수행해야 합니다.

1. yum update
2. yum clean all

현재 패키지가 최신패키지가 되도록 1번과 2번 과정을 반복해 줍니다.

3. 아래 명령을 수행하여 rpm 을 설치합니다.
rpm -Uvh http://download.fedora.redhat.com/pub/fedora/linux/releases/8/Everything/i386/os/Packages/fedora-release-8-3.noarch.rpm http://download.fedora.redhat.com/pub/fedora/linux/releases/8/Everything/i386/os/Packages/fedora-release-notes-8.0.0-3.noarch.rpm 
위와 같이 해주면 /etc/fedora-release 파일 내용이 Fedora release 8 (Werewolf) 로 변경되어 있을 것입니다.
따라서, yum 업데이트시 fedora 8의 저장소로부터 업데이트가 진행될 수가 있습니다.

4. yum -y update
설치된 패키지가 fedora 8 로 업데이트 될 것이다. 참고로 -y 옵션은 질문에 대해 모두 yes로 응답합니다.

5. reboot
재부팅을 하여 Fedora 8으로 업데이트 되었는지 확인합니다.

TAG •
  • ?
    비트겐스 2007.11.28 18:36
    Tip) /etc/yum.repos.d/*.repo 파일들을 편집하여 mirror url은 주석처리하고, base url을 이용하면, 다운로드 속도가 더 좋은 것 같았습니다.

조회 수 32558 추천 수 0 댓글 1
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form
아래 1~5번은 root 권한으로 셸(shell)에서 수행해야 합니다.

1. yum update
2. yum clean all

현재 패키지가 최신패키지가 되도록 1번과 2번 과정을 반복해 줍니다.

3. 아래 명령을 수행하여 rpm 을 설치합니다.
rpm -Uhv http://download.fedora.redhat.com/pub/fedora/linux/releases/7/Fedora/i386/os/Fedora/fedora-release-7-3.noarch.rpm http://download.fedora.redhat.com/pub/fedora/linux/releases/7/Fedora/i386/os/Fedora/fedora-release-notes-7.0.0-1.noarch.rpm 
위와 같이 해주면 /etc/fedora-release 파일 내용이 Fedora release 7 (Moonshine) 로 변경되어 있을 것입니다.
따라서, yum 업데이트시 fedora 7의 저장소로부터 업데이트가 진행될 수가 있습니다.

4. yum -y update
설치된 패키지가 fedora 7 로 업데이트 될 것이다. 참고로 -y 옵션은 질문에 대해 모두 yes로 응답합니다.

5. reboot
재부팅을 하여 Fedora 7으로 업데이트 되었는지 확인합니다.
TAG •
  • ?
    비트겐스 2007.11.28 05:05
    업데이트시 Missing Dependency: python(abi) = 2.4 is needed by package authconfig 에러가 발생되면,
    yum remove authconfig 명령을 내려 authconfig를 제거한 후 다시 yum -y update를 하면 됨. emoticon

Linux
2007.11.28 01:08

Fedora / hostname 변경하기

조회 수 33196 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form
/etc/sysconfig/network 파일을 수정한 후 reboot 해줌.

HOSTNAME="변경할 호스트명"

[wittgens@fot ~]$ cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=fot
[wittgens@fot ~]$
[wittgens@fot ~]$ hostname
fot


TAG •

조회 수 30908 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form

Upgrading Red Hat Linux/Fedora Core with yum

It is possible to upgrade your Red Hat Linux/Fedora Core system using yum instead of the CD/DVD-based install or upgrade option. Only experienced Red Hat/Fedora Core users should attempt this, as the yum upgrade process is not officially supported and may cause problems.

Theoretically, you should be able to upgrade from any Red Hat Linux/Fedora Core release to any Red Hat Linux/Fedora Core release with a yum-compatible repository (i.e. containing yum "header" files). I have successfully upgraded the following operating system releases using yum:
  • Red Hat Linux 7.2 to 9
  • Red Hat Linux 8.0 to 9
  • Red Hat Linux 8.0 to Fedora Core 2
  • Red Hat Linux 9 to Fedora Core 1
  • Fedora Core 1 to Fedora Core 2
  • Fedora Core 2 to Fedora Core 3
  • Fedora Core 3 to Fedora Core 4
  • Fedora Core 4 to Fedora Core 5
The steps are slightly different when upgrading to Fedora Core releases versus a Red Hat Linux release (i.e. through Red Hat Linux 9), so they are presented separately.

Before performing an upgrade with yum, please read the YumUpgradeFaq Wiki.

The basic steps for upgrading a system to the latest Fedora Core release using yum:

1. Install the fedora-release package from the new release
2. Run yum upgrade
3. Reboot

Upgrading to Fedora Core 5

The following steps were used to update a Fedora Core 4 system to Fedora Core 5 using yum.

1. Download and install the Fedora Core 5 version of fedora-release from one of the Fedora Core mirrors.

Example:
# rpm -Uvh http://download.fedora.redhat.com/pub/fedora/linux/core/5/i386/os/Fedora/RPMS/fedora-release-5-5.noarch.rpm 

2. Upgrade to Fedora Core 5.
# yum -y upgrade

If this step fails, I recommend running the following command to capture all screen output to /tmp/yum_upgrade.

# yum upgrade 2>&1 | tee /tmp/yum_upgrade

Failures generally indicate that a currently-installed RPM has a dependency that cannot be satisfied with packages from the new Fedora Core release. Deprecated packages and packages from third party repositories may cause this problem.

The following generates a list of packages that may need to be removed prior to a successful yum upgrade.
$ perl -ne 'print "$1\n" if ((/Error: Missing Dependency:.*is needed by package (.*)$/) || (/Error: Package (.*?) needs.*, this is not available./))' /tmp/yum_upgrade | sort | uniq

If the initscripts package is returned, I recommend booting into the latest Fedora Core 4 kernel, removing all previous kernels, and running yum upgrade again.

3. Reboot the system to begin using Fedora Core 5.
# reboot

Upgrading to Fedora Core 4

The following steps were used to update a Fedora Core 3 system to Fedora Core 4 using yum.

1. Update yum to the latest Fedora Core 3 version.
# yum -y update yum

2. Download and install the Fedora Core 4 version of fedora-release from one of the Fedora Core mirrors.

Example:
# rpm -Uvh http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/os/Fedora/RPMS/fedora-release-4-2.noarch.rpm

3. Disable third-party yum repositories, if applicable.

In my configuration, I had the Dag, FreshRPMs, and Dries third-party yum repositories enabled. As of 2005/06/15, only the Dries repository caused an error message (i.e. it had not been updated with Fedora Core 4 packages or it did not have a Fedora Core 4 directory structure) so I will only disable that repository.

# echo "enabled=0" >> /etc/yum.repos.d/dries.repo

4. When upgrading to Fedora Core 4, the kernel must be upgraded before the rest of the packages.
# yum -y update kernel

Otherwise, you may receive the following error message:

--> Running transaction check
--> Processing Dependency: kernel-utils for package: kernel
--> Finished Dependency Resolution
Error: Missing Dependency: kernel-utils is needed by package kernel

5. Disable SELinux, if applicable, and reboot the system to begin using the Fedora Core 4 kernel. I ran into significant problems after this reboot when SELinux was enabled.

To disable SELinux:

# vi /etc/sysconfig/selinux

Change:
SELINUX=enforcing
-- or --
SELINUX=permissive

To:
SELINUX=disabled

# reboot

7. Remove the Fedora Core 3 kernel(s) to prevent the aforementioned kernel-utils package dependency error.
# yum remove kernel-2.6.\*FC3\*
# yum remove kernel-smp\*FC3\*
(if you have one or more FC3 SMP kernels installed)

8. Continue the upgrade to Fedora Core 4.
# yum -y upgrade

Note: if you receive the following error, import the RPM-GPG-KEY.

warning: rpmts_HdrFromFdno: V3 DSA signature: NOKEY, key ID db42a60e
public key not available for caching-nameserver-7.3-3.noarch.rpm

# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY

9. Reboot the system to begin using Fedora Core 4.

10. If applicable, re-enable SELinux by undoing the changes above, and reboot the system to use SELinux.

User-contributed notes on Upgrading to Fedora Core 4

On 2005/07/16, Jay Thorne wrote:

Before you upgrade the kernel, you need to upgrade mkinitrd, otherwise
the initrd that the kernel install process makes is in the old format
and the new kernel will not boot; it dies with a oops.

# yum -y upgrade mkinitrd

Otherwise, this procedure works well. Good work.

Also, in the x86_64 case, you need to specifically upgrade
libselinux.i386 and libselinux.x86_64 before the kernel upgrade, or the
upgrade will fail with a conflict.

# yum -y upgrade libselinux.i386 libselinux.x86_64

Thanks for Wim Cos for writing on 2005/06/16 and providing the steps to update yum to the latest FC3 version and for the steps to remove FC3 SMP kernels, if applicable.

Upgrading to Fedora Core 3

Before proceeding, please read Seth Vidal's post (Seth is the author of yum) to the fedora-test-list mailing list regarding upgrading from FC2 to FC3 using yum.

1. Verify that the Fedora Project gpg key is installed.

$ rpm -q gpg-pubkey-6b8d79e6-3f49313d
gpg-pubkey-6b8d79e6-3f49313d

If this key is not installed, and you are running Fedora Core, you may install it with:
# rpm --import /usr/share/rhn/RPM-GPG-KEY-fedora

If this key is not installed, and you are not running Fedora Core, you may install it with:
# rpm --import http://fedora.redhat.com/about/security/4F2A6FD2.txt

2. Download the Fedora Core 3 version of fedora-release and yum from one of the Fedora Core mirrors.

Example:

$ wget http://fedora.glorb.com/core/3/i386/os/Fedora/RPMS/fedora-release-3-8.i386.rpm
$ wget http://fedora.glorb.com/core/3/i386/os/Fedora/RPMS/yum-2.1.11-3.noarch.rpm

3. Install the Fedora Core 3 version of fedora-release and yum.

You may need to use the --force flag when installing the RPMs as /etc/sysconfig/rhn/sources from the Fedora Core 3 fedora-release conflicts with up2date.

# rpm -Uvh fedora-release-3-8.i386.rpm yum-2.1.11-3.noarch.rpm
Preparing...                ########################################### [100%]
        file /etc/sysconfig/rhn/sources from install of fedora-release-3-8 conflicts with file from package up2date-4.3.19-1

# rpm -Uvh --force fedora-release-3-8.i386.rpm yum-2.1.11-3.noarch.rpm

4. Upgrade to Fedora Core 3.

# yum upgrade

After several minutes, yum will present a large list of packages that will be upgraded, newly installed, and obsoleted. Choose "y" to download and install the packages.

Is this ok [y/N]: y

Possible problem:

When upgrading from Fedora Core 2 to Fedora Core 3 on one of my systems, yum upgrade experienced dependency problems with many packages, likely due to this bug in rpm. rpm 4.3.1-0.3 was installed when this problem occurred.

Example:
Error: Requiring package gnome-vfs2-2.8.2-8.i386 not in transaction set nor in rpmdb

Installing the Fedora Core 3 versions of rpm (4.3.2-21) and its dependencies (rpm-python, rpm-build, rpm-devel) and re-running yum upgrade fixed the problem.

5. Reboot the system to begin using Fedora Core 3.

Note: you may want to modify /boot/grub/grub.conf and choose the new 2.6.9 kernel (uniprocessor or SMP) as the default kernel as yum upgrade will not modify the default kernel chosen by the grub bootloader. Remember that grub counts the first listed kernel as number 0.

/boot/grub/grub.conf after yum upgrade:

default=2
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Fedora Core (2.6.9-1.667)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-1.667 ro root=LABEL=/
        initrd /initrd-2.6.9-1.667.img
title Fedora Core (2.6.9-1.667smp)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-1.667smp ro root=LABEL=/
        initrd /initrd-2.6.9-1.667smp.img
title Fedora Core (2.6.6-1.435.2.3smp)
        root (hd0,0)
        kernel /vmlinuz-2.6.6-1.435.2.3smp ro root=LABEL=/
        initrd /initrd-2.6.6-1.435.2.3smp.img
title Fedora Core (2.6.6-1.435.2.3)
        root (hd0,0)
        kernel /vmlinuz-2.6.6-1.435.2.3 ro root=LABEL=/
        initrd /initrd-2.6.6-1.435.2.3.img

/boot/grub/grub.conf after manual modification:

default=1
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Fedora Core (2.6.9-1.667)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-1.667 ro root=LABEL=/
        initrd /initrd-2.6.9-1.667.img
title Fedora Core (2.6.9-1.667smp)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-1.667smp ro root=LABEL=/
        initrd /initrd-2.6.9-1.667smp.img
title Fedora Core (2.6.6-1.435.2.3smp)
        root (hd0,0)
        kernel /vmlinuz-2.6.6-1.435.2.3smp ro root=LABEL=/
        initrd /initrd-2.6.6-1.435.2.3smp.img
title Fedora Core (2.6.6-1.435.2.3)
        root (hd0,0)
        kernel /vmlinuz-2.6.6-1.435.2.3 ro root=LABEL=/
        initrd /initrd-2.6.6-1.435.2.3.img

Upgrading to Fedora Core 2

You may want to read the following notes from the yum author about upgrading from Fedora Core 1 to Fedora Core 2:
http://linux.duke.edu/~skvidal/misc/fc1-fc2-yum-hints.txt

Here are the steps I used to upgrade a system from Fedora Core 1 to Fedora Core 2:

1. Install the Fedora Core 2 version of yum and fedora-release:

# rpm -Uvh ftp://ftp.linux.ncsu.edu/pub/fedora/linux/core/2/i386/os/Fedora/RPMS/yum-2.0.7-1.1.noarch.rpm \ ftp://ftp.linux.ncsu.edu/pub/fedora/linux/core/2/i386/os/Fedora/RPMS/fedora-release-2-4.i386.rpm

2. If yum was already installed prior to the upgrade, backup your old /etc/yum.conf file and replace /etc/yum.conf with /etc/yum.conf.rpmnew.

# mv /etc/yum.conf /etc/yum.conf.`date +%m.%d.%y`
# mv /etc/yum.conf.rpmnew /etc/yum.conf

3. Edit /etc/yum.conf. Choose a mirror from http://fedora.redhat.com/download/mirrors.html to the [base] and [updates-released] sections.

Original [base] and [updates-released] sections:

[base]
name=Fedora Core $releasever - $basearch - Base
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/

[updates-released]
name=Fedora Core $releasever - $basearch - Released Updates
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/

New [base] and [updates-released] sections:

[base]
name=Fedora Core $releasever - $basearch - Base
baseurl=ftp://ftp.linux.ncsu.edu/pub/fedora/linux/core/$releasever/$basearch/os/
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/

[updates-released]

name=Fedora Core $releasever - $basearch - Released Updates
baseurl=ftp://ftp.linux.ncsu.edu/pub/fedora/linux/core/updates/$releasever/$basearch/
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/

4. Upgrade to Fedora Core 2.
# yum upgrade

Upgrading to Fedora Core 1

Here are the steps I used to upgrade a system to Fedora Core 1:

1. Download and install the Fedora version of yum:
# rpm -Uvh http://download.fedora.redhat.com/pub/fedora/linux/core/1/i386/os/Fedora/RPMS/yum-2.0.4-2.noarch.rpm

2. Download and install the fedora-release package.
# rpm -Uvh http://download.fedora.redhat.com/pub/fedora/linux/core/1/i386/os/Fedora/RPMS/fedora-release-1-3.i386.rpm

3. Upgrade to Fedora Core 1.
# yum upgrade

Upgrading to Red Hat Linux 9

Here are the steps I used to upgrade a Red Hat Linux 8.0 system to Red Hat Linux 9.

1. Download and install the latest version of yum.
# rpm -Uvh http://linux.duke.edu/projects/yum/download/2.0/yum-2.0.4-1.noarch.rpm

2. Download and install the redhat-release package from the "new" version of Red Hat Linux.
# rpm -Uvh ftp://ftp.quicknet.nl/pub/Linux/ftp.redhat.com/9/en/os/i386/RedHat/RPMS/redhat-release-9-3.i386.rpm

3. If the gnome-mime-data package is installed (confirm with rpm -q gnome-mime-data), change exactarch=1 to exactarch=0 in /etc/yum.conf.

4. Upgrade to Red Hat Linux 9.
# yum upgrade

5. If applicable, change exactarch=0 back to exactarch=1 in /etc/yum.conf.

The following are some problems I ran into with the upgrade from Red Hat Linux 8.0 to Red Hat Linux 9.

Problem:

Resolving dependencies
.package apt needs librpm-4.1.so (not provided)
package apt needs librpmdb-4.1.so (not provided)
package apt needs librpmio-4.1.so (not provided)
package apt needs libelf.so.0 (not provided)

Solution: # rpm -e apt (I will use yum instead of apt for rpm for package management; I could always manually reinstall apt for rpm after the upgrade)


Problem:

Resolving dependencies

.......identical dependency loop exceeded
package gnome-vfs2 needs gnome-mime-data >= 2.0.0-11 (not provided)

Solution: Set exactarch=0 in /etc/yum.conf. The Red Hat Linux 9 gnome-mime-data package is of a different architecture (i386) than the Red Hat Linux 8.0 package (noarch). You may want to change back to exactarch=1 after the yum upgrade.


Problem: After rebooting into the new kernel, my eth0 network interface was brought up with a static address and then with dhcp. During the upgrade process, the file /etc/sysconfig/network-scripts/ifcfg-eth0.dhcp was created. You may want to check /etc/sysconfig/network-scripts for any changes prior to rebooting after the upgrade.

출쳐: http://www.brandonhutchinson.com/Upgrading_Red_Hat_Linux_with_yum.html
TAG •

Board Pagination Prev 1 2 Next
/ 2