由於一些原因,Debian 的內核不能直接在龍芯的 cpu 上使用。據悉 Linux 5.7 kernel 改進了對龍芯的支持,不久的將來我們應該就能更愉快地在龍芯上運行 Debian 了。
感謝龍芯群大佬的指導~~ 免去了編譯內核等繁瑣的工作。
龍芯 3A3000 及更早的機子可以參考劉世偉先生的文章:傳送門 。
思路
Debian Wiki:https://wiki.debian.org/zh_CN/Debootstrap
debootstrap 可以建立一個基本的 Debian 文件系統,但是不包括內核等同樣必要的組分。所以我們使用龍芯Fedora28的內核,並將 Debootstrap 獲取的文件系統放在Fedora28的內核之上。
首先在硬盤上安裝 Fedora28 ;然后重新從 LiveCD 啟動,將已經安裝的 Fedora28 除了內核和引導外的文件全部刪除;最后用 debootstrap 獲取 Debian10 的基本系統,簡單配置即可。
文章默認你有一定的 Linux 基礎。文中的很多操作非常危險,操作過程中請保持清醒,知道自己在干什么。操作前也建議先演練,目前(六月初) 3A4000 有虛擬機可用。
准備
- 龍芯 Fedora28 LiveCD
- 預備安裝系統的龍芯電腦
開始
- 首先確認即將用於安裝新系統的硬盤已經沒有未備份的重要數據,然后引導至 LiveCD 並安裝。如果硬盤中已經安裝有 Fedora28 可以跳過。
passwd root
設置 LiveCD 的 root 密碼- 掛載硬盤中 Fedora28 的根目錄
sudo mount /dev/fedora_sunhaiyong/root /mnt
如果根目錄路徑不同的按實際情況修改。如果出現 "unknown filesystem type 'LVM2_member'" 可以先lvdisplay
查看卷名,如果 LV Status 顯示 unenable 則vgchange -ay <LV mame>
再掛載。 cd /mnt
到 Fedora28 根目錄后sudo rm -rf *
刪除原有的根目錄內容(這里默認/boot
目錄是單獨一個分區,如果不是,則不要刪除/boot
目錄。這里也默認系統里沒有重要文件,如果有,請停止安裝,備份!所有自己不小心造成的任何后果都得自己承擔!非常危險,小心小心再小心)sudo dnf install debootstrap -y
安裝 debootstrap,sudo debootstrap --arch mips64el buster /mnt http://ftp2.cn.debian.org/debian/
創建 Debian 文件系統,源可以按需更改。- 文件系統創建成功后
cp -r /lib/modules /mnt/lib/
從 LiveCD 中復制內核模塊。 - 根據實際情況修改 /mnt/etc/fstab ,示例:
vi /mnt/etc/fstab
鍵入/dev/sda3 / xfs defaults 1 1
保存退出。 - 現在我們已經建立好 Debian 的根目錄,可以使用了。
chroot /mnt
切換到新的 Debian 環境passwd root
修改 Debian 的 root 密碼- 重啟用 root 登陸即可得到可用的 Debian 終端。
dhclient
聯網- 新建一個管理員賬戶
useradd -m <username>
passwd <username>
,visudo
仿照 root 行加上新用戶。
桌面環境
用 root 登陸終端后 vi /etc/asound.conf
,鍵入下面三行,否則安裝桌面環境后會沒有聲音。
defaults.pcm.card 1
defaults.pcm.device 0
defaults.ctl.card 1
安裝Kde: apt-get install task-kde-desktop xorg
安裝Mate: apt-get install task-mate-desktop xorg
安裝完成后 startx
即可進入桌面,可以在設置中添加新的管理員用戶;或重啟登陸。
其他
- "unable to resolve host" 錯誤
sudo 顯示 sudo: unable to resolve host localhost.localdomain: Name or service not known
hostname 默認為 localhost,所以可以在 /etc/hosts 文件中添加一行 127.0.1.1 localhost.localdomain localhost
,保存后立即生效。
也可以自定義 hostname:vi /etc/hostname
(默認沒有這個文件)鍵入自定義的 hostname ,然后在 /etc/hosts 文件中添加一行 127.0.1.1 <myhostname>.localdomain <myhostname>
,重啟后生效,自定義的 hostname 可以在終端的 <username>@
后看到。
再 sudo 時就不會報錯了。
- 無線網卡
Debian Wiki:https://wiki.debian.org/WiFi
Arch Wiki:https://wiki.archlinux.org/index.php/WPA_supplicant_(簡體中文)
sudo apt-get install firmware-linux firmware-linux-nonfree wireless-tools net-tools firmware-ralink firmware-realtek firmware-iwlwifi
更多驅動可以通過 sudo apt-cache search firmware-*
搜索。
似乎無法通過 KDE 連接,但是可以通過 wpa_supplicant 連接:
sudo su -c 'wpa_supplicant -B -i interface -c <(wpa_passphrase MYSSID passphrase)'
連接成功后 dhclient
獲取 IP
- 修改源
安裝完 sources.list 只有一行,可以擴充,示例(注釋掉的那行是默認的):
#deb http://ftp.cn.debian.org/debian buster main
deb https://mirrors.ustc.edu.cn/debian/ buster main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.ustc.edu.cn/debian/ buster-backports main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free
保存后 update 。
- 中文語言
安裝 locale 和 firefox 、 libreoffice 語言包
sudo apt-get install locale kde-l10n-zhcn firefox-esr-l10n-zh-cn libreoffice-l10n-zh-cn
locale 設置頁面勾選 zh_CN
開頭的全部和 en_US.UTF-8
,默認語言改為 zh_CN.UTF-8
。
KDE的語言設置界面添加中文,時區設為上海,然后重啟即可。
- 桌面彈窗
一次偶然發現需要安裝 libnotify-bin 來支持桌面懸浮彈窗,比如 KDE Connect 顯示手機的通知。
sudo apt-get install libnotify-bin
- ssh
sudo apt-get install openssh-server
sudo systemctl enable ssh
sudo systemctl start ssh
- 常用軟件
QQ Linux:選 MIPS64 的 DEB 包 https://im.qq.com/linuxqq/index.html
ps: 由於最初發布的版本沒有 MIPS64 的 DEB 包,如果之前是用 .sh 安裝的可以參照這里卸載 傳送門
WPS Office:選 MIPS 的 64位 Deb 格式 https://www.wps.cn/product/wpslinux
龍芯中科版 Chromium:安裝 http://ftp.loongnix.org/browser/chrome/60/deepin/ 下的四個包
航天龍夢版 Chromium:在源里瞅了半天沒找着,自己找下吧,也可以使用 Flygoat 大佬打包的 Chromium 82 beta2 傳送門
網易雲音樂: 大佬開發的命令行版,拉風又好用 傳送門
Kdeconnect: sudo apt-get install kdeconnect
版權聲明:本頁面文字除了外部鏈接外允許在 CC-BY-SA 4.0 的協議下使用。
原文地址:https://www.cnblogs.com/weilinfox/p/12468458.html