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"
安装启动盘制作软件rufus56Please respect copyright.PENANAN9sJCjXey7
https://github.com/pbatard/rufus/releases/download/v4.5/rufus-4.5.exe56Please respect copyright.PENANAVEZErNIYpl
U盘的容量必须大于7G,在rufus中选择U盘, iso文件,MBR分区类型,NTFS文件格式,点击开始,选择以ISO镜像模式写入。
官方参考资料:56Please respect copyright.PENANAQ8dtr0waca
https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview
56Please respect copyright.PENANAcWwcKZAhj4
B. 安装ubuntu
从U盘启动电脑56Please respect copyright.PENANASwiiRLklhw
try or install ubuntu56Please respect copyright.PENANAzYIpHfVctD
choose your language: english56Please respect copyright.PENANA1CV1QGda2T
accessibility in ubuntu: next56Please respect copyright.PENANAncj8MisVaK
select your keyboard layout: english(US)56Please respect copyright.PENANAvd5rF6oAWe
connect to the internet: connect to a wi-fi network56Please respect copyright.PENANAgmhcizaGEv
install ubuntu56Please respect copyright.PENANAjH76To0fBN
interactive installation56Please respect copyright.PENANANp79TLqVSC
extended selection56Please respect copyright.PENANA9ERLIoEPU8
check: install third-party software for graphics and wi-fi hardware56Please respect copyright.PENANAIed593V0tR
check: download and install support for additional media formats56Please respect copyright.PENANAcvtVu7BIQB
erase disk and install ubuntu56Please respect copyright.PENANAAWt4E9z3nv
choose sdb56Please respect copyright.PENANAddi0IHM4tW
your name: buda 56Please respect copyright.PENANAcorxqIK6LZ
your computer's name: vultr56Please respect copyright.PENANACF60PgmaOI
your username: buda 56Please respect copyright.PENANARavFYAwA3h
timezone: shanghai56Please respect copyright.PENANAHM0Ceevzdp
install56Please respect copyright.PENANAXelhChvX75
restart now56Please respect copyright.PENANAWWg1fzuaQC
拔出U盘, 按enter键
56Please respect copyright.PENANAtpOyPGfbNn
C. 初始化設置
点击左下角ubuntu图标进入开始菜单,将terminal pin to dash56Please respect copyright.PENANA1L4JWRMmYR
# sudo apt update && sudo apt upgrade -y
安装常用工具, 開發编译环境56Please respect copyright.PENANAUeHtt2PAgo
# sudo apt install nano net-tools build-essential gdb git glibc-source unzip openssl libssl-dev libzip-dev aria2 lsof56Please respect copyright.PENANA0gmsKd6dq2
# cd /usr/src/glibc56Please respect copyright.PENANA2hp80pwj5j
# tar xvf glibc-2.39.tar.xz56Please respect copyright.PENANAGAa7qEX8SW
在gdb中指定glibc的源代碼:56Please respect copyright.PENANAPeXD7ETPDf
gdb> directory /usr/src/glibc/glibc-2.39
將用戶加入root組56Please respect copyright.PENANATIHFscEtX5
# usermod -a -G root buda56Please respect copyright.PENANA61ZyhMsJBQ
# groups buda
黑屏时间设置:15分钟无操作后黑屏56Please respect copyright.PENANAs3Huy7arjb
点左下角进入开始菜单, search "power", click " (settings) Power" blank screen: 15 mins
apt search rethinkdb56Please respect copyright.PENANASgjYlB1C9V
apt show rethinkdb56Please respect copyright.PENANAJmuZxqMGOe
apt remove rethinkdb56Please respect copyright.PENANA4LMFkSwqCR
cd /etc/apt/sources.list.d/ #进入PPA源文件所在目录56Please respect copyright.PENANAF9tnPE3tlt
sudo rm XXX.list #删除一个PPA源list文件56Please respect copyright.PENANA4wEB1U6QTM
sudo apt update
56Please respect copyright.PENANAylBPBfl2Dp
D. 安裝中文輸入法rime
# sudo apt install ibus-rime rime-data-luna-pinyin56Please respect copyright.PENANAh1SU74AqAI
点击左下角进入开始菜单,选择settings, keyboard,+ add input source...,others, chinese(rime)56Please respect copyright.PENANAFGUWYM0yfc
点击chinese(rime)右边的小竖点,move up,将chinese(rime)移到Input Sources列表的第一行56Please respect copyright.PENANAlSTMdYK7g0
编辑配置文件56Please respect copyright.PENANALhZsXzAEjq
一次显示9个候选词、模糊音56Please respect copyright.PENANA81a5h5kq9J
# nano ~/.config/ibus/rime/default.custom.yaml56Please respect copyright.PENANANu9rBi52y7
---------default.custom.yaml的内容如下-----------56Please respect copyright.PENANAWBlvB2AHTt
patch:56Please respect copyright.PENANASinRHj5M4e
"menu/page_size": 9
'speller/algebra':56Please respect copyright.PENANA1A9pD34C9w
- erase/^xx$/ # 第一行保留
# 模糊音定義56Please respect copyright.PENANAGqKGyeppdG
- derive/^([zcs])h/$1/ # zh, ch, sh => z, c, s56Please respect copyright.PENANAl44OXgw1v4
- derive/^([zcs])([^h])/$1h$2/ # z, c, s => zh, ch, sh
- derive/^n/l/ # n => l56Please respect copyright.PENANAOx6wJiRfv4
- derive/^l/n/ # l => n
- derive/([ei])n$/$1ng/ # en => eng, in => ing56Please respect copyright.PENANADT5LZGq2sa
- derive/([ei])ng$/$1n/ # eng => en, ing => in56Please respect copyright.PENANA97l2VdjiNc
--------------------------------------------------------------56Please respect copyright.PENANAZtC15iY64j
为了使模糊音生效,拷贝配置文件56Please respect copyright.PENANAh9V55yNKCf
# cp default.custom.yaml luna_pinyin_simp.custom.yaml && cp default.custom.yaml luna_pinyin.custom.yaml56Please respect copyright.PENANAlMe9CJbnzl
部署rime输入法:56Please respect copyright.PENANARDHKuJdTQq
# ibus restart56Please respect copyright.PENANAZNwTHALxrM
# ibus engine rime56Please respect copyright.PENANA235AGjsNKK
在输入时按F4或者Ctrl+\`可弹出菜单,选择菜单上的数字可进行简繁输入转换56Please respect copyright.PENANAGH57uYk7iL
按shift键进行中英输入转换56Please respect copyright.PENANAEzhZOqGXwE
有时候输入法失效时,可以重新运行一下部署rime的命令
参考资料:56Please respect copyright.PENANABVQ4stMhpn
CustomizationGuide · rime/home Wiki · GitHub56Please respect copyright.PENANAwnCah1Z2xX
https://www.cnblogs.com/keatonlao/p/12983158.html
56Please respect copyright.PENANA6CbyvPfpsJ
E. 安裝重要軟件
从code官网下载deb包,然后安装56Please respect copyright.PENANAOtL0kSIt9d
# sudo apt install ./code_1.90.0-1717531825_amd64.deb
gimp图片编辑器, chromium浏览器56Please respect copyright.PENANAB01CO6JCxg
从app center安装
墙内安装node/npm56Please respect copyright.PENANASPruHs6oSm
https://nodejs.org/en/ 下载LTS版本56Please respect copyright.PENANAhHTQa96yAP
# cd ~/Downloads56Please respect copyright.PENANAI0ezRg9aZP
# wget https://nodejs.org/dist/v20.15.0/node-v20.15.0-linux-x64.tar.xz56Please respect copyright.PENANAj5KiGHCpHd
# tar --strip-components 1 -xvf node-v20.15.0-linux-x64.tar.xz -C /usr/local56Please respect copyright.PENANA4tASsV5pVS
# node -v56Please respect copyright.PENANAty975Fg4vt
# npm install npm@latest -g56Please respect copyright.PENANAcOEhxExfgj
# npm config get registry56Please respect copyright.PENANAQMme02yAEO
# npm config set registry https://registry.npmmirror.com56Please respect copyright.PENANAvmelvEATye
如果想用回官方registry:56Please respect copyright.PENANAMbpb6ub3Lm
# npm config set registry https://registry.npmjs.org
墙外安装node/npm56Please respect copyright.PENANA9LtpOQt235
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash56Please respect copyright.PENANAVYcIJXpbr3
# export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"56Please respect copyright.PENANARgzvtRq7pM
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm56Please respect copyright.PENANAkMXTHQe49E
# nvm install --lts56Please respect copyright.PENANAAyn6LiZVZK
# npm install npm@latest -g
安装56Please respect copyright.PENANAbDB4oPuVNi
npm i package_name56Please respect copyright.PENANA17K1GrhnrU
项目更新56Please respect copyright.PENANAXBpQ4F0Nt2
npm update
F. 配置服務器連接
1. ssh免密登录Linux服务器
在客户端检查是否存在证书56Please respect copyright.PENANAS7GGjBqJlB
# ls -al ~/.ssh/id_*.pub56Please respect copyright.PENANAuiZHaCSgGw
如果不存在,生成证书56Please respect copyright.PENANAtxMiowG7Yq
# ssh-keygen -t rsa -b 4096 -C "jinmin.si@outlook.com"56Please respect copyright.PENANAnZ8hvRAsHd
生成证书的过程中使用空白的 passphrase56Please respect copyright.PENANAbkmoncACNV
将证书拷贝到服务器56Please respect copyright.PENANAPixHR3Qney
# ssh-copy-id root@server
2. 从windows登录linux
如果是从windows系统连接ubuntu,可以安装putty作为访问服务器的终端。 56Please respect copyright.PENANA09lgRMs59F
下载putty: https://www.putty.org/
putty免密登录Linux服务器的方法
在putty的安装目录找到puttygen.exe,运行生成ssl私钥和公钥,保存私钥到文件,复制公钥。56Please respect copyright.PENANA7Su1H6ngh0
在putty的 connection/data 设置登录用户名为root,connection/ssh/auth/credentials中设置私钥的文件,保存设置。56Please respect copyright.PENANAaIItkOMdgB
将公钥写入服务器的 ~/.ssh/authorized_keys 文件中, reboot ubuntu使修改生效56Please respect copyright.PENANAZPdCQDy6VV
# nano ~/.ssh/authorized_keys56Please respect copyright.PENANAZdW5L9demZ
# reboot
如果想保持putty与服务器的连接保持不断线,可以在Putty中设置每隔一定的时间发一次心跳消息。
3. 保持与服务器的ssh连接不断线的方法
ssh连接服务器时如果容易断线,可以修改服务器sshd的设置,保持ssh连接不断线:56Please respect copyright.PENANAAmKvA3VBV1
# nano /etc/ssh/sshd_config56Please respect copyright.PENANAKvQpr24zbe
ClientAliveInterval 60 # 表示每60秒发送一次请求,从而保持连接不断线。56Please respect copyright.PENANARGmSVxwHzu
ClientAliveCountMax 10 # 表示服务器发出请求后客户端没有响应的次数达到10次,就自动断开连接56Please respect copyright.PENANAKzI87W2veB
# systemctl restart sshd
4. 從ubuntu remote windows用remmina
從app中心安裝remmina56Please respect copyright.PENANAB8TagVanQy
新建connection到windows
Basic標籤56Please respect copyright.PENANAtiqlXrUGVw
server: ip/domain.name, username: Administrator, password: ***56Please respect copyright.PENANAGbo9mYfgZz
share folder中填寫ubuntu中的路徑,則可從windows訪問56Please respect copyright.PENANAKMa2Penvps
resolution中可設置合適的屏幕大小
Advanced標籤56Please respect copyright.PENANABoE1KIo5mW
output audio: 選擇local,則是windows發出的聲音
windows server 默認是麼有開啓聲音服務的,要設置一下才能發出聲音:56Please respect copyright.PENANANgRXg2fvRG
https://cloud.tencent.com/developer/article/1894933
G. 網絡安全設置
防火墙设置56Please respect copyright.PENANAaohSCrqCaO
# ufw allow 2256Please respect copyright.PENANAKOTxu0PwTQ
# ufw allow 8056Please respect copyright.PENANA7MfRt6WG78
# ufw allow 44356Please respect copyright.PENANACpqWr5TSXX
# ufw enable56Please respect copyright.PENANAODQ40v5qWx
# ufw status
H. 常用命令
创建软链接56Please respect copyright.PENANAA5xbf9pkL4
# sudo ln -s 源文件 目标文件
修改密码56Please respect copyright.PENANAZiwghMILrj
# passwd root56Please respect copyright.PENANAqpd4pl4K75
# usermod -a -G groupA username56Please respect copyright.PENANATje2Uo1Pb2
# groups username
修改hostname56Please respect copyright.PENANA2LtF8YG5OE
# hostnamectl set-hostname xiaoyue
查看cpu56Please respect copyright.PENANAc7XMEW8YUK
# lscpu
查看内存56Please respect copyright.PENANAZHgKEdzBUP
# free -h56Please respect copyright.PENANAQw3F6mil3G
# top
釋放被buff/cache占用的内存56Please respect copyright.PENANAGIxUyIW3zu
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空页面缓存56Please respect copyright.PENANAOILK47oYYt
# sync; echo 1 > /proc/sys/vm/drop_caches # 清空目录项缓存56Please respect copyright.PENANAoA2BumA8T7
# sync; echo 2 > /proc/sys/vm/drop_caches # 清空SLAB缓存56Please respect copyright.PENANAmTsmtVbIoA
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空所有缓存56Please respect copyright.PENANARWRECQCmvJ
用sudo执行:56Please respect copyright.PENANA1tvAOD7N5O
# sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
56Please respect copyright.PENANASSdq1gzDtL
查看硬盘56Please respect copyright.PENANAeL070lxyDC
# sudo lshw -c disk56Please respect copyright.PENANAnSB8GfPX8w
查看分区56Please respect copyright.PENANAxqbqZRQLy7
# sudo fdisk -l56Please respect copyright.PENANAUBL1PxK2Jw
查看磁盘剩余空间56Please respect copyright.PENANAs2UigT6HOV
# df -hl
文件壓縮和打包56Please respect copyright.PENANAE7fNyDodAT
將在windows上壓縮出的zip文件傳遞給Linux系統解壓縮時,文件名會出現亂碼,這是因爲在Windows上文件名的編碼取決於「控制面板-時鐘和區域-區域-管理-非unicode程序語言」中的設置,中國大陸默認是簡體中文,gb2312(cp936)編碼. 而在Linux系統上則統一是utf-8編碼。56Please respect copyright.PENANAm9RzBSJf4z
如何解決?最簡單的辦法是在解壓縮的時候說明一下原來的編碼,這樣壓縮工具就會識別出原來的文件名而自動將文件名轉爲utf8編碼, 命令如下:56Please respect copyright.PENANARNQe3XZhaQ
unzip -O cp936 temp.zip
改變文件權限56Please respect copyright.PENANAQpTOp5NLd7
# chmod g+w <文件/目录路径>56Please respect copyright.PENANADvw57gt57N
# chmod -R g+w /path/to/directory56Please respect copyright.PENANAhan9h2rDyR
设置所有者为 rwx,组为 r-x,其他用户为 r--:56Please respect copyright.PENANApqXxhmvWvb
# chmod 755 <文件/目录路径>
u:所有者(user)。56Please respect copyright.PENANAUkl59yLvOB
g:所属组(group)。56Please respect copyright.PENANAPP0rboPDDd
o:其他用户(others)。56Please respect copyright.PENANAZ00rokGvWO
a:所有用户(u、g、o)。56Please respect copyright.PENANAesHyrU4BXz
操作符:56Please respect copyright.PENANAlaIqhfjPVx
+:添加权限。56Please respect copyright.PENANAAtgYGMiUlr
-:移除权限。56Please respect copyright.PENANAmueHidmDFB
=:设置权限。56Please respect copyright.PENANAmt6MAp64TJ
權限:56Please respect copyright.PENANAHi49Sd3lf3
r(读) = 456Please respect copyright.PENANAxneCiLw4wW
w(写) = 256Please respect copyright.PENANAHT8b6J24Dx
x(执行) = 156Please respect copyright.PENANAWel4BzXMSB
-(无权限) = 056Please respect copyright.PENANAELvG5PN6hV
通过加法得到最终的权限值。例如:56Please respect copyright.PENANAB1Tt4G6Slh
7 = rwx(4 + 2 + 1)56Please respect copyright.PENANAa2PYUN7q0n
5 = r-x(4 + 1)56Please respect copyright.PENANAzJpGBb5GAq
6 = rw-(4 + 2)56Please respect copyright.PENANAaB5oq6Aoqh
56Please respect copyright.PENANA1ObOc1ZeRG
I. 创建自定义命令
# nano ~/.bash_aliases56Please respect copyright.PENANADDAhLK0koB
添加alias, 比如:56Please respect copyright.PENANArpeBlJVqwG
alias gitbuda='gitbuda() { git add -A; git commit -m "$1"; git push; }; gitbuda'56Please respect copyright.PENANALfSJpCx8L5
其中$1表示命令的第一个参数,这样就可以用 gitbuda "commit message"来运行命令56Please respect copyright.PENANAmZ3aFmYqCv
# source ~/.bash_aliases
Section X. Thanks
https://ubuntu.com
56Please respect copyright.PENANAer7SMQ75cC
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.com56Please respect copyright.PENANASWJkOMpGfd
如果您发现本文有任何错误,或者对本文有好的建议,欢迎与我联系探讨,我的微信: 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.7da2