A. 下载iso文件,制作启动U盘
aria2c -x 4 -s 12 "https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/24.04/ubuntu-24.04-desktop-amd64.iso" "https://mirrors.163.com/ubuntu-releases/24.04/ubuntu-24.04-desktop-amd64.iso" "https://mirrors.zju.edu.cn/ubuntu-releases/24.04/ubuntu-24.04-desktop-amd64.iso"
安装启动盘制作软件rufus46Please respect copyright.PENANA0jnaujDQPu
https://github.com/pbatard/rufus/releases/download/v4.5/rufus-4.5.exe46Please respect copyright.PENANAdgdsJ3Z2Ek
U盘的容量必须大于7G,在rufus中选择U盘, iso文件,MBR分区类型,NTFS文件格式,点击开始,选择以ISO镜像模式写入。
官方参考资料:46Please respect copyright.PENANAse8OhPnkr0
https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview
46Please respect copyright.PENANA4L3iFroVAI
B. 安装ubuntu
从U盘启动电脑46Please respect copyright.PENANAskXqoqwaJy
try or install ubuntu46Please respect copyright.PENANAdxCJodirDQ
choose your language: english46Please respect copyright.PENANAwOWQE6RlMS
accessibility in ubuntu: next46Please respect copyright.PENANAU7T8YfOmuZ
select your keyboard layout: english(US)46Please respect copyright.PENANAjBKnE0dOF5
connect to the internet: connect to a wi-fi network46Please respect copyright.PENANA4u430CecD7
install ubuntu46Please respect copyright.PENANA10GpLa5C5u
interactive installation46Please respect copyright.PENANAayqcyvyPbr
extended selection46Please respect copyright.PENANACmrMNvOGMs
check: install third-party software for graphics and wi-fi hardware46Please respect copyright.PENANAHvEWFtwTwx
check: download and install support for additional media formats46Please respect copyright.PENANAiV50oBpAiD
erase disk and install ubuntu46Please respect copyright.PENANAk8XHbDHR1Z
choose sdb46Please respect copyright.PENANAOdlr3THXlW
your name: buda 46Please respect copyright.PENANAulHbtKqFBe
your computer's name: vultr46Please respect copyright.PENANATchFTH8469
your username: buda 46Please respect copyright.PENANAQO1U4gHbJ1
timezone: shanghai46Please respect copyright.PENANAPBUN9vlzcN
install46Please respect copyright.PENANAYa3c31xOGk
restart now46Please respect copyright.PENANApRwWql73do
拔出U盘, 按enter键
46Please respect copyright.PENANA6ow9i60XEq
C. 初始化設置
点击左下角ubuntu图标进入开始菜单,将terminal pin to dash46Please respect copyright.PENANAFjK6RqOj9Y
# sudo apt update && sudo apt upgrade -y
安装常用工具, 開發编译环境46Please respect copyright.PENANAuavkPxKomN
# sudo apt install nano net-tools build-essential gdb git glibc-source unzip openssl libssl-dev libzip-dev aria2 lsof46Please respect copyright.PENANAVM7PihV46Q
# cd /usr/src/glibc46Please respect copyright.PENANAXi3JHKcOaA
# tar xvf glibc-2.39.tar.xz46Please respect copyright.PENANAh3WmgJMH1s
在gdb中指定glibc的源代碼:46Please respect copyright.PENANAIxgMWqxAbx
gdb> directory /usr/src/glibc/glibc-2.39
將用戶加入root組46Please respect copyright.PENANAc1FvYKz3UK
# usermod -a -G root buda46Please respect copyright.PENANAWyeiVGJXCc
# groups buda
黑屏时间设置:15分钟无操作后黑屏46Please respect copyright.PENANA9GQloqW9dU
点左下角进入开始菜单, search "power", click " (settings) Power" blank screen: 15 mins
apt search rethinkdb46Please respect copyright.PENANApg176x1zAS
apt show rethinkdb46Please respect copyright.PENANA8OEgQ4WJIT
apt remove rethinkdb46Please respect copyright.PENANAuShr06hDbB
cd /etc/apt/sources.list.d/ #进入PPA源文件所在目录46Please respect copyright.PENANAo93Ky5m3sb
sudo rm XXX.list #删除一个PPA源list文件46Please respect copyright.PENANAmE9RNSsint
sudo apt update
46Please respect copyright.PENANAWKYG67eaw4
D. 安裝中文輸入法rime
# sudo apt install ibus-rime rime-data-luna-pinyin46Please respect copyright.PENANA1QLFgYsTqM
点击左下角进入开始菜单,选择settings, keyboard,+ add input source...,others, chinese(rime)46Please respect copyright.PENANArXiyra6z2Z
点击chinese(rime)右边的小竖点,move up,将chinese(rime)移到Input Sources列表的第一行46Please respect copyright.PENANALyTUva2Tpm
编辑配置文件46Please respect copyright.PENANAewf9E6VKca
一次显示9个候选词、模糊音46Please respect copyright.PENANAr8RxMTl8sq
# nano ~/.config/ibus/rime/default.custom.yaml46Please respect copyright.PENANACqEGg1zRVb
---------default.custom.yaml的内容如下-----------46Please respect copyright.PENANAiwp5hvTOHM
patch:46Please respect copyright.PENANAxW2tL2PCmd
"menu/page_size": 9
'speller/algebra':46Please respect copyright.PENANA5KDTlvdQFZ
- erase/^xx$/ # 第一行保留
# 模糊音定義46Please respect copyright.PENANAUGcp6MxjKw
- derive/^([zcs])h/$1/ # zh, ch, sh => z, c, s46Please respect copyright.PENANAxBBLB36ML1
- derive/^([zcs])([^h])/$1h$2/ # z, c, s => zh, ch, sh
- derive/^n/l/ # n => l46Please respect copyright.PENANAAY5jF7udDA
- derive/^l/n/ # l => n
- derive/([ei])n$/$1ng/ # en => eng, in => ing46Please respect copyright.PENANAkHwzpbLKAM
- derive/([ei])ng$/$1n/ # eng => en, ing => in46Please respect copyright.PENANABfoJyAm3ol
--------------------------------------------------------------46Please respect copyright.PENANAdIDLzizamj
为了使模糊音生效,拷贝配置文件46Please respect copyright.PENANAoG33LgqLu8
# cp default.custom.yaml luna_pinyin_simp.custom.yaml && cp default.custom.yaml luna_pinyin.custom.yaml46Please respect copyright.PENANA1UOawGSzUS
部署rime输入法:46Please respect copyright.PENANAnAaHb4XyKb
# ibus restart46Please respect copyright.PENANAOdG1VqKiRY
# ibus engine rime46Please respect copyright.PENANAvgLw8WNodj
在输入时按F4或者Ctrl+\`可弹出菜单,选择菜单上的数字可进行简繁输入转换46Please respect copyright.PENANAB5qO07HBEF
按shift键进行中英输入转换46Please respect copyright.PENANAwBRcCL5VB9
有时候输入法失效时,可以重新运行一下部署rime的命令
参考资料:46Please respect copyright.PENANAIqto4dWYGG
CustomizationGuide · rime/home Wiki · GitHub46Please respect copyright.PENANAroKkRfxMxp
https://www.cnblogs.com/keatonlao/p/12983158.html
46Please respect copyright.PENANAgyCKpOTBLv
E. 安裝重要軟件
从code官网下载deb包,然后安装46Please respect copyright.PENANALTLJxL3BKA
# sudo apt install ./code_1.90.0-1717531825_amd64.deb
gimp图片编辑器, chromium浏览器46Please respect copyright.PENANAUYpUOn1bT7
从app center安装
墙内安装node/npm46Please respect copyright.PENANAGcYKJXjUaj
https://nodejs.org/en/ 下载LTS版本46Please respect copyright.PENANAf79ZOgxMnO
# cd ~/Downloads46Please respect copyright.PENANA3ZFQPXdOO7
# wget https://nodejs.org/dist/v20.15.0/node-v20.15.0-linux-x64.tar.xz46Please respect copyright.PENANAYwBus14pjd
# tar --strip-components 1 -xvf node-v20.15.0-linux-x64.tar.xz -C /usr/local46Please respect copyright.PENANAHFNtyqLamH
# node -v46Please respect copyright.PENANAzepgk1DNsN
# npm install npm@latest -g46Please respect copyright.PENANAIrQeK2veD8
# npm config get registry46Please respect copyright.PENANASq1OS1UmOy
# npm config set registry https://registry.npmmirror.com46Please respect copyright.PENANAYgDI2u7Oye
如果想用回官方registry:46Please respect copyright.PENANAD2i0vgVySy
# npm config set registry https://registry.npmjs.org
墙外安装node/npm46Please respect copyright.PENANArykXmHAyE9
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash46Please respect copyright.PENANAk0itLdLmFB
# export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"46Please respect copyright.PENANAWkgTU48kSC
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm46Please respect copyright.PENANA72BHcQ4jii
# nvm install --lts46Please respect copyright.PENANAWBKYyFTR1a
# npm install npm@latest -g
安装46Please respect copyright.PENANAp8zKhdxi5g
npm i package_name46Please respect copyright.PENANAxKLdMk6vHq
项目更新46Please respect copyright.PENANAcQm5pwKrHR
npm update
F. 配置服務器連接
1. ssh免密登录Linux服务器
在客户端检查是否存在证书46Please respect copyright.PENANAMdG3jHm5Jb
# ls -al ~/.ssh/id_*.pub46Please respect copyright.PENANAyPiaLr0tTv
如果不存在,生成证书46Please respect copyright.PENANAxY88E7NLEc
# ssh-keygen -t rsa -b 4096 -C "jinmin.si@outlook.com"46Please respect copyright.PENANAoPXVDQ7XrQ
生成证书的过程中使用空白的 passphrase46Please respect copyright.PENANA8iV5feVeRZ
将证书拷贝到服务器46Please respect copyright.PENANAxJ3oIMapij
# ssh-copy-id root@server
2. 从windows登录linux
如果是从windows系统连接ubuntu,可以安装putty作为访问服务器的终端。 46Please respect copyright.PENANADkfDigfVb6
下载putty: https://www.putty.org/
putty免密登录Linux服务器的方法
在putty的安装目录找到puttygen.exe,运行生成ssl私钥和公钥,保存私钥到文件,复制公钥。46Please respect copyright.PENANAdA0JFt4ntK
在putty的 connection/data 设置登录用户名为root,connection/ssh/auth/credentials中设置私钥的文件,保存设置。46Please respect copyright.PENANASklF9HGa5z
将公钥写入服务器的 ~/.ssh/authorized_keys 文件中, reboot ubuntu使修改生效46Please respect copyright.PENANAicgZMPwTKJ
# nano ~/.ssh/authorized_keys46Please respect copyright.PENANAL1lBYGUjy7
# reboot
如果想保持putty与服务器的连接保持不断线,可以在Putty中设置每隔一定的时间发一次心跳消息。
3. 保持与服务器的ssh连接不断线的方法
ssh连接服务器时如果容易断线,可以修改服务器sshd的设置,保持ssh连接不断线:46Please respect copyright.PENANAC0UICk5s1j
# nano /etc/ssh/sshd_config46Please respect copyright.PENANAi8fzOqbeEC
ClientAliveInterval 60 # 表示每60秒发送一次请求,从而保持连接不断线。46Please respect copyright.PENANAVWH0nFcCWE
ClientAliveCountMax 10 # 表示服务器发出请求后客户端没有响应的次数达到10次,就自动断开连接46Please respect copyright.PENANAQEWTCWW7tI
# systemctl restart sshd
4. 從ubuntu remote windows用remmina
從app中心安裝remmina46Please respect copyright.PENANAOVYyLbIjgr
新建connection到windows
Basic標籤46Please respect copyright.PENANAfPoTVTbNuX
server: ip/domain.name, username: Administrator, password: ***46Please respect copyright.PENANA4wwASHRg3W
share folder中填寫ubuntu中的路徑,則可從windows訪問46Please respect copyright.PENANABeeV2AoHXT
resolution中可設置合適的屏幕大小
Advanced標籤46Please respect copyright.PENANA8dn5730E2j
output audio: 選擇local,則是windows發出的聲音
windows server 默認是麼有開啓聲音服務的,要設置一下才能發出聲音:46Please respect copyright.PENANAAcE89xZBQN
https://cloud.tencent.com/developer/article/1894933
G. 網絡安全設置
防火墙设置46Please respect copyright.PENANABIdqZk51hn
# ufw allow 2246Please respect copyright.PENANAq0ItI74Kxo
# ufw allow 8046Please respect copyright.PENANAIb1ypY2Ldl
# ufw allow 44346Please respect copyright.PENANAHEIAezh8NM
# ufw enable46Please respect copyright.PENANALmcldlMLXY
# ufw status
H. 常用命令
创建软链接46Please respect copyright.PENANAa5KV6ZmC8L
# sudo ln -s 源文件 目标文件
修改密码46Please respect copyright.PENANAkm87nEM6lk
# passwd root46Please respect copyright.PENANAjYK8ElLVyy
# usermod -a -G groupA username46Please respect copyright.PENANAnh2nNjxS2O
# groups username
修改hostname46Please respect copyright.PENANAe2JXeSyDOE
# hostnamectl set-hostname xiaoyue
查看cpu46Please respect copyright.PENANAli18S9XSfs
# lscpu
查看内存46Please respect copyright.PENANAQ1CsOuq7Jr
# free -h46Please respect copyright.PENANA8zpS6pmxyl
# top
釋放被buff/cache占用的内存46Please respect copyright.PENANAWheLGCfxsv
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空页面缓存46Please respect copyright.PENANAvbqcBZRzG6
# sync; echo 1 > /proc/sys/vm/drop_caches # 清空目录项缓存46Please respect copyright.PENANAkv5rBYcsIs
# sync; echo 2 > /proc/sys/vm/drop_caches # 清空SLAB缓存46Please respect copyright.PENANAKVyD97zkoQ
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空所有缓存46Please respect copyright.PENANAZXnrzJykc0
用sudo执行:46Please respect copyright.PENANA3PxNTE5eNb
# sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
46Please respect copyright.PENANASKDR28Vel8
查看硬盘46Please respect copyright.PENANARKUNs2JrfO
# sudo lshw -c disk46Please respect copyright.PENANAPBi4piGwPX
查看分区46Please respect copyright.PENANAhvkuB6Mnrf
# sudo fdisk -l46Please respect copyright.PENANA6q23P9Cf3Q
查看磁盘剩余空间46Please respect copyright.PENANAsuqkxdsHyu
# df -hl
文件壓縮和打包46Please respect copyright.PENANAxcFwmiUebG
將在windows上壓縮出的zip文件傳遞給Linux系統解壓縮時,文件名會出現亂碼,這是因爲在Windows上文件名的編碼取決於「控制面板-時鐘和區域-區域-管理-非unicode程序語言」中的設置,中國大陸默認是簡體中文,gb2312(cp936)編碼. 而在Linux系統上則統一是utf-8編碼。46Please respect copyright.PENANAUq8DwZBLOf
如何解決?最簡單的辦法是在解壓縮的時候說明一下原來的編碼,這樣壓縮工具就會識別出原來的文件名而自動將文件名轉爲utf8編碼, 命令如下:46Please respect copyright.PENANAA9mWhaMbZG
unzip -O cp936 temp.zip
改變文件權限46Please respect copyright.PENANAN22uU76Bo9
# chmod g+w <文件/目录路径>46Please respect copyright.PENANAqJgQOfLy7E
# chmod -R g+w /path/to/directory46Please respect copyright.PENANActODWoc5S3
设置所有者为 rwx,组为 r-x,其他用户为 r--:46Please respect copyright.PENANAVtRWCTHSNG
# chmod 755 <文件/目录路径>
u:所有者(user)。46Please respect copyright.PENANAOet4Q3Shhy
g:所属组(group)。46Please respect copyright.PENANAwR0s1vWUfV
o:其他用户(others)。46Please respect copyright.PENANARsVhnTAj0d
a:所有用户(u、g、o)。46Please respect copyright.PENANA0hN0i4Pcc2
操作符:46Please respect copyright.PENANAVfthErkeBy
+:添加权限。46Please respect copyright.PENANADPi7HP7jmc
-:移除权限。46Please respect copyright.PENANAde2HDC5yqZ
=:设置权限。46Please respect copyright.PENANAYRRj9AZP80
權限:46Please respect copyright.PENANAPsrOGj1rv9
r(读) = 446Please respect copyright.PENANA1zmTxgGiTT
w(写) = 246Please respect copyright.PENANAXU7aklkO9y
x(执行) = 146Please respect copyright.PENANArYx36m9kqn
-(无权限) = 046Please respect copyright.PENANAB3SoLaRJH4
通过加法得到最终的权限值。例如:46Please respect copyright.PENANAveTpa2prN8
7 = rwx(4 + 2 + 1)46Please respect copyright.PENANAEBVDieqdZL
5 = r-x(4 + 1)46Please respect copyright.PENANA7lb2fFtYjF
6 = rw-(4 + 2)46Please respect copyright.PENANAl6UWRBcIRM
46Please respect copyright.PENANA2dUq8AYOnw
I. 创建自定义命令
# nano ~/.bash_aliases46Please respect copyright.PENANA4Z9PIFFeOi
添加alias, 比如:46Please respect copyright.PENANAiVv9XDYAU5
alias gitbuda='gitbuda() { git add -A; git commit -m "$1"; git push; }; gitbuda'46Please respect copyright.PENANA9ChNPhLDVh
其中$1表示命令的第一个参数,这样就可以用 gitbuda "commit message"来运行命令46Please respect copyright.PENANA7WHLbgjJ4T
# source ~/.bash_aliases
Section X. Thanks
https://ubuntu.com
46Please respect copyright.PENANAWVLxYAYExE
Section Y. Contacts Me
If you found any errors or have any suggestions for this article, please let me know, my wechat: si_jinmin, my email: si.jinmin@gmail.com46Please respect copyright.PENANAzErREPoKXX
如果您发现本文有任何错误,或者对本文有好的建议,欢迎与我联系探讨,我的微信: si_jinmin, 我的email: si.jinmin@gmail.com
如果您對C/C++ programming, Linux, website development, Vue, Git, vscode感興趣,邀請您加入「Linux/C/C++ Website Development」微信群,請加我的微信(si_jinmin)以便拉您进群。
ns 15.158.61.48da2