사용자 도구

사이트 도구


miniserver:start

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

다음 판
이전 판
miniserver:start [2014/06/13 17:25] – 새로 만듦 changwoominiserver:start [2017/07/24 00:41] (현재) – [주요 토픽들] changwoo
줄 1: 줄 1:
-====== 미니 서버 운영 문서 ======+====== 미니 서버 문서 ====== 
 + 
 +===== 주요 토픽들 ======= 
 +[[miniserver:xenial|Ubuntu 16.04 설치와 운영 노트]] 
 + 
 +[[miniserver:specs|모델과 사양]]
  
 ===== 아파치2 SSL 구축 ===== ===== 아파치2 SSL 구축 =====
줄 34: 줄 39:
 </code> </code>
 설정도 추가한다. 설정도 추가한다.
 +
 +이건 우분투 관련 설정이므로 적당히 고쳐서 써야 한다는 점 주의.
 +
 +
 +
 +===== 사운드 설정 =====
 +<code>
 +$ sudo apt-get remove --purge alsa-base pulseaudio
 +$ sudo apt-get install alsa-base pulseaudio
 +$ sudo alsa force-reload
 +</code>
 +alsamixer 에서 MUTED 해제. 'MM'이라고 써져 있음 안됨.
 +
 +===== 블루투스 사용 =====
 +<code>
 +# apt-get install bluez python-gobject python-dbus
 +</code>
 +
 +블루투스 스피커를 사용해 보고 싶어 작업을 진행해 보았다.
 +bluez, bluez-tools 패키지 설치. 설치 후 장비 검색 명령
 +<code>
 +$ hcitool scan
 +Scanning ...
 + 40:EF:4C:15:DF:B2 IA160
 + 28:E3:47:83:C2:0A laptop
 +</code>
 +''40:EF:4C:15:DF:B2'' 주소의 'IA160'이 내가 연결하고 싶은 블루투스 스피커이다.
 +
 +서버에 사운드 설정을 하지 않아서 pulseaudio를 설치했다.
 +<code>
 +$ sudo apt-get install pulseaudio bluez-alsa
 +$ sudo update-rc.d pulseaudio defaults
 +$ sudo update-rc.d bluetooth defaults
 +</code>
 +
 +
 +[[.:bluetooth_sound]] 문서에서 기록
 +
 +====== BitTorrent Sync 사용 ======
 +
 +vagrant와 이를 이용한 virtual machine 내역을 공유하기 위하여 NAS에 BitTorrent Sync를 이용해 보았다. 대용량 파일 변화 감지에 매우 유용하므로, 꽤 괜찮은 선택이 될 듯하다.
 +
 +우선 이전 [[project:btsyncforrpi]] 문서에 많은 내용이 우선 기록되어 있다.
 +문서를 작성하는 2015년 11월까지도 리눅스는 별도의 GUI는 제공하지 않으므로, 데스크탑에서는 적당히 btsync를 꺼내 쓰면 될 것 같다.
 +
 +===== NAS Config =====
 +별도의 사용자 btsync를 만들고 홈디렉토리에 .sync 디렉토리를 생성하고 여기에 모든 설정 파일등을 집어 넣는 식으로 작성하였다
 +이와 관련해서는 이전 문서를 참고.
 +
 +<code>
 +{
 +  "device_name": "MiniServer",
 +  "listening_port" : 0, // 0 - randomize port
 +
 +/* storage_path dir contains auxilliary app files if no storage_path field: .sync dir created in the directory
 +   where binary is located. otherwise user-defined directory will be used */
 +  "storage_path" : "/home/btsync/.sync",
 +
 +/* set location of pid file */
 +  "pid_file" : "/home/btsync/.sync/btsync.pid",
 +
 +/* use UPnP for port mapping */
 +  "use_upnp" : true,
 +
 +/* limits in kB/s. 0 - no limit */
 +  "download_limit" : 0,
 +  "upload_limit" : 0,
 +
 +/* proxy configuration */
 +// "proxy_type" : "socks4", // Valid types: "socks4", "socks5", "http_connect". Any other value means no proxy
 +// "proxy_addr" : "192.168.1.2", // IP address of proxy server.
 +// "proxy_port" : 1080,
 +// "proxy_auth" : false, // Use authentication for proxy. Note: only username/password for socks5 (RFC 1929) is supported, and it is not really secure
 +// "proxy_username" : "user",
 +// "proxy_password" : "password",
 +
 +  "webui" :
 +  {
 +    "listen" : "0.0.0.0:8888" // remove field to disable WebUI
 +
 +/* preset credentials. Use password or password_hash */
 +//  ,"login" : "admin"
 +//  ,"password" : "password"
 +//  ,"password_hash" : "some_hash" // password hash in crypt(3) format
 +//  ,"allow_empty_password" : false // Defaults to true
 +/* ssl configuration */
 +//  ,"force_https" : true // disable http
 +//  ,"ssl_certificate" : "/path/to/cert.pem"
 +//  ,"ssl_private_key" : "/path/to/private.key"
 +
 +/* directory_root path defines where the WebUI Folder browser starts (linux only). Default value is / */
 +//  ,"directory_root" : "/home/user/MySharedFolders/"
 +
 +/* directory_root_policy defines how directory_root is used (linux only).
 +   Valid values are:
 +     "all" - accepts directory_root and its subdirectories for 'getdir' and 'adddir' actions
 +     "belowroot" - accepts directory_root's subdirectories for 'getdir' and 'adddir' actions,
 +     but denies attempts to use 'adddir' to create directories directly within directory_root
 +   Default value is "all". */
 +//  ,"directory_root_policy" : "all"
 +
 +/* dir_whitelist defines which directories can be shown to user or have folders added (linux only)
 +   relative paths are relative to directory_root setting */
 +//  ,"dir_whitelist" : [ "/home/user/MySharedFolders/personal", "work" ]
 +  }
 +
 +/* !!! if you set shared folders in config file WebUI will be DISABLED !!!
 +   shared directories specified in config file  override the folders previously added from WebUI. */
 +
 +  , "shared_folders" :
 +  [
 +    /* {
 +      "secret" : "MY_SECRET_1", // required field - use --generate-secret in command line to create new secret
 +      "dir" : "/home/user/bittorrent/sync_test", // * required field
 +      "use_relay_server" : true, //  use relay server when direct connection fails
 +      "use_tracker" : true,
 +      "use_dht" : false,
 +      "search_lan" : true,
 +      "use_sync_trash" : true, // enable SyncArchive to store files deleted on remote devices
 +      "overwrite_changes" : false, // restore modified files to original version, ONLY for Read-Only folders
 +      "known_hosts" : // specify hosts to attempt connection without additional Dsearch
 +      [
 +        "192.168.1.2:44444"
 +      ]
 +    } */
 +    {
 +      "secret"            : "<code>",
 +      "dir"               : "/home/btsync/<path>",
 +      "use_relay_server"  : true,
 +      "use_tracker"       : true,
 +      "search_lan"        : true,
 +      "use_sync_trash"    : true,
 +      "overwrite_changes" : false,
 +      "known_hosts"       : [
 +        "192.168.0.4:48867"
 +      ]
 +    }
 +  ]
 +
 +/* Advanced preferences can be added to config file. Info is available at "http://help.getsync.com/customer/portal/articles/1902048-sync-advanced-preferences--more-options"
 +For example see folder_rescan_interval below */
 +// "folder_rescan_interval" : "86400"
 +
 +}
 +</code>
 +
 +이 정도 예로 만들면 될 것 같다.
 +아래는 우분투에서 쓸 init script
 +
 +<code>
 +#!/bin/sh
 +### BEGIN INIT INFO
 +# Provides: btsync
 +# Required-Start: $local_fs $remote_fs
 +# Required-Stop: $local_fs $remote_fs
 +# Should-Start: $network
 +# Should-Stop: $network
 +# Default-Start: 2 3 4 5
 +# Default-Stop: 0 1 6
 +# Short-Description: Multi-user daemonized version of btsync.
 +# Description: Starts the btsync daemon for all registered users.
 +### END INIT INFO
 +
 +# Replace with linux users you want to run BTSync clients for
 +BTSYNC_USERS="btsync"
 +DAEMON=/usr/local/bin/btsync
 +
 +start() {
 +  for btsuser in $BTSYNC_USERS; do
 +    HOMEDIR=`getent passwd $btsuser | cut -d: -f6`
 +    config=$HOMEDIR/.sync/config.json
 +    if [ -f $config ]; then
 +      echo "Starting BTSync for $btsuser"
 +      start-stop-daemon -b -o -c $btsuser -S -u $btsuser -x $DAEMON -- --config $config
 +    else
 +      echo "Couldn't start BTSync for $btsuser (no $config found)"
 +    fi
 +  done
 +}
 +
 +stop() {
 +  for btsuser in $BTSYNC_USERS; do
 +    dbpid=`pgrep -fu $btsuser $DAEMON`
 +    if [ ! -z "$dbpid" ]; then
 +      echo "Stopping btsync for $btsuser"
 +      start-stop-daemon -o -c $btsuser -K -u $btsuser -x $DAEMON
 +    fi
 +  done
 +}
 +
 +status() {
 +  for btsuser in $BTSYNC_USERS; do
 +    dbpid=`pgrep -fu $btsuser $DAEMON`
 +    if [ -z "$dbpid" ]; then
 +      echo "btsync for USER $btsuser: not running."
 +    else
 +      echo "btsync for USER $btsuser: running (pid $dbpid)"
 +    fi
 +  done
 +}
 +
 +case "$1" in
 + start)
 +start
 +;;
 +stop)
 +stop
 +;;
 +restart|reload|force-reload)
 +stop
 +start
 +;;
 +status)
 +status
 +;;
 +*)
 +echo "Usage: /etc/init.d/btsync {start|stop|reload|force-reload|restart|status}"
 +exit 1
 +esac
 +
 +exit 0
 +</code>
 +
 +
miniserver/start.1402680332.txt.gz · 마지막으로 수정됨: 2014/10/09 21:23 (바깥 편집)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki