Tiny Core Linux 安裝配置
簡介
Tiny Core Linux
是一個mini Linux
操作系統,基於 BusyBox
和FLTK
提供基本功能。 其發行版本在11M-16M
官網上也提供Plus
版本也只有106M
。它很精致。
安裝
操作系統安裝
鏡像下載
下載頁面 http://tinycorelinux.net/downloads.html
我下載了兩個版本鏡像:
- x86版本:
TinyCore-11.1.iso
- x86_64位版本:
TinyCorePure64-11.1.iso
環境准備
我們使用的vmware
首先新建一個linux
虛擬機, 我選的版本是其他Linux5.x或更高版本內核64位
, 並添加了兩塊SATA
的硬盤(默認的SCSI硬盤識別似乎有些問題)
開始安裝
安裝過程主要下面三個步驟 :
- 光盤啟動操作系統;
- 配置網絡
- 下載安裝腳本安裝;
1 . 選擇鏡像: 光盤鏡像選擇 x86版本:TinyCore-11.1.iso
(不影響安裝)
2 . 啟動系統: 啟動后會出現四個選項, 選擇第三項
Boot TinyCore
Boot TinyCore (on slow devices, waitusb=5)
Boot Core (command line only)
Boot Core (command line only on slow devices, waitusb=5)
可以看到系統后進入命令行窗口,但是這種模式下進行操作重啟將全部丟失。要保留我們相關配置,需要掛載硬盤。
3 . 配置網絡: 配置網卡地址路由及域名服務器。
sudo ifconfig eth0 192.168.xxx.202 netmask 255.255.255.0
sudo route add default gw 192.168.xxx.1 dev eth0
sudo echo nameserver 192.168.xxx.1 >> /etc/resolv.conf
4 . 下載安裝腳本: 會聯機下載相關安裝包
tce-load -wi tc-install.tcz
5 . 安裝:
- 啟動安裝腳本
sudo tc-install.sh
- 選擇
c
從光盤啟動
Core Installation.
Install from [R]unning OS, from booted [C]drom, from
[I]so file, or from [N]et. (r/c/i/n): c
- 選擇
f
安裝到本地硬盤
Select install type for /mnt/sr0/boot/core.gz
Frugal
* Use for frugal hard drive installations.
Note: You will be prompted for disk/partion and
formatting options.
HDD
* Use for pendrives. Your BIOS must support USB-HDD booting.
* A single FAT partition will be made.
Note: Requires dosfstools extension.
Warning: This is a whole drive installation!
Zip
* Use for pendrives. Drive will be formatted into two FAT partitions.
* One small one for USB_ZIP boot compatibility, and used to hold Tiny Core.
* The remaining partition will be used for backup & extensions.
Note: Requires dosfstools and perl extensions.
Warning: This is a whole drive installation!
Select Install type [F]rugal, [H]DD, [Z]ip. (f/h/z): f
- 選擇
1
使用整個硬盤安裝
Select Target for Installation of core
1. Whole Disk
2. Partition
Enter selection ( 1 - 2 ) or (q)uit: 1
- 選擇
1
安裝到第一塊硬盤上
Select disk for core
1. sda
2. sdb
Enter selection ( 1 - 2 ) or (q)uit: 1
- 安裝
bootloader
選擇y
Would you like to install a bootloader?
Most people should answer yes unless they are trying to embed Core
into a different Linux distribution with an existing bootloader.
Enter selection ( y, n ) or (q)uit: y
Install Extensions from this TCE/CDE Directory:
- 選擇分區格式
ext4
Select Formatting Option for sda
1. ext2
2. ext3
3. ext4
4. vfat
Enter selection ( 1 - 4 ) or (q)uit: 3
- 設置一些啟動選項, 這里先不輸入, 直接回車
Enter space separated boot options:
Example: vga=normal syslog showapps waitusb=5
- 選擇
y
,開始安裝
Last chance to exit before destroying all data on sda
Continue (y/..)?
- 安裝完畢后有以下信息回顯, 安裝完畢.
Writing zero's to beginning of /dev/sda
Partitioning /dev/sda
Formatting /dev/sda1
mke2fs 1.45.4 (23-Sep-2019)
1+0 records in
1+0 records out
440 bytes (440B) copied, 0.000846 seconds, 507.9KB/s
UUID="XXXXXXX"
Applying syslinux.
/mnt/drive/tce/boot/extlinux is device /dev/sda1
Setting up core image on /mnt/sda1
Installation has completed
Press Enter key to continue.
按照這個步驟把第二塊硬盤也安裝一下. 第二塊硬盤使用鏡像
TinyCorePure64-11.1.iso
安裝, 使用umount
卸載原有x86
鏡像,mount
重新掛載新的鏡像。
sudo umount /dev/sr0
...
sudo mount /dev/sr0
6 . 重啟動,進入配置階段
配置
啟動后默認進入X86
版本系統, 下面開始配置grub2
,openssh
等,其中需要注意的是 Tiny linux
相關設置如果不執行filetool.sh
, 只是臨時生效,重啟系統就會丟失。
相關軟件包安裝需要先配置網絡然后聯網通過tce
工具下載即可, 如果要長期使用需要做持久化處理。
網絡配置
配置網絡並支持永久生效
- 生成文件/opt/eth0.sh 文件內容:
sudo ifconfig eth0 192.168.xxx.202 netmask 255.255.255.0
sudo route add default gw 192.168.xxx.1 dev eth0
sudo echo nameserver 192.168.xxx.1 >> /etc/resolv.conf
- 增加可執行權限
chmod 755 /opt/eth0.sh
sudo /opt/eth0.sh
- 設置開機啟動及永久生效
sudo echo "/opt/eth0.sh" >> /opt/.filetool.lst
sudo chmod 775 /opt/bootlocal.sh
sudo echo "/opt/eth0.sh &" >> /opt/bootlocal.sh
filetool.sh -b
開機啟動配置
- 聯網后使用
tce
安裝grub2
tce-load -wi grub2-multi.tcz
sudo grub-install --target=i386-pc --boot-directory=/mnt/sda1/boot /dev/sda
- 生成
grub.cfg
文件
menuentry "x86" {
set root=(hd0, 1)
linux /tce/boot/vmlinuz tce=sda1
initrd /tce/bot/core.gz
}
menuentry "x86_64" {
set root=(hd1, 1)
linux /tce/boot/vmlinuz64 tce=sdb1
initrd /tce/bot/corepure64.gz
}
這部分修改由於本事就在硬盤上不需要做持久化處理, 重新啟動就可以看到grub2啟動界面
*x86
x86_64
openssh配置
- 如果需要遠程登錄可以安裝
openssh
tce-load -wi openssh.tcz
- 相關配置文件生成
cd /usr/local/etc/ssh
sudo cp sshd_config.orig sshd_config
- 設置密碼
passwd
- 持久化處理
sudo echo '/usr/local/etc/ssh' >> /opt/.filetool.lst
sudo echo '/etc/shadow' >> /opt/.filetool.lst
filetool.sh -b
sudo echo '/usr/local/etc/init.d/openssh start &' >> /opt/bootlocal.sh
- 配置免密
生成SSH key, 使用ssh-keygen
或PuTTY Key Generator
可以生成公私鑰對, 公鑰上傳服務器/home/tc/.ssh
目錄命名為authorized_keys
- 相關問題
安裝過程中報錯 : server refused our key- 公鑰格式: 如果使用
putty key generator
界面上會提示要拷貝的公鑰文件內容,需要改為 openssh 使用的公鑰格式, 或者使用下面命令轉換
ssh-keygen -i -f 公鑰文件名
- 權限調整:去掉組權限
chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
- 公鑰格式: 如果使用
- 永久保存處理
sudo echo '/home/tc/.ssh/' >> /opt/.filetool.lst
filetool.sh -b
這樣就可以通過ssh遠程免密登錄了
新增硬盤
- 安裝
gdisk
tce-load -wi gdisk.tcz
- 使用
gdisk
創建兩個500M
分區, 重啟生效
brw-rw---- 1 root staff 8, 33 Sep 2 04:51 /dev/sdc1
brw-rw---- 1 root staff 8, 34 Sep 2 04:51 /dev/sdc2
- 格式化
mkfs.ext2 /dev/sdc1
mkfs.ext3 /dev/sdc2
- 修改
/etc/fstab
/etc/fstab
/dev/sdc1 /mnt/sdc1 ext2 noauto,users,exec 0 0 # Added by TC
/dev/sdc2 /mnt/sdc2 ext3 noauto,users,exec 0 0 # Added by TC
- 修改
bootlocal.sh
啟動后自動掛載
echo "sudo mount /dev/sdc1 &" >> /opt/bootlocal.sh
echo "sudo mount /dev/sdc2 &" >> /opt/bootlocal.sh
filetool.sh -b
sudo reboot
...
$ mount
rootfs on / type rootfs (rw,size=633520k,nr_inodes=223783)
...
/dev/sdc1 on /mnt/sdc1 type ext2 (rw,relatime)
/dev/sdc2 on /mnt/sdc2 type ext3 (rw,relatime)
參考
Assign Persistent Static IP Address to Tiny Core Linux
Install Tiny Core Linux on Local Disk (Frugal)
Configure SSH Server on Tiny Core Linux using openSSH
Trying to do ssh authentication with key files: server refused our key
出處:https://garlicspace.com/2020/09/02/tiny-core-linux-%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/
=============================================================================================================
Tiny Core Linux的下載地址:
http://www.tinycorelinux.net/downloads.html
當前的版本為:4.7.5
每個人的需求都不一樣,我選擇 Tiny Core Linux 的原因很簡單——因為體積小。建立這個系統的目的就是看看網頁,所以只要讓網頁瀏覽器能正常顯示出中文即可。
一、利用ISO文件啟動計算機,啟動后安裝“tc-install.tcz”,這個程序是部署系統的GUI工具。
二、運行“Tiny Core Installation”,選擇硬盤。
三、選擇文件系統。
四、設置啟動參數,因為要用中文環境,所以設置為:lang=zh_CN。
五、使用桌面系統和無線網絡環境。
六、點擊[Proceed]開始安裝。
七、系統安裝完成,現在可以從硬盤啟動系統了。
八、安裝中文字體:“fireflysung.tcz”。
九、安裝“getlocale.tcz”設置中文語言環境,可以選擇使用[Download+Load]的方式,因為以后不需要再用這個程序切換系統語言環境,沒有必要進行保留。其他的程序都要使用[OnBoot]方式。
十、運行“sudo getlocale.sh”選擇zh_CN。
十一、安裝“Firefox”用來瀏覽網頁,並選擇安裝“getFlash11.tcz”以支持Flash的顯示。
十二、重新啟動系統后瀏覽器已正常顯示中文。