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"
安装启动盘制作软件rufus102Please respect copyright.PENANAY7ShAbQIKL
https://github.com/pbatard/rufus/releases/download/v4.5/rufus-4.5.exe102Please respect copyright.PENANAclUVxa8lsI
U盘的容量必须大于7G,在rufus中选择U盘, iso文件,MBR分区类型,NTFS文件格式,点击开始,选择以ISO镜像模式写入。
官方参考资料:102Please respect copyright.PENANAiekOSNW92U
https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview
102Please respect copyright.PENANAfcXw7IQAAs
B. 安装ubuntu
从U盘启动电脑102Please respect copyright.PENANApyFjphLcWR
try or install ubuntu102Please respect copyright.PENANA01vsQrXgeS
choose your language: english102Please respect copyright.PENANAPQOiQ80c1S
accessibility in ubuntu: next102Please respect copyright.PENANAEeTis7m0Ta
select your keyboard layout: english(US)102Please respect copyright.PENANAxZaUAPVTQq
connect to the internet: connect to a wi-fi network102Please respect copyright.PENANA7hmQaTBJug
install ubuntu102Please respect copyright.PENANAxHJxK9n2S8
interactive installation102Please respect copyright.PENANAeekJuPouVK
extended selection102Please respect copyright.PENANAxiLzmAw1Ni
check: install third-party software for graphics and wi-fi hardware102Please respect copyright.PENANAbA1bIFfrau
check: download and install support for additional media formats102Please respect copyright.PENANAeAMAdpmkeC
erase disk and install ubuntu102Please respect copyright.PENANAfhpLkvikRR
choose sdb102Please respect copyright.PENANAxY2azRQrxr
your name: buda 102Please respect copyright.PENANASLPmMr8wQW
your computer's name: vultr102Please respect copyright.PENANAmL6OyFwovh
your username: buda 102Please respect copyright.PENANATHxuGqbe7Q
timezone: shanghai102Please respect copyright.PENANANrZIPzdw94
install102Please respect copyright.PENANAWZLarMqejz
restart now102Please respect copyright.PENANANOKaayjjsI
拔出U盘, 按enter键
102Please respect copyright.PENANARg1hLfXMJ8
C. 初始化設置
点击左下角ubuntu图标进入开始菜单,将terminal pin to dash102Please respect copyright.PENANAH9WsHFzmH0
# sudo apt update && sudo apt upgrade -y
安装常用工具, 開發编译环境102Please respect copyright.PENANApXuYqSQHDz
# sudo apt install nano net-tools build-essential gdb git glibc-source unzip openssl libssl-dev libzip-dev aria2 lsof102Please respect copyright.PENANAHIl9Py5ltJ
# cd /usr/src/glibc102Please respect copyright.PENANAfgZykTBhXg
# tar xvf glibc-2.39.tar.xz102Please respect copyright.PENANAASbTz0f4VT
在gdb中指定glibc的源代碼:102Please respect copyright.PENANAfXjwrISokv
gdb> directory /usr/src/glibc/glibc-2.39
將用戶加入root組102Please respect copyright.PENANAZt7cCrzQV3
# usermod -a -G root buda102Please respect copyright.PENANAvPLUykBqrC
# groups buda
黑屏时间设置:15分钟无操作后黑屏102Please respect copyright.PENANAmGEMURzEPK
点左下角进入开始菜单, search "power", click " (settings) Power" blank screen: 15 mins
apt search rethinkdb102Please respect copyright.PENANAFlrTUTPW2t
apt show rethinkdb102Please respect copyright.PENANAFKDj0aDUur
apt remove rethinkdb102Please respect copyright.PENANAoZRAuPke3k
cd /etc/apt/sources.list.d/ #进入PPA源文件所在目录102Please respect copyright.PENANA1aIQk29ZIm
sudo rm XXX.list #删除一个PPA源list文件102Please respect copyright.PENANA6FOWGDKxtL
sudo apt update
102Please respect copyright.PENANAleaUSpDfV6
D. 安裝中文輸入法rime
# sudo apt install ibus-rime rime-data-luna-pinyin102Please respect copyright.PENANA6bZWwvDQsp
点击左下角进入开始菜单,选择settings, keyboard,+ add input source...,others, chinese(rime)102Please respect copyright.PENANATi8NK6Ubal
点击chinese(rime)右边的小竖点,move up,将chinese(rime)移到Input Sources列表的第一行102Please respect copyright.PENANAuoXGiIoLLB
编辑配置文件102Please respect copyright.PENANAWkhcsXNPed
一次显示9个候选词、模糊音102Please respect copyright.PENANAw48qTUnRN5
# nano ~/.config/ibus/rime/default.custom.yaml102Please respect copyright.PENANAs0UjrFqWAw
---------default.custom.yaml的内容如下-----------102Please respect copyright.PENANAWRNw1hNjPO
patch:102Please respect copyright.PENANAP6grDg1KP9
"menu/page_size": 9
'speller/algebra':102Please respect copyright.PENANAHdTfxaprmE
- erase/^xx$/ # 第一行保留
# 模糊音定義102Please respect copyright.PENANAaNXebtdF1s
- derive/^([zcs])h/$1/ # zh, ch, sh => z, c, s102Please respect copyright.PENANAGVfB5hxFbq
- derive/^([zcs])([^h])/$1h$2/ # z, c, s => zh, ch, sh
- derive/^n/l/ # n => l102Please respect copyright.PENANA8D2gSlvSVV
- derive/^l/n/ # l => n
- derive/([ei])n$/$1ng/ # en => eng, in => ing102Please respect copyright.PENANA76KBF9SNLr
- derive/([ei])ng$/$1n/ # eng => en, ing => in102Please respect copyright.PENANAnGRRCXMFTn
--------------------------------------------------------------102Please respect copyright.PENANAhG3bG5aqNM
为了使模糊音生效,拷贝配置文件102Please respect copyright.PENANAmm6al4lR77
# cp default.custom.yaml luna_pinyin_simp.custom.yaml && cp default.custom.yaml luna_pinyin.custom.yaml102Please respect copyright.PENANA57LvuSeokv
部署rime输入法:102Please respect copyright.PENANAoLszFrs3bj
# ibus restart102Please respect copyright.PENANArJICdJP01n
# ibus engine rime102Please respect copyright.PENANANPthDhSKJT
在输入时按F4或者Ctrl+\`可弹出菜单,选择菜单上的数字可进行简繁输入转换102Please respect copyright.PENANA9CwWBRNlFP
按shift键进行中英输入转换102Please respect copyright.PENANA0hUlJ6hHTZ
有时候输入法失效时,可以重新运行一下部署rime的命令
参考资料:102Please respect copyright.PENANAEg1leBq1cz
CustomizationGuide · rime/home Wiki · GitHub102Please respect copyright.PENANAF0pVWZoN3m
https://www.cnblogs.com/keatonlao/p/12983158.html
102Please respect copyright.PENANA2hlfINOvjd
E. 安裝重要軟件
从code官网下载deb包,然后安装102Please respect copyright.PENANABqD9eykTma
# sudo apt install ./code_1.90.0-1717531825_amd64.deb
gimp图片编辑器, chromium浏览器102Please respect copyright.PENANAHdTbSrl3w0
从app center安装
墙内安装node/npm102Please respect copyright.PENANAOrKagJAuXY
https://nodejs.org/en/ 下载LTS版本102Please respect copyright.PENANAPKcjsurWMh
# cd ~/Downloads102Please respect copyright.PENANA0SML5zPUAO
# wget https://nodejs.org/dist/v20.15.0/node-v20.15.0-linux-x64.tar.xz102Please respect copyright.PENANAzurklZRbBl
# tar --strip-components 1 -xvf node-v20.15.0-linux-x64.tar.xz -C /usr/local102Please respect copyright.PENANAGqw0UPzWBt
# node -v102Please respect copyright.PENANAhBUjwhNLom
# npm install npm@latest -g102Please respect copyright.PENANA9LyzL22y3h
# npm config get registry102Please respect copyright.PENANA574u020eQ8
# npm config set registry https://registry.npmmirror.com102Please respect copyright.PENANANoXkGDDOAy
如果想用回官方registry:102Please respect copyright.PENANAUYk1DJsvhO
# npm config set registry https://registry.npmjs.org
墙外安装node/npm102Please respect copyright.PENANAijmwSlCsnD
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash102Please respect copyright.PENANAUE6rIlt0wj
# export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"102Please respect copyright.PENANAZ2ARRcs4E2
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm102Please respect copyright.PENANA4MIRwcX6Gk
# nvm install --lts102Please respect copyright.PENANA0XGmlZUjmn
# npm install npm@latest -g
安装102Please respect copyright.PENANAlznFu0B03y
npm i package_name102Please respect copyright.PENANAALNirAmpBY
项目更新102Please respect copyright.PENANAIjiOnYeNYP
npm update
F. 配置服務器連接
1. ssh免密登录Linux服务器
在客户端检查是否存在证书102Please respect copyright.PENANA2TbenjCmgS
# ls -al ~/.ssh/id_*.pub102Please respect copyright.PENANAz1TSdwb8Qu
如果不存在,生成证书102Please respect copyright.PENANA0g6NCfAqy3
# ssh-keygen -t rsa -b 4096 -C "[email protected]"102Please respect copyright.PENANAliK8GQKr14
生成证书的过程中使用空白的 passphrase102Please respect copyright.PENANADLiqA3TjmO
将证书拷贝到服务器102Please respect copyright.PENANAcbG3d18ZzD
# ssh-copy-id root@server
2. 从windows登录linux
如果是从windows系统连接ubuntu,可以安装putty作为访问服务器的终端。 102Please respect copyright.PENANA0w9R63Bvei
下载putty: https://www.putty.org/
putty免密登录Linux服务器的方法
在putty的安装目录找到puttygen.exe,运行生成ssl私钥和公钥,保存私钥到文件,复制公钥。102Please respect copyright.PENANAUidaYw7Fue
在putty的 connection/data 设置登录用户名为root,connection/ssh/auth/credentials中设置私钥的文件,保存设置。102Please respect copyright.PENANAsOOscLv5B9
将公钥写入服务器的 ~/.ssh/authorized_keys 文件中, reboot ubuntu使修改生效102Please respect copyright.PENANAtrwkYhJXvs
# nano ~/.ssh/authorized_keys102Please respect copyright.PENANAC0g49Igroo
# reboot
如果想保持putty与服务器的连接保持不断线,可以在Putty中设置每隔一定的时间发一次心跳消息。
3. 保持与服务器的ssh连接不断线的方法
ssh连接服务器时如果容易断线,可以修改服务器sshd的设置,保持ssh连接不断线:102Please respect copyright.PENANAOmj96beSid
# nano /etc/ssh/sshd_config102Please respect copyright.PENANAloBUe1NhLT
ClientAliveInterval 60 # 表示每60秒发送一次请求,从而保持连接不断线。102Please respect copyright.PENANAkNDLLUbnIM
ClientAliveCountMax 10 # 表示服务器发出请求后客户端没有响应的次数达到10次,就自动断开连接102Please respect copyright.PENANAPYfXLnnFUS
# systemctl restart sshd
4. 從ubuntu remote windows用remmina
從app中心安裝remmina102Please respect copyright.PENANAt5ZxQHGuxS
新建connection到windows
Basic標籤102Please respect copyright.PENANA4SXgvRhGof
server: ip/domain.name, username: Administrator, password: ***102Please respect copyright.PENANA8dBOnw8Pp1
share folder中填寫ubuntu中的路徑,則可從windows訪問102Please respect copyright.PENANA54uyd3ZI70
resolution中可設置合適的屏幕大小
Advanced標籤102Please respect copyright.PENANADnCzRSHNDh
output audio: 選擇local,則是windows發出的聲音
windows server 默認是麼有開啓聲音服務的,要設置一下才能發出聲音:102Please respect copyright.PENANAvzAIGYtp2B
https://cloud.tencent.com/developer/article/1894933
G. 網絡安全設置
防火墙设置102Please respect copyright.PENANA0RDNklHUZ1
# ufw allow 22102Please respect copyright.PENANAdtG03Hi3eV
# ufw allow 80102Please respect copyright.PENANAO0hlFO9UWn
# ufw allow 443102Please respect copyright.PENANAceRAq3XCC7
# ufw enable102Please respect copyright.PENANA25TIG0qPrG
# ufw status
H. 常用命令
创建软链接102Please respect copyright.PENANAtTLitffanl
# sudo ln -s 源文件 目标文件
修改密码102Please respect copyright.PENANAA2ByHy1YY0
# passwd root102Please respect copyright.PENANAZgUoRc4gke
# usermod -a -G groupA username102Please respect copyright.PENANAMG97RmuPN9
# groups username
修改hostname102Please respect copyright.PENANAJ2JDIwsZD7
# hostnamectl set-hostname xiaoyue
查看cpu102Please respect copyright.PENANA9JcqRT7j5r
# lscpu
查看内存102Please respect copyright.PENANAxcAM26rO4k
# free -h102Please respect copyright.PENANAI2OFv7R0Tz
# top
釋放被buff/cache占用的内存102Please respect copyright.PENANAxPSaWKhZQf
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空页面缓存102Please respect copyright.PENANAL1Wde7LRcl
# sync; echo 1 > /proc/sys/vm/drop_caches # 清空目录项缓存102Please respect copyright.PENANAk901akKwnj
# sync; echo 2 > /proc/sys/vm/drop_caches # 清空SLAB缓存102Please respect copyright.PENANAETFl72xdRA
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空所有缓存102Please respect copyright.PENANAKTuy7lYi4C
用sudo执行:102Please respect copyright.PENANAs37g75Tufe
# sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
102Please respect copyright.PENANA0TBGWmdvl3
查看硬盘102Please respect copyright.PENANATPsIOLHQO4
# sudo lshw -c disk102Please respect copyright.PENANAzB1m9HVsl5
查看分区102Please respect copyright.PENANAiIHfasz6JB
# sudo fdisk -l102Please respect copyright.PENANAodAMBdQiUb
查看磁盘剩余空间102Please respect copyright.PENANAgtMm5bAsk2
# df -hl
文件壓縮和打包102Please respect copyright.PENANAgOAw7u27GW
將在windows上壓縮出的zip文件傳遞給Linux系統解壓縮時,文件名會出現亂碼,這是因爲在Windows上文件名的編碼取決於「控制面板-時鐘和區域-區域-管理-非unicode程序語言」中的設置,中國大陸默認是簡體中文,gb2312(cp936)編碼. 而在Linux系統上則統一是utf-8編碼。102Please respect copyright.PENANAHjVvEeT7An
如何解決?最簡單的辦法是在解壓縮的時候說明一下原來的編碼,這樣壓縮工具就會識別出原來的文件名而自動將文件名轉爲utf8編碼, 命令如下:102Please respect copyright.PENANAmRLGguA2Sw
unzip -O cp936 temp.zip
改變文件權限102Please respect copyright.PENANAAbJHSOK5Ki
# chmod g+w <文件/目录路径>102Please respect copyright.PENANAURtde6smpG
# chmod -R g+w /path/to/directory102Please respect copyright.PENANAUndJesgbe5
设置所有者为 rwx,组为 r-x,其他用户为 r--:102Please respect copyright.PENANAoMJNfYVwrN
# chmod 755 <文件/目录路径>
u:所有者(user)。102Please respect copyright.PENANAoOU7qcPUm8
g:所属组(group)。102Please respect copyright.PENANAQmxKp1fzmY
o:其他用户(others)。102Please respect copyright.PENANAfDp9gOZkSt
a:所有用户(u、g、o)。102Please respect copyright.PENANAOoWBJo3QqO
操作符:102Please respect copyright.PENANA1hDnapB2wV
+:添加权限。102Please respect copyright.PENANAkC78EEfhl4
-:移除权限。102Please respect copyright.PENANAOV5v498OOt
=:设置权限。102Please respect copyright.PENANAHqhhyzDk8M
權限:102Please respect copyright.PENANA708UjE3udf
r(读) = 4102Please respect copyright.PENANA4PJGpcj8DA
w(写) = 2102Please respect copyright.PENANAiM3nKD1Hh5
x(执行) = 1102Please respect copyright.PENANANVGNU1TBbr
-(无权限) = 0102Please respect copyright.PENANA1r3ZYH1Bns
通过加法得到最终的权限值。例如:102Please respect copyright.PENANALdB7FyblH8
7 = rwx(4 + 2 + 1)102Please respect copyright.PENANAqSIGjeTjkr
5 = r-x(4 + 1)102Please respect copyright.PENANAEHVtfI31C3
6 = rw-(4 + 2)102Please respect copyright.PENANAzDI83SWB61
102Please respect copyright.PENANAj4ReVKS2Wg
I. 创建自定义命令
# nano ~/.bash_aliases102Please respect copyright.PENANA3bpI4VmIJh
添加alias, 比如:102Please respect copyright.PENANA1hvh1kEBMZ
alias gitbuda='gitbuda() { git add -A; git commit -m "$1"; git push; }; gitbuda'102Please respect copyright.PENANAYK0bwkIsrX
其中$1表示命令的第一个参数,这样就可以用 gitbuda "commit message"来运行命令102Please respect copyright.PENANAN5U35ebS5J
# source ~/.bash_aliases
Section X. Thanks
https://ubuntu.com
102Please respect copyright.PENANA74v3JFigTE
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]102Please respect copyright.PENANAnEWoCJRTem
如果您发现本文有任何错误,或者对本文有好的建议,欢迎与我联系探讨,我的微信: si_jinmin, 我的email: [email protected]
如果您對C/C++ programming, Linux, website development, Vue, Git, vscode感興趣,邀請您加入「Linux/C/C++ Website Development」微信群,請加我的微信(si_jinmin)以便拉您进群。
ns3.144.101.71da2