安装操作系统

为树莓派安装操作系统已经成了一件非常简单的事情。官方提供的工具只需要选择想要安装的系统版本,选择希望烧录的内存卡即可完成安装,免去了复杂的下载安装工作。

在众多的操作系统中,其实最推荐的依然是 32 位的基于 Debain 的 Raspberry Pi OS Lite,64 位的系统软件包支持方面多少有些欠缺, GUI 对于树莓派 4 以前的设备也不是特别友好。

  • Raspberry Pi OS 默认的用户名为 pi ,密码为 raspberry。
  • Ubuntu server/core/desktop 默认的用户名和密码均为 ubuntu 。
Raspberry Pi Imager
Raspberry Pi Imager

不使用显示器完成基础配置

由于树莓派 4B/Zero 都不具备全尺寸 HDMI 接口,连接显示器对它们来说可能是一件比较困难的事情。

直接将烧录好的 SD 卡插入电脑,打开 boot 分区,在其根目录中创建一个名为 wpa_supplicant.conf 的文件,并编辑其内容。

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="WiFi的SSID"
    psk="WiFi密码"
}

接着在同一位置创建一个无后缀文件,并命名为全大写 SSH 。

至此,你可以从电脑上的 SSH 客户端访问树莓派。推荐使用 Terminus 作为 SSH 客户端。完成此步骤后,请忽略剩余步骤中和 WI-FI 或 SSH 有关的部分。

修改默认用户用户名

由于 root 用户默认不支持远程登录,为了免去修改配置文件的麻烦将此步骤放在开启 SSH 服务前。若你执意不想在树莓派上输入太多指令,那么修改 /etc/ssh/sshd_config 文件,将 PermitRootLogin yes 取消注释即可。

DIMOJANG

首先为 root 账户指定密码。

$ sudo passwd

输入密码后回车,重复输入一次再回车即可。

接着退出当前账户( pi )并登录 root 。然后便可以开始修改默认 pi 账户的用户名。

$ exit
$ root
$ root #上一步设置的密码
$ usermod -l yourname pi
$ groupmod -n yourname pi
$ mv /home/pi /home/yourname
$ usermod -d /home/yourname yourname

yourname 处即为目标修改用户名。需要注意,如果操作系统在修改用户名前已经使用过一段时间,需要谨慎重命名 home 目录。

连接 WI-FI 、开启 SSH 、更改主机名

Raspbery Pi OS 连接 WI-FI 并开启 SSH 非常方便。只需要执行

$ sudo raspi-config

即可进入图形界面。

raspi-config
raspi-config

进入第一项,即可连接 Wi-Fi 和修改主机名。

进入第三项,则可以选择开启 SSH 。

使用 Samba 共享家目录

有时在树莓派上下载一些文件(例如 GitHub )会非常慢,所以使用 PC 下载后传输给树莓派是个不错的选择。可选的方案有 U 盘,FTP 等。由于对树莓派来说,共享文件一般只发生在局域网,所以 Samba 或许是个不错的选择。

首先更新软件源。如果这一步进展缓慢,则可以考虑切换到清华源

$ sudo apt update

接下来便可以开始安装 Samba 了。

$ sudo apt install samba samba-common

期间可能会弹出窗口询问是否要根据 DHCP 调整配置文件,选择 yes 并回车即可。

接着对 Samba 进行简单的配置。使用 sudo 编辑 samba 配置文件 /etc/samba/smb.conf ,滑动到最下方添加我们自己的配置文件。

$ sudo nano /etc/samba/smb.conf
[username]
   path = /home/dimoj
   valid users = dimoj
   browseable = yes
   writable = yes
   read only = no

其中,中括号内的为共享名称,可以按照自己的需求修改。

path 后为 samba 根目录,推荐修改为自己的 home 路径。

valid users 后为允许登录的用户。

修改完成后,按下 CTRL+X ,输入 r 并回车保存并退出。

然后添加 samba 用户。

$ sudo smbpasswd dimoj

输入两次密码即可完成创建。若 samba 提示 Failed to find entry for user ,则在 smbpassd 后添加参数 -a 即可。

$ sudo smbpasswd -a xxxxx

1,330 个评论

  1. hello there and thank you for your information – I have
    certainly picked up anything new from right here.
    I did however expertise some technical points using this web site,
    since I experienced to reload the web site lots
    of times previous to I could get it to load correctly.
    I had been wondering if your web hosting is OK? Not that I am complaining, but sluggish loading instances times will sometimes
    affect your placement in google and could damage your high quality score if ads and
    marketing with Adwords. Well I am adding this RSS to my e-mail and can look out for a lot more of your respective intriguing content.

    Make sure you update this again very soon..

    Feel free to visit my blog :: travels easier

  2. Hi would you mind stating which blog platform you’re working with?
    I’m going to start my own blog in the near future but I’m having a hard time making a decision between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems different then most blogs and
    I’m looking for something completely unique. P.S My apologies for getting off-topic but I had to ask!

    My web site: libido cures

  3. I almost never leave responses, but I read a few of the comments
    here 树莓派的简易上手指南 – 迪莫的博客.

    I do have 2 questions for you if it’s allright. Could it be just me or do some of these
    remarks appear like they are written by brain dead visitors?

    😛 And, if you are writing at additional sites, I’d like to follow everything new you have to post.
    Would you make a list of all of your social community sites like your Facebook page, twitter feed,
    or linkedin profile?

    Also visit my page … lose weight

  4. I still can’t quite think that I could possibly be one of those
    reading the important guidelines found on your blog.
    My family and I are truly thankful for your generosity and for
    presenting me the potential to pursue my chosen profession path.
    Thanks for the important information I got from your web site.

    Feel free to visit my site – Scotty

  5. I seldom write comments, but i did some searching and wound up here
    树莓派的简易上手指南 – 迪莫的博客. And I
    actually do have a couple of questions for you if it’s allright.
    Could it be just me or does it give the impression like some of the remarks look as if they are coming from
    brain dead individuals? 😛 And, if you are posting at other places, I’d like to keep
    up with anything fresh you have to post. Would you make a list of
    every one of your shared pages like your twitter feed,
    Facebook page or linkedin profile?

    Also visit my web-site :: healthy skin care

  6. The very next time I read a blog, Hopefully it does not disappoint me just as much as this particular
    one. After all, Yes, it was my choice to read, but I truly believed you’d have something interesting to talk about.

    All I hear is a bunch of whining about something that you can fix if you weren’t too busy
    looking for attention.

    Also visit my website – crash diets

  7. My wife and i felt now peaceful that Ervin managed to finish off his
    survey while using the ideas he received out of
    your blog. It’s not at all simplistic to just be offering facts that many others have
    been selling. And now we already know we have got the writer to
    appreciate because of that. All of the explanations you have made, the
    easy blog navigation, the friendships you help to foster – it’s all powerful, and it’s really letting our son and our family understand this situation is entertaining,
    and that’s wonderfully important. Thank you for everything!

    Also visit my web page :: post-workout supplements

  8. I am glad for writing to make you understand what a awesome experience my friend’s girl undergone
    reading yuor web blog. She came to find lots of issues, not to mention what it is like to possess an ideal
    teaching mood to let many people easily know just exactly a number
    of very confusing matters. You undoubtedly did more than her
    expected results. I appreciate you for presenting these great, dependable, informative
    as well as fun tips on that topic to Janet.

    Feel free to visit my web-site :: http://23.95.102.216/viewtopic.php?id=472095

  9. Hey there outstanding website! Does running a blog like this
    take a lot of work? I’ve virtually no knowledge of coding however I had been hoping
    to start my own blog soon. Anyways, if you have any recommendations or techniques for new blog owners please share.
    I know this is off topic nevertheless I just
    wanted to ask. Appreciate it!

  10. Excellent post. I was checking continuously this blog and I
    am impressed! Very useful information particularly the last
    part 🙂 I care for such info much. I was seeking this certain info for a long time.

    Thank you and good luck.

  11. Greetings! This is my 1st comment here so I just wanted to give a quick shout out and tell you
    I really enjoy reading through your posts. Can you suggest any
    other blogs/websites/forums that deal with the same topics?
    Thanks!

  12. Thanks for a marvelous posting! I truly enjoyed reading it, you could
    be a great author.I will always bookmark your blog and may come back later
    on. I want to encourage yourself to continue your great job,
    have a nice afternoon!

    my homepage: Ellen

  13. What i do not realize is if truth be told how you’re now not really much
    more smartly-preferred than you may be now. You’re so intelligent.
    You know thus significantly in terms of this topic,
    produced me for my part believe it from numerous
    varied angles. Its like men and women aren’t interested except it’s one thing to
    do with Girl gaga! Your individual stuffs great.
    All the time deal with it up!

    my blog post; vbriudaipur.org

  14. hey there and thank you for your info – I’ve certainly picked up anything new
    from right here. I did however expertise several technical issues using this website, as I experienced to reload the web site many times previous to I could get it to load correctly.
    I had been wondering if your hosting is OK? Not that I’m complaining, but slow loading instances times
    will sometimes affect your placement in google
    and could damage your quality score if ads and marketing with Adwords.
    Anyway I am adding this RSS to my e-mail and can look out for much more of your respective
    exciting content. Make sure you update this again very soon.

  15. Hey there! Do you know if they make any plugins to assist with SEO?
    I’m trying to get my blog to rank for some targeted
    keywords but I’m not seeing very good results. If you know
    of any please share. Thanks!

  16. I know this if off topic but I’m looking into starting my own weblog and was wondering what all
    is required to get setup? I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very web savvy so I’m not 100% certain. Any suggestions or advice would be greatly appreciated.
    Cheers

    Feel free to visit my website – build muscle mass

  17. Thank you for your blog post. Jones and I are already saving for a new
    book on this matter and your writing has made us to
    save our own money. Your opinions really clarified all our inquiries.
    In fact, a lot more than what we had thought of prior to when we
    came upon your superb blog. I actually no
    longer have doubts and also a troubled mind because you have
    attended to each of our needs above. Thanks

    Check out my blog – http://www.comptine.biz

  18. Hey just wanted to give you a quick heads up. The words in your post
    seem to be running off the screen in Opera. I’m not sure if this is a formatting issue or something to do with internet browser compatibility but I figured I’d post to let
    you know. The design and style look great though!
    Hope you get the problem fixed soon. Kudos

    Review my web blog – weight loss plateu

  19. Hi there! I understand this is somewhat off-topic however I needed to ask.
    Does managing a well-established website such as yours take a lot of
    work? I’m completely new to blogging but I
    do write in my journal on a daily basis. I’d like to start a blog so
    I can share my personal experience and views online.
    Please let me know if you have any kind of ideas or best weight loss tips for brand new aspiring blog owners.
    Thankyou!

  20. You probably make that seem very easy with your business appearance but My personal spouse and i also find this
    type of matter internet marketing actually something which I think I
    might personally never appreciate. It seems too complex and intensely broad
    properly. I am looking forward to your forthcoming post, I can try to get the hang
    of it!

  21. I know this if off topic but I’m looking into starting my own weblog and was curious what all is required to get set up?
    I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very web savvy so I’m not 100% sure.
    Any tips or advice would be greatly appreciated.
    Thanks

    Visit my page :: Jestine

  22. Whether you’re preparing an spectacular vacation or having a spur from the time jaunt, occasionally, it’s the tiny specifics that could be the deciding component on how significantly you prefer your time out of the house. The information on this page will assist you to plan an ideal getaway. Abandon all pointless valuables at home. You are taking the potential risks of getting everything robbed on your part should you do take valuables along. In case you are visiting a region that includes a liquefied-constraint on all fluids you could be packing, purchase pub hair shampoos and teeth natural powder. Believe it or not, it is possible to discover nightclub shampoo and toothpaste obtainable in powder kind on-line. These items are an easy way to acquire around liquid-restrictions. When you are traveling in countries with unsafe tap water, recall different ways which you might be subjected. Shut the mouth area while using the shower and brush your tooth only with treated h2o. If you make herbal tea or gourmet coffee together with the drinking water, allow it to boil for a number of minutes before steeping. Even a small exposure will make you really ill. Get a travel attire, which is a garment that may be worn numerous ways. It may be worn being a attire, skirt, tshirt and wrap. You can then pack a couple of other add-ons and related products, that can preserve a great deal of room with your baggage for all the gifts you wish to provide house. Consider a number of clothespins together with you if you traveling. It is really an uncommon product to consider loading, even so they may be very valuable. If you’re going on a luxury cruise, be sure you take a small working day travelling bag with you. You’ll learn that your baggage won’t be available without delay whenever you table the cruise ship. So you’ll want to have a handbag with a go swimming fit, a book, an added transform of garments within it, and whatever else you might need straight away. Regardless of where you need to go, preparation is likely to make your trip all it can be. Take advantage of the advice you’ve study here to have the most out of your travelling practical experience.

  23. Oh my goodness! a tremendous article dude. Thank you However I am experiencing issue with ur rss . Don’t know why Unable to subscribe to it. Is there anybody getting equivalent rss problem? Anybody who knows kindly respond. Thnkx

  24. Great post. I was checking constantly this blog and I’m impressed! Very helpful information particularly the last part 🙂 I care for such info a lot. I was looking for this certain info for a very long time. Thank you and good luck.

  25. กระแสพนันออนไลน์ว่าแรงแล้ว ยังแรงไม่สู้โปรโมชั่นเด็ดๆที่ UFABET ขยันเอาอกเอาใจสมาชิกมากมายนะครับ และก็ถูกอกถูกใจผมซะด้วย ไม่ใช่แค่เรื่องโปรโมชั่นครับผม ผมถูกใจที่เค้ามีเกมให้เลือกมาก อีกทั้งพนันบอล บาคาร่า ยิงปลา สล็อต เกมใหม่ๆมีหมด