zoukankan      html  css  js  c++  java
  • Tiny Core Linux 安装配置

    Tiny Core Linux 安装配置

    简介

    Tiny Core Linux是一个mini Linux操作系统,基于 BusyBoxFLTK提供基本功能。 其发行版本在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-keygenPuTTY 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 Linux 显示中文的方法

      二、运行“Tiny Core Installation”,选择硬盘。

    Tiny Core Linux 显示中文的方法

      三、选择文件系统。

    Tiny Core Linux 显示中文的方法

      四、设置启动参数,因为要用中文环境,所以设置为:lang=zh_CN。

    Tiny Core Linux 显示中文的方法

      五、使用桌面系统和无线网络环境。

    Tiny Core Linux 显示中文的方法

      六、点击[Proceed]开始安装。

    Tiny Core Linux 显示中文的方法

      七、系统安装完成,现在可以从硬盘启动系统了。

    Tiny Core Linux 显示中文的方法

      八、安装中文字体:“fireflysung.tcz”。

    Tiny Core Linux 显示中文的方法

      九、安装“getlocale.tcz”设置中文语言环境,可以选择使用[Download+Load]的方式,因为以后不需要再用这个程序切换系统语言环境,没有必要进行保留。其他的程序都要使用[OnBoot]方式。

    Tiny Core Linux 显示中文的方法

      十、运行“sudo getlocale.sh”选择zh_CN。

    Tiny Core Linux 显示中文的方法

    Tiny Core Linux 显示中文的方法

      十一、安装“Firefox”用来浏览网页,并选择安装“getFlash11.tcz”以支持Flash的显示。

    Tiny Core Linux 显示中文的方法

      十二、重新启动系统后浏览器已正常显示中文。

    Tiny Core Linux 显示中文的方法


    参考:https://my.oschina.net/yygh/blog/484459

  • 相关阅读:
    1-7周成绩总结
    1-6周成绩总结
    第七周学习笔记
    前五周测验成绩总结
    第六周学习笔记
    第五周学习笔记
    2018-2019-2 20189206 Python3学习
    2018-2019-2 20189206 安全工具的学习
    2018-2019-2 20189206 《网络攻防实践》 第一周作业
    2018-2019-1 20189206 《Linux内核原理与分析》第九周作业
  • 原文地址:https://www.cnblogs.com/mq0036/p/13749661.html
Copyright © 2011-2022 走看看