리눅스 버전 확인하기

$ cat /etc/issue

or

$ lsb_release -a


리눅스 비트 확인

$ getconf LONG_BIT


저는 이전에 suse 리눅스를 사용하였는데 이때 사용하였떤 shell등이 제대로 동작하지 않아서

이를 해결하기위해 많은 검색하던 도중 우연히 발견하였습니다.


suse는 기본 bash를 사용하는데 이때 사용하였던 스크립트중에  if문 array 선언문 등등 안되는 부분이

많이 있었어서 이를 하나씩 변경하다가 이벙법을 발견하였습니다.


우분투는 기본적으로 dash 쉘을 사용합니다.

하지만 개발용 쉘등은 bash로 개발된것이 많아서 바로 사용이 안되는경우가 많습니다.

shell을 dash로 변경을 하는 방법이나 아니면 ubuntu 기본쉘을 bash로 변경하는 방법이 있는데

저는 ubuntu기본 쉘을 bash로 변경함으로써 이를 해결화였습니다.



$ sudo dpkg-reconfigure dash

NO라고 선택


위를 실행하면

dash대신 bash가 설치됩니다.



현재 설치된 shell확인하는 방법입니다.

$ ls -al /bin/sh

lrwxrwxrwx 1 root root 4  12월 11 02:12 /bin/sh -> bash



라이브러기 경로 추가


리눅스에 설치하는 라이브러리에 따라 설치되는 경로가 조금씩 틀린경우가 있습니다.

저같은 경우에는 우분투에 boost라이브러리르 설치 했을때 12.04는 /usr/lib에

14.04같은경우에는 /usr/lib/x86_64-linux-gnu에 설치가 되었습니다.

이런경우에 /usr/lib/x86_64-linux-gnu를 기본 라이브러리 경로로 설정할 필요가 있습니다.


아래 2가지 방법으로 가능합니다.


1.  /etc/ld.so.conf 에 경로를 입력하는 방법입니다.

$ vi /etc/ld.so.conf

include /usr/lib/x86_64-linux-gnu     // 추가하고 저장하빈다.

$ ldconfig  // 링킹정보를 다시 읽어들입니다.


2. /etc/profile에 입력하는 방법입니다.

$ vi /etc/profile

아래사항을 입력합니다.

LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu

export LD_LIBRARY_PATH

재로그인을 하면 적용됩니다.

IPCS 와 IPCRM을 이용한 IPC(Inter Process Communication) 자원관리

 

IPCS 명령어


- ipc의 상태를 보는 명령어입니다.


ipcs [-qms]


ipcs

- 모든 IPC의 정보를 보여준다

ipcs -q

- Message queue의 정보를 보여준다

ipcs -m

- Shared memory segment의 정보를 보여준다

ipcs -s

- Semaphore의 정보를 보여준다.


 

 

ex) ipcs 모든 IPC정보를 보여준다

 

aaaa@linux:~> ipcs

 

------ Shared Memory Segments --------

key        shmid      owner      perms      bytes      nattch     status      

0x00000000 131072     root      777        135168     1                       

0x00000000 196609     root      644        106496     1          dest         

0x00000000 851974     aaaa 600        262144     1          dest         

0x00000000 1179655    aaaa 600        393216     2          dest         

 

------ Semaphore Arrays --------

key        semid      owner      perms      nsems     

 

------ Message Queues --------

key        msqid      owner      perms      used-bytes   messages

 

ex) 특정 IPC정보를 본다

 

aaa@linux:~> ipcs -m

 

------ Shared Memory Segments --------

key        shmid      owner      perms      bytes      nattch     status      

0x00000000 131072     root      777        135168     1                       

0x00000000 196609     root      644        106496     1          dest         

0x00000000 851974     aaa 600        262144     1          dest         

0x00000000 1179655    aaa 600        393216     2          dest 



IPCRM 명령어


- 지정한 IPC를 지운다.


ipcrm [ -q msgid | -Q msgkey | -s semid | -S semkey |

              -m shmid | -M shmkey ]


ipcrm -q msgid

Message Queue ID를 지운다

ipcrm -Q msgkey

- Message Queue Key를 지운다

ipcrm -s semid

Semaphore ID를 지운다

ipcrm -S semkey

- Semaphore Key를 지운다

ipcrm -m shmid

- Shared Memory ID를 지운다

ipcrm -M shmkey

- Shared Memory Key를 지운다.


ex )

ipcrm -q 1000

ipcrm -m 232323

우분투 서버 네트워크 설정 방법

 

IP 설정 및 DNS 설정

 

/etc/network/interfaces

 

1. DHCP로 설정

auto eth0

iface eth0 inet dhcp

 

2. 수동(Static)으로 설정

 

auto eth0

iface eth0 inet static

address 192.168.0.1

netmask 255.255.255.0

gateway 192.168.0.254

dns-nameservers 168.126.63.1 168.126.63.2

 

 

변경내용 적용

 

ifdown eth0 && ifup eth0

 

or 

 

service networking restart

+ Recent posts