make 명령어 옵션

리눅스 2015. 6. 28. 09:34


ex) make -j 8        -8 이라하면 코어 8개로 한번에 돌린다는 뜻.


보통 그냥 돌리면 코어 하나로 돌아감


'리눅스' 카테고리의 다른 글

dmidecode 하드웨어 확인 명령어  (0) 2015.07.14
도메인을 이용해 사용자 디렉토리 접속 방법  (0) 2015.07.01
awstats 설치  (0) 2015.06.24
VI 문자열 치환  (0) 2015.06.22
fstab , mtab 이 삭제된 경우  (0) 2015.06.22
Posted by Narusika
,

awstats 설치

리눅스 2015. 6. 24. 20:57


버전 

centos 6.6

awstats 6.5


cd /usr/local/

wget http://firewolf.co.kr/download/linux/PUB/awstats-6.5.tar.gz

tar xvfpz awstats-6.5.tar.gz

mv awstats-6.5 awstats

chown -R root:root awstats

chmod 755 awstats

mkdir /etc/awstats

mkdir /var/lib/awstats


cd /usr/local/awstats/tools

perl ./awstats_configure.pl

y

firewolf.co.kr  (자신이 사용할 도메인을 넣는다.)

/etc/awstats

엔터

엔터


cd /etc/awstats/

vi ./awstats.firewolf.co.kr.conf

LogFile="/var/log/httpd/mylog.log" ==> LogFile="/usr/local/apache/logs/access_log"



cat /usr/local/awstats/tools/httpd_conf  요항목들을

vi /usr/local/apache/conf/httpd.conf 삽입 (설치하면 기본적으로 삽입되어있습니다.)

# Directives to add to your Apache conf file to allow use of AWStats as a CGI.

# Note that path "/usr/local/awstats/" must reflect your AWStats install path.

#

Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"

Alias /awstatscss "/usr/local/awstats/wwwroot/css/"

Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"

ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"


# This is to permit URL access to scripts/files in AWStats directory.

#

    Options None

    AllowOverride None

    Order allow,deny

    Allow from all





vi /usr/local/apache/conf/httpd.conf에서 로그 형식 바꿈


CustomLog /usr/local/apache/logs/access_log 보통 이렇게 되어있는것을


SetEnvIfNoCase Request_URI (gif|png|jpg|css|js|bmp|jpeg|swf)$ IMAGE=1

CustomLog /usr/local/apache/logs/access_log combined env=!img-nosave,!CodeRedNimda


/usr/local/apache/bin/apachectl restart (아피치 리스타트)




실행 /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=firewolf.co.kr



실행시 오류 날때


[root@localhost awstats]# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=115.68.74.148

Update for config "/etc/awstats/awstats.115.68.74.148.conf"

With data in log file "/usr/local/apache/logs/access_log"...

Phase 1 : First bypass old records, searching new record...

Searching new records from beginning of log file...

AWStats did not find any valid log lines that match your LogFormat parameter, in the 50th first non commented lines read                          of your log.

Your log file /usr/local/apache/logs/access_log must have a bad format or LogFormat parameter setup does not match this f                         ormat.

Your AWStats LogFormat parameter is:

1

This means each line in your web server log file need to have "combined log format" like this:

111.22.33.44 - - [10/Jan/2001:02:14:14 +0200] "GET / HTTP/1.1" 200 1234 "http://www.fromserver.com/from.htm" "Mozilla/4.0                          (compatible; MSIE 5.01; Windows NT 5.0)"

And this is an example of records AWStats found in your log file (the record number 50 in your log):

66.249.75.113 - - [28/May/2015:12:02:58 +0900] "GET /store/shop/index.php?page=view_class&class_id=5606 HTTP/1.1" 404 218

Setup ('/etc/awstats/awstats.115.68.74.148.conf' file, web server or permissions) may be wrong.

Check config file, permissions and AWStats documentation (in 'docs' directory).


로그 타입때문에 생기는 오류


#vi /etc/awstats/awstats.youmust.conf

LogFormat=”%host %other %logname %time1 %methodurl %code %bytesd”






[root@localhost awstats]# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=115.68.74.148

Update for config "/etc/awstats/awstats.115.68.74.148.conf"

With data in log file "/usr/local/apache/logs/access_log"...

Phase 1 : First bypass old records, searching new record...

Direct access after last parsed record (after line 28)

Jumped lines in file: 28

 Found 28 already parsed records.

Parsed lines in file: 34

 Found 0 dropped records,

 Found 0 corrupted records,

 Found 0 old records,

 Found 34 new qualified records.


위같은 메시지가 나오면 성공!




crontab -e 

10 * * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=115.68.74.148





확인 http://자기 도메인/awstats/awstats.pl?config=자기 도메인




-----------------------------------------------------------------------------------------------------------------------


yum install awstats


cd /etc/awstats

cp awstats.localhost.localdomain.conf  ./awstats.naruman.com.conf


vi awstats.naruman.com.conf


LogFile="/logs/access.log"               // 아파치 로그

SiteDomain="naruman.com"            // 도메인 이름

DirData="/var/www/awstats"           // 데이터 디렉토리


기본에서 위 3개만 수정



vi /etc/httpd/conf.d/awstats.conf


allow from 127.0.0.1 을   -->  allow from all   변경




스크립트 작성


vi /root/script/awstatsupdate.sh


#!/bin/bash

exec /usr/bin/awstats_updateall.pl now -confdir="/etc" -awstatsprog="/var/www/awstats/awstats.pl" >/dev/null 

exit 0




vi /etc/crontab 등록


#awstats

*/5     *       *       *       *       root    /root/script/awstatsupdate.sh




naruman.com/awstats/awstats.pl


접속




 


출처 : https://www.linux.co.kr/home/lecture/?leccode=10641

'리눅스' 카테고리의 다른 글

도메인을 이용해 사용자 디렉토리 접속 방법  (0) 2015.07.01
make 명령어 옵션  (0) 2015.06.28
VI 문자열 치환  (0) 2015.06.22
fstab , mtab 이 삭제된 경우  (0) 2015.06.22
mrtg 설치하기  (0) 2015.06.20
Posted by Narusika
,

VI 문자열 치환

리눅스 2015. 6. 22. 16:56

vi 문자열 치환하기


vi상에서 문자열을 일괄적으로 치환할 때, 명령줄에 다음을 입력한다.


:시작범위,끝범위 s/원래문자열/바꿀문자열/g


ex1) 처음부터 끝까지 lex를 yacc로 바꾸려면

:1,$ s/lex/yacc/g

※범위를 전체(처음부터 끝까지)로 잡을 경우, 1,$ 대신 %를 써도 무관하다.


ex2) 22번째 줄부터 40번째 줄 사이에서 절망을 희망으로 바꾸려면

:22,40 s/절망/희망/g


출처 : http://soharang.tistory.com/849

'리눅스' 카테고리의 다른 글

make 명령어 옵션  (0) 2015.06.28
awstats 설치  (0) 2015.06.24
fstab , mtab 이 삭제된 경우  (0) 2015.06.22
mrtg 설치하기  (0) 2015.06.20
apache 데몬 chkconfig 등록 안될때  (0) 2015.06.05
Posted by Narusika
,

mysql 실행 시 -bash: mysql: command not found


# vi /etc/profile  맨 마지막 줄에


export PATH="$PATH:/usr/local/mysql/bin"  


source /etc/profile   바로적용

'리눅스 > mysql' 카테고리의 다른 글

mysql 제로보드 패스워드 초기화  (0) 2015.07.09
mysql make시에 에러 발생 error: expected primary-expression before '?' token  (0) 2015.06.29
mysql 실행 에러  (0) 2015.06.08
mysql 실행 오류  (0) 2015.05.30
mysql ip 설정  (0) 2015.05.16
Posted by Narusika
,
fstab 을 수정 하다가 꼬이거나 삭제가 된경우 read only 파일 시스템이 되거나 부팅이 되다 멈추거나 하는 증상이 있습니다.
이미 read only 상태기 때문에 수정이 안되지만, 방법은 있습니다.
 
그럼 아래와 같이 최상위 폴더를 마운트 한 후 수정 합니다.
[root@falinux ~]$ mount -o remount rw /
[root@falinux ~]$ cp .fstab /etc/fstab  
 
fstab 파일은 최상위 폴더에 .fstab 이라는 파일로 가지고 있으며, 이를 복사 해 주면 됩니다.
 
 
mtab 은 조금 다릅니다.
mtab 은 사실 링크파일 입니다.
 
ll -al 명령으로 확인 해보면 아래와 같이 나오는 것을 볼 수 있습니다.
 
lrwxrwxrwx    1 root     root           12 Sep 30 10:44 mtab -> /proc/mounts 
 
즉, mtab 은 /proc/mounts 입니다.
 
read only 파일 시스템으로 변경되는 이유는 대부분 이 mtab 이 삭제 되어서 입니다.
사실 이 심볼릭링크 파일이 삭제되는 이유는 잘 모르겠지만, 복구는 위 fstab 과 비슷 합니다.
 
[root@falinux ~]$ mount -o remount rw /
[root@falinux etc]$ ln -s /proc/mounts mtab
[root@falinux etc]$ cat mtab 
rootfs / rootfs rw 0 0
/dev/root / yaffs2 rw,relatime 0 0
/proc /proc proc rw,relatime 0 0
/sys /sys sysfs rw,relatime 0 0
none /dev/pts devpts rw,relatime,gid=5,mode=620 0 0
usbfs /proc/bus/usb usbfs rw,relatime 0 0
[root@falinux etc]$  
 
위 같이 리마운트 해서 /proc/mounts 를 mtab 으로 링크 걸어주면 됩니다.
 
리부팅 해보면 정상적으로 될 것 입니다.


 출처 : http://forum.falinux.com/zbxe/index.php?document_srl=797150&mid=lecture_tip

'리눅스' 카테고리의 다른 글

awstats 설치  (0) 2015.06.24
VI 문자열 치환  (0) 2015.06.22
mrtg 설치하기  (0) 2015.06.20
apache 데몬 chkconfig 등록 안될때  (0) 2015.06.05
아파치 접속자 수 확인  (0) 2015.06.03
Posted by Narusika
,

mrtg 설치하기

리눅스 2015. 6. 20. 02:14


1. snmp 설치

 

# yum install net-snmp

# yum install net-snmp-utils

# yum install net-snmp-devel (v3 를 사용하려면)


2. mrtg 설치

# yum install mrtg*


3. snmp 설정

# vi /etc/snmp/snmpd.conf (first, second, third, final 섹션만 변경)

first

 

com2sec local localhost webnics

second

group localgroup  v1 local

group localgroup  v2c local

group localgroup  usm local

third

view all included .1 80

view    systemview      included        system

final 

access localgroup  "" any noauth exact all none none

 

 local은 보통 호스트명을 써준다고 하나.. 난 걍 local로함

※ webnics는 community 값이라고 하는데... 쉽게 설명해 접근하는 계정? 정도라고함...

# snmpwalk -v 2c -c webnics localhost (설정 확인하기)

주루룩~ 나와야함


※ Timeout: No Response from localhost 오류가 있는거임

/var/log/message 로그를 확인해보라

혹시라도 snmpd[1303]: Connection from UDP: [127.0.0.1]:59991->[127.0.0.1] REFUSED

이런 로그가있다면 방화벽 등에서 거절된 것이다.

이것 때문에 한나절을 고생했다.. ㅡㅡ;

tcpwaper를 운영중인데 여기에서 걸렸다.

아직도 의문인것은 iptables과 tcpwaper를 stop 해도 거절되더라는거...ㅡㅡ;

#vi /etc/hosts.allow

snmpd:localhost

이렇게 설정 해주었더니 된다... ㅎㅎ


4. cfg 생성

# cfgmaker --global 'WorkDir: /website/mrtg/' --global 'Language: korean' --global 'Options[_]: bits,growright' -output /etc/mrtg/mrtg.cfg webnics@localhost


WorkDir: /website/mrtg/          --> 내 웹소스 있는경로에 mrtg디렉토리 만들면됨.


5. index 생성

indexmaker --title "Title" --output /website/mrtg/index.htm /etc/mrtg/mrtg.cfg


6. cron 등록

# crontab -e

*/5 * * * * root /usr/sbin/mrtg /etc/mrtg/mrtg.cfg


7. apache 설정                                     --> 안해도 되는듯               

 

# vi /etc/httpd/conf.d/mrtg.conf

Allow from 127.0.0.1 을 Allow from All 로 변경         --> 그냥 놔둬도 됨

# /etc/init.d/httpd reload

 

udp port 161번과 162번 열어 줄것.                 


-----------------------------------------------------------------------------------------------


snmpd 로그 제거

 

/etc/init.d/snmpd 스크립트상에 OPTIONS 부분만 수정하면 된다.

기존 : OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"

수정 : OPTIONS="-LS 2 d -Lf /dev/null -p /var/run/snmpd.pid -a" 


udp 데몬 확인

 

netstat -an | grep udp


기 타

 

view    all     included        .1      80

view    systemview      included        system

view    mib2    included        .iso.org.dod.internet.mgmt.mib-2 fc <== 이경우는 network 관련 정보 만 얻을 수 있단다




출처 http://blog.daum.net/mygunsan/96

'리눅스' 카테고리의 다른 글

VI 문자열 치환  (0) 2015.06.22
fstab , mtab 이 삭제된 경우  (0) 2015.06.22
apache 데몬 chkconfig 등록 안될때  (0) 2015.06.05
아파치 접속자 수 확인  (0) 2015.06.03
scp 사용  (0) 2015.05.31
Posted by Narusika
,


# /etc/rc.d/mysqld start

# Starting MySQL. ERROR! Manager of pid-file quit without updating file.


1)

 /etc/my.cnf를 삭제


# /usr/local/mysql/bin/mysql_install_db --user=mysql     재생성후 시작



2) /usr/local/mysql/data 폴더에서


mysql-bin.00001    뭐 이런파일들 권한을 보고 mysql로 바꿔서 실행해본다




실행했을때


usr/local/mysql/bin/mysql: error while loading shared libraries: libmysqlclient.so.12: cannot open shared object file: No such file or directory


/usr/local/mysql/bin/mysqld_safe &  


/usr/local/mysql/bin/mysql -u root -p   실행 하면 된다

Posted by Narusika
,

# vi /etc/init.d/apachectl


아래내용 추가

#!/bin/sh

#

# chkconfig: 2345 90 90

# description: init file for Apache server daemon

# processname: /usr/local/apache/bin/apachectl

# config: /usr/local/apache/conf/httpd.conf

# pidfile: /usr/local/apache/logs/httpd.pid



'리눅스' 카테고리의 다른 글

fstab , mtab 이 삭제된 경우  (0) 2015.06.22
mrtg 설치하기  (0) 2015.06.20
아파치 접속자 수 확인  (0) 2015.06.03
scp 사용  (0) 2015.05.31
apm 설치시 configure 옵션 보기  (0) 2015.05.30
Posted by Narusika
,

아파치 동시접속자수 확인


#netstat -l 또는 netstat -nap | grep LISTEN (LISTEN 되는 모든 포트)
#netstat -nap | grep ESTABLISHED | wc -l ( 모든 서비스 동시 접속자 수)
#netstat -nap | grep :80 | grep ESTABLISHED | wc -l( 웹 동시 접속자 수)
#netstat -n|grep -F :80|egrep '(ESTAB|SYN)'|awk '{print $5}'|sed 's/:[0-9]*//'|sort -u|wc -l
  (웹서버 커넥션수 체크)


'리눅스' 카테고리의 다른 글

mrtg 설치하기  (0) 2015.06.20
apache 데몬 chkconfig 등록 안될때  (0) 2015.06.05
scp 사용  (0) 2015.05.31
apm 설치시 configure 옵션 보기  (0) 2015.05.30
/bin/false, /sbin/nologin 의 차이점  (0) 2015.05.28
Posted by Narusika
,

scp 사용

리눅스 2015. 5. 31. 02:25


파일 보내기

scp -P 22 /home/123 root@x.x.x.x.:/home/

              내서버 home디렉토리의 123 파일을   상대편 x.x.x.x의 home디렉토리 안에 복사         



파일 가져오기

scp -P 22  root@x.x.x.x.:/home/123 /home/

상대편 x.x.x.x.x의 home디렉토리의 123파일을    내서버의 home디렉토리 안에 복사





 scp -r -P 22 /home/1234/ root@x.x.x.x.:/home/


-r 옵션 : 폴더 복사

'리눅스' 카테고리의 다른 글

apache 데몬 chkconfig 등록 안될때  (0) 2015.06.05
아파치 접속자 수 확인  (0) 2015.06.03
apm 설치시 configure 옵션 보기  (0) 2015.05.30
/bin/false, /sbin/nologin 의 차이점  (0) 2015.05.28
ftp 설정  (0) 2015.05.28
Posted by Narusika
,