Ubuntu MATE安裝及初始配置
前言
家里有個老電腦、還是在我上初中的時候買的,到現在他的使用率也很低了。考慮配置為amd雙核、4G內存、250G硬盤,拿來搭一個小型的Linux服務器,用來學習和跑一些常用的軟件還是很不錯的。以下是操作詳情。
系統下載及安裝
Ubuntu MATE is an impressive lightweight Linux distro that runs fast enough on older computers. It features the MATE desktop – so the user interface might seem a little different at first but it’s easy to use as well.
此次使用的是Ubuntu MATE,如果你需要使用其他系統,以下操作方式類似
1. 下載iso鏡像文件
2. 刻錄鏡像文件到u盤
使用rufus刻錄工具進行鏡像刻錄,使用默認配置。
3. 系統安裝
開機按F12
選擇u盤進行默認安裝,圖形化安裝基本使用默認配置安裝就可以。
界面大概是這樣
軟件安裝
系統安裝完之后需要一些必要的軟件安裝及配置
1、SSH服務端
初始系統中是沒有ssh軟件的,我們也就無法通過ssh遠程訪問,需要安裝ssh。
# 安裝ssh
sudo apt install ssh
# 啟用ssh服務
sudo service ssh enable
2、zeroTier安裝(可選)
因為家里是內網,如果不在家連接到電腦,需要安裝ZeroTIer。
# 下載curl工具
sudo apt install curl
# 下載zerotier
curl -s https://install.zerotier.com | sudo bash
# 查看相關信息
zerotier-cli info
# 加入局域網,xxx為zero中心的16位網絡標識碼
sudo zerotier-cli join xxx
# 卸載
yum erase zerotier-one
3、speedtest(可選)
下載完第一件事當然是測個速了
curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash
# 安裝
sudo apt-get install speedtest
# 使用
speedtest
測完我們發現網速一般情況下沒跑到寬帶網速上限,以下需要設置一下。
## 安裝ethtool工具
sudo apt install ethtool
## 設置網速
sudo ethtool -s enp2s5 speed 100 duplex full autoneg on
設置開機自啟動(Ubuntu)
## 創建文件
/etc/systemd/system/foo.service
## 添加腳本
[Unit]
Description=Job that runs your user script
[Service]
ExecStart=/some/command
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
## 執行腳本
sudo systemctl daemon-reload
sudo systemctl enable foo.service
4、docker 安裝
docker作為容器,部署使用常用應用非常方便,安裝一下
# 添加軟件源密鑰
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# 添加docker軟件源
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# 更新緩存
sudo apt-get update
# 安裝docker
sudo apt-get install docker-ce docker-ce-cli containerd.io
5、安裝clash for linux
wget -P /home/gxhao/Downloads https://github.com/Dreamacro/clash/releases/download/v1.9.0/clash-linux-amd64-v1.9.0.gz
6、關閉系統休眠
#查看休眠狀態
systemctl status sleep.target
# 執行關閉休眠功能
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
引用
Ubuntu MATE介紹
網速為10mb/s設置
https://phoenixnap.com/kb/ethtool-command-change-speed-duplex-ethernet-card-linux
網速設置為自啟動
如何設置命令行開機自啟動
https://askubuntu.com/questions/814/how-to-run-scripts-on-start-up