Ubuntu 18.04 ARM离线安装cifs-utils

1、环境说明

  • 由于本地都是x86,不支持arm架构,所以用Docker容器下载离线包
  • 本地环境:Docker、Ubuntu 22.04.1 LTS x86(可上网)
  • 安装环境:Ubuntu 18.04.4 LTS arm(内网)

2、启动qemu-arm

默认x86系统不支持arm容器

# apt-get update && apt-get install -y --no-install-recommends qemu-user-static binfmt-support
# update-binfmts --enable qemu-arm
# update-binfmts --display qemu-arm
# chmod a+x /usr/bin/qemu-*

3、启动容器

# docker pull docker.io/arm64v8/ubuntu:18.04        # 拉取容器
# docker run -it --name ubuntu arm64v8/ubuntu:18.04 /bin/bash

4、通过脚本下载离线包

(1)配置脚本

root@6251acc5e192:/# mkdir /cifs && cd /cifs
root@6251acc5e192:/cifs# vim get_package.sh
#!/bin/bash
get_all_depends()
{
        apt-cache depends --no-pre-depends --no-suggests --no-recommends \
                --no-conflicts --no-breaks --no-enhances\
                --no-replaces --recurse $1 | awk '{print $2}'| tr -d '<>' | sort --unique
}
 
for pkg in $*
do
        all_depends=$(get_all_depends $pkg)
        echo -e "所有依赖共计"$(echo $all_depends | wc -w)"个"
        echo $all_depends
        i=0
        for depend in $all_depends
        do
                i=$((i+1))
                echo -e "\033[1;32m正在下载第$i个依赖:"$depend "\033[0m"
                apt-get download $depend
        done
done

(2)运行脚本

root@6251acc5e192:/cifs# apt-get update
root@6251acc5e192:/cifs# bash get_package.sh cifs-utils

5、打包目录

root@6251acc5e192:/cifs# cd / && tar zcvf cifs.tar.gz /cifs
# docker cp ubuntu:/cifs.tar.gz .        # 宿主机上面执行

6、离线机器安装与挂载

(1)安装cifs

# tar xf cifs.tar.gz
# cd cifs && dkpg -i *

(2)mount挂载报错

加上busybox挂载即可
参考文章:https://blog.csdn.net/cao_ni_mei2015/article/details/134262668

mount: /mnt: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.

(3)挂载

# busybox mount -t cifs //10.10.10.10/test /mnt -o user="root",password="wielun",vers=1.0,dir_mode=0777,file_mode=0777

你可能感兴趣的:(运维,ubuntu离线安装包,ubuntu,arm,x86安装arm,docker,离线安装cifs-utils,cifs-utils安装)