<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName wiki.dasomoli.org
ServerAdmin dasomoli@gmail.com
DocumentRoot /var/lib/mediawiki
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/wiki_error.log
CustomLog ${APACHE_LOG_DIR}/wiki.access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
Include conf-available/serve-cgi-bin.conf
</VirtualHost>
이제 mediawiki configuration을 enable 하자
sudo a2enconf mediawiki
wiki.dasomoli.org site도 enable하자
sudo a2ensite wiki.dasomoli.org.conf
apache2도 reload하자
sudo service apache2 reload
이제 wiki.dasomoli.org에 접속해서 mediawiki 설치를 시작한다.
설치가 끝나면 LocalSettings.php 파일을 저장할 수 있는데, 이 파일을 /etc/mediawiki/LocalSettings.php 로 저장한다.
minidlnad-upnphttp.o: In function `SendResp_dlnafile':
/home/pi/src/readymedia-transcode/upnphttp.c:2041: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
tmpnam()이 위험하니까 mkstemp()를 이용하라는 거니까 찾아서 바꿔준다.
$ vi upnphttp.c
char tmp[L_tmpnam];
mkdtemp(tmp);
다시 컴파일하면 잘 된다. 설치를 sudo make install로 해줘도 되는데(사실 이렇게 한 후에 checkinstall을 사용했다-_-), 패키지를 만들어 설치하면 나중에 제거가 편하다. checkinstall이 없으면 설치(sudo apt-get install checkinstall)한 후에 아래 명령을 준다.
$ sudo checkinstall
아래와 같은 게 나오면 ‘Y’
아래와 같은게 나오면 난 MiniDLNA Version 2015-06-18 Compiled June 18, 2017 라고 입력했다.
그럼 아래와 같은게 나오는데, 여기서 3번, 버전만 숫자로 시작해야해서 아래처럼 2015-06-18 로 입력했다.
“audio_codecs”나 “video_codecs” 에 적혀있는 코덱에 해당하는 미디어 파일이 재생되면, 그 아래의 “transcode_audio_transcoder”혹은 “transcode_video_transcoder” 에 적혀 있는 스크립트를 실행한다. 원하는 코덱을 transcoding하고 싶다면 해당 코덱을 적어주자. 어떤 것을 적어야 하는지는 avconv -formats 라고 입력하면 찾아볼 수 있다.
transcoding 스크립트는 /usr/local/share/minidlna/transcodescripts/ 아래에 있다. 옵션을 변경하고 싶다면 해당 스크립트를 수정한다. 옵션을 변경하지 않더라도 수정을 해주어야 하는데 ffmpeg 대신 avconv를 사용해야 하기 때문이다.
# vi /usr/local/share/minidlna/transcodescripts/transcode_audio
매번 위처럼 실행하긴 귀찮으니까, 부팅될 때마다 자동 실행 되도록 하자. /etc/init.d/안에 minidlna 파일을 새로 생성해서 아래와 같이 내용을 채운다. Process가 2개 되는 경우가 보여서 참고로 보았던 글에 있는 스크립트를 좀 수정했다. 잘안되면, 뭐 또 수정해야지..
# vi /etc/init.d/minidlna
#!/bin/bash
# Mini DLNA
### BEGIN INIT INFO
# Provides: scriptname
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
case "$1" in
'start')
/usr/local/sbin/minidlnad -f /etc/minidlna.conf
echo Started
;;
'stop')
PIDS=`/bin/pidof minidlnad`
if [ "${PIDS}" != "" ];
then
for PID in ${PIDS};
do
kill -SIGTERM ${PID}
done
else
echo Already Stopped
fi
;;
'restart')
PIDS=`/bin/pidof minidlnad`
if [ "${PIDS}" != "" ];
then
for PID in ${PIDS};
do
kill -SIGTERM ${PID}
done
fi
/usr/local/sbin/minidlnad -f /etc/minidlna.conf
echo Restarted
;;
'status')
PID=`/bin/pidof minidlnad`
if [ "${PID}" != "" ];
then
echo Running. Process ${PID}
else
echo Stopped
fi
;;
'rescan')
PIDS=`/bin/pidof minidlnad`
if [ "${PIDS}" != "" ];
then
for PID in ${PIDS};
do
kill -SIGTERM ${PID}
done
fi
/usr/local/sbin/minidlnad -R -f /etc/minidlna.conf
echo Rescanning
;;
*)
echo "Usage: $0 { start | stop | restart | status | rescan }"
;;
esac
exit 0
24시간 내내 돌리면 라즈베리 파이가 너무 뜨거울 것 같아서 USB 선풍기를 포트에 연결하고, 이걸 껐다 켰다 하려고 시도했다. 결론적으론 다른 USB 기기를 쓰지 않는다면, 전체 USB 포트를 껐다 켜는 방식으로 가능하다. 다른 USB 기기를 사용한다면, 실패. 아직 디바이스 드라이버에 커널 컴파일까진 시도하고 싶지 않다.
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=93463 쓰레드를 참고하면, hub-ctrl을 이용하면, 전체 포트 혹은 개별 포트를 껐다 켰다 하는 것을 할 수 있다. 그러나 개별 포트를 끄는 게, 실제 VBUS 전원까지 내리는 건 아니고, 그냥 못쓰게 할 뿐이다. 그래서, 전체 포트를 끄지 않는 한, 개별 포트를 꺼도 해당 포트 VBUS는 살아있기 때문에 USB 선풍기는 계속 돈다-_-;;
Hub:Port — Controlled port(s)
0:1 — Controls the Ethernet port
0:2 — Controls all four USB ports (not the Ethernet)
0:3 — Controls USB Port 4
0:4 — Controls USB Port 2
0:5 — Controls USB Port 3