<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>RaspberryPi &#8211; 備忘程式碼</title>
	<atom:link href="https://www.weblink.idv.tw/category/raspberrypi/feed" rel="self" type="application/rss+xml" />
	<link>https://www.weblink.idv.tw</link>
	<description>Javascript, PHP, HTML5 &#38; CSS3 coding memos</description>
	<lastBuildDate>Tue, 26 Mar 2024 03:16:48 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.3</generator>
	<item>
		<title>Raspberry Pi 4 8GB做文書電腦滿月心得</title>
		<link>https://www.weblink.idv.tw/2021/335</link>
					<comments>https://www.weblink.idv.tw/2021/335#respond</comments>
		
		<dc:creator><![CDATA[Steven LIU]]></dc:creator>
		<pubDate>Sun, 24 Jan 2021 09:41:51 +0000</pubDate>
				<category><![CDATA[RaspberryPi]]></category>
		<category><![CDATA[raspberrypi]]></category>
		<category><![CDATA[raspbian]]></category>
		<category><![CDATA[RP4]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[文書]]></category>
		<category><![CDATA[電腦]]></category>
		<guid isPermaLink="false">https://www.weblink.idv.tw/?p=335</guid>

					<description><![CDATA[去年中（2020）看到Raspberry基金會推出8GB版本的Raspberry Pi 4時就很心動，畢竟1. [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>去年中（2020）看到Raspberry基金會推出8GB版本的Raspberry Pi 4時就很心動，畢竟1.5GHz的CPU加上8GB的RAM作為基本文書Desktop應該非常夠用，而且近幾年我在家的3C設備已經越來越精簡，凡事以能夠應付最低限度需求的硬體配備為主：一台已經服役超過15年的TFT 22&#8243;螢幕（可視角度雖可悲但夠用）、一部兼做平板用的Surface Pro 5 + dock、一台E-Ink閱讀器、一隻初代iPhone SE，沒了！</p>



<p>由於Surface Pro是公司家裡兩頭用，有時候在家只是簡單想查個資料、看個影片，實在是懶得把筆電再從背包拿出來；看到8GB版本發表時，心想如果花個一、兩千就能架個文書電腦，平常用來上網、敲文章、看影片（720p就好因為螢幕也沒有FHD&#8230;），省電、輕量又不須關機，應該非常適合應付我在家的簡單使用。再說，Raspberry Pi 4搞個8GB版本出來，擺明就是想試試Desktop的水溫，正好遇上我這種有意當白老鼠的用戶自然是一拍即合。</p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9940075534877533"
     crossorigin="anonymous"></script>
<ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-9940075534877533"
     data-ad-slot="4891658629"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<br>



<p>小插曲是我還沒下單時，剛好遇上Cooler Master在KickStarter募資Raspberry Pi好看又兼散熱功能的機殼，腦波一弱就直接預購了含Raspberry Pi 4 8GB的套餐。只是沒想到原本預計2020年10月就要交貨的產品，因為疫情影響運輸之類blablabla的理由，遲到12月初才拿到；至於Cooler Master因為機殼的GPIO腳位失誤導致退費風波事件，就又是另一個故事了&#8230;&#8230;（煙）。</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img fetchpriority="high" decoding="async" width="1024" height="768" src="https://www.weblink.idv.tw/wp-content/uploads/2021/01/set-1024x768.jpg" alt="CoolMaster募資套組" class="wp-image-334" srcset="https://www.weblink.idv.tw/wp-content/uploads/2021/01/set-1024x768.jpg 1024w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/set-300x225.jpg 300w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/set-768x576.jpg 768w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/set-1536x1152.jpg 1536w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/set-2048x1536.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">▲Cooler Master募資的機殼非常扎實、密合度高，被動散熱效果也很卓越</figcaption></figure></div>


<p>總之，我12月初拿到Cooler Master組合後，便立馬開始測試Raspberry Pi 4 8GB作為Desktop的能耐。目前Raspberry Pi主流安裝的OS大概就是兩種：Raspbian與Ubuntu，Windows 10還有許多bug未克服就不嘗試了，畢竟作為Desktop穩定相當重要，每天當程式員除蟲誰受得了？</p>



<p>附帶一提，因為RP開始支援USB開機，所以我的測試都包含MicroSD與USB 3.0 SSD硬碟兩種模式。後來因為拖著一台SSD尿袋感覺很累贅，而且USB 3.0還是有干擾我無線鍵鼠2.4GHz頻率的問題，最後還是決定單純一點，用了一張比較快速的MicroSD，效能試用下來挺ok的。</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" width="640" height="640" src="https://www.weblink.idv.tw/wp-content/uploads/2021/01/microsd.jpg" alt="SanDisk Extreme PRO MicroSD" class="wp-image-332" srcset="https://www.weblink.idv.tw/wp-content/uploads/2021/01/microsd.jpg 640w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/microsd-300x300.jpg 300w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/microsd-150x150.jpg 150w" sizes="(max-width: 640px) 100vw, 640px" /><figcaption class="wp-element-caption">▲SanDisk這張除了寫入支援到90MB/s，還有A2拉高隨機讀寫的速度，很適合當系統碟</figcaption></figure></div>


<p>最後，我的硬體設定都是一律超頻到2.0GHz，平常的輕量文書使用並沒有熱當過，包括同時開YT影片、文書處理與瀏覽網頁，這一點必須幫Cooler Master機殼的散熱功能搭專機來按讚！</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" width="786" height="533" src="https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip4.png" alt="overclock setting" class="wp-image-331" srcset="https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip4.png 786w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip4-300x203.png 300w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip4-768x521.png 768w" sizes="(max-width: 786px) 100vw, 786px" /><figcaption class="wp-element-caption">▲壓在2.0GHz系統頗為穩定，效能也沒什麼好抱怨</figcaption></figure></div>


<h2 class="wp-block-heading">Raspbian + Raspberry Pi 4 8GB</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="576" src="https://www.weblink.idv.tw/wp-content/uploads/2021/01/rasbianDesktop-1024x576.jpg" alt="Raspbian桌面" class="wp-image-333" srcset="https://www.weblink.idv.tw/wp-content/uploads/2021/01/rasbianDesktop-1024x576.jpg 1024w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/rasbianDesktop-300x169.jpg 300w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/rasbianDesktop-768x432.jpg 768w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/rasbianDesktop-1536x864.jpg 1536w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/rasbianDesktop.jpg 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">▲Raspbian最明顯的優勢就是系統非常纖細，RP 4應付起來算是輕鬆從容</figcaption></figure></div>


<p>優點：</p>



<ul>
<li>輕量、快速</li>



<li>有專屬app可以針對硬體做設定，例如USB開機等等，相對友善</li>
</ul>



<p>缺點：</p>



<ul>
<li>界面醜，可設定的地方也不多</li>



<li>初始app非常陽春，作為Desktop需要安裝非常多額外程式</li>



<li>沒有原生Line app（個人使用習慣）</li>



<li>最新系統版本不知道為何，我在看YouTube的時候會死當，各種重刷系統都沒有用，國外論壇爬了幾輪還是找不出原因。這點成為壓倒我決定換到Ubuntu的最後一根稻草</li>
</ul>



<h2 class="wp-block-heading">Ubuntu 20.10 + Raspberry Pi 4 8GB</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="640" src="https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip1-1024x640.png" alt="Ubuntu Desktop" class="wp-image-328" srcset="https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip1-1024x640.png 1024w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip1-300x188.png 300w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip1-768x480.png 768w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip1-1536x960.png 1536w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip1-200x125.png 200w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip1.png 1680w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">▲Ubuntu界面漂亮、app與設定非常方便，雖然20.10有小bug但可順暢用</figcaption></figure></div>


<p>優點：</p>



<ul>
<li>界面質感非常好，直追Windows與Mac OS了</li>



<li>初始app作為Desktop很夠用，尤其是辦公室相關app與設定的使用體驗已經很接近W與M兩大系統了，包括連結我的hp無線複合機與NAS都很無腦方便</li>



<li>系統操作邏輯頗直覺，上手快速，像是USB碟等各種外接設備目前也都正常使用中</li>
</ul>



<p>缺點：</p>



<ul>
<li>還是有小bug，例如聲音輸出每次重開機都會跳回預設的耳機孔，如果是走HDMI每次都要調會有點麻煩</li>



<li>檔案拖拉功能有時候會造成整個檔案系統崩潰（但其他已經開啟的軟體還是可以正常使用），遇到了就連Terminal都無法開啟只能拔電源重開（一個月遇到兩次），導致我後來上傳檔案到雲端都用開啟資料夾點選檔案，減少拖拉可能造成的問題</li>



<li>效能不及Raspbian，不過因為界面好看我可以忍（握拳）</li>



<li>沒有原生Line app（個人使用習慣）</li>
</ul>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="582" src="https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip3-1024x582.png" alt="Ubuntu效能使用狀況" class="wp-image-330" srcset="https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip3-1024x582.png 1024w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip3-300x171.png 300w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip3-768x437.png 768w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip3-1536x873.png 1536w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip3.png 1680w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">▲若不超頻CPU很容易沒事就100%，超到2.0GHz就好多了</figcaption></figure></div>


<p>以上就是我用Raspberry Pi 4 8GB作為桌機使用滿月的心得，不是專業人員所以只是就我的使用狀況提供分享。目前使用起來非常滿意，這篇文章當然也是利用這組配置寫的。未來會就這個配置繼續用下去，希望Ubuntu繼續更新修Bug讓體驗更完美啦！</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="862" src="https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip2-1024x862.png" alt="系統資訊" class="wp-image-329" srcset="https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip2-1024x862.png 1024w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip2-300x253.png 300w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip2-768x647.png 768w, https://www.weblink.idv.tw/wp-content/uploads/2021/01/clip2.png 1032w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">▲分享一下系統資訊</figcaption></figure></div>]]></content:encoded>
					
					<wfw:commentRss>https://www.weblink.idv.tw/2021/335/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>8GB RPi 4 / 64 bit OS released!</title>
		<link>https://www.weblink.idv.tw/2020/317</link>
					<comments>https://www.weblink.idv.tw/2020/317#respond</comments>
		
		<dc:creator><![CDATA[Steven LIU]]></dc:creator>
		<pubDate>Thu, 28 May 2020 09:39:14 +0000</pubDate>
				<category><![CDATA[RaspberryPi]]></category>
		<guid isPermaLink="false">https://www.weblink.idv.tw/?p=317</guid>

					<description><![CDATA[快速註記一下，今天(2020/5/28)樹莓派基金會發表了搭載8GB RAM的RPi 4，以及(總算)64位元 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>快速註記一下，今天(2020/5/28)樹莓派基金會發表了搭載8GB RAM的<a rel="noreferrer noopener" href="https://www.raspberrypi.org/blog/8gb-raspberry-pi-4-on-sale-now-at-75/" target="_blank">RPi 4</a>，以及(總算)64位元、改名為<a rel="noreferrer noopener" href="https://www.raspberrypi.org/forums/viewtopic.php?f=117&amp;t=275370" target="_blank">Raspberry Pi OS</a>的作業系統(還是beta版)。</p>



<p>Wow，8GB RAM的RPi 4已經可以達到一台基本文書影片機的效能、64位元的系統也能解決之前很多無法與32位元系統相容的軟體與套件問題。我期待將來把平常瀏覽網頁、看影片與coding的使用放上RPi 4的那天！</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.weblink.idv.tw/2020/317/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>純遠端初始設定Raspberry Pi (headless)</title>
		<link>https://www.weblink.idv.tw/2020/260</link>
					<comments>https://www.weblink.idv.tw/2020/260#respond</comments>
		
		<dc:creator><![CDATA[Steven LIU]]></dc:creator>
		<pubDate>Mon, 06 Apr 2020 15:23:15 +0000</pubDate>
				<category><![CDATA[RaspberryPi]]></category>
		<category><![CDATA[headless]]></category>
		<category><![CDATA[raspberrypi]]></category>
		<category><![CDATA[設定]]></category>
		<guid isPermaLink="false">https://www.weblink.idv.tw/?p=260</guid>

					<description><![CDATA[很久沒有增加備忘了，原因之前在近況更新裡面解釋過；去年底感覺我帶領的部門已經逐漸上軌道，案子慢慢可以由下面的同 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>很久沒有增加備忘了，原因之前在<a href="https://www.weblink.idv.tw/2018/177" target="_blank" rel="noopener noreferrer">近況更新</a>裡面解釋過；去年底感覺我帶領的部門已經逐漸上軌道，案子慢慢可以由下面的同仁自行運作了，便跟我老闆提說想離開 (他當然是大吃了一斤的____)，主要原因除了希望能休息一陣子 (肝指數真的被操到多了好幾項紅字阿&#8230;&#8230;)，其實更想花點時間精進coding的知識。交接過程拖拖磨磨，到了今年三月初才總算把棒子交了出去，回到家開始了半廢人的新生活。</p>



<p>這個wordpress的站一直是架在我的一台Raspberry Pi 3上面，練習coding可別拿正在服務的機子開刀；翻箱倒櫃找出了另一台原本拿來玩RetroPie的Pi 3出來，想要重新製作SD卡才發現，這幾年我已經把所有的作業移到筆電上了，桌機賣掉自然也不會留鍵盤滑鼠，但沒有鍵盤滑鼠要如何初始設定Pi呢？上網找了找才知道原來<a href="https://www.raspberrypi.org/documentation/configuration/wireless/headless.md" target="_blank" rel="noreferrer noopener">官方</a>就有提供方式，想到未來應該都會用這種方式去初始設定Pi，不如就好好備註在這裡以免忘記。</p>



<hr><p><h4>思考流程</h4><ul><li>因為沒有鍵盤滑鼠，所以希望直接以ssh連到Pi 3做設定</li><li>但Pi預設關閉ssh、wifi也需要另外設定</li><li>有沒有方法可以事先打開ssh、並設定好wifi SSID與密碼？</li><li style="color: red">找到headless方式</li><li>加入ssh檔案</li><li>加入wpa_supplicant.conf檔案</li><li>Pi開機，透過wifi路由器找到IP，ssh登入</li><li>結束收工</li></ul></p>



<hr><p><h4>設定步驟</h4><ol><li>下載<a href="https://www.raspberrypi.org/downloads/raspbian/" target="_blank" rel="noopener noreferrer">Raspbian的映像檔</a>、解壓縮 (Noobs沒有鍵盤滑鼠應該是完全沒辦法安裝，省省吧)</li><li><a href="https://www.sdcard.org/downloads/formatter/" target="_blank" rel="noopener noreferrer">SD card formatter</a>去格式化記憶卡、<a href="https://win32diskimager.download/" target="_blank" rel="noopener noreferrer">Win32DiskImager</a>把映像檔解進記憶卡內</li><li>用windows內建的「記事本」製作一個檔名為”ssh”的空檔案(不要有後綴.txt)</li><li>把這個”ssh”檔案放進記憶卡的根目錄內</li><img loading="lazy" decoding="async" width="1746" height="1486" class="wp-image-262" style="width: 450px;" src="https://www.weblink.idv.tw/wp-content/uploads/2020/04/sshImg.jpg" alt="" srcset="https://www.weblink.idv.tw/wp-content/uploads/2020/04/sshImg.jpg 1746w, https://www.weblink.idv.tw/wp-content/uploads/2020/04/sshImg-300x255.jpg 300w, https://www.weblink.idv.tw/wp-content/uploads/2020/04/sshImg-1024x872.jpg 1024w, https://www.weblink.idv.tw/wp-content/uploads/2020/04/sshImg-768x654.jpg 768w, https://www.weblink.idv.tw/wp-content/uploads/2020/04/sshImg-1536x1307.jpg 1536w" sizes="(max-width: 1746px) 100vw, 1746px" /><li>用程式編輯軟體 (例如VS Code) 製作一個檔名為”wpa_supplicant.conf”的檔案</li><li>檔案內容：<br>



<pre class="wp-block-code"><code>ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=TW

network={
 ssid="輸入你的wifi ssid"
 psk="輸入wifi密碼" //若wifi沒有密碼則此行要改成下行：
 //key_mgmt=NONE 
}</code></pre>



</li><li>同樣把wpa_supplicant.conf放在記憶卡的根目錄</li><li>Pi以記憶卡開機，進入路由器設定頁面，找到Pi的IP</li><img loading="lazy" decoding="async" width="1800" height="378" class="wp-image-269" style="width: 450px;" src="https://www.weblink.idv.tw/wp-content/uploads/2020/04/ipImg.jpg" alt="" srcset="https://www.weblink.idv.tw/wp-content/uploads/2020/04/ipImg.jpg 1800w, https://www.weblink.idv.tw/wp-content/uploads/2020/04/ipImg-300x63.jpg 300w, https://www.weblink.idv.tw/wp-content/uploads/2020/04/ipImg-1024x215.jpg 1024w, https://www.weblink.idv.tw/wp-content/uploads/2020/04/ipImg-768x161.jpg 768w, https://www.weblink.idv.tw/wp-content/uploads/2020/04/ipImg-1536x323.jpg 1536w" sizes="(max-width: 1800px) 100vw, 1800px" /><li>PuTTY走ssh連進Pi，輸入預設帳密</li><li>結束收工</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.weblink.idv.tw/2020/260/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>如何把Raspberry Pi移到較小容量的micro SD card？</title>
		<link>https://www.weblink.idv.tw/2017/162</link>
					<comments>https://www.weblink.idv.tw/2017/162#respond</comments>
		
		<dc:creator><![CDATA[Steven LIU]]></dc:creator>
		<pubDate>Wed, 29 Nov 2017 14:45:46 +0000</pubDate>
				<category><![CDATA[RaspberryPi]]></category>
		<category><![CDATA[raspberrypi]]></category>
		<guid isPermaLink="false">https://www.weblink.idv.tw/?p=162</guid>

					<description><![CDATA[Raspberry Pi的使用者不知道有沒有過這種經驗呢？一開始安裝系統的時候，把未來的擴充想得太多太大太美好 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Raspberry Pi的使用者不知道有沒有過這種經驗呢？一開始安裝系統的時候，把未來的擴充想得太多太大太美好，結果等到系統穩定運行一陣子之後，才發現原本準備給系統的大容量根本用不滿。</p>



<span id="more-162"></span>



<p>我就是個活生生血淋淋的例子，一開始野心勃勃的用64g micro SD card安裝，想著以後也許會拿來當音樂播放器、模擬器、檔案伺服器……，最後發現像Raspberry Pi這種效能有限的架構，還是一張一系統才是正途。 </p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9940075534877533"
     crossorigin="anonymous"></script>
<ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-9940075534877533"
     data-ad-slot="4891658629"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<br>



<p>剛好，手邊有閒置的16g micro SD card，最近又想把音樂資料庫從NAS上搬回Mac（遠端連實在太累了），可以把音樂放在64g那張卡、再用短版的轉接卡長駐在Macbook Air的SD卡槽裡；於是乎，我的Raspberry Pi就有了系統搬家的需求。但上網找了找，發現絕大部分的資料都是「小搬大」，「大搬小」無法直接硬塞，必須先把大的系統利用特殊軟體resize成小於等於16g的映像檔，才能還原到小的micro SD card上並正常運作。至於這個特殊軟體，取決於你手邊的系統；由於我只有Mac與Raspberry Pi，無緣windows上面好用的win32diskimager，最後採用了國外論壇上很多網友推薦的<a href="https://gparted.org/" target="_blank" rel="noopener">GParted</a>。</p>



<p>結論是，系統「大搬小」需要先準備以下工具：<br>
1. 可執行<a href="https://gparted.org/" target="_blank" rel="noopener">GParted</a>與製作／還原映像檔的電腦，我的是Macbook Air<br>
2. 可燒錄的光碟機與光碟片一張，用來製作<a href="https://gparted.org/" target="_blank" rel="noopener">GParted</a>開機光碟（Mac用系統功能就能製作開機光碟，windows我就不是很熟了）<br>
3. micro SD讀卡機</p>



<p>執行步驟整理如下：<br>
1. 利用<a href="https://gparted.org/" target="_blank" rel="noopener">GParted</a>開機光碟開機（Mac開機時按著「option」就能選擇開機系統），進入<a href="https://gparted.org/" target="_blank" rel="noopener">GParted</a>的分割區操作畫面</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="300" height="225" src="https://www.weblink.idv.tw/wp-content/uploads/2017/11/IMG_3183-300x225.jpg" alt="" class="wp-image-165" srcset="https://www.weblink.idv.tw/wp-content/uploads/2017/11/IMG_3183-300x225.jpg 300w, https://www.weblink.idv.tw/wp-content/uploads/2017/11/IMG_3183-768x576.jpg 768w, https://www.weblink.idv.tw/wp-content/uploads/2017/11/IMG_3183-1024x768.jpg 1024w" sizes="(max-width: 300px) 100vw, 300px" /></figure>



<p>2. 整理磁碟名單，取得讀卡機內64g micro SD card資料<br>
3. 調整分割區至符合「新家」的大小，執行並結束退出、回到Mac系統</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="300" height="225" src="https://www.weblink.idv.tw/wp-content/uploads/2017/11/IMG_3184-300x225.jpg" alt="" class="wp-image-166" srcset="https://www.weblink.idv.tw/wp-content/uploads/2017/11/IMG_3184-300x225.jpg 300w, https://www.weblink.idv.tw/wp-content/uploads/2017/11/IMG_3184-768x576.jpg 768w, https://www.weblink.idv.tw/wp-content/uploads/2017/11/IMG_3184-1024x768.jpg 1024w" sizes="(max-width: 300px) 100vw, 300px" /></figure>



<p>4. 在Mac的指令列視窗中，先用</p>



<pre class="wp-block-code"><code>diskutil list</code></pre>



<p>列出磁碟掛載路徑（我的micro SD card是掛載在/dev/disk2），再用<code>dd</code>將系統製作為映像檔</p>



<pre class="wp-block-code"><code>sudo dd if=/dev/disk2 of=~/Desktop/backup.img bs=1m count=14000</code></pre>



<p><code>if</code>為input file後接來源路徑、<code>of</code>為output file後接目的路徑，同時用<code>bs</code>與<code>count</code>指定檔案大小（不指定的話就算沒有用滿64g做出來的映像檔一樣會是64g，大小設為14000MB避免單位換算讓最後容量大於16g micro SD card）<br>
5. 經過漫長的等待，映像檔終於製作好了！（我的2013mid Macbook Air大約跑了快四個小時才跑完&#8230;）<br>
6. 讀卡機換成16g micro SD card<br>
7. 在Mac的指令列視窗中，先利用</p>



<pre class="wp-block-code"><code>sudo diskutil unmountDisk /dev/disk2</code></pre>



<p>卸載micro SD card，然後將<code>dd</code>後<code>if</code>與<code>of</code>的路徑對調（通常讀卡機掛載的路徑不會變，disk2前面的r可以讓還原步驟加快）</p>



<pre class="wp-block-code"><code>sudo dd if=~/Desktop/backup.img of=/dev/rdisk2 bs=1m</code></pre>



<p>8. 再等待約一個小時，內容完全一樣的系統「大搬小」就完成啦！</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.weblink.idv.tw/2017/162/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>申請Let&#8217;s Encrypt－以Raspberry Pi為例</title>
		<link>https://www.weblink.idv.tw/2017/74</link>
					<comments>https://www.weblink.idv.tw/2017/74#respond</comments>
		
		<dc:creator><![CDATA[Steven LIU]]></dc:creator>
		<pubDate>Tue, 11 Jul 2017 00:00:53 +0000</pubDate>
				<category><![CDATA[RaspberryPi]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[letsencrypt]]></category>
		<category><![CDATA[raspberrypi]]></category>
		<category><![CDATA[ssl]]></category>
		<guid isPermaLink="false">https://www.weblink.idv.tw/?p=74</guid>

					<description><![CDATA[Google已經宣布以HTTPS作安全加密的網頁將會在搜尋的排名中取得較高的順位，就算網站沒有交易需求，為了S [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Google已經宣布以HTTPS作安全加密的網頁將會在搜尋的排名中取得較高的順位，就算網站沒有交易需求，為了SEO也值得花點時間申請一下SSL。</p>



<span id="more-74"></span>



<p>以往申請SSL憑證都需要費用，不過現在有了<a rel="noreferrer noopener" href="https://letsencrypt.org/" target="_blank">Let&#8217;s Encrypt</a>這個免費的數位憑證認證機構，任何網站都能免費升級為HTTPS啦！由於「備忘程式碼」這個網站是架在Raspberry Pi上，因此這篇我們就來說明一下如何為Raspberry Pi上架的網站申請SSL。 </p>



<p><a href="https://certbot.eff.org/" target="_blank" rel="noopener">Certbot</a>這個網站提供了非常簡單的套件與操作說明，讓我們能很輕鬆的替網站升級為HTTPS，實作步驟如下：<br> <b>1. 先將路由器的對外443 port開放，對內則指向我們的Raspberry Pi</b><br> <b>2. 進入Raspberry Pi的command模式，移動到/usr/local/bin/、輸入指令下載certbot-auto安裝套件：</b></p>



<pre class="wp-block-code"><code>cd /usr/local/bin
wget https://dl.eff.org/certbot-auto</code></pre>



<p><b>3. 下載完成後讓certbot-auto可執行：</b></p>



<pre class="wp-block-code"><code>chmod a+x certbot-auto</code></pre>



<p><b>4. 執行certbot-auto：</b></p>



<pre class="wp-block-code"><code>sudo ./certbot-auto --apache --domain=www.blabla.com, blabla.com certonly</code></pre>



<p>
（domain=後面接網站網址，用逗號分隔不同domain name）</p>



<p>然後……，沒有然後，這樣就完成了！certbot-auto會把所有的設定檔都搞定，現在只要上https://www.blabla.com就會看到網址列前面那個綠色的鎖頭跟安全字樣啦！</p>



<hr class="wp-block-separator has-css-opacity"/>



<p><b>同場加映：定期更新</b><br> 由於Let&#8217;s Encrypt的憑證效期只有90天，因此必須每三個月自己手動更新一次憑證，不過這個動作可以由排程自動執行，只要輸入：</p>



<pre class="wp-block-code"><code>sudo crontab -e</code></pre>



<p>若是首次執行會跳出一個選單，詢問你要用什麼編輯程式，我習慣用nano，所以選<code>"/bin/nano"</code>，接著便會進入crontab這個檔案。將游標移到最下面，輸入：</p>



<pre class="wp-block-code"><code>30 2 1 * * /usr/local/bin/certbot-auto renew --quiet</code></pre>



<p>（前面五組數字分別代表「分」、「時」、「日」、「月」、「星期」，所以這裡的意思是「每個月1號的凌晨2:30分」）<br>
輸入完畢後按<code>ctrl-x</code>再按<code>y</code>存檔，系統便會自動排程檢查是否需要更新，不用我們再花心思留意憑證是否過期了！</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.weblink.idv.tw/2017/74/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
