前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >树莓派安装 ubuntu 20.04 LTS 碰壁指南

树莓派安装 ubuntu 20.04 LTS 碰壁指南

作者头像
Kindear
发布2021-02-02 16:51:25
2.7K0
发布2021-02-02 16:51:25
举报
树莓派安装 Ubuntu 20.04 LTS 碰壁指南

设备 Raspberry 4B 4+32G 系统 Ubuntu 20.04 LTS

1.镜像下载与烧录

镜像下载地址:https://cdimage.ubuntu.com/releases/20.04.1/release/ubuntu-20.04.1-preinstalled-server-arm64+raspi.img.xz

烧录工具

SD Card Formatter

Win32DiskImager

2.启用root账户

输入命令后根据提示操作

代码语言:javascript
复制
su passwd root
3.无线网络连接初始化

进入netplan配置文件夹

代码语言:javascript
复制
cd /etc/netplan/

配置无线网

代码语言:javascript
复制
sudo vim 50-cloud-init.yaml

配置如下,仅供参考

代码语言:javascript
复制
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eth0:
            dhcp4: true
            optional: true
    version: 2
    wifis:
      wlan0:
        dhcp4: true
        optional: true
        access-points:
              "你的无线网络名称": 
               password: "123456789"

注意在冒号后面,记得要有个空格或者换行 启用配置

代码语言:javascript
复制
sudo netplan try
sudo netplan apply
systemctl daemon-reload
4.更换树莓派国内镜像源
代码语言:javascript
复制
sudo vim /etc/apt/sources.list

我全部更换为阿里镜像源,最终配置如下

代码语言:javascript
复制
## Note, this file is written by cloud-init on first boot of an instance
## modifications made here will not survive a re-bundle.
## if you wish to make changes you can:
## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
##     or do the same in user-data
## b.) add sources in /etc/apt/sources.list.d
## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
#deb http://ports.ubuntu.com/ubuntu-ports focal main restricted
deb https://mirrors.aliyun.com/ubuntu-ports/ focal main restricted
# deb-src http://ports.ubuntu.com/ubuntu-ports focal main restricted

## Major bug fix updates produced after the final release of the
## distribution.
#deb http://ports.ubuntu.com/ubuntu-ports focal-updates main restricted
deb https://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted
# deb-src http://ports.ubuntu.com/ubuntu-ports focal-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
#deb http://ports.ubuntu.com/ubuntu-ports focal universe
deb https://mirrors.aliyun.com/ubuntu-ports focal universe
# deb-src http://ports.ubuntu.com/ubuntu-ports focal universe
#deb http://ports.ubuntu.com/ubuntu-ports focal-updates universe
deb https://mirrors.aliyun.com/ubuntu-ports focal-updates universe
# deb-src http://ports.ubuntu.com/ubuntu-ports focal-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
#deb http://ports.ubuntu.com/ubuntu-ports focal multiverse
deb https://mirrors.aliyun.com/ubuntu-ports focal multiverse
# deb-src http://ports.ubuntu.com/ubuntu-ports focal multiverse
#deb http://ports.ubuntu.com/ubuntu-ports focal-updates multiverse
deb https://mirrors.aliyun.com/ubuntu-ports focal-updates multiverse
# deb-src http://ports.ubuntu.com/ubuntu-ports focal-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
#deb http://ports.ubuntu.com/ubuntu-ports focal-backports main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu-ports focal-backports main restricted universe multiverse
# deb-src http://ports.ubuntu.com/ubuntu-ports focal-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner

#deb http://ports.ubuntu.com/ubuntu-ports focal-security main restricted
deb https://mirrors.aliyun.com/ubuntu-ports focal-security main restricted
# deb-src http://ports.ubuntu.com/ubuntu-ports focal-security main restricted
#deb http://ports.ubuntu.com/ubuntu-ports focal-security universe
deb https://mirrors.aliyun.com/ubuntu-ports focal-security universe
# deb-src http://ports.ubuntu.com/ubuntu-ports focal-security universe
#deb http://ports.ubuntu.com/ubuntu-ports focal-security multiverse
deb https://mirrors.aliyun.com/ubuntu-ports focal-security multiverse
# deb-src http://ports.ubuntu.com/ubuntu-ports focal-security multiverse

刷新镜像源

代码语言:javascript
复制
source source.list
apt get update
apt get upgrade
4.启用SSH(*)
代码语言:javascript
复制
sudo apt install openssh-server

查看ssh状态

防火墙端口放行SSH

代码语言:javascript
复制
ufw allow ssh

尝试一下用默认账户连接(我尝试失败,您可以一试)

方法一:修改sshd_config 参考 https://blog.csdn.net/john1337/article/details/109465781

修改配置文件

代码语言:javascript
复制
sudo vim /etc/ssh/sshd_config

在vim中搜索定位PermitRootLogin,可直接查找:

代码语言:javascript
复制
/PermitRootLogin

修改以下配置: 33 #LoginGraceTime 2m 34 #PermitRootLogin prohibit-password 35 #StrictModes yes 36 #MaxAuthTries 6 37 #MaxSessions 10

修改为:

代码语言:javascript
复制
 LoginGraceTime 2m
 PermitRootLogin yes
 StrictModes yes
 #MaxAuthTries 6
 #MaxSessions 10
  1. 重启ssh,使配置生效
代码语言:javascript
复制
sudo service ssh restart

现在可是使用root用户登录ssh了!!!

方法二:建立新用户(*)

我使用该方法完成ssh连接

不知为何默认账户ubunturoot无法进行SSH连接认证,但是可以通过自己添加账户进行SSH连接

直接输入

代码语言:javascript
复制
adduser your_username

按照指示配置新用户信息,最后使用该用户名称完成SSH连接

5. BT宝塔面板安装
代码语言:javascript
复制
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh

参考文档 1.https://blog.csdn.net/zx3517288/article/details/109889688 2.https://blog.csdn.net/john1337/article/details/109465781 3.https://blog.csdn.net/qq_35975447/article/details/105858964

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021-01-27 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 树莓派安装 Ubuntu 20.04 LTS 碰壁指南
  • 1.镜像下载与烧录
  • 2.启用root账户
  • 3.无线网络连接初始化
  • 4.更换树莓派国内镜像源
  • 4.启用SSH(*)
  • 5. BT宝塔面板安装
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档