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"
安装启动盘制作软件rufus98Please respect copyright.PENANAxc0ELhingV
https://github.com/pbatard/rufus/releases/download/v4.5/rufus-4.5.exe98Please respect copyright.PENANAGY0BpaKUW6
U盘的容量必须大于7G,在rufus中选择U盘, iso文件,MBR分区类型,NTFS文件格式,点击开始,选择以ISO镜像模式写入。
官方参考资料:98Please respect copyright.PENANAYVMlOus0tO
https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview
98Please respect copyright.PENANAQDWDz0ZRbk
B. 安装ubuntu
从U盘启动电脑98Please respect copyright.PENANA3fNan1YnoW
try or install ubuntu98Please respect copyright.PENANAPVgkq6Mc2b
choose your language: english98Please respect copyright.PENANAjql6IyubYx
accessibility in ubuntu: next98Please respect copyright.PENANAlRNI6MgA6c
select your keyboard layout: english(US)98Please respect copyright.PENANATGBWZZKmPk
connect to the internet: connect to a wi-fi network98Please respect copyright.PENANAaE2IcbG5Ie
install ubuntu98Please respect copyright.PENANAthWGwrZ2OK
interactive installation98Please respect copyright.PENANAPiBsFalnDM
extended selection98Please respect copyright.PENANAPrdR1y39aj
check: install third-party software for graphics and wi-fi hardware98Please respect copyright.PENANAlUdepSrlmR
check: download and install support for additional media formats98Please respect copyright.PENANAQhpsK6JlJT
erase disk and install ubuntu98Please respect copyright.PENANAP9iIjFwq8T
choose sdb98Please respect copyright.PENANA2VuxuRROtN
your name: buda 98Please respect copyright.PENANA6YGRAvnY7j
your computer's name: vultr98Please respect copyright.PENANAZdlUfq3qW0
your username: buda 98Please respect copyright.PENANAVTV66hQqPV
timezone: shanghai98Please respect copyright.PENANASG1jkyYuqv
install98Please respect copyright.PENANAW626rT0hdK
restart now98Please respect copyright.PENANAp0aAvF89Cl
拔出U盘, 按enter键
98Please respect copyright.PENANAUKw3SQN7qH
C. 初始化設置
点击左下角ubuntu图标进入开始菜单,将terminal pin to dash98Please respect copyright.PENANAh10SqMev5c
# sudo apt update && sudo apt upgrade -y
安装常用工具, 開發编译环境98Please respect copyright.PENANAEEmuy2Kkn4
# sudo apt install nano net-tools build-essential gdb git glibc-source unzip openssl libssl-dev libzip-dev aria2 lsof98Please respect copyright.PENANA5tOLpVzmqi
# cd /usr/src/glibc98Please respect copyright.PENANArOCJlC8OJV
# tar xvf glibc-2.39.tar.xz98Please respect copyright.PENANAnIjCuXw8lc
在gdb中指定glibc的源代碼:98Please respect copyright.PENANAwcXlTLxcjk
gdb> directory /usr/src/glibc/glibc-2.39
將用戶加入root組98Please respect copyright.PENANA846FNeAuSS
# usermod -a -G root buda98Please respect copyright.PENANA0NUfEnL3K6
# groups buda
黑屏时间设置:15分钟无操作后黑屏98Please respect copyright.PENANAgQibrUUAiR
点左下角进入开始菜单, search "power", click " (settings) Power" blank screen: 15 mins
apt search rethinkdb98Please respect copyright.PENANAPLI5NikqiT
apt show rethinkdb98Please respect copyright.PENANACAsnO8cnvl
apt remove rethinkdb98Please respect copyright.PENANAce9nj7LTa6
cd /etc/apt/sources.list.d/ #进入PPA源文件所在目录98Please respect copyright.PENANAmA7uZti9oF
sudo rm XXX.list #删除一个PPA源list文件98Please respect copyright.PENANATp1sojdEmT
sudo apt update
98Please respect copyright.PENANAWwKM1tQqO0
D. 安裝中文輸入法rime
# sudo apt install ibus-rime rime-data-luna-pinyin98Please respect copyright.PENANAoyOn1TnfEu
点击左下角进入开始菜单,选择settings, keyboard,+ add input source...,others, chinese(rime)98Please respect copyright.PENANAuHBiCakkA8
点击chinese(rime)右边的小竖点,move up,将chinese(rime)移到Input Sources列表的第一行98Please respect copyright.PENANAHcbqcbHMgW
编辑配置文件98Please respect copyright.PENANAtWkyosInai
一次显示9个候选词、模糊音98Please respect copyright.PENANAIaf5MuNP93
# nano ~/.config/ibus/rime/default.custom.yaml98Please respect copyright.PENANArHqjLvTdj3
---------default.custom.yaml的内容如下-----------98Please respect copyright.PENANACecVHNIsnD
patch:98Please respect copyright.PENANAwLnyvwlOyh
"menu/page_size": 9
'speller/algebra':98Please respect copyright.PENANAlFA34hLiDN
- erase/^xx$/ # 第一行保留
# 模糊音定義98Please respect copyright.PENANAt8ynRBh3Gz
- derive/^([zcs])h/$1/ # zh, ch, sh => z, c, s98Please respect copyright.PENANAynhHT7aX0q
- derive/^([zcs])([^h])/$1h$2/ # z, c, s => zh, ch, sh
- derive/^n/l/ # n => l98Please respect copyright.PENANAoC7IiQ5Lwo
- derive/^l/n/ # l => n
- derive/([ei])n$/$1ng/ # en => eng, in => ing98Please respect copyright.PENANAWO6NWsnOlX
- derive/([ei])ng$/$1n/ # eng => en, ing => in98Please respect copyright.PENANANaDeMqpRJZ
--------------------------------------------------------------98Please respect copyright.PENANA6hfs10NTvY
为了使模糊音生效,拷贝配置文件98Please respect copyright.PENANAA96ROmZy7L
# cp default.custom.yaml luna_pinyin_simp.custom.yaml && cp default.custom.yaml luna_pinyin.custom.yaml98Please respect copyright.PENANArjiJ4jVJ3b
部署rime输入法:98Please respect copyright.PENANARKpyMwjJQe
# ibus restart98Please respect copyright.PENANAhV19xE4ECG
# ibus engine rime98Please respect copyright.PENANAKH86On7bKS
在输入时按F4或者Ctrl+\`可弹出菜单,选择菜单上的数字可进行简繁输入转换98Please respect copyright.PENANAVUyUzXHcgv
按shift键进行中英输入转换98Please respect copyright.PENANAWzXn4Y12RP
有时候输入法失效时,可以重新运行一下部署rime的命令
参考资料:98Please respect copyright.PENANAtpIBsFDigj
CustomizationGuide · rime/home Wiki · GitHub98Please respect copyright.PENANAfxdYzi0oKl
https://www.cnblogs.com/keatonlao/p/12983158.html
98Please respect copyright.PENANA4ZP6JnJVoh
E. 安裝重要軟件
从code官网下载deb包,然后安装98Please respect copyright.PENANA7Lwp9U0OlG
# sudo apt install ./code_1.90.0-1717531825_amd64.deb
gimp图片编辑器, chromium浏览器98Please respect copyright.PENANAStPzqk0o1a
从app center安装
墙内安装node/npm98Please respect copyright.PENANAT43FshBKdC
https://nodejs.org/en/ 下载LTS版本98Please respect copyright.PENANAIm7FXiBnoe
# cd ~/Downloads98Please respect copyright.PENANA8nFZ3YDWZY
# wget https://nodejs.org/dist/v20.15.0/node-v20.15.0-linux-x64.tar.xz98Please respect copyright.PENANAEy2fSABhEN
# tar --strip-components 1 -xvf node-v20.15.0-linux-x64.tar.xz -C /usr/local98Please respect copyright.PENANAOTuX1AVHDM
# node -v98Please respect copyright.PENANArfoQnvODjD
# npm install npm@latest -g98Please respect copyright.PENANA16LiP4qFby
# npm config get registry98Please respect copyright.PENANAZUl8B7axH2
# npm config set registry https://registry.npmmirror.com98Please respect copyright.PENANA8De9h721nX
如果想用回官方registry:98Please respect copyright.PENANAUR5bbnMyq1
# npm config set registry https://registry.npmjs.org
墙外安装node/npm98Please respect copyright.PENANAfY2un4hvoT
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash98Please respect copyright.PENANAtRgmdCAYLI
# export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"98Please respect copyright.PENANA9dW80rabgt
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm98Please respect copyright.PENANAmnhxwy6Tkh
# nvm install --lts98Please respect copyright.PENANAhGuPwTCace
# npm install npm@latest -g
安装98Please respect copyright.PENANAbLorZWmWBJ
npm i package_name98Please respect copyright.PENANAE2wLMkNQRY
项目更新98Please respect copyright.PENANAj9etl6HMNq
npm update
F. 配置服務器連接
1. ssh免密登录Linux服务器
在客户端检查是否存在证书98Please respect copyright.PENANAXW1ywCSiFs
# ls -al ~/.ssh/id_*.pub98Please respect copyright.PENANA3oxzw2txL3
如果不存在,生成证书98Please respect copyright.PENANAq2X5ytQsxe
# ssh-keygen -t rsa -b 4096 -C "[email protected]"98Please respect copyright.PENANAKQpWFDvREI
生成证书的过程中使用空白的 passphrase98Please respect copyright.PENANAm7FHDEmJl2
将证书拷贝到服务器98Please respect copyright.PENANAUP6gU5ldSi
# ssh-copy-id root@server
2. 从windows登录linux
如果是从windows系统连接ubuntu,可以安装putty作为访问服务器的终端。 98Please respect copyright.PENANAUOYiINGcSz
下载putty: https://www.putty.org/
putty免密登录Linux服务器的方法
在putty的安装目录找到puttygen.exe,运行生成ssl私钥和公钥,保存私钥到文件,复制公钥。98Please respect copyright.PENANAD8twgeImk6
在putty的 connection/data 设置登录用户名为root,connection/ssh/auth/credentials中设置私钥的文件,保存设置。98Please respect copyright.PENANA3pSvGTDmkp
将公钥写入服务器的 ~/.ssh/authorized_keys 文件中, reboot ubuntu使修改生效98Please respect copyright.PENANA1WlRkiSOxb
# nano ~/.ssh/authorized_keys98Please respect copyright.PENANAznv1pA7kWf
# reboot
如果想保持putty与服务器的连接保持不断线,可以在Putty中设置每隔一定的时间发一次心跳消息。
3. 保持与服务器的ssh连接不断线的方法
ssh连接服务器时如果容易断线,可以修改服务器sshd的设置,保持ssh连接不断线:98Please respect copyright.PENANAo79lY9VsdQ
# nano /etc/ssh/sshd_config98Please respect copyright.PENANAPT2hXGS5RZ
ClientAliveInterval 60 # 表示每60秒发送一次请求,从而保持连接不断线。98Please respect copyright.PENANALLjX1kJJ0E
ClientAliveCountMax 10 # 表示服务器发出请求后客户端没有响应的次数达到10次,就自动断开连接98Please respect copyright.PENANAjXzNz1p6us
# systemctl restart sshd
4. 從ubuntu remote windows用remmina
從app中心安裝remmina98Please respect copyright.PENANAv6BA3ucPfR
新建connection到windows
Basic標籤98Please respect copyright.PENANA1zPloBtU0l
server: ip/domain.name, username: Administrator, password: ***98Please respect copyright.PENANAlzLgARHvvz
share folder中填寫ubuntu中的路徑,則可從windows訪問98Please respect copyright.PENANAfyq734WrrM
resolution中可設置合適的屏幕大小
Advanced標籤98Please respect copyright.PENANAeV7ATDQ0VD
output audio: 選擇local,則是windows發出的聲音
windows server 默認是麼有開啓聲音服務的,要設置一下才能發出聲音:98Please respect copyright.PENANAupFGO3miFL
https://cloud.tencent.com/developer/article/1894933
G. 網絡安全設置
防火墙设置98Please respect copyright.PENANA0q54N2Tlrp
# ufw allow 2298Please respect copyright.PENANAJ42hWWlh5j
# ufw allow 8098Please respect copyright.PENANA0tMaQEWQRj
# ufw allow 44398Please respect copyright.PENANAufjwE1At6z
# ufw enable98Please respect copyright.PENANAzDLyhxfPyT
# ufw status
H. 常用命令
创建软链接98Please respect copyright.PENANAbAEV62cn3l
# sudo ln -s 源文件 目标文件
修改密码98Please respect copyright.PENANAbWGsDKhLPi
# passwd root98Please respect copyright.PENANAsoqUKPKMX3
# usermod -a -G groupA username98Please respect copyright.PENANAyNX8N0BO1e
# groups username
修改hostname98Please respect copyright.PENANArMqqmErXj2
# hostnamectl set-hostname xiaoyue
查看cpu98Please respect copyright.PENANAjMAlAD6E4w
# lscpu
查看内存98Please respect copyright.PENANA7SSGLAfQRj
# free -h98Please respect copyright.PENANAVnqZic86uY
# top
釋放被buff/cache占用的内存98Please respect copyright.PENANAtqas4leWXO
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空页面缓存98Please respect copyright.PENANAgVwFXb85yb
# sync; echo 1 > /proc/sys/vm/drop_caches # 清空目录项缓存98Please respect copyright.PENANAiXe66bNCx4
# sync; echo 2 > /proc/sys/vm/drop_caches # 清空SLAB缓存98Please respect copyright.PENANAPhG4M5kQBs
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空所有缓存98Please respect copyright.PENANAYw6BylkFhs
用sudo执行:98Please respect copyright.PENANANHtvGj5i10
# sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
98Please respect copyright.PENANAmMln43209A
查看硬盘98Please respect copyright.PENANAKUk9w5cJIz
# sudo lshw -c disk98Please respect copyright.PENANA4kZvWYFvO4
查看分区98Please respect copyright.PENANAVR9f4A0x5j
# sudo fdisk -l98Please respect copyright.PENANAkYHqPFfW8D
查看磁盘剩余空间98Please respect copyright.PENANA513nxEhHaP
# df -hl
文件壓縮和打包98Please respect copyright.PENANAawNjHgAPBm
將在windows上壓縮出的zip文件傳遞給Linux系統解壓縮時,文件名會出現亂碼,這是因爲在Windows上文件名的編碼取決於「控制面板-時鐘和區域-區域-管理-非unicode程序語言」中的設置,中國大陸默認是簡體中文,gb2312(cp936)編碼. 而在Linux系統上則統一是utf-8編碼。98Please respect copyright.PENANAh412t7zkgU
如何解決?最簡單的辦法是在解壓縮的時候說明一下原來的編碼,這樣壓縮工具就會識別出原來的文件名而自動將文件名轉爲utf8編碼, 命令如下:98Please respect copyright.PENANAnMnakAJM6Q
unzip -O cp936 temp.zip
改變文件權限98Please respect copyright.PENANAj0rhJ6VI8x
# chmod g+w <文件/目录路径>98Please respect copyright.PENANAkWvsTM6LrZ
# chmod -R g+w /path/to/directory98Please respect copyright.PENANAWM32dV39sn
设置所有者为 rwx,组为 r-x,其他用户为 r--:98Please respect copyright.PENANAJlaHWDJKf8
# chmod 755 <文件/目录路径>
u:所有者(user)。98Please respect copyright.PENANAvtzTD6Gyf1
g:所属组(group)。98Please respect copyright.PENANARkEhFivGN1
o:其他用户(others)。98Please respect copyright.PENANAARIhszgDmm
a:所有用户(u、g、o)。98Please respect copyright.PENANA9v1vbH6MF5
操作符:98Please respect copyright.PENANADT0XY5sjyy
+:添加权限。98Please respect copyright.PENANAJvcu781KSC
-:移除权限。98Please respect copyright.PENANAeXyAivak97
=:设置权限。98Please respect copyright.PENANAZlafctFTVA
權限:98Please respect copyright.PENANAQGlFKgiC1q
r(读) = 498Please respect copyright.PENANA9f7Z4WrwA2
w(写) = 298Please respect copyright.PENANA88q09bzvgg
x(执行) = 198Please respect copyright.PENANAXOtiJQC9Iv
-(无权限) = 098Please respect copyright.PENANAIPBdcZz9oH
通过加法得到最终的权限值。例如:98Please respect copyright.PENANA7NAon4ZcLt
7 = rwx(4 + 2 + 1)98Please respect copyright.PENANASpo2hExQEz
5 = r-x(4 + 1)98Please respect copyright.PENANAaZB3oXXXn1
6 = rw-(4 + 2)98Please respect copyright.PENANAeOrs3b5tyo
98Please respect copyright.PENANAosbxuurGtn
I. 创建自定义命令
# nano ~/.bash_aliases98Please respect copyright.PENANA7YZYzp12Q6
添加alias, 比如:98Please respect copyright.PENANAGsoEMfJ7W5
alias gitbuda='gitbuda() { git add -A; git commit -m "$1"; git push; }; gitbuda'98Please respect copyright.PENANAWrPxPHSrED
其中$1表示命令的第一个参数,这样就可以用 gitbuda "commit message"来运行命令98Please respect copyright.PENANArLQq2Hm4h6
# source ~/.bash_aliases
Section X. Thanks
https://ubuntu.com
98Please respect copyright.PENANAkUp7VHs8ZQ
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: [email protected]98Please respect copyright.PENANA8QJTgoEDdm
如果您发现本文有任何错误,或者对本文有好的建议,欢迎与我联系探讨,我的微信: si_jinmin, 我的email: [email protected]
如果您對C/C++ programming, Linux, website development, Vue, Git, vscode感興趣,邀請您加入「Linux/C/C++ Website Development」微信群,請加我的微信(si_jinmin)以便拉您进群。
ns3.149.253.136da2