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"
安装启动盘制作软件rufus97Please respect copyright.PENANA7hfKMSTfBR
https://github.com/pbatard/rufus/releases/download/v4.5/rufus-4.5.exe97Please respect copyright.PENANAFBDXiiPtrB
U盘的容量必须大于7G,在rufus中选择U盘, iso文件,MBR分区类型,NTFS文件格式,点击开始,选择以ISO镜像模式写入。
官方参考资料:97Please respect copyright.PENANAvk2f9mbGAv
https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview
97Please respect copyright.PENANAV5kPFdoOX7
B. 安装ubuntu
从U盘启动电脑97Please respect copyright.PENANA0o5ZdeL8mi
try or install ubuntu97Please respect copyright.PENANAO3DxRnCeCD
choose your language: english97Please respect copyright.PENANAuIK05Ktm45
accessibility in ubuntu: next97Please respect copyright.PENANABdf3M2TgpR
select your keyboard layout: english(US)97Please respect copyright.PENANAPmgHOJEPdp
connect to the internet: connect to a wi-fi network97Please respect copyright.PENANAnAmnLLQgLH
install ubuntu97Please respect copyright.PENANAg3xPWMraDO
interactive installation97Please respect copyright.PENANAiF2RvXsC3v
extended selection97Please respect copyright.PENANAtevpbI5yxy
check: install third-party software for graphics and wi-fi hardware97Please respect copyright.PENANA54iCDxi0eT
check: download and install support for additional media formats97Please respect copyright.PENANARx7jnhkefB
erase disk and install ubuntu97Please respect copyright.PENANAbwTGjCSKbg
choose sdb97Please respect copyright.PENANAJufEv7X4KV
your name: buda 97Please respect copyright.PENANAZu5z989i5e
your computer's name: vultr97Please respect copyright.PENANAafTzGcpFF4
your username: buda 97Please respect copyright.PENANAKjQOgz0nsV
timezone: shanghai97Please respect copyright.PENANASYsZTVw9GQ
install97Please respect copyright.PENANAcCnxnFYgop
restart now97Please respect copyright.PENANAd8JR6yGDNC
拔出U盘, 按enter键
97Please respect copyright.PENANAV1YQd9c7ZI
C. 初始化設置
点击左下角ubuntu图标进入开始菜单,将terminal pin to dash97Please respect copyright.PENANAvekxN7sZIy
# sudo apt update && sudo apt upgrade -y
安装常用工具, 開發编译环境97Please respect copyright.PENANAuFN1RjcF0P
# sudo apt install nano net-tools build-essential gdb git glibc-source unzip openssl libssl-dev libzip-dev aria2 lsof97Please respect copyright.PENANAjOYgUhwjyW
# cd /usr/src/glibc97Please respect copyright.PENANAYFtZZKMq8G
# tar xvf glibc-2.39.tar.xz97Please respect copyright.PENANADjTlQEi3u7
在gdb中指定glibc的源代碼:97Please respect copyright.PENANAJIgE8D9kKI
gdb> directory /usr/src/glibc/glibc-2.39
將用戶加入root組97Please respect copyright.PENANAvmlZB4fGOo
# usermod -a -G root buda97Please respect copyright.PENANAA9MnbM3Gm1
# groups buda
黑屏时间设置:15分钟无操作后黑屏97Please respect copyright.PENANAx9uCZZQySg
点左下角进入开始菜单, search "power", click " (settings) Power" blank screen: 15 mins
apt search rethinkdb97Please respect copyright.PENANATrQAbxqMtA
apt show rethinkdb97Please respect copyright.PENANAaYwJqLWaSY
apt remove rethinkdb97Please respect copyright.PENANAB02SdG0xyw
cd /etc/apt/sources.list.d/ #进入PPA源文件所在目录97Please respect copyright.PENANAOg7BosBL2m
sudo rm XXX.list #删除一个PPA源list文件97Please respect copyright.PENANAavRKhXISD3
sudo apt update
97Please respect copyright.PENANABBMIOTJNjt
D. 安裝中文輸入法rime
# sudo apt install ibus-rime rime-data-luna-pinyin97Please respect copyright.PENANAGfwKxsquHs
点击左下角进入开始菜单,选择settings, keyboard,+ add input source...,others, chinese(rime)97Please respect copyright.PENANAW5N6Mz3FuJ
点击chinese(rime)右边的小竖点,move up,将chinese(rime)移到Input Sources列表的第一行97Please respect copyright.PENANAL012AMBDne
编辑配置文件97Please respect copyright.PENANAyF1YfMrsK1
一次显示9个候选词、模糊音97Please respect copyright.PENANAbGUqRCKPvN
# nano ~/.config/ibus/rime/default.custom.yaml97Please respect copyright.PENANAVO0mb34SQm
---------default.custom.yaml的内容如下-----------97Please respect copyright.PENANATXs8IBdibR
patch:97Please respect copyright.PENANAgiq7KTNYdU
"menu/page_size": 9
'speller/algebra':97Please respect copyright.PENANAvEXrON7ncv
- erase/^xx$/ # 第一行保留
# 模糊音定義97Please respect copyright.PENANAWEBo3lDBkd
- derive/^([zcs])h/$1/ # zh, ch, sh => z, c, s97Please respect copyright.PENANA4sLPZ5t5Wi
- derive/^([zcs])([^h])/$1h$2/ # z, c, s => zh, ch, sh
- derive/^n/l/ # n => l97Please respect copyright.PENANALaCISd3rYw
- derive/^l/n/ # l => n
- derive/([ei])n$/$1ng/ # en => eng, in => ing97Please respect copyright.PENANAT8u03AlOS2
- derive/([ei])ng$/$1n/ # eng => en, ing => in97Please respect copyright.PENANAlvPfD9IN2O
--------------------------------------------------------------97Please respect copyright.PENANA39bAz4JNtC
为了使模糊音生效,拷贝配置文件97Please respect copyright.PENANAjNW19JL932
# cp default.custom.yaml luna_pinyin_simp.custom.yaml && cp default.custom.yaml luna_pinyin.custom.yaml97Please respect copyright.PENANAaYoQ9ZCN8T
部署rime输入法:97Please respect copyright.PENANAF4t2aHhAlI
# ibus restart97Please respect copyright.PENANACYs5eVL4AH
# ibus engine rime97Please respect copyright.PENANAeCagITvos7
在输入时按F4或者Ctrl+\`可弹出菜单,选择菜单上的数字可进行简繁输入转换97Please respect copyright.PENANAQVtmf6jf0z
按shift键进行中英输入转换97Please respect copyright.PENANAsBGdC0oYzc
有时候输入法失效时,可以重新运行一下部署rime的命令
参考资料:97Please respect copyright.PENANAGsfaceTN0G
CustomizationGuide · rime/home Wiki · GitHub97Please respect copyright.PENANAVwOSzoBxGO
https://www.cnblogs.com/keatonlao/p/12983158.html
97Please respect copyright.PENANAeWGat68RxW
E. 安裝重要軟件
从code官网下载deb包,然后安装97Please respect copyright.PENANAzXmik2odvw
# sudo apt install ./code_1.90.0-1717531825_amd64.deb
gimp图片编辑器, chromium浏览器97Please respect copyright.PENANAHEsBY1ghT0
从app center安装
墙内安装node/npm97Please respect copyright.PENANAd4JRg0dq9m
https://nodejs.org/en/ 下载LTS版本97Please respect copyright.PENANA8ZtZhL3QVe
# cd ~/Downloads97Please respect copyright.PENANAZpCLcqHbqj
# wget https://nodejs.org/dist/v20.15.0/node-v20.15.0-linux-x64.tar.xz97Please respect copyright.PENANAYxcX6fZVxM
# tar --strip-components 1 -xvf node-v20.15.0-linux-x64.tar.xz -C /usr/local97Please respect copyright.PENANAZWzHQKTrY5
# node -v97Please respect copyright.PENANAnG0PWHXbsj
# npm install npm@latest -g97Please respect copyright.PENANAhcGSHjaZX4
# npm config get registry97Please respect copyright.PENANAGArebQet3C
# npm config set registry https://registry.npmmirror.com97Please respect copyright.PENANA0SUJgCpiL7
如果想用回官方registry:97Please respect copyright.PENANAvZkl5HvFhZ
# npm config set registry https://registry.npmjs.org
墙外安装node/npm97Please respect copyright.PENANA0n1NS7BOpa
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash97Please respect copyright.PENANAH6HaYCMPxZ
# export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"97Please respect copyright.PENANAV69EmFwysP
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm97Please respect copyright.PENANAEw5O3nj6p0
# nvm install --lts97Please respect copyright.PENANAwF9dSPBIo4
# npm install npm@latest -g
安装97Please respect copyright.PENANArzowFpoA5q
npm i package_name97Please respect copyright.PENANAbiArxxxVL7
项目更新97Please respect copyright.PENANAh97AuhlHHA
npm update
F. 配置服務器連接
1. ssh免密登录Linux服务器
在客户端检查是否存在证书97Please respect copyright.PENANAaqz3cPLSkd
# ls -al ~/.ssh/id_*.pub97Please respect copyright.PENANAhfu2dhEtg7
如果不存在,生成证书97Please respect copyright.PENANAWyadRnM4t7
# ssh-keygen -t rsa -b 4096 -C "jinmin.si@outlook.com"97Please respect copyright.PENANAblj7xmlWd1
生成证书的过程中使用空白的 passphrase97Please respect copyright.PENANArOWN5ZCphx
将证书拷贝到服务器97Please respect copyright.PENANARBgmHpvbes
# ssh-copy-id root@server
2. 从windows登录linux
如果是从windows系统连接ubuntu,可以安装putty作为访问服务器的终端。 97Please respect copyright.PENANAtaVOGU3YKv
下载putty: https://www.putty.org/
putty免密登录Linux服务器的方法
在putty的安装目录找到puttygen.exe,运行生成ssl私钥和公钥,保存私钥到文件,复制公钥。97Please respect copyright.PENANAgwp372Spn9
在putty的 connection/data 设置登录用户名为root,connection/ssh/auth/credentials中设置私钥的文件,保存设置。97Please respect copyright.PENANAzr94PXZu6X
将公钥写入服务器的 ~/.ssh/authorized_keys 文件中, reboot ubuntu使修改生效97Please respect copyright.PENANAJEdRYxYD6f
# nano ~/.ssh/authorized_keys97Please respect copyright.PENANAJAXdhzuTwd
# reboot
如果想保持putty与服务器的连接保持不断线,可以在Putty中设置每隔一定的时间发一次心跳消息。
3. 保持与服务器的ssh连接不断线的方法
ssh连接服务器时如果容易断线,可以修改服务器sshd的设置,保持ssh连接不断线:97Please respect copyright.PENANAM5mprOMDdx
# nano /etc/ssh/sshd_config97Please respect copyright.PENANAQWIKfdr5lW
ClientAliveInterval 60 # 表示每60秒发送一次请求,从而保持连接不断线。97Please respect copyright.PENANA32dBFVqADZ
ClientAliveCountMax 10 # 表示服务器发出请求后客户端没有响应的次数达到10次,就自动断开连接97Please respect copyright.PENANAz6TQuZejUb
# systemctl restart sshd
4. 從ubuntu remote windows用remmina
從app中心安裝remmina97Please respect copyright.PENANAO4KGhXgRBz
新建connection到windows
Basic標籤97Please respect copyright.PENANAtvF7uHVGVZ
server: ip/domain.name, username: Administrator, password: ***97Please respect copyright.PENANAGzUamxojb7
share folder中填寫ubuntu中的路徑,則可從windows訪問97Please respect copyright.PENANAHI8GioiHoL
resolution中可設置合適的屏幕大小
Advanced標籤97Please respect copyright.PENANACnUheguOey
output audio: 選擇local,則是windows發出的聲音
windows server 默認是麼有開啓聲音服務的,要設置一下才能發出聲音:97Please respect copyright.PENANAnfJGFzrdCE
https://cloud.tencent.com/developer/article/1894933
G. 網絡安全設置
防火墙设置97Please respect copyright.PENANAJzkSrZVpHa
# ufw allow 2297Please respect copyright.PENANA8Mo4Sx7sjN
# ufw allow 8097Please respect copyright.PENANAoKWMluEWDP
# ufw allow 44397Please respect copyright.PENANAwVlgmb84Y3
# ufw enable97Please respect copyright.PENANAqqQjxE4vq1
# ufw status
H. 常用命令
创建软链接97Please respect copyright.PENANA5binOHNhiK
# sudo ln -s 源文件 目标文件
修改密码97Please respect copyright.PENANAwazbkT0pkh
# passwd root97Please respect copyright.PENANAyAQSRJfcTZ
# usermod -a -G groupA username97Please respect copyright.PENANAUaRxtDJp3I
# groups username
修改hostname97Please respect copyright.PENANArPACcVghna
# hostnamectl set-hostname xiaoyue
查看cpu97Please respect copyright.PENANAuwgn7hZwnZ
# lscpu
查看内存97Please respect copyright.PENANAbNcxAmxTZA
# free -h97Please respect copyright.PENANAAeORjNiRI6
# top
釋放被buff/cache占用的内存97Please respect copyright.PENANA9sh6dvTFBS
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空页面缓存97Please respect copyright.PENANA6xUk3UrnlW
# sync; echo 1 > /proc/sys/vm/drop_caches # 清空目录项缓存97Please respect copyright.PENANA8H1MqbvK36
# sync; echo 2 > /proc/sys/vm/drop_caches # 清空SLAB缓存97Please respect copyright.PENANAnOVBBjq4wa
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空所有缓存97Please respect copyright.PENANAPz07OXMdDA
用sudo执行:97Please respect copyright.PENANAF3UlXAQw6f
# sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
97Please respect copyright.PENANAmnycgyw4n8
查看硬盘97Please respect copyright.PENANAMudvuG3gVR
# sudo lshw -c disk97Please respect copyright.PENANADhBzKbO0fU
查看分区97Please respect copyright.PENANAmechm1BqIa
# sudo fdisk -l97Please respect copyright.PENANAd8VThnOBz9
查看磁盘剩余空间97Please respect copyright.PENANAvHxgG1bA0n
# df -hl
文件壓縮和打包97Please respect copyright.PENANARCbAM5dm2U
將在windows上壓縮出的zip文件傳遞給Linux系統解壓縮時,文件名會出現亂碼,這是因爲在Windows上文件名的編碼取決於「控制面板-時鐘和區域-區域-管理-非unicode程序語言」中的設置,中國大陸默認是簡體中文,gb2312(cp936)編碼. 而在Linux系統上則統一是utf-8編碼。97Please respect copyright.PENANAqPTBLKrOK5
如何解決?最簡單的辦法是在解壓縮的時候說明一下原來的編碼,這樣壓縮工具就會識別出原來的文件名而自動將文件名轉爲utf8編碼, 命令如下:97Please respect copyright.PENANAwDZ5rvlC8i
unzip -O cp936 temp.zip
改變文件權限97Please respect copyright.PENANA81QjZkHvNp
# chmod g+w <文件/目录路径>97Please respect copyright.PENANAsElbUrLdaV
# chmod -R g+w /path/to/directory97Please respect copyright.PENANAn7GCTk5sdP
设置所有者为 rwx,组为 r-x,其他用户为 r--:97Please respect copyright.PENANAvlIhjm9Vp3
# chmod 755 <文件/目录路径>
u:所有者(user)。97Please respect copyright.PENANAYOpcPkYBAy
g:所属组(group)。97Please respect copyright.PENANATdjUUGyAI9
o:其他用户(others)。97Please respect copyright.PENANA10KSIgtQWH
a:所有用户(u、g、o)。97Please respect copyright.PENANARcsab4Nv1M
操作符:97Please respect copyright.PENANAzHu3EAoZ5b
+:添加权限。97Please respect copyright.PENANAsvOjBZ7JFi
-:移除权限。97Please respect copyright.PENANAEnEzJmxjaY
=:设置权限。97Please respect copyright.PENANACAmaWcn8JK
權限:97Please respect copyright.PENANACEsPW58qNC
r(读) = 497Please respect copyright.PENANAeylaibRJrz
w(写) = 297Please respect copyright.PENANAg2tVbfSG8x
x(执行) = 197Please respect copyright.PENANAxeuF8dDwGB
-(无权限) = 097Please respect copyright.PENANATflC5anwUo
通过加法得到最终的权限值。例如:97Please respect copyright.PENANAHsTQJ0k876
7 = rwx(4 + 2 + 1)97Please respect copyright.PENANAQABRbmz2tC
5 = r-x(4 + 1)97Please respect copyright.PENANAtQAfO1MYiu
6 = rw-(4 + 2)97Please respect copyright.PENANAx3ACNvPDaX
97Please respect copyright.PENANARyXWcIHs1P
I. 创建自定义命令
# nano ~/.bash_aliases97Please respect copyright.PENANA4V63g6epHk
添加alias, 比如:97Please respect copyright.PENANAieqjssCTfX
alias gitbuda='gitbuda() { git add -A; git commit -m "$1"; git push; }; gitbuda'97Please respect copyright.PENANA7gxcUCJAUh
其中$1表示命令的第一个参数,这样就可以用 gitbuda "commit message"来运行命令97Please respect copyright.PENANAubDannprUw
# source ~/.bash_aliases
Section X. Thanks
https://ubuntu.com
97Please respect copyright.PENANAaB3GNimNXd
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.com97Please respect copyright.PENANA4FyICOdLuF
如果您发现本文有任何错误,或者对本文有好的建议,欢迎与我联系探讨,我的微信: si_jinmin, 我的email: si.jinmin@gmail.com
如果您對C/C++ programming, Linux, website development, Vue, Git, vscode感興趣,邀請您加入「Linux/C/C++ Website Development」微信群,請加我的微信(si_jinmin)以便拉您进群。
ns3.15.5.184da2