備忘錄_20160105(定位)
修改
回首頁
程式 2025-05-20 10:13:43 1747707223 100
Raspberry Pi 4 Model B 8GB - 安裝
Raspberry Pi 4 Model B 8GB - 安裝
Raspberry Pi 4 Model B - 8GB RAM - 256GB micro sd 卡
01.使用 Raspberry Pi Imager
機器:Raspberry Pi 4
系統:Raspberry Pi OS(64bit)
初始設定
hostname, Username/Password, SSID/Password
Wireless LAN country:TW
Time zone:Asia/Taipei
Keyboard layout:tw
Enable SSH, Use password authentication
02.將記憶卡放入 Raspberry Pi 4 裡面,開啟電源
03.切換GUI模式
terminal
sudo raspi-config
→6 Advanced Options→A6 Wayland→W1 X11→Ok→Ok→Finish→Yes
04.調整設定
樹莓圖示→Preferences→Raspberry Pi Configuration
◎Localisation
Locale(Language:zh(Chinese), Country:TW(Taiwan), Character Set:UTF-8)→Ok
Keyboard(Model:Generic 104-key PC, Layout: Taiwanese, Variant:Taiwanese)→Ok
→OK→Yes
05.調整設定
樹莓圖示→偏好設定→Raspberry Pi 設定
◎介面 (VNC→On)
◎Display (過掃描→On, Headless Resolution:1920x1080)
◎系統 (Browser:Firefox)
→OK→Yes
06.調整設定
樹莓圖示→偏好設定→外觀設定
◎桌面 勾選 Documents
◎選單列 選取 底部
→OK
07.新增酷音輸入法(類似注音輸入法)
樹莓圖示→偏好設定→Add/Remove Software
輸入 fcitx 並按下 enter
勾選 fcitx5-5.0.21-3(64位元)
勾選 fcitx5-chewing-5.0.13-1(64位元)
→OK→輸入密碼→確定
樹莓圖示→登出→Reboot (這樣開機後,輸入法就可以套用)
開啟 geany (或其他記事本之類的軟體)
在 keybaord 圖示上面按滑鼠右鍵→設定→附加元件→經典使用者介面
→(字體、功能表字體、托盤字體 都改為 36)→確定→關閉
這樣候選字就可以很大,看得清楚了。
08.調整遠端遙控軟體
在 Real VNC 圖示上面按滑鼠右鍵→Options→
(Encryption:Prefer off)(Authentication:VNC Password)
→Apply→(輸入 Password, Confirm Password 並勾選 Allow connections from legacy VNC Viewer users)
→OK→OK
09.更新
[terminal] sudo apt update
[terminal] sudo apt upgrade -y
10.安裝辦公室軟體
[terminal] sudo apt install libreoffice -y
------到此為止,一台簡單的文書機已完成------
11.安裝 apache2
terminal
sudo apt install apache2
sudo geany /etc/apache2/apache2.conf
拿掉目錄瀏覽功能
在 <Directory /var/www/> 區塊
把 Options Indexes FollowSymLinks 改成 Options FollowSymLinks
sudo service apache2 restart
cd /var/www
sudo chmod 777 -R html
sudo chown pi:www-data -R html
apache2 的組態檔案路徑如下
/etc/apache2/
|-- apache2.conf
| `-- ports.conf
|-- mods-enabled
| |-- *.load
| `-- *.conf
|-- conf-enabled
| `-- *.conf
|-- sites-enabled
| `-- *.conf
12.安裝 php + composer
terminal
sudo apt install php
sudo apt install php8.2-xml
sudo apt install php-mbstring
sudo apt install php-gd
sudo geany /etc/php/8.2/apache2/php.ini
display_errors = On (從 Off 改成 On,可以顯示錯誤狀況)
session.auto_start = On (從 0 改成 On,自動開啟 session)
date.timezone = "Asia/Taipei"
儲存,離開。
sudo service apache2 restart
sudo apt install composer
13.安裝 curl
terminal
sudo apt install curl
sudo apt install php8.2-curl
sudo service apache2 restart
14.安裝 mariadb
terminal
sudo apt install mariadb-server
若您在 terminal 輸入 mysql -u root -p 遇到 Access denied for user 'root'@'localhost'
則須要下面修正
sudo mysql
use mysql
alter user 'root'@'localhost' identified with mysql_native_password using password('your_password');
------
sudo apt install php8.2-mysql
sudo geany /etc/php/8.2/apache2/php.ini
extension=mysqli 要啓用
sudo service apache2 restart
用 phpinfo(); 就可以知道是否啓用成功!
15.關閉螢幕保護模式
terminal (預設路徑就是家目錄 e.q. /home/pi)
新增一文件,檔案名稱為 .xsessionrc
裡面加上指令並儲存 (括號內的文字不用輸入)
xset s off (關閉螢幕保護模式)
xset -dpms (關閉電源節能管理)
登入時,會自動執行指令
16.調整數位時鐘設定
滑鼠移到右上方時間的位置,按下右鍵,點選「數位時鐘 Settings」
在時鐘格式的地方,填入 %A %F %T,然後點選 OK 即可。
參數部份,可參考下面說明。
https://livingthelinuxlifestyle.wordpress.com/2020/01/07/display-the-date-and-time-using-codes-in-linux/
%A: Display the full name of the day of the week
%a: Display the abbreviated name of the day of the week
%B: Display the full name of the month
%b: Display the abbreviated name of the month
%C: Display the abbreviated year
%c: Display the abbreviated day, date, and month, and full year and time
%D: Display the full date in numeric format
%d: Display only the date
%e: Display the abbreviated date, single numeral preceded with a space
%F: Display the full date in numeric format, year first
%H: Display the hour only
%I: Display the abbreviated hour
%j: Display the day of the year (1 – 365)
%k: Display the abbreviated hour, single numeral preceded with a space
%l: Display the abbreviated hour, single numeral preceded with a space, 12 hour
%M: Display the minute, numerical format
%m: Display the month, numerical format
%N: Display nanoseconds
%n: Display a new line
%P: Display AM or PM, lowercase
%p: Display AM or PM, uppercase
%r: Display time in 12 hour format
%R: Display time in 24 hour format
%S: Display seconds
%s: Display seconds since 01/01/1970 00:00:00
%T: Display time in %H:%M:%S format
%t: Display tab
%U: Display week of year, numerical format
%V: Display number of day of the week, with Monday as 01
%W: Display number of the day of the week, with Monday as 00
%w: Display number of the day of the week, with Sunday as 0
%X: Display time, HH:MM:SS format
%x: Display date, MM/DD/YYYY format
%Y: Display year
%y: Display last two digits of year
%Z: Display time zone, alphabetical %z: Display time zone, numerical (-0600)
%:z: Display time zone, numerical (-06:00)
%::z: Display time zone, numerical (-06:00:00)