Tiny Core Linux
是一个mini Linux
操作系统,基于 BusyBox
和FLTK
提供基本功能。 其发行版本在11M-16M
官网上也提供Plus
版本也只有106M
。它很精致。
下载页面 http://tinycorelinux.net/downloads.html
我下载了两个版本镜像:
TinyCore-11.1.iso
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
工具下载即可, 如果要长期使用需要做持久化处理。
配置网络并支持永久生效
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
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-keygen
或PuTTY Key Generator
可以生成公私钥对, 公钥上传服务器/home/tc/.ssh
目录命名为authorized_keys
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
Previous Post dhclient error while loading shared libraries libdns-export.so.1102
Next Post MezzFS文件系统
出处:https://garlicspace.com/2020/09/02/tiny-core-linux-%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/