달력

42024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

PC 에서 VirtualBox 에 라즈베리파이3 버전을 올리고 보면은
해상도 조정이 불가한 부분이 있습니다.
이부분을 해소 하려면 VirtualBox Guest Additions를 설치해야 합니다.

 

VirutalBox 메뉴에서 장치 -> 게스트 확장 설치

 

게스트 확장 창이 열리면 cdrom 에있는 내용을 [복사]

 

 

 

/home/pi/Downloads 폴더안에 복사 합니다.

 

 

 

복사 완료후 콘솔로 들어가서

 

-$ cd /home/pi/Downloads

-$ sudo ./VBoxLinuxAdditions.run

위 명령어로 플러그인을 설치 합니다. 설치가 완료 되면

 

파일을 하나 생성 합니다.

 

-$ sudo nano /etc/X11/xorg.conf  (파일이 없으면 새로 생성)

 

----------------------------------------------
Section "Device"
    Identifier  "Configured Video Device"
    Driver      "vboxvideo"
EndSection
 
Section "Monitor"
    Identifier  "Configured Monitor"
EndSection
 
Section "Screen"
    Identifier  "Default Screen"
    Monitor     "Configured Monitor"
    Device      "Configured Video Device"
EndSection
----------------------------------------------

 

위 내용을 그대로 넣으신 후 재부팅 시킨후 VirtualBox 창을 변화시키는 대로 해상도가 자동으로 바뀌게 됩니다.

 

다음엔 VirtualBox 에 라즈베리파이3 를 설치하는 방법을 알려드리겠습니다. 순서가 좀 바뀌었지만 0-0ㅎ;;

 

Posted by 타카스 류지
|

이번에 사용할 것은 핸드폰으로 텔레그램 어플을 이용하여

토렌트 파일을 검색하고 다운로드 하는 부분을 해보겠습니다.

시작 하기 전에 이전에 올린 글을 참고 하시고 하시기 바랍니다.

 

2017/12/27 - [라즈베리파이3] - 라즈베리파이3 transmission(토렌트)

2017/12/26 - [라즈베리파이3] - API 텔레그램 토큰 생성

2017/12/27 - [라즈베리파이3] - 라즈베리파이3 transmission (텔레그램 API 연동)

 

 

-$ cd /home/pi

 

받기
-$ git clone https://github.com/seungjuchoi/telegram-control-torrent

이름변경(사용하기 쉽게)
-$ mv telegram-control-torrent telegram

-$ cd ./telegram


이름 변경
-$ mv setting_templete.json setting.json


수정
-$ nano setting.json

 

--------------------------------------------------------
{
  "common": {
    "token": "110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw",
    "valid_users": [
      123456789,
      123456789
    ],
    "agent_type": "transmission",
    "download_path": "~/Downloads"
  },
  "transmission": {
    "id_pw": "transmission:transmission",
    "port": ""
  }
}

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

위 내용이 보입니다. 아래는 설명

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

{
  "common": {
    "token": "텔레그램 API 토큰",
    "valid_users": [
      사용할 아이디
   123456789,987654321  <---- 이렇게 하면 두명이 사용 가능합니다.     
    ],
    "agent_type": "transmission",
    "download_path": "~/Downloads"  <-- 기본 다운로드 경로
  },
  "transmission": {
    "id_pw": "아이디:패스워드",
    "port": "포트번호 기본 9091 입니다."
  }
}
--------------------------------------------------------

 

폴더안에 보시면 pip-requirements.txt 파일이 있습니다. 이파일은 여러개 패키지가 적혀있는데 한번에 불러와 설치합니다.

-$ sudo pip3 install -r pip-requirements.txt

 

실행방법
-$ python3 telegram_torrent.py

실행후

 Listening ...

라고 떠있으면 성공 한겁니다.

 

이제 핸드폰으로 봇창을 열어서 아무 말을 걸어 메세지 창이 뜨면 잘연동된것 입니다.

 

이제 이걸 자동으로 실행 되게 설정 하겠습니다.

먼저 아래 테스트내용을 해보고난 다음 스크립트를 작성해보겠습니다.

 

백그라운드 실행(테스트)
- $ nohup python3 -u /home/osmc/telegram/telegram_torrent.py &

 

텔레그램 백그라운드 검색 종료(테스트)
- $ kill $(ps -e | grep python3)
- $ kill $(ps aux |awk '/telegram_torrent.py/ {print $2}')

 

 

★ 실행정지 데몬 만들기

 

-$ sudo nano /etc/init.d/telegram

 

--------------------- telegram -----------------------
#!/bin/sh
### BEGIN INIT INFO
# Provides:          telegram
# Required-Start:    $network
# Required-Stop:     $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop telegram
### END INIT INFO
 
case "$1" in
  start)
    nohup python3 -u /home/pi/telegram/telegram_torrent.py &
    echo "텔레그램 봇 시작"
    ;;
  stop)
    sudo kill $(ps -e | grep python3)
    echo "텔레그램 봇 정지"
    ;;
  *)
    echo "Usage: /etc/init.d/telegram {start|stop}"
    exit 1
    ;;
esac
exit 0

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

소유권 이동

-$ sudo chown pi:pi /etc/init.d/telegram

권한 수정
-$ sudo chmod 755 /etc/init.d/telegram

 

 

#Tip. update-rc.d 서비스 수동실행 명령어
-$ sudo /etc/init.d/telegram start
-$ sudo /etc/init.d/telegram stop

 

-$ sudo service telegram start
-$ sudo service telegram stop

 

위 명령어가 이상 없이 잘되면은

아래 서비스를 등록하면 끝입니다.

 

 

시작 서비스 등록
-$ sudo update-rc.d telegram defaults

 

시작 서비스 삭제
-$ sudo update-rc.d -f telegram remove

 

아래 파일은 영문을 한글로 바꿔논 파일입니다.

기본 파일을 사용시에 시드가 죽거나, 받다가 시드가 없어지거나, 정지하거나 할 경우

해당 다운로드 시드를 지워버리는 부분이 보여서 수정하였습니다.

그리고 필요시에 transmission 을 종료 시키고 시작 시키는 버튼도 넣었으니 알아서 고쳐서 사용하시면 되겠습니다.

 

telegram_torrent.py

 

위 파일에서 transmission  종료는 이전 강좌에서 설명해 드렸던 내용중

 

2017/12/27 - [라즈베리파이3] - 라즈베리파이3 transmission(토렌트)

 

crontab 예약 작업을 제거하고 사용하시면 되겠습니다.

 

 

구동하고나서 텔레그램  비서로 확인한 스샷입니다.

 

 

   

 

 

 

Posted by 타카스 류지
|

이전에 transmission 을 설치하는 방법을 알려드렸습니다.

이번 시간엔 transmission 이 다운이 완료 되었을때 텔레그램 푸쉬로 알림이 오는 설정을 하겠습니다.

 

이 글을 읽기 전에 하단 링크에 작업이 완료후에 진행하시면 되겠습니다.

 

2017/12/27 - [라즈베리파이3] - 라즈베리파이3 transmission(토렌트)

2017/12/26 - [라즈베리파이3] - API 텔레그램 토큰 생성

 

 

폴더 생성
-$ sudo mkdir /usr/script


권한부여
-$ sudo chmod -R 777 /usr/script

 

작성

-$ sudo nano /usr/script/torrent_push.sh

 

-------------------- torrent_push.sh ---------------

#!/bin/sh

# telegram configuration
SERVER="9091 --auth 아이디:패스워드"
TOKEN='111222333:aaaabbbbccccddddeeeeffffgggghhhhiii'
URL='https://api.telegram.org/bot'$TOKEN
MSG_URL=$URL'/sendMessage?chat_id='
CHAT_ID="123456789"

sleep 1s

# torrent remove
TORRENTLIST=`transmission-remote $SERVER --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=" " --fields=1`
for TORRENTID in $TORRENTLIST
do
    DL_COMPLETED=`transmission-remote $SERVER --torrent $TORRENTID --info | grep "Percent Done: 100%"`
    STATE_STOPPED=`transmission-remote $SERVER --torrent $TORRENTID --info | grep "State: Seeding\|Stopped\|Finished\|Idle"`
    if [ "$DL_COMPLETED" ] && [ "$STATE_STOPPED" ]; then
        transmission-remote $SERVER --torrent $TORRENTID --remove
    fi
done

# telegram notify go
res=$(/usr/bin/curl --data-urlencode "text=$TR_TORRENT_NAME 다운로드가 완료되었습니다." "$MSG_URL"$CHAT_ID"&")
---------------------------------------------------

 

실행가능 하게 변경
-$ sudo chmod a+x /usr/script/torrent_push.sh


권한 부여
-$ sudo chmod 777 /usr/script/torrent_push.sh

 

토렌트 정지
-$ sudo /etc/init.d/transmission-daemon stop


설정파일 열기

-$ sudo nano /etc/transmission-daemon/settings.json

 


    "script-torrent-done-enabled": false,
    "script-torrent-done-filename": "",

위 내용을 아래 처럼 변경 

 

    "script-torrent-done-enabled": true,
    "script-torrent-done-filename": "/usr/script/torrent_push.sh",

 

 

transmission-daemon 시작

 

-$ sudo /etc/init.d/transmission-daemon start
OR
-$ sudo service transmission-daemon start
OR
-$ sudo transmission-daemon -g /etc/transmission-daemon

 

Posted by 타카스 류지
|

transmission-daemon 설치

-$ sudo apt-get install transmission-daemon

OSMC 사용시 : sudo apt-get install transmission-cli 설치


transmission-daemon 정지 (정지 안하면 아예 수정이 안된다)

-$ sudo /etc/init.d/transmission-daemon stop

 

 

토렌트 폴더 생성 - 이폴더에 토렌트 파일을 넣으면 자동 추가됨(필요없으면 안해도됨)

-$ sudo mkdir /home/pi/torrent.seeds

누구나 읽고 쓰고 지울 수 있게 권한 설정

-$ sudo chmod -R 777 /home/pi/torrent.seeds



transmission 설정 수정

- 참고로 설정 내에서는 주석처리가 안됩니다.

- { (대괄호)와 " (따옴표) 주의

-$ sudo nano /etc/transmission-daemon/settings.json


transmission 설정 수정

- 참고로 설정 내에서는 주석처리가 안됩니다.

- { (대괄호)와 " (따옴표) 주의

-$ sudo nano /etc/transmission-daemon/settings.json


IP filter 설정

"blocklist-enabled": true,

"blocklist-url": "http://list.iblocklist.com/?list=bt_level1&fileformat=p2p&archiveformat=gz"


외부 웹 접속 설정

"rpc-authentication-required": true, 

"rpc-url": "/transmission/", ## 접속 URL

"rpc-username": "admin", ## 아이디

"rpc-enabled": true, 

"rpc-password": "admin12", ## 패스워드

"rpc-port": 9091, ## 접속 포트

"rpc-whitelist": "127.0.0.1", 

"rpc-whitelist-enabled": false, ## 지정  접속 허가



최대 다운로드, 최대 업로드 관련 설정

"speed-limit-down-enabled": true 일 경우에만 speed-limit-down 가 적용

"speed-limit-up-enabled": true 일 경우에만 speed-limit-up 가 적용


"speed-limit-down": 5000, 

"speed-limit-down-enabled": true, 

"speed-limit-up": 50,

"speed-limit-up-enabled": true, 



다운로드 경로 설정
"download-dir": "/home/pi/Downloads", ## 다운 완료 폴더


자동 불러오기
"trash-original-torrent-files": true, ## 토렌트 파일 자동 삭제
"watch-dir": "/home/pi/torrent.seeds", ## 토렌트 파일 자동 인식 폴더 기존폴더를 쓰던가 새로운 폴더생성해서 경로 지정
"watch-dir-enabled": true


시딩 설정-★이걸 해두면 다운로드가 완료된 후 배포를 하지않고 완료상태로 바뀜
"ratio-limit": 0, ## 배포 비율
"ratio-limit-enabled": true, ## 시딩 활성화


settings.json


※ 위파일은 기본 셋팅 설정해둔 파일입니다. 가져다가 필요한거 넣으시고 전체 복붙 하시면됩니다.



transmission-daemon 시작

-$ sudo /etc/init.d/transmission-daemon start
OR
-$ sudo service transmission-daemon start
OR
-$ sudo transmission-daemon -g /etc/transmission-daemon   <--추천

IP : 9091 접속

 

 

위에 아이디 패스워드로 접속후 밑에 사진처럼 필터 업데이트까지하면 설치는 완료 됩니다.

 

 

 



★ 여기서 중요한 부분이 토렌트 데몬을 계속 켜논상태에서 프로세스가 안죽으면
    다행이지만 이것저것 깔아서 쓰다보면 간혹 죽어버리는 상황이 발생함
    그리고 start 명령어가 어느 순간부터인진 모르겠지만 service 명령어가 안먹음 그래서
    위의 시작명령어중 3번째 명령어를 사용함
    해결방법 : 스크립트를 작성해 crontab 으로 예약을 걸어 수시로 죽으면 살리는 방법으로 해결


폴더 생성
-$ sudo mkdir /usr/script

권한부여
-$ sudo chmod -R 777 /usr/script

작성
-$ sudo nano /usr/script/transmission.sh

--------------------------------------------------
#!/bin/sh

# transmission configuration
portchk(){
    if nc -zv localhost 9091
    then
         echo "transmission Running...."
    else
         echo "transmission Stop -> running..."
         sudo transmission-daemon -g /etc/transmission-daemon
    fi
}
portchk
exit 0
--------------------------------------------------

 

실행가능 하게 변경

-$ sudo chmod a+x /usr/script/transmission.sh
권한 부여
-$ sudo chmod 777 /usr/script/transmission.sh

※ transmission 프로세스 죽이기

-$ sudo kill $(ps -ef | grep 'transmission-daemon -g /etc/transmission-daemon' | grep root |awk '/transmission-daemon/ {print $2}') 



후에 크론텝 등록
-$ sudo crontab -e

1분마다 작업
*/1 * * * * /usr/script/transmission.sh

 CTRL +  O 엔터 CTRL + X
 
Posted by 타카스 류지
|

최신 버전 현재 4.3-851~g62d2ce6

-$ sudo nano /etc/apt/sources.list

 

라즈베리 버전 - wheezy

deb https://dl.bintray.com/tvheadend/deb wheezy stable
deb https://dl.bintray.com/tvheadend/deb wheezy unstable

 

라즈베리 버전 - jessie

deb https://dl.bintray.com/tvheadend/deb jessie stable
deb https://dl.bintray.com/tvheadend/deb jessie unstable


 

라즈베리 버전 - stretch (미확인)

deb https://dl.bintray.com/mpmc/deb raspbianstretch stable-4.2

 

위 내용을 가장 밑에 추가하고 저장한다. CTRL +  O and CTRL + X

 

-$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61


-$ sudo apt-get update

-$ sudo apt-get install tvheadend


update 과정에서 다음과 같이 오류가 나면


E: The method driver /usr/lib/apt/methods/https could not be found.

N: Is the package apt-transport-https installed?

다음을 설치한 후 다시 update 와 설치를 진행한다.

 

$ sudo apt-get install apt-transport-https


 

관리자 계정 설정

 

 

암호 설정

 

 

 

설치후 접속 주소 : http://서버IP주소:9981


위에 설정한 계정 아이디, 암호를 입력하고 접속

 

 

기본 사항으로 언어설정만 위 사진처럼 해서 save 해주시고

 

아래로 넘어가면 Cancel 닫기 하면 설치가 완료 되었습니다.

 

 

 

★ tvheadend 프로세스 다운 방지


-$ sudo nano /home/pi/pvr/tvheadend.sh  <- 경로는 알아서


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

#!/bin/sh


# tvheadend configuration

portchk(){

    if nc -zv localhost 9981

    then

         echo "TvHeadEnd Running...."

    else

         echo "TvHeadEnd Stop -> running..."

         sudo service tvheadend restart

    fi

}


portchk


exit 0

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


실행가능 하게 변경

-$ sudo chmod a+x /home/pi/pvr/tvheadend.sh

권한 부여

-$ sudo chmod 777 /home/pi/pvr/tvheadend.sh



후에 크론텝 등록

-$ sudo crontab -e


1분마다 작업

*/1 * * * * /home/pi/pvr/tvheadend.sh


 CTRL +  O 엔터 CTRL + X

 


Posted by 타카스 류지
|

텔레그램 어플을 설치


@botfather라는 봇을 검색 후 "시작" 또는 "재시작" 버튼을 클릭하여 BotFather와 대화를 시작



"/newbot"  입력 - 봇 생성

"토렌트 알림" 입력 - 봇 이름

"torrentPushBot" 입력 - 봇 username <- 마지막은 bot 이란 단어로 끝나야 됩니다.


그럼 BotFather는 새로운 봇을 생성하고 token을 알려줍니다.

("Use this token to access the HTTP API:" 밑에 있는 문자열이 token입니다.)


이 토큰은 외부 노출을 하시면 안되요~ torrentPushBot 의 비밀번호라고 생각하세요


위 토큰 메세지중 상단 2번쨰 라인에 t.me/torrentPushBot. 이라는 링크가 있는데


클릭하면은 생성한 봇하고 대화를 할수 있습니다.


중요한점은 푸쉬를 받을려고 할때 chatid 라는게 필요 합니다.


한마디로 현재 자신의 계정 id 입니다.


먼저 토렌트 알림 봇창에서 아무 대화를 한번 글을 적고


https://api.telegram.org/bot[아까 발급 받은 token]/getUpdates 를 입력합니다.


https://api.telegram.org/bot111222333:aaaabbbbccccddddeeeeffffgggghhhhiii/getUpdates


위와 같이 되겠죠?


입력하면 json 형태로 리턴이 되서 보여지는데


{"ok":true,"result":[{"update_id":413816513, "message":{"message_id":2,

"from":{"id":123456789  <-- 요기가 chat_id 입니다.  first_name":"\uc2b9\uc900","last_name":"\uc774","username":"test"},

"chat":{"id":48561232,"first_name":"\uc2b9\uc800","last_name":"\uc674","username":"test2","type":"private"},

"date":1467868645,"text":"\uc2dc\uc791"}}]}


자 이제 준비가 다됬네요

토큰 : 111222333:aaaabbbbccccddddeeeeffffgggghhhhiii


챗ID : 123456789



ps.이전 게시물 http://cjbox.tistory.com/135?category=707036 에서 정리 헀던 내용 입니다.

Posted by 타카스 류지
|

이걸 하게 된 이유는 아이피가 매번 바뀌는 경우를 해소시킬려고 하는 이유입니다.

무료로 지원되는 사이트를 이용하여 사용중이지 아주 편합니다.

ddns.net 이사이트는 30일마다 갱신인증을 해줘야 하며 도메인 설정후 접속 하는데 

이상한 아이피로 튀는 경우도 다반사라 일주일 쓰다가 바로 다른걸로 갈아 탔습니다.


무료 DDNS : www.myq-see.com


위 사이트는 갱신 필요없고 신규 계정 만들고 도메인 등록만 하면은 바로 사용이 가능합니다.

위 사이트에서 가입후 하고 싶은 도메인을 만드시면

xxxx.myq-see.com  으로 사용 가능합니다.


그 후 ddclient 설치


-$ sudo apt-get install ddclient


설치 하면서 창이 몇번 전환 되면서 내용을 입력 하라고 하는데

그냥 공란으로 엔터쳐서 전부 넘김니다.

설치를 하면은 데몬을 정지 시켜 줍니다.


-$ sudo /etc/init.d/ddclient stop


설정 파일을 바꿔주도록 합시다.


-$ sudo nano /etc/ddclient.conf


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

# Configuration file for ddclient generated by debconf

#

# /etc/ddclient.conf

pid=/var/run/ddclient.pid

# 5분마다 갱신

daemon=300

# 시스템 로그 남기기

syslog=yes

# WEB 방식으로 현재 IP 주소 획득시 사용이

use=web

# 로그인 이메일(가입시 이메일)

login=xxxxxx@gmail.com

# 패스워드

password=xxxxxx

server=www.myq-see.com

protocol=dyndns2

# 사용하려는 도메인을

xxxxxx.myq-see.com

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

컨트롤+O, 컨트롤+X



정리해서 복붙

--------------------- ddclient.conf --------------------

# /etc/ddclient/ddclient.conf

#

daemon=300

syslog=yes

pid=/var/run/ddclient.pid

use=web

login=xxxxxxx@gmail.com

password=*********

server=www.myq-see.com

protocol=dyndns2

xxx.myq-see.com

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


데몬 시작

sudo /etc/init.d/ddclient start


디버그로 테스트 해볼시

-$ sudo /usr/sbin/ddclient -daemon=0 -debug -verbose -noquiet


기본적으로 재부팅시 자동 시작 되게 되어있는데 만약 안되면


서비스 등록

-$ sudo systemctl start ddclient.service


Posted by 타카스 류지
|

라즈베리파이3 사용시에 일반 외장하드나 USB 를 꼽아서


외장하드 폴더로 마운트해서 사용시에 유용함



-$ sudo nano /boot/config.txt


맨 위에 추가

max_usb_current=2

safe_mode_gpio=4


외장하드가 ntfs로 설정된 경우 ntfs 인식을 위해 ntfs-3g 설치

-$ sudo apt-get install ntfs-3g


※ 참고로 파일시스템을 exfat을 쓰려면 아래와 같이 설치

-$ sudo apt-get install exfat-fuse


마운트할 폴더를 만듭니다.권한설정까지

-$ sudo mkdir /home/pi/exHDD

-$ sudo chmod -R 777 /home/pi/exHDD



마운트 확인

-$ sudo fdisk -l | grep sda  

-$ df -h   ->  blkid  <- UUID 알아낼때



자동 마운트 수정

-$ sudo nano /etc/fstab


/dev/sda4  /home/pi/exHDD     ntfs    defaults          0       0

UUID="blkid 로 나온 UUID"  /home/pi/exHDD     ntfs    defaults          0       0


수동 마운트

-$ sudo mount -t auto /dev/sda4 /home/pi/exHDD

-$ sudo umount  /home/pi/exHDD




※외장하드 절전 모드


-$ sudo hdparm -y /dev/sda


실행. 10분후 HDD 정지


-$ sudo hdparm -S 120 /dev/sda


시작시 실행 등록. 

-$ sudo nano /etc/rc.local 


exit 0 이전에 기입.

Posted by 타카스 류지
|

OwnCloud 설치에 앞써서 앞단에 APM 웹서버를 설치해주셔야 됩니다.



- 다운로드


-$ wget https://download.owncloud.org/community/owncloud-latest.tar.bz2


- 압축해제


-$ tar -xvf owncloud-latest.tar.bz2 -C /var/www/owncloud/


- 권한 설정

-$ cd /var/www

-$ sudo chown -R www-data:www-data owncloud



- DB 등록

mysql -u root -p

mysql> CREATE DATABASE owncloud;

mysql> exit



아파치 설정파일에 OwnCloud 등록


-$ sudo nano  /etc/apache2/apache2.conf


<Directory /var/www/>

Options Indexes FollowSymLinks

AllowOverride All

Require all granted

</Directory>



하단은 웹서버 따로 추가 해서 사용할시에 사용하시면됩니다.

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

- OwnCloud 사이트 설정 파일 생성 및 수정


-$ cd /etc/apache2/sites-available

-$ sudo cp 000-default.conf owncloud.conf


-$ sudo nano /etc/apache2/sites-available/owncloud.conf


ServerName 서브도메인주소 (예를 들어 cloud.example.com)

ServerAlias 서브도메인주소 (다른 도메인이어도 상관없다)

ServerAdmin 이메일주소

DocumentRoot /var/www/owncloud


- 아파치 서버 등록

a2ensite owncloud.conf

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


service apache2 restart



- OwnCloud 설치


http://서버주소:port/owncloud  로 접속 



출처: http://withcoding.com/117


Posted by 타카스 류지
|

-$ sudo nano /etc/apt/sources.list


deb http://download.webmin.com/download/repository sarge contrib

deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

 


-$ su root

-$ cd /root


-$ wget http://www.webmin.com/jcameron-key.asc

-$ apt-key add jcameron-key.asc


-$ apt-get update

-$ apt-get install webmin




설치후 접속 주소 : https://서버IP주소:10000


 

 

위 webmin 은 웹에서 라즈베리 FTP 서버나 SAMBA 같은 기능을 편하게


사용할수있는 종합 콘솔 이라고 생각하면되요


접속할때는 root 계정으로만 접속되요.



ps.크론 이름 변경 (쩔쨔전 으로 나오는것)

sudo nano /usr/share/webmin/cron/module.info

desc_ko_KR.UTF-8=예약된 cron 작업

desc_ko_KR.euc=예약된 cron 작업


번역 에러인듯한 부분이네요 0-0찾아서 수정하면 잘나옵니다.


putty 에 안붙고 webmin 웹접속해서 명령어로 관리도 하니 좀 편하네요 ^^ㅎ


Posted by 타카스 류지
|

웹서버는 apache2, mysql, php 를 공통으로 사용하지만 PHP 에서는 사용하는 플러그인도 많고 해서 정리해봄


▶ 웹서버 설치


★기본 APM 설치 구문


pi@raspberrypi:~ $ sudo apt-get -y install apache2 mysql-server php5


php 에서 사용하는 각종 플러그인 설치 구문


pi@raspberrypi:~ $ sudo apt-get -y install php5-gd php5-json php5-curl php5-intl php5-mcrypt php5-imagick php5-mysql



위 명령을 수행하면 알아서 아파치 웹서버, MySQL, PHP를 설치


다 자동으로 되지만 MySQL 관리자 암호는 직접 입력


웹 서버 기본 경로는 [/var/www/html] 



▶ 세팅 법


★ www폴더 권한 변경 (ps.기본적으로 root 권한으로 가지고있어 pi 계정으로 소유권을 넘겨서 사용하는 취지)


pi@raspberrypi:~ $ sudo chown pi.pi /var/www

pi@raspberrypi:~ $ sudo chown -R pi /var/www


-R 옵션을 사용하면 디렉토리와 그 안에 들어있는 모든 파일의 사용자를 변경한다.


★ 아파치 설정


pi@raspberrypi:~ $ sudo nano /etc/apache2/apache2.conf


 /var/www/html -> /var/www 로 변경


★ a2enmod 명령으로 rewrite 모듈을 활성화


 pi@raspberrypi:~ $ sudo a2enmod rewrite


★ 자동 서브 도메인 바인딩


pi@raspberrypi:~ $ sudo nano /etc/apache2/sites-available/000-default.conf


ServerName cjbox.tk

ServerAdmin webmaster@localhost

DocumentRoot /var/www


ServerAlias *.cjbox.tk

RewriteEngine on

RewriteCond  %{HTTP_HOST} ^[^.]+\.cjbox\.tk$

RewriteRule  ^(.+) %{HTTP_HOST}$1 [C]

RewriteRule  ^([^.]+)\.cjbox\.tk(.*) /var/www/$1/$2


예) cjbox.tk -> /var/www

예) test.cjbox.tk -> /var/www/test


★mysql database 생성


pi@raspberrypi:~ $ mysql -u root -p  로그인


패스워드 입력


CREATE DATABASE 이름;


exit



▶ PHP 파일이 코드로 그대로 출력될시


방법 1


pi@raspberrypi:~ $ apt-get install libapache2-mod-php5


이나


pi@raspberrypi:~ $ apt-get install libapache2-mod-php7.0


방법 2


php.ini -> short_open_tag = Off 찾기


short_open_tag = On : <? 태그 가능

short_open_tag = Off : <? 태그 불가능 <?php  ?> 로만 사용


short_open_tag = On 으로 변경


방법 3


모듈의 활성화

# a2enmod

모듈의 비활성화

# a2dismod


로 php5.0  php7.0 활성화

Posted by 타카스 류지
|

▶ 업데이트 및 업그레이드


pi@raspberrypi:~ $ sudo apt-get update -y  && sudo apt-get upgrade -y


▶ 비밀번호 변경


★ pi 계정 비밀번호 변경


pi@raspberrypi:~ $ sudo raspi-config

 

 

 

 

 

★ root 계정 비밀번호 변경


pi@raspberrypi:~ $ sudo passwd root

 


▶ 한글 패치


pi@raspberrypi:~ $ sudo apt-get -y install ibus ibus-hangul ttf-unfonts-core -> fonts-unfonts-core(stretch)


설치가 완료뒤 [Menu] 버튼 [Preferences] > [Raspberry Pi Configuration]을 클릭

 

 


 

configuration의 [Localisation] - [Set Locale] 클릭

 

Lagnguage -> Ko(Korean)

Country -> KR (Republic of Korea)

Charater Set -> UTF-8

 

 

타임존

Area -> Asia

Location -> Seoul

 

 


[Set Keyboard]

Korea, Republic of -> Korean(101/104 key)



Posted by 타카스 류지
|