반응형

vim 에서
     vim에서는 dos mode의 화일을 읽어도 화면에 ^M을 표시하지 않습니다.
     대신 밑에 [dos] 라고 나타납니다.
     다음과 같이 해서 unix mode로.. 즉 ^M을 빼는것입니다.

     :set fileformat=unix

     반대로 unix mode에서 dos mode로 바꾸고 싶다면

     :set fileformat=dos

반응형
반응형

CentOS 7 에서 로케일 변경하는 방법입니다.

현재 사용가능한 한글관련 로케일

# localectl list-locales | grep -i ko
ko_KR
ko_KR.euckr
ko_KR.utf8
kok_IN
kok_IN.utf8
korean
korean.euc
ru_RU.koi8r
ru_UA.koi8u
tg_TJ.koi8t
uk_UA.koi8u

utf8 로 변경

 # localectl set-locale LANG=ko_KR.utf8

수동으로 변경시는 /etc/locale.conf 파일을 만들어 아래 내용 추가

LANG=ko_KR.utf8

서버 부팅 후 로케일 설정 확인

# locale
LANG=ko_KR.utf8
LC_CTYPE="ko_KR.utf8"
LC_NUMERIC="ko_KR.utf8"
LC_TIME="ko_KR.utf8"
LC_COLLATE="ko_KR.utf8"
LC_MONETARY="ko_KR.utf8"
LC_MESSAGES="ko_KR.utf8"
LC_PAPER="ko_KR.utf8"
LC_NAME="ko_KR.utf8"
LC_ADDRESS="ko_KR.utf8"
LC_TELEPHONE="ko_KR.utf8"
LC_MEASUREMENT="ko_KR.utf8"
LC_IDENTIFICATION="ko_KR.utf8"
LC_ALL= 

# cat /etc/locale.conf
LANG=ko_KR.utf8
반응형
반응형
[1]
[2] Install MRTG, SNMP.
[root@dlp ~]#
yum -y install net-snmp net-snmp-utils mrtg
[3] Configure SNMP (Simple Network Management Protocol).
[root@dlp ~]#
vi /etc/snmp/snmpd.conf
# line 41: comment out

#
com2sec notConfigUser   default       public
# line 74,75: uncomment and change

# change to your local network for "mynetwork" section

# change comunity name except public or private

com2sec local
localhost
Serverworld

com2sec mynetwork
10.0.0.0/24
Serverworld
# line 78,79: uncomment and change

group MyRWGroup
v2c
    local

group MyROGroup
v2c
    mynetwork
# line 85: uncomment

view all    included  .1                               80

# line 93,94: uncomment and change

access MyROGroup ""
v2c
  noauth  
exact
  all   none   none

access MyRWGroup ""
v2c
  noauth  
exact
  all   all      all
[root@dlp ~]#
systemctl start snmpd

[root@dlp ~]#
systemctl enable snmpd
# show status (replace the "Serverworld" to your comunity name)

[root@dlp ~]#
snmpwalk -v2c -c Serverworld localhost system

SNMPv2-MIB::sysDescr.0 = STRING: Linux dlp.srv.world 3.10.0-229.4.2.el7.x86_64 #1 SMP Wed May.....
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (91954) 0:15:19.54
SNMPv2-MIB::sysContact.0 = STRING: Root <root@localhost> (configure /etc/snmp
.....
.....
SNMPv2-MIB::sysORUpTime.9 = Timeticks: (4) 0:00:00.04
SNMPv2-MIB::sysORUpTime.10 = Timeticks: (4) 0:00:00.04
[4] Configure MRTG.
[root@dlp ~]#
cfgmaker --snmp-options=:::::2 --ifref=descr --ifdesc=descr Serverworld@10.0.0.30 > /etc/mrtg/mrtg.cfg

[root@dlp ~]#
vi /etc/mrtg/mrtg.cfg
# line 8: add

WorkDir: /var/www/mrtg
# line 16: uncomment

Options[_]: growright, bits
# near line 75: uncomment all from the line & change MaxBytes value

Target[10.0.0.30_eth0]: \eth0:Serverworld@10.0.0.30:::::2
noHC[10.0.0.30_eth0]: yes
SetEnv[10.0.0.30_eth0]: MRTG_INT_IP="10.0.0.30" MRTG_INT_DESCR="eth0"
MaxBytes[10.0.0.30_eth0]:
125000000

Title[10.0.0.30_eth0]: eth0 -- dlp.srv.world
PageTop[10.0.0.30_eth0]: <h1>eth0 -- dlp.srv.world</h1>
.....
.....
# execute mrtg 3 times (display warnings until 3 times)

[root@dlp ~]#
for (( i=1 ; i <= 3 ; i++ )); do env LANG=C mrtg /etc/mrtg/mrtg.cfg; done

2015-06-16 19:54:12, Rateup WARNING: /usr/bin/rateup could not read the primary log file for 10.0.0.30_eth0 2015-06-16 19:54:12, Rateup WARNING: /usr/bin/rateup The backup log file for 10.0.0.30_eth0 was invalid as well 2015-06-16 19:54:12, Rateup WARNING: /usr/bin/rateup Can't rename 10.0.0.30_eth0.log to 10.0.0.30_eth0.old updating log file
# generate index file

[root@dlp ~]#
indexmaker --columns=1 /etc/mrtg/mrtg.cfg > /var/www/mrtg/index.html
# add in Cron

[root@dlp ~]#
vi /etc/cron.d/mrtg
*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
[5] Configure httpd to access MRTG site from other hosts.
[root@dlp ~]#
vi /etc/httpd/conf.d/mrtg.conf
# line 10: uncomment and add access permission, line 11: add DirectoryIndex

Require ip
10.0.0.0/24
DirectoryIndex index.html
[root@dlp ~]#
systemctl start httpd

[6] Access to the "http://(MRTG hostname or IP address)/mrtg/" from a client with HTTP, then it's possible to see MRTG site.

 

출처 : http://www.server-world.info/en/note?os=CentOS_7&p=mrtg

반응형
반응형

There is an update to this post available: UUIDs and Linux: Everything you ever need to know.

The Universally Unique Identifier can be used to identify a device independent form its mount point or device name. This is more and more important as many devices today support hot-plugging or are external anyway. Therefore it makes sometimes sense to access a device (for example in fstab) not by device name but by the UUID.

There are several ways to get the UUID. The first one uses the /dev/ directory. While you are on is you might want to check other by-* directories, I never knew of them.

1
2
$ ls -l /dev/disk/by-uuid
lrwxrwxrwx 1 root root 10 11. Okt 18:02 53cdad3b-4b01-4a6c-a099-be1cdf1acf6d -> ../../sda2

Another way to get the uuid by usage of the tool blkid:

1
2
$ blkid /dev/sda1
/dev/sda1: LABEL="/" UUID="ee7cf0a0-1922-401b-a1ae-6ec9261484c0" SEC_TYPE="ext2" TYPE="ext3"

There you also get the label and other information. Quite usefule.

Btw., if you wonder how “unique” this unique is, here a quote from Wikipedia:

1 trillion UUIDs would have to be created every nanosecond for 10 billion years to exhaust the number of UUIDs.

Pretty unique.

Thanks to Linux By Examples for the initial howto.

반응형
반응형

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • 64 bit architecture
  • 32 bit packages installed sharing some files with the 64 bit ones

Issue

  • Files are conflicting between 64 and 32 bit packages, how to fix it ?
  • yum update or yum install fails with package conflict between 64 bit and 32 bit package architectures.
  • 32 bit package showing conflict problem with 64 bit package.
Transaction Check Error:
file /usr/share/man/man1/ca.1ssl.gz from install of openssl-0.9.8e-27.el5_10.3.x86_64 conflicts with file from package openssl-0.9.8e-27.el5_10.1.i686
file /usr/share/man/man1/req.1ssl.gz from install of openssl-0.9.8e-27.el5_10.3.x86_64 conflicts with file from package openssl-0.9.8e-27.el5_10.1.i686
file /usr/share/man/man1/x509.1ssl.gz from install of openssl-0.9.8e-27.el5_10.3.x86_64 conflicts with file from package openssl-0.9.8e-27.el5_10.1.i686

Resolution

You can configure the yum client to update only a package of the exact architecture installed on the system.

Perform the following steps to remove duplicate packages(i.e. 32-bit and 64-bit packages installed on server which is causing the dependency issues).

  1. Install the yum-utils package:

    # yum install yum-utils
    
  2. The package-cleanup --dupes lists all duplicate packages:

    # package-cleanup --dupes        
    
  3. The package-cleanup --cleandupes removes the duplicates (it asks for a confirmation to remove all duplicates unless the -y switch is given):

    # package-cleanup --cleandupes   
    
  4. Edit /etc/yum.conf, set the following line:

    exactarch=1
    
  5. Run yum command:

    # yum clean all
    # yum update
반응형
반응형

CentOS(리눅스)를 운영중인 장비에 하드디스크 등 저장장치를 추가 하면

 

디스크를 이용하기 위해서 다음과 같은 작업을 해줘야 합니다.

 

디스크 설치 후

fdisk –l 을 이용해서 디스크 정보를 확인합니다.

새로 설치된 디스크는 파티션 정보가 없습니다.

 

디스크 정보를 확인 했으면 fdisk 를 실행 합니다.

fdisk <장치명> (예 : fdisk /dev/sdb)

 

fdisk 메뉴를 확인하고 싶으시면 m을 입력하시면 됩니다.

 

p를 입력해서 파티션 정보를 확인합니다.

파티션이 없는 것을 확인 할 수 있습니다.

n 을 입력하면 파티션을 새롭게 만들 수 있습니다.

n을 누르면 두개의 메뉴가 나옵니다.

e(extended) 확장 파티션과, p(primary partition) 주파티션을 선택 할 수 있습니다.

주로 사용하는 주 파티션을 선택하고 partition number 는 첫번째 파티션 이니까 1번을 선택했습니다.

파티션넘버 다음에는 파티션의 크기를 설정할 수 있습니다. 용량으로 나오지가 않고

Cylinder 크기로 나옵니다. 시작 점과 종료 점을 선택해 주면 됩니다.

디스크 전체를 하나의 파티션으로 설정하는 경우에는 엔터, 엔터 로 진행하셔도 됩니다.

파티션 사이즈까지 설정 완료 하였으면, w를 눌러 정보를 저장합니다.

 

파티션 설정이 끝났으면 원하는 파일 형식으로 파티션을 포맷합니다.

Ext4 형식의 경우에는 아래와 같습니다.

mkfs.ext4 <디스크명> <예 : mkfs.ext4 /dev/sdb1>

 

포멧이 완료 되면 해당 파티션을 마운트 합니다.

 

마운트 방법은

mount –t ext4 /dev/sdb1 /data

mount –t <파일시스템형식> <파티션명> <마운트할위치> 입니다

 

부팅시에 자동으로 마운트를 되게 하기 위해서는 /etc/fstab을 수정해 저야 합니다.

Centos 6.3부터는 fstab 마운트에 UUID를 이용하고 있습니다.

UUID를 확인하기 위해서는 blkid 명령어를 이용하거나

ls –l /dev/disk/by-uuid 를 통해서 확인 하실 수 있습니다.

 

UUID를 확인한 후에 fatab을 열어 마운트할 내용을 추가해 줍니다.

Vi /etc/fatab

UUID = 추가할 파티션의 UUID <마운트할위치> ext4 defaults 1 2

 

 

 

출처 : http://itisyo.tistory.com/entry/CentOS-%EC%A0%80%EC%9E%A5%EC%9E%A5%EC%B9%98HDD-%EC%B6%94%EA%B0%80-%ED%95%98%EA%B8%B0

반응형
반응형

While trying to run a yum update I received the below warning message:

 

Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check

 

To resolve this yum-complete-transaction is required to complete the unfinished transactions.

 


yum-complete-transaction is a program which finds incomplete or aborted yum transactions on a system and attempts to complete them. It looks at the transaction-all* and transaction-done* files which can normally be found in /var/lib/yum if a yum transaction aborted in the middle of execution.

If it finds more than one unfinished transaction it will attempt to complete the most recent one first. You can run it more than once to clean up all unfinished transactions.

 

 

Run the following to install yum-utils (which provides yum-complete-transaction), cleanup and finish the transactions.

yum install yum-utils
yum clean all
/usr/sbin/yum-complete-transaction --cleanup-only

 

Now yum commands can be run without the unfinished transactions warning.

yum update

Share this blog post on social media:

반응형
반응형

리눅스를 사용하다 보면, tar 혹은 tar.gz로 압축을 하거나 압축을 풀어야 할 경우가 자주 생긴다.


이를 처리하기 위해 리눅스에서는 tar 라는 명령어를 사용하게 되는데,


tar 명령어도 여러가지 옵션이 있지만 각 옵션에 대해서 알아보기 보단, 자주 사용하는 명령어 패턴만 정리한다.



1. tar로 압축하기

> tar -cvf [파일명.tar] [폴더명]


ex) abc라는 폴더를 aaa.tar로 압축하고자 한다면

     > tar -cvf aaa.tar abc



2. tar 압축 풀기

> tar -xvf [파일명.tar]


ex) aaa.tar라는 tar파일 압축을 풀고자 한다면

     > tar -xvf aaa.tar



3. tar.gz로 압축하기

> tar -zcvf [파일명.tar.gz] [폴더명]


ex) abc라는 폴더를 aaa.tar.gz로 압축하고자 한다면

     > tar -zcvf aaa.tar.gz abc



4. tar.gz 압축 풀기

> tar -zxvf [파일명.tar.gz]


ex) aaa.tar.gz라는 tar.gz파일 압축을 풀고자 한다면

     > tar -zxvf aaa.tar.gz




참고로, 위의 옵션들을 포함한 그나마 자주 사용되는 tar 명령어의 옵션들은 아래와 같다.



 옵션

 설명

 -c

 파일을 tar로 묶음

 -p

 파일 권한을 저장

 -v

 묶거나 파일을 풀 때 과정을 화면으로 출력

 -f

 파일 이름을 지정

 -C

 경로를 지정

 -x

 tar 압축을 풂

 -z

 gzip으로 압축하거나 해제함

 

 

출처 : http://nota.tistory.com/53

반응형

+ Recent posts