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"
安装启动盘制作软件rufus95Please respect copyright.PENANAQvjUfUgNzm
https://github.com/pbatard/rufus/releases/download/v4.5/rufus-4.5.exe95Please respect copyright.PENANANexi21IlsO
U盘的容量必须大于7G,在rufus中选择U盘, iso文件,MBR分区类型,NTFS文件格式,点击开始,选择以ISO镜像模式写入。
官方参考资料:95Please respect copyright.PENANAbEP013CKzx
https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview
95Please respect copyright.PENANAIFLzrGQq0B
B. 安装ubuntu
从U盘启动电脑95Please respect copyright.PENANAyLYhnW6u7i
try or install ubuntu95Please respect copyright.PENANAqoXiEFJd3D
choose your language: english95Please respect copyright.PENANACVJLFYF3ln
accessibility in ubuntu: next95Please respect copyright.PENANANUIOjQITvr
select your keyboard layout: english(US)95Please respect copyright.PENANAs9JRBKahBu
connect to the internet: connect to a wi-fi network95Please respect copyright.PENANA3IErnIvAjf
install ubuntu95Please respect copyright.PENANAhx4wzgi1ee
interactive installation95Please respect copyright.PENANAdrNrqynWFr
extended selection95Please respect copyright.PENANAa8bUKeSS8n
check: install third-party software for graphics and wi-fi hardware95Please respect copyright.PENANAdzyTqUN5Jm
check: download and install support for additional media formats95Please respect copyright.PENANAB0Puhpa8gC
erase disk and install ubuntu95Please respect copyright.PENANAwKHvDykiWn
choose sdb95Please respect copyright.PENANAw9s7tukbLA
your name: buda 95Please respect copyright.PENANAdb8s8GRXKn
your computer's name: vultr95Please respect copyright.PENANAG2uYtvxzOO
your username: buda 95Please respect copyright.PENANAwUWmi9vqhU
timezone: shanghai95Please respect copyright.PENANAzRefqs7F5S
install95Please respect copyright.PENANAAF2vHPkWyx
restart now95Please respect copyright.PENANALdnP5PCFet
拔出U盘, 按enter键
95Please respect copyright.PENANA7Cm9NnAoBh
C. 初始化設置
点击左下角ubuntu图标进入开始菜单,将terminal pin to dash95Please respect copyright.PENANAbSK8fWcv3u
# sudo apt update && sudo apt upgrade -y
安装常用工具, 開發编译环境95Please respect copyright.PENANA6LVYiGlVZI
# sudo apt install nano net-tools build-essential gdb git glibc-source unzip openssl libssl-dev libzip-dev aria2 lsof95Please respect copyright.PENANAB1PkYZDb5M
# cd /usr/src/glibc95Please respect copyright.PENANAbRP28gAjRw
# tar xvf glibc-2.39.tar.xz95Please respect copyright.PENANAs2MSZJ9wPa
在gdb中指定glibc的源代碼:95Please respect copyright.PENANAV7bX2nslNe
gdb> directory /usr/src/glibc/glibc-2.39
將用戶加入root組95Please respect copyright.PENANAzgUxl49gM1
# usermod -a -G root buda95Please respect copyright.PENANA41Uz3aisv3
# groups buda
黑屏时间设置:15分钟无操作后黑屏95Please respect copyright.PENANAytvvu9dTXn
点左下角进入开始菜单, search "power", click " (settings) Power" blank screen: 15 mins
apt search rethinkdb95Please respect copyright.PENANABWmA8PcdqL
apt show rethinkdb95Please respect copyright.PENANAbpe6lQhTgx
apt remove rethinkdb95Please respect copyright.PENANADz0CSImqqF
cd /etc/apt/sources.list.d/ #进入PPA源文件所在目录95Please respect copyright.PENANAkKhoQKYmCe
sudo rm XXX.list #删除一个PPA源list文件95Please respect copyright.PENANA8IRJwO7yJ5
sudo apt update
95Please respect copyright.PENANAGGHxx0iYRg
D. 安裝中文輸入法rime
# sudo apt install ibus-rime rime-data-luna-pinyin95Please respect copyright.PENANAYPGDUNRYID
点击左下角进入开始菜单,选择settings, keyboard,+ add input source...,others, chinese(rime)95Please respect copyright.PENANAtH15AgsVKz
点击chinese(rime)右边的小竖点,move up,将chinese(rime)移到Input Sources列表的第一行95Please respect copyright.PENANANbo7ukwOeY
编辑配置文件95Please respect copyright.PENANA70yAs2qz9v
一次显示9个候选词、模糊音95Please respect copyright.PENANAjuvucyyEhc
# nano ~/.config/ibus/rime/default.custom.yaml95Please respect copyright.PENANAMZSliHE7vJ
---------default.custom.yaml的内容如下-----------95Please respect copyright.PENANARIsoqgEUMb
patch:95Please respect copyright.PENANAZ9M5tAQbvN
"menu/page_size": 9
'speller/algebra':95Please respect copyright.PENANAK4K3HahvUN
- erase/^xx$/ # 第一行保留
# 模糊音定義95Please respect copyright.PENANAEEf3V4wHqW
- derive/^([zcs])h/$1/ # zh, ch, sh => z, c, s95Please respect copyright.PENANAEiVd4eIDK0
- derive/^([zcs])([^h])/$1h$2/ # z, c, s => zh, ch, sh
- derive/^n/l/ # n => l95Please respect copyright.PENANA6bD3aPLF0J
- derive/^l/n/ # l => n
- derive/([ei])n$/$1ng/ # en => eng, in => ing95Please respect copyright.PENANAp8hOHUoNdM
- derive/([ei])ng$/$1n/ # eng => en, ing => in95Please respect copyright.PENANApsWxpaJQhs
--------------------------------------------------------------95Please respect copyright.PENANAVqdQA6bHsD
为了使模糊音生效,拷贝配置文件95Please respect copyright.PENANAy6Ldu4ZSX3
# cp default.custom.yaml luna_pinyin_simp.custom.yaml && cp default.custom.yaml luna_pinyin.custom.yaml95Please respect copyright.PENANAYMqtTdkPTx
部署rime输入法:95Please respect copyright.PENANA3guKw84Ugf
# ibus restart95Please respect copyright.PENANA88dEa87Mf8
# ibus engine rime95Please respect copyright.PENANAEu2d7igxt7
在输入时按F4或者Ctrl+\`可弹出菜单,选择菜单上的数字可进行简繁输入转换95Please respect copyright.PENANA8KQRWul6Zb
按shift键进行中英输入转换95Please respect copyright.PENANAUqgmIGzb7s
有时候输入法失效时,可以重新运行一下部署rime的命令
参考资料:95Please respect copyright.PENANAtbPOGO1s9Q
CustomizationGuide · rime/home Wiki · GitHub95Please respect copyright.PENANAleuQvEiFD2
https://www.cnblogs.com/keatonlao/p/12983158.html
95Please respect copyright.PENANAads59BCNUG
E. 安裝重要軟件
从code官网下载deb包,然后安装95Please respect copyright.PENANA8aeycdqY1f
# sudo apt install ./code_1.90.0-1717531825_amd64.deb
gimp图片编辑器, chromium浏览器95Please respect copyright.PENANA2slV3iss7J
从app center安装
墙内安装node/npm95Please respect copyright.PENANADQV2ZJmATh
https://nodejs.org/en/ 下载LTS版本95Please respect copyright.PENANApd2LPZKUfe
# cd ~/Downloads95Please respect copyright.PENANAM11GpPwJ14
# wget https://nodejs.org/dist/v20.15.0/node-v20.15.0-linux-x64.tar.xz95Please respect copyright.PENANAGU6VljhXrA
# tar --strip-components 1 -xvf node-v20.15.0-linux-x64.tar.xz -C /usr/local95Please respect copyright.PENANAysC3L0Ossl
# node -v95Please respect copyright.PENANARdoAU8sXbr
# npm install npm@latest -g95Please respect copyright.PENANA33ERXHd0Ep
# npm config get registry95Please respect copyright.PENANA2iUkz2tOEn
# npm config set registry https://registry.npmmirror.com95Please respect copyright.PENANAaZm4CLTd8e
如果想用回官方registry:95Please respect copyright.PENANAOw9QNk1FQA
# npm config set registry https://registry.npmjs.org
墙外安装node/npm95Please respect copyright.PENANAAXco3cCAUt
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash95Please respect copyright.PENANARaOs6hm5p5
# export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"95Please respect copyright.PENANAmJGiMa3xHt
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm95Please respect copyright.PENANAucHrA8tHVU
# nvm install --lts95Please respect copyright.PENANApqLcBWkC5R
# npm install npm@latest -g
安装95Please respect copyright.PENANAQn84Mo6uCL
npm i package_name95Please respect copyright.PENANANFvTwUhhD9
项目更新95Please respect copyright.PENANA9ovKr3QxPs
npm update
F. 配置服務器連接
1. ssh免密登录Linux服务器
在客户端检查是否存在证书95Please respect copyright.PENANAKvFFyI0EVH
# ls -al ~/.ssh/id_*.pub95Please respect copyright.PENANAtw0iXxVbZm
如果不存在,生成证书95Please respect copyright.PENANAF2Vt5peTrr
# ssh-keygen -t rsa -b 4096 -C "[email protected]"95Please respect copyright.PENANATBmFy2g8tx
生成证书的过程中使用空白的 passphrase95Please respect copyright.PENANASO1jpBggWx
将证书拷贝到服务器95Please respect copyright.PENANAXXTNBmaMoC
# ssh-copy-id root@server
2. 从windows登录linux
如果是从windows系统连接ubuntu,可以安装putty作为访问服务器的终端。 95Please respect copyright.PENANAFeeDlhf0Xi
下载putty: https://www.putty.org/
putty免密登录Linux服务器的方法
在putty的安装目录找到puttygen.exe,运行生成ssl私钥和公钥,保存私钥到文件,复制公钥。95Please respect copyright.PENANAYBQdiBkeMB
在putty的 connection/data 设置登录用户名为root,connection/ssh/auth/credentials中设置私钥的文件,保存设置。95Please respect copyright.PENANA0df7OkvJrY
将公钥写入服务器的 ~/.ssh/authorized_keys 文件中, reboot ubuntu使修改生效95Please respect copyright.PENANAr5ikOHwBou
# nano ~/.ssh/authorized_keys95Please respect copyright.PENANADWDxSjGTP6
# reboot
如果想保持putty与服务器的连接保持不断线,可以在Putty中设置每隔一定的时间发一次心跳消息。
3. 保持与服务器的ssh连接不断线的方法
ssh连接服务器时如果容易断线,可以修改服务器sshd的设置,保持ssh连接不断线:95Please respect copyright.PENANAb3KZPsFLKt
# nano /etc/ssh/sshd_config95Please respect copyright.PENANAauHn0iWu8J
ClientAliveInterval 60 # 表示每60秒发送一次请求,从而保持连接不断线。95Please respect copyright.PENANAIcnEyi75Qx
ClientAliveCountMax 10 # 表示服务器发出请求后客户端没有响应的次数达到10次,就自动断开连接95Please respect copyright.PENANAHquGUUmbfE
# systemctl restart sshd
4. 從ubuntu remote windows用remmina
從app中心安裝remmina95Please respect copyright.PENANAzf9bbZRFa1
新建connection到windows
Basic標籤95Please respect copyright.PENANAmxjj1XN1oz
server: ip/domain.name, username: Administrator, password: ***95Please respect copyright.PENANAwlqyP0PBkC
share folder中填寫ubuntu中的路徑,則可從windows訪問95Please respect copyright.PENANAnzhzaTJ1rd
resolution中可設置合適的屏幕大小
Advanced標籤95Please respect copyright.PENANAmiNiJQ4xoP
output audio: 選擇local,則是windows發出的聲音
windows server 默認是麼有開啓聲音服務的,要設置一下才能發出聲音:95Please respect copyright.PENANAVxElk65vkP
https://cloud.tencent.com/developer/article/1894933
G. 網絡安全設置
防火墙设置95Please respect copyright.PENANAYqf8BmaaI3
# ufw allow 2295Please respect copyright.PENANArOKPmAYtVY
# ufw allow 8095Please respect copyright.PENANAt0YrXyaIxj
# ufw allow 44395Please respect copyright.PENANAKdgBWDEuup
# ufw enable95Please respect copyright.PENANAmC0A9l3j4X
# ufw status
H. 常用命令
创建软链接95Please respect copyright.PENANA4dQAkf04jO
# sudo ln -s 源文件 目标文件
修改密码95Please respect copyright.PENANADLE4sv2MVE
# passwd root95Please respect copyright.PENANAALgsGsmTOA
# usermod -a -G groupA username95Please respect copyright.PENANAAM5i746dCs
# groups username
修改hostname95Please respect copyright.PENANAvo4yPsdKXC
# hostnamectl set-hostname xiaoyue
查看cpu95Please respect copyright.PENANAcN7jbpjbus
# lscpu
查看内存95Please respect copyright.PENANATArFSuU05p
# free -h95Please respect copyright.PENANA2FOIhcvEiG
# top
釋放被buff/cache占用的内存95Please respect copyright.PENANAiwENtJ82Ua
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空页面缓存95Please respect copyright.PENANA4EtZJTfruZ
# sync; echo 1 > /proc/sys/vm/drop_caches # 清空目录项缓存95Please respect copyright.PENANAnjf5Rvtlcv
# sync; echo 2 > /proc/sys/vm/drop_caches # 清空SLAB缓存95Please respect copyright.PENANAiT8eK3mSh4
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空所有缓存95Please respect copyright.PENANAoxTXWToh0y
用sudo执行:95Please respect copyright.PENANA83nsyb54qx
# sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
95Please respect copyright.PENANAVjszQIxKYL
查看硬盘95Please respect copyright.PENANAq4gWHEtINh
# sudo lshw -c disk95Please respect copyright.PENANAbmtHrZeGq0
查看分区95Please respect copyright.PENANAn4ALH1m3qi
# sudo fdisk -l95Please respect copyright.PENANAZiIQyOxGEE
查看磁盘剩余空间95Please respect copyright.PENANAw4bbtCwgrR
# df -hl
文件壓縮和打包95Please respect copyright.PENANAMVquJnAp0L
將在windows上壓縮出的zip文件傳遞給Linux系統解壓縮時,文件名會出現亂碼,這是因爲在Windows上文件名的編碼取決於「控制面板-時鐘和區域-區域-管理-非unicode程序語言」中的設置,中國大陸默認是簡體中文,gb2312(cp936)編碼. 而在Linux系統上則統一是utf-8編碼。95Please respect copyright.PENANA0frkPuRSnp
如何解決?最簡單的辦法是在解壓縮的時候說明一下原來的編碼,這樣壓縮工具就會識別出原來的文件名而自動將文件名轉爲utf8編碼, 命令如下:95Please respect copyright.PENANAVJ3KrbIBHr
unzip -O cp936 temp.zip
改變文件權限95Please respect copyright.PENANAi1uiLf4BfS
# chmod g+w <文件/目录路径>95Please respect copyright.PENANAag5eGNIbc3
# chmod -R g+w /path/to/directory95Please respect copyright.PENANAD6p8VdJW2P
设置所有者为 rwx,组为 r-x,其他用户为 r--:95Please respect copyright.PENANAH3f1UIRelK
# chmod 755 <文件/目录路径>
u:所有者(user)。95Please respect copyright.PENANAch0A8vTgY1
g:所属组(group)。95Please respect copyright.PENANAm5p6zR5C3E
o:其他用户(others)。95Please respect copyright.PENANA2YkWnE79ie
a:所有用户(u、g、o)。95Please respect copyright.PENANABLXlTAFYEv
操作符:95Please respect copyright.PENANA5NQjJqBKiY
+:添加权限。95Please respect copyright.PENANAjhrGIfVu58
-:移除权限。95Please respect copyright.PENANAboy1vKOCVM
=:设置权限。95Please respect copyright.PENANALPzxDnJmXl
權限:95Please respect copyright.PENANAiDsLaqu1KX
r(读) = 495Please respect copyright.PENANABHainB0YoO
w(写) = 295Please respect copyright.PENANANUUB31AHH9
x(执行) = 195Please respect copyright.PENANAzV8cRPFxGa
-(无权限) = 095Please respect copyright.PENANAFroXY2fFwg
通过加法得到最终的权限值。例如:95Please respect copyright.PENANAIc5n4OpsIe
7 = rwx(4 + 2 + 1)95Please respect copyright.PENANA69HuFWSsvz
5 = r-x(4 + 1)95Please respect copyright.PENANA1DHYKhTLAT
6 = rw-(4 + 2)95Please respect copyright.PENANANkukYXq8xP
95Please respect copyright.PENANAe04C6iQlFv
I. 创建自定义命令
# nano ~/.bash_aliases95Please respect copyright.PENANAol9nFMygAf
添加alias, 比如:95Please respect copyright.PENANAPbf1StyVY2
alias gitbuda='gitbuda() { git add -A; git commit -m "$1"; git push; }; gitbuda'95Please respect copyright.PENANA8RyACLhwrj
其中$1表示命令的第一个参数,这样就可以用 gitbuda "commit message"来运行命令95Please respect copyright.PENANAglxeE7i1cJ
# source ~/.bash_aliases
Section X. Thanks
https://ubuntu.com
95Please respect copyright.PENANA3CSPaD2pvV
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]95Please respect copyright.PENANATpWLSnKor1
如果您发现本文有任何错误,或者对本文有好的建议,欢迎与我联系探讨,我的微信: si_jinmin, 我的email: [email protected]
如果您對C/C++ programming, Linux, website development, Vue, Git, vscode感興趣,邀請您加入「Linux/C/C++ Website Development」微信群,請加我的微信(si_jinmin)以便拉您进群。
ns3.144.97.63da2