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"
安装启动盘制作软件rufus57Please respect copyright.PENANAnPaXCsaGDJ
https://github.com/pbatard/rufus/releases/download/v4.5/rufus-4.5.exe57Please respect copyright.PENANAgksDHbfkXi
U盘的容量必须大于7G,在rufus中选择U盘, iso文件,MBR分区类型,NTFS文件格式,点击开始,选择以ISO镜像模式写入。
官方参考资料:57Please respect copyright.PENANAcIqw4pnbzb
https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview
57Please respect copyright.PENANAhQPM2k4nPa
B. 安装ubuntu
从U盘启动电脑57Please respect copyright.PENANA93qj4i4Bpe
try or install ubuntu57Please respect copyright.PENANADkgAs0fkWv
choose your language: english57Please respect copyright.PENANARgGbRI0ryO
accessibility in ubuntu: next57Please respect copyright.PENANAoeQj09v712
select your keyboard layout: english(US)57Please respect copyright.PENANAJCOiaWcyym
connect to the internet: connect to a wi-fi network57Please respect copyright.PENANA7ZVJ7Pydrh
install ubuntu57Please respect copyright.PENANAZCsxFJFJ7A
interactive installation57Please respect copyright.PENANArFYkVppW3h
extended selection57Please respect copyright.PENANAisgzIJpAlf
check: install third-party software for graphics and wi-fi hardware57Please respect copyright.PENANAooCeplHOLZ
check: download and install support for additional media formats57Please respect copyright.PENANA6srZ8svLWt
erase disk and install ubuntu57Please respect copyright.PENANAC98O1rAfwp
choose sdb57Please respect copyright.PENANAkKKSEjOX8s
your name: buda 57Please respect copyright.PENANAq4OyRTkta3
your computer's name: vultr57Please respect copyright.PENANAb9mjIGbOCl
your username: buda 57Please respect copyright.PENANAJdpSMrwCwd
timezone: shanghai57Please respect copyright.PENANAhKSrGhacKm
install57Please respect copyright.PENANArZdOvNSYnl
restart now57Please respect copyright.PENANAqTKuTiiwBS
拔出U盘, 按enter键
57Please respect copyright.PENANAHsdHAVKaU5
C. 初始化設置
点击左下角ubuntu图标进入开始菜单,将terminal pin to dash57Please respect copyright.PENANAd48rL02Zmt
# sudo apt update && sudo apt upgrade -y
安装常用工具, 開發编译环境57Please respect copyright.PENANADC1XIK4LG9
# sudo apt install nano net-tools build-essential gdb git glibc-source unzip openssl libssl-dev libzip-dev aria2 lsof57Please respect copyright.PENANAhWmRZ4U2XI
# cd /usr/src/glibc57Please respect copyright.PENANAIfoUrtdMBs
# tar xvf glibc-2.39.tar.xz57Please respect copyright.PENANApJ43LOtjC3
在gdb中指定glibc的源代碼:57Please respect copyright.PENANAGFTPoVf7jR
gdb> directory /usr/src/glibc/glibc-2.39
將用戶加入root組57Please respect copyright.PENANACIJgZupqZn
# usermod -a -G root buda57Please respect copyright.PENANA3UBFsHd4O9
# groups buda
黑屏时间设置:15分钟无操作后黑屏57Please respect copyright.PENANAhRZUBdIj3M
点左下角进入开始菜单, search "power", click " (settings) Power" blank screen: 15 mins
apt search rethinkdb57Please respect copyright.PENANAhl3xlLx7pq
apt show rethinkdb57Please respect copyright.PENANAc5hcdu4v5M
apt remove rethinkdb57Please respect copyright.PENANA5zP6QjXRvG
cd /etc/apt/sources.list.d/ #进入PPA源文件所在目录57Please respect copyright.PENANAmkct4emziu
sudo rm XXX.list #删除一个PPA源list文件57Please respect copyright.PENANAstJlQfkej0
sudo apt update
57Please respect copyright.PENANAehhMeEvqWW
D. 安裝中文輸入法rime
# sudo apt install ibus-rime rime-data-luna-pinyin57Please respect copyright.PENANALeWwbvPMnL
点击左下角进入开始菜单,选择settings, keyboard,+ add input source...,others, chinese(rime)57Please respect copyright.PENANApt4Jnl7vzv
点击chinese(rime)右边的小竖点,move up,将chinese(rime)移到Input Sources列表的第一行57Please respect copyright.PENANAAuJyxNXdhr
编辑配置文件57Please respect copyright.PENANAxMSbe5tFYN
一次显示9个候选词、模糊音57Please respect copyright.PENANAkzuJHZeu1r
# nano ~/.config/ibus/rime/default.custom.yaml57Please respect copyright.PENANAcZKMVXI8Db
---------default.custom.yaml的内容如下-----------57Please respect copyright.PENANAtvIFJFkB2N
patch:57Please respect copyright.PENANAljDbcSk8Eu
"menu/page_size": 9
'speller/algebra':57Please respect copyright.PENANAXaoapwoiuV
- erase/^xx$/ # 第一行保留
# 模糊音定義57Please respect copyright.PENANAeoqC9Chqgi
- derive/^([zcs])h/$1/ # zh, ch, sh => z, c, s57Please respect copyright.PENANAFvGmhob6Xr
- derive/^([zcs])([^h])/$1h$2/ # z, c, s => zh, ch, sh
- derive/^n/l/ # n => l57Please respect copyright.PENANAMqzUd3AYfy
- derive/^l/n/ # l => n
- derive/([ei])n$/$1ng/ # en => eng, in => ing57Please respect copyright.PENANAc22X8EqR5j
- derive/([ei])ng$/$1n/ # eng => en, ing => in57Please respect copyright.PENANATS1HhPb6aK
--------------------------------------------------------------57Please respect copyright.PENANAH7Ak5Ab72w
为了使模糊音生效,拷贝配置文件57Please respect copyright.PENANAMHuVHMbLaJ
# cp default.custom.yaml luna_pinyin_simp.custom.yaml && cp default.custom.yaml luna_pinyin.custom.yaml57Please respect copyright.PENANAbTxTKxGwwz
部署rime输入法:57Please respect copyright.PENANAOlbceXUsED
# ibus restart57Please respect copyright.PENANAoPrJKYgT8D
# ibus engine rime57Please respect copyright.PENANArhlMSQl9nv
在输入时按F4或者Ctrl+\`可弹出菜单,选择菜单上的数字可进行简繁输入转换57Please respect copyright.PENANAOMa2i62iAe
按shift键进行中英输入转换57Please respect copyright.PENANAjR04v3p3Gl
有时候输入法失效时,可以重新运行一下部署rime的命令
参考资料:57Please respect copyright.PENANAoprMbNL4UU
CustomizationGuide · rime/home Wiki · GitHub57Please respect copyright.PENANAOvyL5ae87y
https://www.cnblogs.com/keatonlao/p/12983158.html
57Please respect copyright.PENANA5eZnsraLLj
E. 安裝重要軟件
从code官网下载deb包,然后安装57Please respect copyright.PENANAIbWcHbENXz
# sudo apt install ./code_1.90.0-1717531825_amd64.deb
gimp图片编辑器, chromium浏览器57Please respect copyright.PENANA3gwuEqKhGQ
从app center安装
墙内安装node/npm57Please respect copyright.PENANAEKVtJLYjub
https://nodejs.org/en/ 下载LTS版本57Please respect copyright.PENANAekugMlcoDu
# cd ~/Downloads57Please respect copyright.PENANAnXwbuSf2K2
# wget https://nodejs.org/dist/v20.15.0/node-v20.15.0-linux-x64.tar.xz57Please respect copyright.PENANAL3C4eHrwM8
# tar --strip-components 1 -xvf node-v20.15.0-linux-x64.tar.xz -C /usr/local57Please respect copyright.PENANAQVOXRVRHAm
# node -v57Please respect copyright.PENANACs3ew8enWB
# npm install npm@latest -g57Please respect copyright.PENANAE1rzjAWxJw
# npm config get registry57Please respect copyright.PENANAbIimev1b8T
# npm config set registry https://registry.npmmirror.com57Please respect copyright.PENANAgsJqAQYpr9
如果想用回官方registry:57Please respect copyright.PENANAlApa9UX9gU
# npm config set registry https://registry.npmjs.org
墙外安装node/npm57Please respect copyright.PENANA6sLjV05HqK
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash57Please respect copyright.PENANAkZptUDxsG7
# export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"57Please respect copyright.PENANAn19XETBP1V
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm57Please respect copyright.PENANAJQ9uYMHj3c
# nvm install --lts57Please respect copyright.PENANAI4AZolBo9J
# npm install npm@latest -g
安装57Please respect copyright.PENANAAtHshK6nLU
npm i package_name57Please respect copyright.PENANAu5UKkITEtM
项目更新57Please respect copyright.PENANAtuuQNl2et9
npm update
F. 配置服務器連接
1. ssh免密登录Linux服务器
在客户端检查是否存在证书57Please respect copyright.PENANAk8ODGcWMdU
# ls -al ~/.ssh/id_*.pub57Please respect copyright.PENANAmvo15icVaR
如果不存在,生成证书57Please respect copyright.PENANAkd8OXMgfdP
# ssh-keygen -t rsa -b 4096 -C "jinmin.si@outlook.com"57Please respect copyright.PENANA8Mx3xAS2iF
生成证书的过程中使用空白的 passphrase57Please respect copyright.PENANAHTCAwlcssc
将证书拷贝到服务器57Please respect copyright.PENANAeWtJiZwrBM
# ssh-copy-id root@server
2. 从windows登录linux
如果是从windows系统连接ubuntu,可以安装putty作为访问服务器的终端。 57Please respect copyright.PENANAkooFc9NaZb
下载putty: https://www.putty.org/
putty免密登录Linux服务器的方法
在putty的安装目录找到puttygen.exe,运行生成ssl私钥和公钥,保存私钥到文件,复制公钥。57Please respect copyright.PENANAX8b6EhBaqc
在putty的 connection/data 设置登录用户名为root,connection/ssh/auth/credentials中设置私钥的文件,保存设置。57Please respect copyright.PENANAbePkenZ4wc
将公钥写入服务器的 ~/.ssh/authorized_keys 文件中, reboot ubuntu使修改生效57Please respect copyright.PENANACCrNGMgNmK
# nano ~/.ssh/authorized_keys57Please respect copyright.PENANAWeO79m1rg3
# reboot
如果想保持putty与服务器的连接保持不断线,可以在Putty中设置每隔一定的时间发一次心跳消息。
3. 保持与服务器的ssh连接不断线的方法
ssh连接服务器时如果容易断线,可以修改服务器sshd的设置,保持ssh连接不断线:57Please respect copyright.PENANAAoDPr0a9p2
# nano /etc/ssh/sshd_config57Please respect copyright.PENANAaBrX7q3PEw
ClientAliveInterval 60 # 表示每60秒发送一次请求,从而保持连接不断线。57Please respect copyright.PENANA7umXeDRHhp
ClientAliveCountMax 10 # 表示服务器发出请求后客户端没有响应的次数达到10次,就自动断开连接57Please respect copyright.PENANAWICONXXI2f
# systemctl restart sshd
4. 從ubuntu remote windows用remmina
從app中心安裝remmina57Please respect copyright.PENANA0qQRNvHJyM
新建connection到windows
Basic標籤57Please respect copyright.PENANASMMfTrnI7l
server: ip/domain.name, username: Administrator, password: ***57Please respect copyright.PENANACfRtoWFekN
share folder中填寫ubuntu中的路徑,則可從windows訪問57Please respect copyright.PENANAbJjDyBMP0J
resolution中可設置合適的屏幕大小
Advanced標籤57Please respect copyright.PENANAiNXjHJ09Oj
output audio: 選擇local,則是windows發出的聲音
windows server 默認是麼有開啓聲音服務的,要設置一下才能發出聲音:57Please respect copyright.PENANAL4nXSKqkJU
https://cloud.tencent.com/developer/article/1894933
G. 網絡安全設置
防火墙设置57Please respect copyright.PENANAywQTvIWgKz
# ufw allow 2257Please respect copyright.PENANA5ANq9HKJeW
# ufw allow 8057Please respect copyright.PENANAzk8Pb67XDp
# ufw allow 44357Please respect copyright.PENANABRJdgLULkX
# ufw enable57Please respect copyright.PENANAfIXy6Nn3dw
# ufw status
H. 常用命令
创建软链接57Please respect copyright.PENANAZ7unBK7IoX
# sudo ln -s 源文件 目标文件
修改密码57Please respect copyright.PENANAFGu8OLT0pn
# passwd root57Please respect copyright.PENANAR30tgwXYXu
# usermod -a -G groupA username57Please respect copyright.PENANAZ7fbMbyxeZ
# groups username
修改hostname57Please respect copyright.PENANA8kI8uI9u2N
# hostnamectl set-hostname xiaoyue
查看cpu57Please respect copyright.PENANARy2O5rzpYn
# lscpu
查看内存57Please respect copyright.PENANAjpcRGtJZBt
# free -h57Please respect copyright.PENANAgcEACbFlox
# top
釋放被buff/cache占用的内存57Please respect copyright.PENANAV7eBiA7YHm
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空页面缓存57Please respect copyright.PENANAATLzk8ND1e
# sync; echo 1 > /proc/sys/vm/drop_caches # 清空目录项缓存57Please respect copyright.PENANAjiyITZ8k23
# sync; echo 2 > /proc/sys/vm/drop_caches # 清空SLAB缓存57Please respect copyright.PENANA7bhluIK9Tq
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空所有缓存57Please respect copyright.PENANAameueZ714X
用sudo执行:57Please respect copyright.PENANAIPJMmPiOM4
# sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
57Please respect copyright.PENANAlJnp7QhVMM
查看硬盘57Please respect copyright.PENANAhFpXzhwkPw
# sudo lshw -c disk57Please respect copyright.PENANAJCqOWBNsZm
查看分区57Please respect copyright.PENANA435uOKSM7u
# sudo fdisk -l57Please respect copyright.PENANAq6H3Zkka7w
查看磁盘剩余空间57Please respect copyright.PENANAIAMPVOG0FJ
# df -hl
文件壓縮和打包57Please respect copyright.PENANADtq16h9w1n
將在windows上壓縮出的zip文件傳遞給Linux系統解壓縮時,文件名會出現亂碼,這是因爲在Windows上文件名的編碼取決於「控制面板-時鐘和區域-區域-管理-非unicode程序語言」中的設置,中國大陸默認是簡體中文,gb2312(cp936)編碼. 而在Linux系統上則統一是utf-8編碼。57Please respect copyright.PENANA2uf1OzWrhX
如何解決?最簡單的辦法是在解壓縮的時候說明一下原來的編碼,這樣壓縮工具就會識別出原來的文件名而自動將文件名轉爲utf8編碼, 命令如下:57Please respect copyright.PENANAhG1NVfuZjt
unzip -O cp936 temp.zip
改變文件權限57Please respect copyright.PENANAacAU627nPF
# chmod g+w <文件/目录路径>57Please respect copyright.PENANADXsodQlJYE
# chmod -R g+w /path/to/directory57Please respect copyright.PENANAUIXa35z5wm
设置所有者为 rwx,组为 r-x,其他用户为 r--:57Please respect copyright.PENANAenPXj3U0Qq
# chmod 755 <文件/目录路径>
u:所有者(user)。57Please respect copyright.PENANA2OI9CKzbma
g:所属组(group)。57Please respect copyright.PENANAEWTCHwYVOd
o:其他用户(others)。57Please respect copyright.PENANAdBa9nVTqGk
a:所有用户(u、g、o)。57Please respect copyright.PENANAZqADExzVaE
操作符:57Please respect copyright.PENANAZiDSsiVTxx
+:添加权限。57Please respect copyright.PENANAHqcxnARVZb
-:移除权限。57Please respect copyright.PENANApRPJK4KeoN
=:设置权限。57Please respect copyright.PENANACWMv4rHczZ
權限:57Please respect copyright.PENANAVW9SWbSATu
r(读) = 457Please respect copyright.PENANAdOzLi4tN6q
w(写) = 257Please respect copyright.PENANAHDwWIDTBx3
x(执行) = 157Please respect copyright.PENANA4J6eWJNIvx
-(无权限) = 057Please respect copyright.PENANAm4MOd108rG
通过加法得到最终的权限值。例如:57Please respect copyright.PENANAH1u2GGwtN9
7 = rwx(4 + 2 + 1)57Please respect copyright.PENANA7CEJHC0Zwd
5 = r-x(4 + 1)57Please respect copyright.PENANAyrQ1PlCQqW
6 = rw-(4 + 2)57Please respect copyright.PENANA9HIerK6h1v
57Please respect copyright.PENANAstdBytkYYT
I. 创建自定义命令
# nano ~/.bash_aliases57Please respect copyright.PENANAYpMiyFbRdK
添加alias, 比如:57Please respect copyright.PENANAKJ6FwAUAhW
alias gitbuda='gitbuda() { git add -A; git commit -m "$1"; git push; }; gitbuda'57Please respect copyright.PENANAiKX88dAC90
其中$1表示命令的第一个参数,这样就可以用 gitbuda "commit message"来运行命令57Please respect copyright.PENANAgmSH7sWyj0
# source ~/.bash_aliases
Section X. Thanks
https://ubuntu.com
57Please respect copyright.PENANAykMlgjNi9k
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.com57Please respect copyright.PENANAZNgvPY8syk
如果您发现本文有任何错误,或者对本文有好的建议,欢迎与我联系探讨,我的微信: 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.6da2