ææŠãã
3ã€ã®ãã¹ãããããŸãã ããŒã ãããã¯ãŒã¯ã«2ã€ããªã¢ãŒãã«1ã€ã ããã¯ã¢ããã«ã¯ãããŒã ãããã¯ãŒã¯ã«çŽæ¥æ¥ç¶ãããããªã¢ãŒãã§ãã¹ãã§ããç¬ç«ããããã¯ã¢ãããµãŒããŒãå¿ èŠã§ãã äž»ãªã¿ã¹ã¯ïŒããŒã ã·ã¹ãã ãšãªã¢ãŒãã·ã¹ãã ã®äž¡æ¹ã®å®æçãªããã¯ã¢ãããäœæããŸãã ãµãŒããŒã¯ã§ããã ãçµæžçã§ãªããã°ãªããŸããã ãã¹ãŠã®ãã¹ããšããã¯ã¢ãããµãŒããŒã¯ãFreeBSDãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã䜿çšããŸãã
å€ãã³ã³ãã¥ãŒã¿ãŒããµãŒããŒãšããŠäœ¿çšããã®ãæãç°¡åã§ãã ãããã圌ã¯24æéäœå¶ã§å€åããŠããå¿ èŠããããããå€ãã®é»åãæ¶è²»ããŸãã ãã®ãããARMããã»ããµäžã®ã·ã³ã°ã«ããŒãã³ã³ãã¥ãŒã¿ãŒã«ç®ãåããŸããã ãã®ããã»ããµã¯ãFreeBSDãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã§ãµããŒããããŠããŸãã
æè¯ã®éžæã¯Banana Pi M1ã§ãã é©åãªããã»ããµãšã¡ã¢ãªã SATAãã©ã€ããæ¥ç¶ã§ããŸãã ãã®ãã©ã¡ãŒã¿ã¯ãç¹ã«æ¥ãã§è¡ãå Žæããªãããã¯ã¢ãããµãŒããŒã«ã¯éåžžã«æºè¶³ã®ãããã®ã§ãã
BackupPCããœãããŠã§ã¢ãœãªã¥ãŒã·ã§ã³ãšããŠéžæãããŸããã ã¢ãŒã«ã€ããæå·åãããŠããªãããšãé€ããŠã圌ã«ã¯ãã¹ãŠåé¡ãããŸããã ã¢ãŒã«ã€ãã®ã³ããŒãã¯ã©ãŠãã«ã¢ããããŒãããã«ã¯ïŒããã«ã³ãŒã·ã£ä»¥å€ã®mail.ruã«ã¢ããããŒãããã«ã¯ïŒãè¿œå ã®æå·åãå¿ èŠã§ãã ããããããã¯ãã®ãããã¯ã«é¢ããå¥ã®åé¡ã§ã¯ãããŸããã BackupPC Webã€ã³ã¿ãŒãã§ãŒã¹ã«ã¢ã¯ã»ã¹ããã«ã¯ãWebãµãŒããŒãå¿ èŠã§ãã BackupPCã®ã¯ã©ã·ãã¯ã€ã³ã¹ããŒã«ã§ã¯ãApacheãæäŸãããŸãã ããããå°ããªãããPiã§æãäžããŠãã®ãããªã¢ã³ã¹ã¿ãŒãç©ã¿äžããããšã¯ãããŸããã ãããã£ãŠãnginxããããŸãã
é
以äžã®æ©åšãaliexpressã§æ³šæãããŸããã
1. Banana Pi A20ãã¥ã¢ã«ã³ã¢1GB RAMã·ã³ã°ã«ããŒãã³ã³ãã¥ãŒã¿ãŒ
2. ãããPI M1ã±ãŒã¹
3. PC Banana piã¢ã«ãããŠã 補ããŒãã·ã³ã¯CPUããã³RAM
4. Banana Pi M1 SATAã±ãŒãã«
5.5v 3aãã€ã¯ãUsb AC / DCé»æºã¢ããã¿ãŒEu
ã³ã³ãã¥ãŒã¿ããŒãã¯ãããã«è¡ãããŸãã ããã«ãããæ£åžžã«æ©èœãããšããèªä¿¡ãçãŸããŸãã FreeBSD 11ãããŒãããŸãããåäœããŸãã ã±ãŒã¹ãéåžžã«ããã§ããŠããŸãã æåã¯ããã§ããã 梱å ããããããŸããã§ããã 察称ã«èŠããŸãã ããããããèŠããšãã±ãŒã¹ã®åºéšã«ããŒã®çåŽã®ã¹ããããŒã®åœ¢ç¶ãå°ãç°ãªãããšãããããŸãã çããµã€ãã«ããŒïŒé»æºãã¿ã³ãšãªã»ãããã¿ã³ãããïŒã¯ãå察åŽã®ã«ããŒãããäœãäœçœ®ã«ãããŸãã ä»ã®ãã¹ãŠãå®å šã«éãŸã£ãŠããŸãã ããžãç· ããã ãã§ãã ãããã«ã¯ãããžã§ç©Žã«æ¥çããããŽã 補ã®èããããŸãã
æåã®ã¢ã»ã³ããªã¯ãã¹ãã§ããããããã¡ããèã¯ãã£ã€ããŸããã§ããã ã©ãžãšãŒã¿ãŒãèšçœ®ããã«ã¯å解ããå¿ èŠããããŸãã äœã¯æããã§ãã ããã«äœãããã®ãââãå ·äœçã«ã©ã®ããã«ç±ããªãã®ããããã€ã¹ãéåžžã¢ãŒãã§åäœãå§ãããšãã確èªããŸãã 2ã»ããã®ã©ãžãšãŒã¿ãŒãåããããããè³Œå ¥ãããŸããã ã»ããã«ã¯4ã€ãããŸãã åãããã«1ã€ã 1ãããã®ã©ãžãšãŒã¿ãŒã»ããã¯å«ãŸããŠããŸããã ãããã£ãŠãããã¯ã¹ãã¢ã§ããããšãå€æããŸããã ã¢ãªã¯ãŸããããã€ãã®ã»ã©ããã¯ã©ãžãšãŒã¿ãŒãæäŸããŠããŸããããããã¯ã©ã®ããã«ç±ãæŸæ£ããã¹ããã¯äžæã§ãã 圌ãã¯rib骚ãæã£ãŠããŸãã-ãããäžã®ã¡ããã©åãã¹ããã«ãŒã ã»ãšãã©ã®å Žåãããã¯äžåœã®èšæ¶ãããããªãŒãLEDã©ã³ããªã©ã®ç¡çç©ã®ãã®ã§ãã
ã±ãŒã¹ã®ææ°ç¹æ§ã¯æé«ã§ã¯ãããŸããã åºé¢ã«ããŒã«ã¯ã°ãªã«ããããŸãããã°ãªã«ã¯1ã€ã ãã§ããã空æ°ã®ééã¯ãããŸããã ãã ããã±ãŒã¹èªäœã¯å¿«é©ã§ãã ãã¹ãŠã®ããã«ç¢ºãã«äœãããç©ŽããããŸãã ããŒãã«å®å šã«ãã£ããããŸãã ãã€ã¯çšã®ç©Žã®ã¿ããããŸãã ãããã圌ã¯å¿ èŠãããŸããã äžéšã«ããŒã«ã¯ãã³ãã¯ã¿ãèŠã2ã€ã®è¿œå ã®ãããããããŸãããããã¯äœ¿çšããŸããã ããŒãäžã®èµ€ãLEDããã·ã£ãŒã·ã®è¡šé¢ã«å ãåºåããã©ã€ãã¬ã€ãããããé»æºæ¥ç¶ã瀺ããŸãã ãã1ã€ã®æ¬ ç¹ã¯ãå£ã«åãä»ããããã®ç©Žããªãããšã§ãã
é»æºã¯2Aãæšå¥šããŸããã3ã€æ³šæããŸããã å€ä»ãã®2.5ã€ã³ãHDDã§äœ¿çšããäºå®ã§ããããã«ã¯ããã¯ãŒãªã¶ãŒãä»ãã®é»æºãéåžžã«äŸ¿å©ã§ããããã¯ãããŒã¯ã¢ãŒããæå³ããŸããçŸåšã®ã¢ãŒãã§ã¯ãã·ã¹ãã å šäœã®æ¶è²»ã¯1Aã«åãŸããŸãã
ã¿ã¹ã¯å®è¡
ã·ã¹ãã ãSDã«ãŒãããèµ·åããŸãã æ§æã¯åºæ¬ã§ãã ããã«ãããŒãºã«åãããŠèª¿æŽããå¿ èŠããããŸãã ããã«ãrc.confã«
growfs_enable="YES"
ãªãã·ã§ã³ãè¿œå ãããŸããã ã·ã¹ãã ã®æåã®èµ·åæã«ãã«ãŒãã®å šå®¹éã確å®ã«äœ¿çšã§ããŸãã ãã1ã€ã®ã¯ã³ã¿ã€ã ãªãã·ã§ã³ã¯ãããŒããžã®åæã¢ã¯ã»ã¹ã®ããã«DHCPãä»ããŠIPã¢ãã¬ã¹ãååŸããããšã§ãã
SSHãä»ããŠããŒãã«æ¥ç¶ã§ããããã«ãããããã·ã¹ãã ã«ã¯æåã«freebsdãšrootã®2人ã®ãŠãŒã¶ãŒãããŸãã ãã¹ã¯ãŒãã¯ååãšäžèŽããŸãã ããããããå®å šãªãã®ãšäº€æããããšãå¿ããªãã§ãã ããã ãŸããæ°ããrc.confãäœæããå¿ èŠããããŸãã ããã©ã«ãã§ã¯ãsendmailã¯ç¡å¹ã«ãªã£ãŠããŸãã BackupPCã¡ãã»ãŒãžãéä¿¡ããã®ã«åœ¹ç«ã¡ãŸãã ãããã£ãŠãèšå®ããåæãããè¡ã¯åé€ãããŸãã Sendmailã¯ãlocalhostããã¡ãŒã«ãéä¿¡ã§ããããã«ãªããŸãã
## common #apcupsd_enable="YES" hostname="foo.example.com" keymap="us.dvorak.kbd" ntpd_enable="YES" ntpd_sync_on_start="YES" sshd_enable="YES" ## net ifconfig_dwc0_ipv6="inet6 accept_rtadv" rtsold_enable="YES" ipv6_defaultrouter="2a01:348:1f9:29::1" ## nginx nginx_enable="YES" spawn_fcgi_enable="YES" fcgiwrap_enable="YES" fcgiwrap_user="bpc"
#apcupsd_enable="YES"
-åæäžãæ¬çªãžã®åãæ¿ãæã«ããã¯ã¢ããé»æºãæ¥ç¶ãããŸãã
keymap="us.dvorak.kbd"
-ããã¯çŽç²ã«ç§ã®å人çãªãã®ã§ãã ã³ã³ãœãŒã«ããæ¥ç¶ããå Žåãå¿ èŠãªããŒããŒãã¬ã€ã¢ãŠããæäŸããå¿ èŠããããŸãã ããŒãã¯çŸåšã®æå»ãä¿åããŸããã ntpãµãŒããŒããèŠæ±ãããŸãã ãããã£ãŠã察å¿ããããŒã¢ã³ã®èµ·åãæäŸãããŸãã
ãã¹ãŠã®ãã¹ãã«äœãã§ãã䜿ãæ £ãããŠãŒã¶ãŒãè¿œå ããŸããã .ssh / authorized_keysãã¡ã€ã«ãè¿œå ãããã®ããã«å¿ èŠãªã·ã§ã«ãã€ã³ã¹ããŒã«ããŸããã ããã§ãæåã®ãŠãŒã¶ãŒãfreebsdããåé€ã§ããŸãã ãŸããæ°ãããŠãŒã¶ãŒãéå§ããããšã¯ã§ããŸããããæ¢åã®ãŠãŒã¶ãŒã®ãŸãŸã«ããŠãã ããã äžè¬ã«ãBackupPCãäœæãããŠãŒã¶ãŒã§ã®ã¿ã¢ã¯ã»ã¹ã§ããŸããããã®åŸãwheelã°ã«ãŒãã«å«ããŠãã±ãŒã¹ã䜿çšããã³ã³ãœãŒã«ã®ãã¹ã¯ãŒãã¢ã¯ã»ã¹ãèš±å¯ããå¿ èŠããããŸãã ã·ã³ã°ã«ããŒãã³ã³ãã¥ãŒã¿ã®ãªãœãŒã¹ã¯éãããŠããããšãèŠããŠããå¿ èŠããããŸãã ãããŠããã®ããã€ã¹ã¯1ã€ã®ã¿ã¹ã¯çšã§ãã è¿œå ã®ãœãããŠã§ã¢ã¯å¿ èŠãããŸããã
éåžžããã¹ãŠã®ãã¹ãã§ããŒãã·ã¹ãã ã䜿çšããŸãã ä»ãç§ã¯ããããªãã§ããããšããŸãã
# pkg install
ããã±ãŒãžã¯æè»æ§ã®äœããœãªã¥ãŒã·ã§ã³ã§ãããæéãç¯çŽã§ããŸãã ãããã£ãŠãzshãvimãmcãé 眮ããŸãã Vim-æã£ãŠããå¿ èŠããããŸãã zshãªãã§ãå®è¡ã§ããŸã-ããã¯ãã¹ã¯ãããã§ã¯ãããŸããã èšçœ®ããããå£ã«éä»ãããŠãããã«äœãŸãããŸãã ããããããããããã«MCã圹ç«ã€å ŽåããããŸãããMCããªããã°çããããšãã§ããŸãã
2 GBã§éžæãããSDã«ãŒãã ã€ãŸã æ£ããã®ã¬ãã€ãã¯1.8ã«ãªããŸãã ãã®ããããœãããŠã§ã¢ã®äžéšã®ãéå°ãã¯äœè£ããããŸãã åœåãã·ã¹ãã ã¯çŽ1 GBã䜿çšããŠããŸããã æ®ãã¯ãŠãŒã¶ãŒçšã§ãã ãããã«è¡šç€ºãããªãã«ãŒãããããŸãã ãã®ãããã·ã¹ãã ãèµ·åããªãå Žåããããã¯ã«é¥ãããšã¯ãããŸããããå¥ã®SDã«ãŒããè©Šãã ãã§ãã
BackupPCãã€ã³ã¹ããŒã«ããŸãã ããã€ãã®æ©èœããããŸãã 泚æããŠãã ãã-rc.confã§ã¯ãBackupPCã®èµ·åã¯ãããŸããã æåã§èµ·åããŸãã ãã®æ¹æ³ã§èµ·åãããBackupPCã¯ãæ§æã«ãªã¹ããããŠãããã¹ãŠã®ãã¹ãã«ãã€ã§ãã¢ã¯ã»ã¹ã§ããŸãã ãã ããããã¯ã¢ãããŠãŒã¶ãŒããä»ã®ãã¹ãã«ãã°ã€ã³ããã ãã§ã¯æ©èœããŸããã 圌ã¯éµã«ã¢ã¯ã»ã¹ããããã®ãã¹ãã¬ãŒãºãèŠæ±ããŸãã ãã ããé·æéã®é»åäžè¶³ãªã©ã§ãµãŒããŒãåèµ·åããå Žåãããã¯ã¢ããã·ã¹ãã ãåæ¢ããåŸã«ãµãŒããŒãèµ·åãããšãBackupPCãå床ããŒãããå¿ èŠããããŸãã ãã®ãããªã€ãã³ããèŠéããªãããã«ãcronã¯3æéããšã«ã¢ã¯ãã£ããªBackupPCããã§ãã¯ããŸãã BackupPCããã»ã¹ãå®è¡ãããŠããªãå ŽåããµãŒããŒã¯é»åã¡ãŒã«ãéä¿¡ããŸãã
ããã«ãBackupPCèªäœã¯ãäœãåé¡ãããå Žåãé»åã¡ãŒã«éç¥ãéä¿¡ããŸãã 次ã®ã³ãã³ãã䜿çšããŠããã®ãµãŒãã¹ã®åäœã確èªã§ããŸãïŒãã¡ãããbackupcæ§æã®æ£ããæ§æãããEmailã»ã¯ã·ã§ã³ã䜿çšïŒã
BackupPC_sendEmail -u your@email.address
çŸåšã®ããŒãžã§ã³ã§ã¯ãBackupPCã¯IPv6ããµããŒãããŠããŸããã Githubã®èšäºã«åŸã£ãŠãå°ãããããé©çšããå¿ èŠããããŸãã 1ã€ã®æ©èœããããŸãã configure.plãã¡ã€ã«ãã€ã³ã¹ããŒã«ãããæ§æã«ãããŸããã 代ããã«ã/ usr / local / libexec / backuppc / update.plã«å€æŽãå ããŸããã ãã¡ã€ã«ãç·šéããåŸãBackupPCã¯6çªç®ã®IPã¢ãã¬ã¹ã§äœæ¥ããæ©äŒãåŸãŸããã åé¡ã¯èµ·ãããŸããã§ããã
ãŸããp5-File-RsyncP-0.74ããã±ãŒãžïŒPerl Rsyncã¯ã©ã€ã¢ã³ãïŒãã€ã³ã¹ããŒã«ããå¿ èŠããããŸãã ããã¯ã¢ããã®å®è£ ã«ã¯rsyncã¡ãœããã䜿çšãããŸãã
BackupPCãã€ã³ã¹ããŒã«ãããšãæå°éã®æš©éã§åãååã®ãŠãŒã¶ãŒãäœæãããŸãã å®éã®ãŠãŒã¶ãŒãå¿ èŠã§ãã backuppcãšããååã¯é·ãããŠäžå¿«ã§ãã ãããã£ãŠãçãbpcã䜿çšããæ¹ã䟿å©ã§ãã ããã«æ¥ç¶ããŠBackupPCãèµ·åã§ããŸãã ãããŠãBackupPCã¯ãã¹ãããããã¹ãã«åœŒã®ååã§è¡ããŸãã ãŠãŒã¶ãŒåã®å€æŽã«é¢é£ããŠããã£ã¬ã¯ããª/ usr / local / www / backuppcã®ååã/ usr / local / www / bpcã«å€æŽããå¿ èŠããããŸãã
ããã§ãããã¯ã¢ãããã¹ã¿ãŒã¯/ etc / passwdã次ã®ããã«è¡šç€ºããŸãã
bpc:*:301:301:BackupPC user:/home/bpc:/usr/local/bin/zsh
ãŠãŒã¶ãŒã®ããŒã ãã£ã¬ã¯ããªã«ãã¡ã€ã«ããããŸãã
-rwxr--r-- 1 bpc bpc 304 Nov 13 19:02 agent -rw-r--r-- 1 bpc bpc 110 Nov 20 12:11 agent-info -rwxr--r-- 1 bpc bpc 158 Nov 19 10:21 mailbpc -rw-r--r-- 1 bpc bpc 38 Nov 19 09:51 mailtext
agent
-BackupPCãå®è¡ããã¹ã¯ãªããã éåžžããã¹ã¯ããããŸãã¯ã¢ã¯ã»ã¹ãèš±å¯ãããŠããå¥ã®ã³ã³ãã¥ãŒã¿ãŒããåŒã³åºãããŸãã
ssh bpc@foo.example.com /home/bpc/agent
ã¹ã¯ãªããã®å 容ïŒ
#!/usr/local/bin/zsh ## ssh-agent to the file pid=`ps ax| grep ssh-agent | grep -v grep` if [ "$pid" = "" ] then ssh-agent | head -2 > ~/agent-info ## Setup Environment for ssh-agent source ~/agent-info ssh-add fi ## Start BackupPC and term the connection /usr/local/bin/BackupPC -d
å®è¡äžã®ssh-agentã確èªããå®è¡ãããŠããªãå Žåã¯èµ·åããç°å¢ãã€ã³ã¹ããŒã«ããssh-addãèµ·åããBackupPCãèµ·åããŸãã éå§å ã®ãã¹ããžã®æ¥ç¶ãéããããŸãã ssh-agentããã»ã¹ãæ€åºããããšãã¹ã¯ãªããã¯çµäºãããšãŒãžã§ã³ããæ¢ã«å®è¡ãããŠãããšããã¡ãã»ãŒãžã衚瀺ãããŸãã
agent-info
ç°å¢ãã©ã¡ãŒã¿ãŒãå«ããã¡ã€ã«ã ãšãŒãžã§ã³ãã«ãã£ãŠäœæãããŸãã
mailbpc
-BackupPCãèœã¡ãããšãèŠåããé»åã¡ãŒã«çšã®ã¹ã¯ãªããïŒ
#!/usr/local/bin/zsh pid=`ps ax | grep perl | grep -v grep` if [ "$pid" = "" ] then mail -s "bpc failure" postmaster@example.com < /home/bpc/mailtext fi
ïŒ3æéããšã«ïŒãã§ãã¯ããã«ã¯ãcrontab -eã§bpcã®è¡ãè¿œå ããŸãã
3 */3 * * * /home/bpc/mailbpc
mailtext
ããã«ããã¹ããèªç±ã«è¿œå ããŠãã ããã ãBackupPCãæ©èœããŠããŸããã åèµ·åããå¿ èŠããããŸããããã¹ãŠãæ£åžžãªå Žåãã¡ãŒã«ã¯å±ããŸããã
å 容ãbpc / .ssh
~ % ls -l .ssh total 20 -rw-r--r-- 1 bpc bpc 400 Oct 28 11:43 authorized_keys -rw------- 1 bpc bpc 35 Nov 7 16:15 config -rw------- 1 bpc bpc 444 Nov 15 12:46 id_ed25519 -rw-r--r-- 1 bpc bpc 90 Nov 15 14:49 id_ed25519.pub -rw-r--r-- 1 bpc bpc 762 Nov 20 14:39 known_hosts
authorized_keys
ããã«ãBackupPCãèµ·åã§ãããã¹ãã®å ¬éããŒãè¿œå ãããŸãã
config
ããŒã«ã«sshæ§æãã¡ã€ã«ã æ°ãããã¹ããBackupPCã«è¿œå ãããå Žåã«å¿ èŠã§ãã æ°ãããã¹ããžã®èªåã¢ã¯ã»ã¹ãæäŸããŸãã ããã©ã«ãã§ã¯ããã®ããŒã¯ãŒãã§askåŒæ°ã䜿çšãããbackupcã¯è³ªåã«çããããšãã§ããŸããã å 容ïŒ
Host * StrictHostKeyChecking no
id_ed25519
-BackupPCãã¯ã©ã€ã¢ã³ããžã®ã¡ãã»ãŒãžãæå·åããç§å¯éµ
id_ed25519.pub
-authorized_keysã§ã¯ã©ã€ã¢ã³ãã«è¿œå ãããå ¬ééµ
known_hosts
ãã¡ã€ã«ã®å 容ã瀺ãããšã«ããèªåçã«æŽæ°ãããã¯ã©ã€ã¢ã³ãã®ãªã¹ãã
BackupPCã¯ããšãŒãžã§ã³ããä»ããèµ·åãèšå®ãããåã«è©Šãããšãã§ããŸãã è©Šé転ã®å Žåãåæ調æŽbackuppc / config.plãè¡ãå¿ èŠããããŸã-å€ââæŽããããŠãŒã¶ãŒåãç»é²ããŸãã ãã¡ã€ã«ãã¹ã確èªãããµãŒããŒåã瀺ããŸãã IPã¢ãã¬ã¹ã§ååã§ããã6çªç®ã®ããŒãžã§ã³ã¯4çªç®ã®ããŒãžã§ã³ãããæ±ãã«ããã§ãã ãã¡ã€ã³åã¯ã/ etc / hostsãŸãã¯ãã¡ã€ã³ã®ãµãŒããŒã®DNSãŸãŒã³ãã¡ã€ã«ã«ç»é²ããå¿ èŠããããŸãã æ§æã¯ãåŸã§Webã€ã³ã¿ãŒãã§ãŒã¹ã䜿çšããŠè©³çŽ°ã«æ§æã§ããŸãã ããã°ã©ã ã®Webã€ã³ã¿ãŒãã§ãŒã¹ã¯éåžžã«äŸ¿å©ã§ãã ãã¹ãŠã®ãã€ã³ãã«ã€ããŠãç¶æ³äŸåãã«ãããããŸãã
èµ·åãããã©ããã確èªããŸãã ãããè¡ãã«ã¯ãbpcãŠãŒã¶ãŒã®äžã®ãµãŒããŒã«ç§»åããŸãã
ssh bpc@foo.example.com
ãã®åŸããã¹ããå®è¡ããŸãã
/usr/local/bin/BackupPC -d
çµæã¯topãŸãã¯psã³ãã³ãã§è¡šç€ºã§ããŸãïŒ
~ % ps aux | grep perl bpc 753 0.0 1.1 15252 11908 - I 12:11 0:00.19 /usr/local/bin/perl /usr/local/bin/BackupPC -d bpc 754 0.0 0.8 12748 8084 - IN 12:11 0:00.77 /usr/local/bin/perl /usr/local/bin/BackupPC_trashClean
ããã§ã¯ãnginxã«åãæãããŸãããã ãŸããæšæºæ§æã§å®è¡ããŸãã
# service nginx start
ãã¹ãŠãé 調ã§ããã°ãnginx.confã次ã®åœ¢åŒã«ããŸãã
load_module /usr/local/libexec/nginx/ngx_mail_module.so; load_module /usr/local/libexec/nginx/ngx_stream_module.so; user bpc bpc; worker_processes auto; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen [::]:80; server_name foo.example.com; index index.html /index.cgi; root /usr/local/www; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; location / { auth_basic "BackupPC admin"; auth_basic_user_file /usr/local/etc/nginx/.passwd; } location ~ \.cgi$ { include fastcgi_params; fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.sock; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_USER $remote_user; fastcgi_param SCRIPT_FILENAME /usr/local/www/cgi-bin/BackupPC_Admin; error_page 404 /404.html; error_page 500 502 503 504 /50x.html; } } }
ãã®æ§æãšrc.confã§åç §ãããããã±ãŒãžãã€ã³ã¹ããŒã«ããããšãå¿ããªãã§ãã ããã
fcgiwrap-1.1.0_3 Simple FastCGI wrapper for CGI scripts spawn-fcgi-1.6.4_2 Spawns fastcgi applications
SSHã®æšæºããŒã22ãå¥ã®ããŒãã«çœ®ãæãããšãæããªãã«ãŒããã©ãŒãµãŒãã¹ã¿ãã¯ããŠããŸããŸãã sshd_configïŒããŒã12345ãä¿®æ£ããŸããBackupPCãä»ã®ãã¹ãã«ã¢ã¯ã»ã¹ã§ããããã«ãssh_configãã¡ã€ã«ã§åæ§ã®æäœãå®è¡ããŸãã
次ã«ãBackupPC Webã€ã³ã¿ãŒãã§ãŒã¹ãžã®ã¢ã¯ã»ã¹ãå¶éããå¿ èŠããããŸãã ãã®ããã«ãhtdigestã䜿çšããããšæããŸããã ããããããã¯æ®å¿µã§ããã ã€ã³ã¹ããŒã«ãããããã±ãŒãžã«ã¯ãã®ãªãã·ã§ã³ã¯ãããŸããã Nginxã¯ã¢ãžã¥ãŒã«ããã©ã°ã€ã³ã§ããŸãã ç§ã¯ãããããããšããŠããŸãã ç®çã®ã¢ãžã¥ãŒã«ã¯githubã«ãããŸãã 5幎åã«åœãŠã¯ãŸããŸãã ç§ã¯ãããã³ã³ãã€ã«ããããšããŠããŸãã ã³ãŒãã¯æ代é ãã§ãããçŸä»£ã®nginxã§ã¯è¯ãçµæãäžããŸããã ãã£ãšæ°ããããŒãžã§ã³ãèŠã€ããŸããã ãã¹ãŠãã³ã³ãã€ã«ãããŸãã ããããåã¶ã«ã¯æ©ãããŸãã ãã©ã°ã€ã³ãšããŠã®htdigestã¯äœæãããŸããã ãã®çµæãéåžžã®htpasswdãå®è¡ããopensslãã¹ã¯ãŒãã䜿çšããŠãã¹ã¯ãŒããäœæããå¿ èŠããããŸããã å¥ã®æ¹æ³ã¯ãportsãŸãã¯srcããã€ã³ã¹ããŒã«ããããšã§ãã äžå¿ èŠã«é¢åãªããšã BackupPC Webã€ã³ã¿ãŒãã§ãŒã¹ã¯foo.example.comã§å©çšã§ããŸãã
ç§ã¯æåã®äžæ©ãèžã¿åºããŸããã ããã¯ã¢ããã®ããã«æåã®ãã¹ããå ¥åããŸããã [ä¿å]ãã¿ã³ãã¯ãªãã¯ããŸããã ãã¹ãŠãæ£åžžã«è¡ãããŠããããã§ãã ãã®ã¯ã©ã€ã¢ã³ãã®pingã確èªããå¿ èŠããããŸãã
ping6 client.your.domain
ããã«ãä»æ¹ã§ã¯ãã€ãŸãã ã¯ã©ã€ã¢ã³ãã§ã¯ã誰ããrsyncãåŒã³åºããŠãã¯ã©ã€ã¢ã³ããä»ããŠããã¯ã¢ããã«å¿ èŠãªãã¡ã€ã«ãèµ·åã§ããŸãã
bpc:*:1006:1006:backuppc from foo:/home/bpc:/bin/csh
ãããè¡ãã«ã¯ãåã¯ã©ã€ã¢ã³ãã§bpcãŠãŒã¶ãŒãäœæããŸããããã«ã¯ããã¹ãŠã®ãã¡ã€ã«ãžã®ã¢ã¯ã»ã¹æš©ãä»äžãããŠããå¿ èŠããããŸãã ãã ãããããã®æš©éã¯ã¿ã¹ã¯ã®ç¯å²ã«ãã£ãŠå³å¯ã«å¶éãããå¿ èŠããããŸãã ãããè¡ãã«ã¯ã次ã®è¡ã/ usr / local / etc / sudoersã«è¿œå ããŸãã
bpc ALL=NOPASSWD: /usr/local/bin/rsync --server *
次ã®ã¹ãããã¯ãã¯ã©ã€ã¢ã³ããžã®ã¢ã¯ã»ã¹ã確èªããããšã§ãã sshãä»ããŠã¯ã©ã€ã¢ã³ãã«ãã°ã€ã³ããããšããŠããŸãã Sshã¯ãããŒã«ã¢ã¯ã»ã¹ããããã®ãã¹ãã¬ãŒãºã«ããã«é¢å¿ãæã¡ãŸãã ãã¹ãŠãããŸãããã°ãBackupPCãå ¥ããŸãã ãã ããå®éã«ã¯ãBackupPCãã4ãã€ããèªã¿åããŸããããšè¡šç€ºããªãããã«ããããšã¯éåžžã«å°é£ã§ãã ããã¯ã圌ãã¯ã©ã€ã¢ã³ãã«æ¥ç¶ã§ããªãããšãæå³ããŸãã ååãšããŠããã®ãããªå Žåã®çç±ã¯äžæ³šæã§ãã ãšã©ãŒãä¿®æ£ããåé¡ã解決ããŸã-ãµãŒããŒã¯ãã¹ãã«æ¥ç¶ãããŠããŸãã
1ã€ã®éèŠãªããšã¯ãŸã è¡ãããŠããŸãã-SATAãã©ã€ãã¯ãçŸæç¹ã§ã¯æ¥ç¶ãããŠããªãããæ¥ç¶ãããŠããŸããã ãããŸã§ã®ãšããããããã°ã®ç®çã§ãUSBãã©ãã·ã¥ãã©ã€ãããã©ã€ããšããŠäœ¿çšãããŠããŸãã
次ã«ãBackupPCã®æšæºæ§æãšãããã°ãå¿ èŠã§ããããã«ã€ããŠã¯ãããã¥ã¡ã³ãã§è©³ãã説æãããŠããããã®ãããã¯ã«é¢ããå€ãã®æ å ±ãã€ã³ã¿ãŒãããã§èŠã€ããããšãã§ããŸãã BackupPCãæ§æããå Žåã次ã®ã³ãã³ãã䜿çšãããšäŸ¿å©ã§ãã
BackupPC_dump -v -f bpc@client.your.domain
詳现ãªçµè«ãåŸããããã®åæã«ãããæ£åžžã«æ©èœããbackuppcãååŸã§ããŸãã
ããã§æºåå®äºã§ãã ã·ã¹ãã ã¯æ©èœããŠããŸãã æåŸã®ä»äžãããããŸãã SDã«ãŒããããã¯ã¢ããããå¿ èŠããããŸãã
# dd if=/dev/da0 of=//bpc.img bs=1m
ããã§äœæ¥ã¯å®äºããããã¯ã¢ããã³ããŒããããŸããäœããçºçããå Žåã¯ãããããã·ã¹ãã ãæ°ããSDã«ãŒãã«åŸ©å ã§ããŸãã
ãã®èšäºã¯ããã¹ãŠãååã«è©³çŽ°ã«åæ ããŠããŸããã å®éãBackupPCã®ã»ããã¢ããããã»ã¹ã¯å®è³ªçã«ãããŸããã ããããäž»ãªç®æšã¯è©³çŽ°ã§ã¯ãªããFreeBSD 11ãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®å¶åŸ¡äžã§Banana Pi M1ã§BackupPCããã¹ããããšããåºæ¬çãªå¯èœæ§ã§ãã