달력

52024  이전 다음

  • 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
  • 31

오드로이드 여러 곳을 들리면서 필요한 패키지등을 설치해보면서 정리해둔 내용 입니다.

참고만 하세욤 0-0

저는 mate 버전으로 설치해서 사용했습니다.


#########################################################################

# Defalut for Odroid                                                     

# https://dn.odroid.com/5422/ODROID-XU3/Ubuntu/ubuntu-16.04.3-4.9-mate-odroid-xu4-20171025.img.xz

# 오드로이드 초기 셋팅 mate-odroid-xu4

# 작업 계정 [root]

# 포트확인 netstat -tnlp

#########################################################################



# ■■■ 오류 덩어리 파이어 폭스 삭제


apt-get purge firefox* -y && apt-get autoremove -y


# ■■■ 전체 업데이트 && 의존성 검사하여 업그레이드


apt-get update && apt-get dist-upgrade -y


# ■■■ 완료 후 재부팅


reboot


# ■■■ 한글 셋팅


apt-get install language-pack-ko-base -y


update-locale LANG=ko_KR.UTF-8

echo 'LANG="ko_KR.UTF-8"' | sudo tee -a /etc/environment

echo 'LANGUAGE="ko_KR:ko:en_US:en"' | sudo tee -a /etc/environment

echo "TZ='Asia/Seoul'; export TZ" | sudo tee -a ~/.profile

echo "TZ='Asia/Seoul'; export TZ" | sudo tee -a /etc/skel/.profile


dpkg-reconfigure tzdata

Asia/Seoul 설정



# ■■■ 계정 추가


adduser [ID]


# ■■■ 관리자 권한 부여


usermod -G sudo [ID]


# ■■■ SSH root 접근 제한


nano /etc/ssh/sshd_config


PermitRootLogin yes -> no


service sshd restart





# ■■■ 외장 하드 마운팅



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

sudo apt-get install ntfs-3g


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

sudo apt-get install exfat-fuse



mkdir /media/exHDD


chmod -R 777 /media/exHDD


blkid


/dev/sda5: UUID="01D395B80CF091D0" TYPE="ntfs" PARTUUID="04f839f0-05"


nano /etc/fstab


기본으로 할시 외장하드가 연결되어있지 안으면 부팅 에러 걸림

UUID=01D395B80CF091D0 /media/exHDD ntfs defaults 0 0


권장 내용

UUID=01D395B80CF091D0 /media/exHDD ntfs nofail,auto,noatime,rw,user 0 0





# ■■■ 웹서버 설치 [순서대로]


apt-get install apache2 mysql-server   <-- mysql 패스워드 설정화면 뜹니다.


add-apt-repository ppa:ondrej/php

apt-get update

apt-get install php5.6 php5.6-common php5.6-json libapache2-mod-php5.6 php5.6-curl php5.6-gd php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-xmlrpc php5.6-intl php5.6-imagick php5.6-zip php5.6-cgi

a2enmod php5.6

systemctl restart apache2





※ proxy 설정
경로
cd /etc/apache2/sites-available

nano vhost.conf

#기본 호스트 지정
<VirtualHost *:80>
ServerName 도메인
ServerAlias 도메인
DocumentRoot /var/www/html <- 도메인별 특정경로 지정 가능
</VirtualHost>

#프록시로 내부 포트 포워딩이 가능
#sub.도메인.kr 로 내부 포트 지정시 url 엔 도메인만 기준으로 표시됨
#트렌스미션 설치하고 접속시 셋팅법
<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyRequests Off
    ServerName torrent.도메인.kr
    ServerAlias torrent.도메인.kr
    ProxyPass / http://127.0.0.1:9091/ retry=1 acquire=3000 timeout=600 Keepalive=On
    ProxyPassReverse / http://127.0.0.1:9091/
</VirtualHost>

파일 저장후 하단 내용 실행


a2enmod proxy

a2enmod proxy_http

a2enmod proxy_balancer

a2enmod lbmethod_byrequests

a2ensite vhost.conf



위처럼 proxy 설정을 하면 사용하면


http://IP:9091 로 접속을 안하고


http://torrent.도메인.kr 로 접속이 가능





# ■■■ webmin 설치(웹 관리 콘솔)


wget -O - http://www.webmin.com/jcameron-key.asc | apt-key add -

이나

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

apt-key add jcameron-key.asc


echo "deb http://download.webmin.com/download/repository sarge contrib" | sudo tee -a /etc/apt/sources.list

echo "deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib" | sudo tee -a /etc/apt/sources.list

apt-get update

apt-get install webmin


nano /etc/apt/sources.list

위 추가한 2줄 주석


# webmin의 기본 Port가 10000이라서 ufw(우분투 방화벽)를 이용하여 10000번 포트를 열어줍니다.

# sudo ufw allow 10000 

# nano /etc/webmin/miniserv.conf

# port=10000

# //이하 라인은 생략


service webmin {start, stop, restart}


※ 한글 오류 수정

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

or

nano /usr/share/webmin/cron/module.info.ko_KR.UTF-8


desc_ko_KR.UTF-8=예약된 Cron 작업 <-- 한글깨져있는 부분 수정


https://localhost:10000





# ■■■ SAMBA 설치(네트워크 공유)


apt-get install samba && samba-common-bin


※ samba 계정 지정[리눅스에 있는 계정만 추가 가능]

smbpasswd -a [ID]


나머지 설정은 webmin 에서 하는게 편함




# ■■■ 토렌트 설치 transmission-daemon


apt-get install transmission-daemon


정지

/etc/init.d/transmission-daemon stop


설정

nano /etc/transmission-daemon/settings.json


※중요한 부분


블랙 리스트
"blocklist-enabled": true, 
"blocklist-url": "http://list.iblocklist.com/?list=bt_level1&fileformat=p2p&archiveformat=gz", 

다운로드 경로
"download-dir": "/media/exHDD/contents/Downloads", 

웹 활성화
"rpc-enabled": true, 

접근 화이트 리스트 끄기
"rpc-whitelist-enabled": false,
"rpc-username": "아이디", 
"rpc-password": "암호[자동암호화]",

다운로드 완료시 배포안하고 완료 처리
"ratio-limit": 0, 
"ratio-limit-enabled": true, 



다운로드 완료시 응답 스크립트

"script-torrent-done-enabled": true, 

"script-torrent-done-filename": "/home/root/script/torrent_push.sh", 


위 응답 스크립트는 밑에 게시글 참조

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

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


다운로드 업로드 속도 설정

"speed-limit-down": 6000, 

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

"speed-limit-up": 100, 

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


다운로드 파일 권한 설정 

"umask": 2, 



시작
/etc/init.d/transmission-daemon start


서비스 등록
update-rc.d transmission-daemon defaults

시작
service transmission-daemon start


서비스를 등록하고 나중에 토렌트가 죽어있어 다시 시작하려고 할때 구동이 안되는 경우가 생깁니다.
이유는 못찾구요 -0- ;;; 실행방법만 다른데서 찾아서 올립니다.


나중에 구동시 에러가 나면 프로세스 죽이기
kill $(ps -ef | grep 'transmission-daemon -g /etc/transmission-daemon' | grep root |awk '/transmission-daemon/ {print $2}')

구동
transmission-daemon -g /etc/transmission-daemon






# ■■■ TvHeadEnd 설치


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

apt-add-repository ppa:mamarley/tvheadend-git-stable

apt-get update

apt-get install tvheadend


관리자 계정 패스워드 설정화면 출력 설정후 설치완료


http://localhost:9981


접속후 로그인하고 언어 Korean 으로 설정후 저장 닫기


계정 새로 추가하여 전체 권한을 다 부여하면은

한글 계정으로 전체 관리가 가능함..


1. 설정 - DVB 입력 - 네트워크

  네트워크 이름 : IPTV Automatic Network

  최대 # 입력 스트림 : 4

  URL : file:///home/root/pvr/iptv.m3u


2. 설정 - DVB 입력 - 먹스

  스캔상태가 유휴는 작업이 끝난 상태 

  진행 - 활성 - 유후 순

  헤더 오른쪽 서비스 구간 0 으로 되어있는 항목들을 정렬하여

  오른쪽 체크박스 TSID 값을 체크

  스캔상태를 활성으로 변경 - 저장

3. 설정 - 채널 / EPG - 채널

  모든 서비스 매핑

4. 설정 - 채널 / EPG - EPG 그래버

  채널 이름 업데이트 체크

  채널 번호 업데이트 체크

  저장

5. 설정 - 채널 / EPG - EPG 그래버 모듈

  외부 : XMLTV - 켜짐 체크, 우선순위 1, 채널번호(휴리스틱) 체크

  저장



※ tvheadend 등록한 채널 백업 후 이용시 권한 설정


백업폴더경로 /home/hts/.hts/tvheadend/

백업 폴더 : channel, epggrab, input


chown -R hts:video /home/hts/.hts/tvheadend/channel

chmod -R 700 /home/hts/.hts/tvheadend/channel

chmod -f 600 /home/hts/.hts/tvheadend/channel/*


chown -R hts:video /home/hts/.hts/tvheadend/epggrab

chmod -R 700 /home/hts/.hts/tvheadend/epggrab

chmod -Rf 600 /home/hts/.hts/tvheadend/epggrab/*

chmod -f 777 /home/hts/.hts/tvheadend/epggrab/xmltv.sock


chown -R hts:video /home/hts/.hts/tvheadend/input

chmod -R 700 /home/hts/.hts/tvheadend/input

chmod -Rf 600 /home/hts/.hts/tvheadend/input/*


재시작

service tvheadend restart







※ tvheadend 로 녹화가 완료된다음 인코딩 처리하는 부분 입니다.  속도는 느립니다. ㅎㄷㄷ

인코딩을 하실려면 x264, ffmpeg 설치가 되어있어야 합니다.

install-ffmpeg.sh


위 스크립트는 root 계정으로 실행하세요.

아마 30분 정도는 걸린걸로 기억합니다.


인코딩 스크립트 출처 : http://3jini.tistory.com/104


autoencoding.sh

autoencoding720mp4.sh


※ 녹화 설정
설정 - 녹화 - 디지털 비디오 녹화 프로필  화면으로 들어가면
(Default profile) 로 기본 프로필이 있습니다.
여기다가 하셔도되고 새로 추가하셔서 하셔도 됩니다.

녹화 전 여유 시간 : 2분
녹화 후 여유 시간 : 2분
후처리 명령 : /home/root/script/autoencoding720mp4.sh  "%f" "%b"
녹화할 시스템 경로입니다. : /media/exHDD/recording
문자 포맷 : $t/$t.E$e.%Y.%m.%d$-c%F.$n$x

------------------------- 부가 설명 -------------------------------
    autoencoding.sh 파일 수정할 내용
    5행     : TRANSCODEPATH='/media/exHDD/TVheadendRec/' - 녹화 된 파일 경로
    8행     : MKVVIDEO=$TRANSCODEPATH$title".H264.1080P.mkv" - ".H264.1080P.mkv"  원하는데로
              보통 mkv 확장자 형태, mp4, avi 등 사용 가능
    20행  : ffmpeg 

적당한 곳에 저장하고 터미널에서 실행권한 부여
    예) 메인저장소>Downloads폴더에 두었을 경우…
chmod +x /home/root/script/autoencoding.sh

tvheadend에서 Post-Processor Command(후처리 명령)이라고 있는 곳에 
    저장한 파일의 경로와 %f %b를 붙여주고 저장
    TVHeanend 설정>녹화중>디지털 비디오 녹화 프로필
    후처리 명령 할 autoencoding.sh 파일을 경로 포함해서 지정하고 "%f" "%b"를 붙임.
    /home/root/script/autoencoding.sh "%f" "%b" 스크립트가 있는 경로

    전체경로 이름지정 : 문자포멧 $t/$t.E$e.%Y.%m.%d.$n$x

    녹화할 시스템 경로 이 부분에는 녹화파일이 저장될 폴더를 지정
    /media/exHDD/TVheadendRec/
   파일 이름 옵션 에서는 윈도우 호환 파일 이름 사용, 날짜를 파일 이름에 포함 2개 항목에 체크
------------------------- 부가 설명 -------------------------------






# ■■■ Plex Server 설치

wget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | apt-key add -
이나
wget https://dev2day.de/pms/dev2day-pms.gpg.key
apt-key add dev2day-pms.gpg.key

echo "deb https://dev2day.de/pms/ jessie main" >> /etc/apt/sources.list
apt-get install apt-transport-https
apt-get update
apt-get install plexmediaserver-installer

nano /etc/apt/sources.list
위 추가한 1줄 주석


※ 국내 메타 데이터 설정

영화&드라마
https://github.com/axfree/DaumMovie.bundle
이나
https://github.com/hojel/DaumMovie.bundle

음악
https://github.com/hojel/NaverMusic.bundle


다운 받고
압축 파일을 /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins 풀어줌

영화&드라마
wget https://github.com/axfree/DaumMovie.bundle/archive/master.zip
mv master.zip DaumMovie.bundle.zip
unzip DaumMovie.bundle.zip -d /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/
음악
wget https://github.com/hojel/NaverMusic.bundle/archive/master.zip
mv master.zip NaverMusic.bundle.zip
unzip NaverMusic.bundle.zip -d /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/


이동
cd /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/

폴더 이름 변경

mv DaumMovie.bundle-master DaumMovie.bundle
mv NaverMusic.bundle-master NaverMusic.bundle

chown -R plex:nogroup DaumMovie.bundle
chown -R plex:nogroup NaverMusic.bundle

이나

chown -R plex:plex DaumMovie.bundle
chown -R plex:plex NaverMusic.bundle

service plexmediaserver restart

http://localhost:32400




# ■■■ Kodi 

자동실행 설정

nano /etc/rc.local

'fi' 와 'exit 0' 사이에 kodi & 입력 저장

mate-odroid-xu4 버전은 kodi 가 기본 설치 되어있음

애드온 플러그인 설치
https://github.com/hojel/xbmc-korea-addons
https://github.com/hojel/xbmc-korea-addons/archive/master.zip


파일을 다운 받아서 

kodi 에서 애드온 에서 설치하면됨






# ■■■ 예약작업 크론텝


crontab -e


# Edit this file to introduce tasks to be run by cron.

#TvHeadEnd

#0 4 * * * php /home/root/pvr/epg2xml.php

3 */12 * * * php /home/root/pvr/epg2xml.php



가끔 tvheadend 가 죽더라구요 그래서 자동 실행되게 넣어둔겁니다. 0-0

#TvHeadEnd Auto Start  

*/1 * * * * /home/root/script/tvheadend.sh


도메인 구입후 dnszi 에서 관리를 합니다. IP 자동 갱신 스크립트 합니다. ddclient 같은 개념이라 보시면 되겠네요

#dnszi.com domain ddns client

*/5 * * * * wget -q -O - '내용'













# ■■■■■■■■■■■■ 기본 명령어 ■■■■■■■■■■■■■■■ 

사용하면서 명령어가 가끔 기억안날때 봅니다. 0-0참고 하시면 괜찬아요



종료

shutdown -r now


재부팅

sudo reboot


시작

sudo /etc/init.d/ddclient start


스톱

sudo /etc/init.d/ddclient stop


재시작

sudo /etc/init.d/ddclient restart


디버그 테스트

sudo /usr/sbin/ddclient -daemon=300 -debug -verbose -noquiet


프로세스 킬

ps -ax or ps ax |grep ddclient

sudo kill -9 PID


패키지 설정 파일까지 삭제

sudo apt-get purge ddclient


패키지 목록을 갱신합니다.

apt-get update


모든 패키지를 최신 버전으로 업그레이드합니다.

apt-get upgrade


의존성 검사하여 업그레이드 합니다.

apt-get dist-upgrade -y


ddclient 패키지를 설치합니다.

apt-get install ddclient


ddclient 패키지를 재설치합니다.

apt-get --reinstall install ddclient


ddclient 패키지를 삭제합니다. 설정파일은 삭제하지 않습니다.

apt-get remove ddclient


ddclient 패키지를 삭제합니다. remove와 다르게 설정파일도 삭제합니다.

apt-get purge ddclient


패키지 검색은 apt-cache로 합니다.

ddclient를 포함한 패키지를 검색하려면 

apt-cache search ddclient




★퍼미션 권한


-$ sudo chmod [변경될 퍼미션값] [변경할 파일]


-$ sudo chmod 777 /home/pi/파일

-$ sudo chmod -R 777 /home/pi/디렉토리

-$ sudo chmod -R 777 conory /home/pi/디렉토리 

 ※conory - 디렉토리의 하위에 위치한 모든 파일및 디렉토리 퍼미션이 777로 변경




★소유자 변경하기


-$ chown [변경할 소유자] [변경할 파일,디렉토리]


-$ sudo chown pi /var/www


★그룹 변경하기


-$ chown [변경할 소유자] [변경할 파일,디렉토리]


-$ sudo chgrp pi /var/www



★소유자,그룹 변경하기


-$ chown [변경할 소유자]:[변경할 그룹] [변경할 파일,디렉토리]


-$ sudo chown pi:pi /var/www



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


-$ sudo chown -R pi /var/www





 ※파일 스크립트 실행권한 주기

-$ sudo chmod a+x /usr/script/torrent_push.sh

-$ sudo chmod 777 /usr/script/torrent_push.sh



★ 압축하기

tar cfvz 파일명.tgz 폴더경로/

tar cfvj 파일명.bz2 폴더경로



확장자 tar

tar -cvf [파일명.tar] [폴더명] 압축

tar -xvf [파일명.tar] -C 폴더경로 해제


확장자 tar.gz 

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

 tar -zxvf [파일명.tar.gz] -C 폴더경로 해제



tar -cfvj [파일명.bz2] [폴더명] 압축

tar -xfvj 파일명.bz2 -C 폴더경로 해제



 -c 파일을 tar로 묶음

 -p 파일 권한을 저장

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

 -f 파일 이름을 지정

 -C 경로를 지정

 -x tar 압축을 풂

 -z gzip으로 압축하거나 해제함


# ■■■ 포트 확인


netstat -tnlp



Posted by 타카스 류지
|