shoutcast 스트리밍 서버 세팅
서버 아파치 또는 nginx 설치 후
스트리밍 폴더 생성
ex) mkdir /radio/server1
sc_serv 파일 다운
$ wget http://mirror.lchost.net/download.nullsoft.com/shoutcast/tools/sc_serv2_linux_x64_07_31_2011.tar.gz
압축 해제
$ tar -xvzf sc_serv2_linux_x64_07_31_2011.tar.gz
sc_serv_basic.conf 파일 수정 - 수정해야 하는 부분은 빨간색으로 표시
$ vi sc_serv_basic.conf
-----------------------------------------------------------------------------------------------------
Last login: Mon Feb 17 05:39:15 2020
[xware@radio_server04 ~]$ cd /radio/server1vi
[xware@radio_server04 server1]$ vi sc_serv_basic.conf
; NOTE: for any relative paths specified are relative to
; sc_serv and not to where the conf file is being stored
; here we will setup where the log and other related files
; will be stored. make sure that these folders exist else
; sc_serv will throw an error and will close itself down.
; we will make the logs save to the sc_serv2 directory
logfile=logs/sc_serv.log
w3clog=logs/sc_w3c.log
banfile=control/sc_serv.ban
ripfile=control/sc_serv.rip
; for testing we will make the server only work locally
; (i.e. localhost / 127.0.0.1) though if this is left out
; or set to publicserver=always then we attempt to make a
; connection to the YP for listing - do not forget to add
; in a 'streamauthhash' value for any public streams made
;publicserver=never
MaxUser=2000 < 최대 청취자 수를 정해주는 문구. 입력을 해줘야함 기본은 32
; if you're wanting to use a different port to use for any
; connections then you can use this option e.g. to use 80
; otherwise port 8000 is used as the default to listen on.
portbase=8001 < 스트리밍으로 사용할 포트 번호 8001을 잡아주면 8002도 같이 사용함
처음에는 주석처리 되어있기 때문에 주석을 제거해주어야 함 > ; << 주석표시
; password used by sc_trans or the Winamp dsp plug-in
; NOTE: remember to change this to something else
password= 비밀번호 입력< 스트리밍 서버의 비밀 번호 DJ서버의 sc_trans_basic.conf 파일도 같은 비밀번호 입력
; password used for accessing the administation pages
; NOTE: remember to change this to something else
adminpassword=비밀번호 입력 < 스트리밍 서버 관리자 비밀 번호
; now we will specify the details of the stream we're going
; to serve which can be done as follows
streamid=1
streampath=/test.aac
; or
; it can be done like this which is how it needs to be done
; if you are going to provide multiple streams from sc_serv
;streamid_1=1
;streampath_1=/test.aac
;streamid_2=2
;streampath:q!
~
~
"sc_serv_basic.conf" 50L, 1555C
-----------------------------------------------------------------------------------------------------
iptables 에 8000번 포트 부터 8100 포트까지 추가 < 원하는 포트를 추가
$ vi /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8000:8100 -j ACCEPT < 추가
$ systemctl restart iptables
그 후 데몬으로 서버 열기
sc_serv_basic.conf 파일이 있는 폴더에서
$ ./sc_serv sc_serv_basic.conf > /dev/null &
그리고 해당 아이피:포트 명 입력후 서버가 열렸는지 확인
- DJ 서버 세팅
스트리밍 서버 세팅 후
dj 폴더 생성
ex) mkdir dj1
dj1 폴더에서 sc_trans 파일 다운
$ wget http://mirror.lchost.net/download.nullsoft.com/shoutcast/tools/sc_trans_linux_x64_10_07_2011.tar.gz
압축 해제
$ tar -xvzf sc_trans_linux_x64_10_07_2011.tar.gz
sc_trans_basic.conf 파일 수정 - 수정해야 하는 부분은 빨간색으로 표시
$ vi sc_trans_basic.conf
------------------------------------------------------------------------------------------------------
; NOTE: for any relative paths specified are relative to
; sc_trans and not to where the conf file is being stored
; here we will setup where the log and other related files
; will be stored. make sure that these folders exist else
; sc_trans will throw an error and will close itself down.
logfile=logs/sc_trans.log
; for the purpose of this test then we will not take into
; account the use of a calendar.xml file and so disable it
calendarrewrite=0
; for testing we will only setup a single encoder though it
; is easy to add in additional encoder configurations and
; we are using an aac plus encoder as the default due to
; the licensing requirements for mp3 encoding as detailed
; in sc_trans.txt - section 2.5).
encoder_1=aacp
bitrate_1=128000 < 128kbps 로 설정
;Shuffle the play list < 노래 재생목록을 셔플로 재생하겠다는 내용 추가
Shuffle=1
; this is where we define the details required for sc_trans
; to connect to the sc_serv instance being used where the
; details must match those specified in sc_serv_basic.conf
outprotocol_1=3
ex) serverip_1=45.32.61.6 < 스트리밍 IP 주소
; default is 8000, if not change to sc_serv's 'portbase'
serverport_1=8001 < 연결할 포트 번호
; this is the same as 'password' in sc_serv_basic.conf
password_1= 비밀번호 입력 < 스트리밍 서버와 같은 비밀번호 입력
; this is the same as 'streamid' in sc_serv_basic.conf for
; the stream we are acting as the source for
streamid_1=1
; this is a name for the source we're creating and is used
; with the AJAX control api or can be left blank to get a
; generic name created in the form of 'endpointX' where 'X'
; is the index of the created source from sc_trans lists.
endpointname_1=/Bob
; here you would provide any information to fill in details
; provided to clients about the stream. it us upto you what
; is entered though do not do anything which will annoy, etc
streamtitle=My Test Server
streamurl=http://www.shoutcast.com
genre=Misc
; here we specify a playlist to use as the master list from
; which to play files from.
playlistfile=playlists/main.lst < 플레이 리스트 경로
; these options will allow you access the admin interfaces
; of sc_trans though also allows the 'testui' example to be
; accessed. remember to change the password, etc as needed
adminport=9000 < 어드민 포트로 사용할 포트 각각 다르게 지정해주어야 한곳에서 실행 가능 ex) 두번째 dj를 설정할 경우 9001로 설정해주어야 함
포트가 열려 있지않기 때문에 9000부터 사용할 포트까지 열어주어야 함
원하는 포트로 설정해도 무관
adminuser=admin
adminpassword=goaway
; if we want to have an intro file for when the client gets
; the stream or a backup file incase of our connection to
; the server failing then we can set these. this is needed
; as we are using 'outprotocol=3' which supports this (and
; is needed in place of the sc_serv defined values to work)
;serverintrofile=<specify_intro_filepath>
;serverbackupfile=<specify_backup_filepath>
----------------------------------------------------------------------------------------------------------
이 후 플레이 리스트 작성
플레이 리스트는 기본적으로 playlist 폴더 안의 main.lst 파일이 기본 플레이 리스트
리눅스 shoutcast는 mp3는 유료 코드가 없으면 실행이 불가하기 때문에 ogg 파일로 변환해주어야 함
-----------------------------------------------------------------------------------------------------------
# This example playlist is used as the main playlist sc_trans will use to pick
# out the files it will use to create its output for the source we generate.
#
# Also remember to use the correct path format for the OS you are using and to
# ensure that the files you want to play are present in the location you choose
# e.g.
(여자)아이들 - LION.ogg
10CM - 나의 어깨에 기대어요.ogg
AKMU (악동뮤지션) - 어떻게 이별까지 사랑하겠어, 널 사랑하는 거지.ogg
Anne-Marie - 2002.ogg
Anne-Marie - Birthday.ogg
Arizona Zervas - ROXANNE.ogg
-----------------------------------------------------------------------------------------------------------
만약 다른 폴더에 곡을 넣었다면 playlist 폴더를 기준으로 경로를 작성해주면 됨
현재는 playlist 폴더에 곡들을 다 넣었기 때문에 곡 제목만 적어주면 재생 가능
ex) /radio/dj1 폴더 밑에 playlist, music 폴더가 같이 있는 경우
../music/(여자)아이들 - LION.ogg < 이런식으로 작성
해당 리스트를 작성하고 저장 후 sc_trans_basic.conf 실행
$ ./sc_trans sc_trans_basic.conf > /dev/null &
해당 아이피:포트 주소로 들어가서 방송이 나오는지 확인
실행 쉘 스크립트 작성
start.sh 내용
# vi /radio/start1.sh
#!/bin/bash
/radio/server/1/sc_serv /radio/server/1/sc_serv_basic.conf > /dev/null &
중지 쉘 스크립트 작성
stop.sh 내용
# vi /radio/stop1.sh
#!/bin/bash
fuser -k -n tcp 해당 포트 번호
log 파일때문에 실행 안된다는 에러 뜨면 로그 파일 경로를 절대 경로로 변경
'IT 끄적이기' 카테고리의 다른 글
Dokcer 이미지로 PostgreSQL세팅 (4) | 2024.12.26 |
---|---|
MySQL 리플리케이션(Replication) 설정 방법 (1) | 2021.08.13 |
ubuntu 18.04 iptables,SSL적용 및 logrotate 설정 방법 (1) | 2021.08.10 |
nginx 18.04 LEMP 설치 방법( nginx + php7.2+mariadb ) (1) | 2021.08.10 |
기획할 때 사용하면 좋을만한 PowerMockUp (1) | 2021.01.11 |