<?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>headless &#8211; 備忘程式碼</title>
	<atom:link href="https://www.weblink.idv.tw/tag/headless/feed" rel="self" type="application/rss+xml" />
	<link>https://www.weblink.idv.tw</link>
	<description>Javascript, PHP, HTML5 &#38; CSS3 coding memos</description>
	<lastBuildDate>Wed, 06 Dec 2023 07:03:00 +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 (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 fetchpriority="high" 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 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>
	</channel>
</rss>
