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"
安装启动盘制作软件rufus99Please respect copyright.PENANAKMqjHTPESO
https://github.com/pbatard/rufus/releases/download/v4.5/rufus-4.5.exe99Please respect copyright.PENANATQy0rrm4b9
U盘的容量必须大于7G,在rufus中选择U盘, iso文件,MBR分区类型,NTFS文件格式,点击开始,选择以ISO镜像模式写入。
官方参考资料:99Please respect copyright.PENANAknhbMrVjlT
https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview
99Please respect copyright.PENANAUKSdJsjY1i
B. 安装ubuntu
从U盘启动电脑99Please respect copyright.PENANAH5bO9aaQRP
try or install ubuntu99Please respect copyright.PENANAg8FvkMyubf
choose your language: english99Please respect copyright.PENANAU6cj6vyKXW
accessibility in ubuntu: next99Please respect copyright.PENANAVi3zp2S56F
select your keyboard layout: english(US)99Please respect copyright.PENANAS6onEpeZj7
connect to the internet: connect to a wi-fi network99Please respect copyright.PENANAZae3BvLfOi
install ubuntu99Please respect copyright.PENANA2J929koVrw
interactive installation99Please respect copyright.PENANAu1hwSC7XoE
extended selection99Please respect copyright.PENANAuu0NOMliaq
check: install third-party software for graphics and wi-fi hardware99Please respect copyright.PENANA2jnTkOd8CU
check: download and install support for additional media formats99Please respect copyright.PENANAS6K9Bu89Jp
erase disk and install ubuntu99Please respect copyright.PENANAIwDZBvF1KY
choose sdb99Please respect copyright.PENANAdQCrqYJdah
your name: buda 99Please respect copyright.PENANAJLXZw6pWOt
your computer's name: vultr99Please respect copyright.PENANAHq0rQ7LXpd
your username: buda 99Please respect copyright.PENANAXhce7Fzuzb
timezone: shanghai99Please respect copyright.PENANAX9QiC166Eq
install99Please respect copyright.PENANA6GyUo8xmCg
restart now99Please respect copyright.PENANABgHSKqIxJ4
拔出U盘, 按enter键
99Please respect copyright.PENANA7BXLVNFFEG
C. 初始化設置
点击左下角ubuntu图标进入开始菜单,将terminal pin to dash99Please respect copyright.PENANAV4ZkBNq1cV
# sudo apt update && sudo apt upgrade -y
安装常用工具, 開發编译环境99Please respect copyright.PENANA0NJeObE9Qw
# sudo apt install nano net-tools build-essential gdb git glibc-source unzip openssl libssl-dev libzip-dev aria2 lsof99Please respect copyright.PENANAvYtSaOgO8n
# cd /usr/src/glibc99Please respect copyright.PENANAENRMIYSMT0
# tar xvf glibc-2.39.tar.xz99Please respect copyright.PENANA45ucQ5LdW9
在gdb中指定glibc的源代碼:99Please respect copyright.PENANAkgvpClpj9r
gdb> directory /usr/src/glibc/glibc-2.39
將用戶加入root組99Please respect copyright.PENANAcqsfpJnAHN
# usermod -a -G root buda99Please respect copyright.PENANAJOuMFLY5ci
# groups buda
黑屏时间设置:15分钟无操作后黑屏99Please respect copyright.PENANAJL53HiWrXj
点左下角进入开始菜单, search "power", click " (settings) Power" blank screen: 15 mins
apt search rethinkdb99Please respect copyright.PENANAHlhjAzQSam
apt show rethinkdb99Please respect copyright.PENANAPomGn10ihz
apt remove rethinkdb99Please respect copyright.PENANAt0R3bALbwf
cd /etc/apt/sources.list.d/ #进入PPA源文件所在目录99Please respect copyright.PENANAcJ6MW8yj10
sudo rm XXX.list #删除一个PPA源list文件99Please respect copyright.PENANAVJF2pHRGGk
sudo apt update
99Please respect copyright.PENANAxSdPYBpZIf
D. 安裝中文輸入法rime
# sudo apt install ibus-rime rime-data-luna-pinyin99Please respect copyright.PENANAcOwbDW5fBT
点击左下角进入开始菜单,选择settings, keyboard,+ add input source...,others, chinese(rime)99Please respect copyright.PENANAIkbj7YMrir
点击chinese(rime)右边的小竖点,move up,将chinese(rime)移到Input Sources列表的第一行99Please respect copyright.PENANAI9XF7TAXm6
编辑配置文件99Please respect copyright.PENANAXfpZyo2mKh
一次显示9个候选词、模糊音99Please respect copyright.PENANAjAu0PcQlJT
# nano ~/.config/ibus/rime/default.custom.yaml99Please respect copyright.PENANAgahkYxagRX
---------default.custom.yaml的内容如下-----------99Please respect copyright.PENANAjkEsuSwgPR
patch:99Please respect copyright.PENANAULuIunKjye
"menu/page_size": 9
'speller/algebra':99Please respect copyright.PENANAW7hsNmJAQA
- erase/^xx$/ # 第一行保留
# 模糊音定義99Please respect copyright.PENANA3OIYbrvFaZ
- derive/^([zcs])h/$1/ # zh, ch, sh => z, c, s99Please respect copyright.PENANAsEg4aZ9bQk
- derive/^([zcs])([^h])/$1h$2/ # z, c, s => zh, ch, sh
- derive/^n/l/ # n => l99Please respect copyright.PENANAo0nAhiFTpX
- derive/^l/n/ # l => n
- derive/([ei])n$/$1ng/ # en => eng, in => ing99Please respect copyright.PENANA75uQPTqKtf
- derive/([ei])ng$/$1n/ # eng => en, ing => in99Please respect copyright.PENANA5Ltclhc2BJ
--------------------------------------------------------------99Please respect copyright.PENANA9iCi1EbY6q
为了使模糊音生效,拷贝配置文件99Please respect copyright.PENANAbHEIu3aSm9
# cp default.custom.yaml luna_pinyin_simp.custom.yaml && cp default.custom.yaml luna_pinyin.custom.yaml99Please respect copyright.PENANASMLWidaOwv
部署rime输入法:99Please respect copyright.PENANAGhnzMrwnFX
# ibus restart99Please respect copyright.PENANAgApLfBnSOe
# ibus engine rime99Please respect copyright.PENANADYu1MvE9xi
在输入时按F4或者Ctrl+\`可弹出菜单,选择菜单上的数字可进行简繁输入转换99Please respect copyright.PENANA2WeeBY3ZNj
按shift键进行中英输入转换99Please respect copyright.PENANAAJg10pL3L4
有时候输入法失效时,可以重新运行一下部署rime的命令
参考资料:99Please respect copyright.PENANAxDsdTrNgNE
CustomizationGuide · rime/home Wiki · GitHub99Please respect copyright.PENANACNFFDAY4Qj
https://www.cnblogs.com/keatonlao/p/12983158.html
99Please respect copyright.PENANAcmxANt9o1e
E. 安裝重要軟件
从code官网下载deb包,然后安装99Please respect copyright.PENANAjwpaRxI3TP
# sudo apt install ./code_1.90.0-1717531825_amd64.deb
gimp图片编辑器, chromium浏览器99Please respect copyright.PENANAUBlnsogQtp
从app center安装
墙内安装node/npm99Please respect copyright.PENANAs4RXd4fjom
https://nodejs.org/en/ 下载LTS版本99Please respect copyright.PENANA1NrAHJrI7E
# cd ~/Downloads99Please respect copyright.PENANAwNMv7cPw9d
# wget https://nodejs.org/dist/v20.15.0/node-v20.15.0-linux-x64.tar.xz99Please respect copyright.PENANAJyxqNzhFXa
# tar --strip-components 1 -xvf node-v20.15.0-linux-x64.tar.xz -C /usr/local99Please respect copyright.PENANAZPPBCVw6CE
# node -v99Please respect copyright.PENANAPxtgh4qWGR
# npm install npm@latest -g99Please respect copyright.PENANArdcxBawDxu
# npm config get registry99Please respect copyright.PENANAisXGVEdDgQ
# npm config set registry https://registry.npmmirror.com99Please respect copyright.PENANAUk4vxuKYkZ
如果想用回官方registry:99Please respect copyright.PENANAzZh8y9wMKj
# npm config set registry https://registry.npmjs.org
墙外安装node/npm99Please respect copyright.PENANA8YVtAbuM50
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash99Please respect copyright.PENANAIzl420TiH4
# export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"99Please respect copyright.PENANAXgWUqwDVxw
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm99Please respect copyright.PENANAvxQV2CrnPs
# nvm install --lts99Please respect copyright.PENANAtJ4TDkClMB
# npm install npm@latest -g
安装99Please respect copyright.PENANAu73k4ioJZO
npm i package_name99Please respect copyright.PENANAYvkfPHIETM
项目更新99Please respect copyright.PENANAWsnkWdnejx
npm update
F. 配置服務器連接
1. ssh免密登录Linux服务器
在客户端检查是否存在证书99Please respect copyright.PENANAu8aDA1tVp1
# ls -al ~/.ssh/id_*.pub99Please respect copyright.PENANAlUgGCURdY6
如果不存在,生成证书99Please respect copyright.PENANAYievKTONLu
# ssh-keygen -t rsa -b 4096 -C "[email protected]"99Please respect copyright.PENANAtv2Nu3AonF
生成证书的过程中使用空白的 passphrase99Please respect copyright.PENANATsBpl7c8wX
将证书拷贝到服务器99Please respect copyright.PENANAlWebdo5mTm
# ssh-copy-id root@server
2. 从windows登录linux
如果是从windows系统连接ubuntu,可以安装putty作为访问服务器的终端。 99Please respect copyright.PENANAgQUj3fUPE5
下载putty: https://www.putty.org/
putty免密登录Linux服务器的方法
在putty的安装目录找到puttygen.exe,运行生成ssl私钥和公钥,保存私钥到文件,复制公钥。99Please respect copyright.PENANAb8n2zQRvGV
在putty的 connection/data 设置登录用户名为root,connection/ssh/auth/credentials中设置私钥的文件,保存设置。99Please respect copyright.PENANAlzjz1or9sl
将公钥写入服务器的 ~/.ssh/authorized_keys 文件中, reboot ubuntu使修改生效99Please respect copyright.PENANAuDoWeTDFbo
# nano ~/.ssh/authorized_keys99Please respect copyright.PENANAcqwyGRLfTc
# reboot
如果想保持putty与服务器的连接保持不断线,可以在Putty中设置每隔一定的时间发一次心跳消息。
3. 保持与服务器的ssh连接不断线的方法
ssh连接服务器时如果容易断线,可以修改服务器sshd的设置,保持ssh连接不断线:99Please respect copyright.PENANAmJCdFVp3lk
# nano /etc/ssh/sshd_config99Please respect copyright.PENANATx7XqHBKxP
ClientAliveInterval 60 # 表示每60秒发送一次请求,从而保持连接不断线。99Please respect copyright.PENANAGyPkHbjO74
ClientAliveCountMax 10 # 表示服务器发出请求后客户端没有响应的次数达到10次,就自动断开连接99Please respect copyright.PENANAHLGseluG49
# systemctl restart sshd
4. 從ubuntu remote windows用remmina
從app中心安裝remmina99Please respect copyright.PENANAhkQbi7F5I0
新建connection到windows
Basic標籤99Please respect copyright.PENANAyN9fhFsnal
server: ip/domain.name, username: Administrator, password: ***99Please respect copyright.PENANA7K4y3pPFns
share folder中填寫ubuntu中的路徑,則可從windows訪問99Please respect copyright.PENANASemUfe2ygU
resolution中可設置合適的屏幕大小
Advanced標籤99Please respect copyright.PENANAa0P2O4V9EP
output audio: 選擇local,則是windows發出的聲音
windows server 默認是麼有開啓聲音服務的,要設置一下才能發出聲音:99Please respect copyright.PENANANzk7FUE0Af
https://cloud.tencent.com/developer/article/1894933
G. 網絡安全設置
防火墙设置99Please respect copyright.PENANAHSEf9dnR2D
# ufw allow 2299Please respect copyright.PENANAZYNjNaH3hm
# ufw allow 8099Please respect copyright.PENANAMkcX3jTtL9
# ufw allow 44399Please respect copyright.PENANArPNg7P7mK7
# ufw enable99Please respect copyright.PENANA6Y1nGZTbdC
# ufw status
H. 常用命令
创建软链接99Please respect copyright.PENANAuLOPadHQgK
# sudo ln -s 源文件 目标文件
修改密码99Please respect copyright.PENANA2bi6poeQGn
# passwd root99Please respect copyright.PENANAlaFQOzokDq
# usermod -a -G groupA username99Please respect copyright.PENANAAD9u1sNRqr
# groups username
修改hostname99Please respect copyright.PENANAzAX4I48H3t
# hostnamectl set-hostname xiaoyue
查看cpu99Please respect copyright.PENANAskRTSct2Js
# lscpu
查看内存99Please respect copyright.PENANAsKGrh4z6Fc
# free -h99Please respect copyright.PENANA0AMukQDfZp
# top
釋放被buff/cache占用的内存99Please respect copyright.PENANApp8yXufBVW
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空页面缓存99Please respect copyright.PENANAjjHSLLCwyr
# sync; echo 1 > /proc/sys/vm/drop_caches # 清空目录项缓存99Please respect copyright.PENANAPOyY3R8ac2
# sync; echo 2 > /proc/sys/vm/drop_caches # 清空SLAB缓存99Please respect copyright.PENANAyQnrd310O3
# sync; echo 3 > /proc/sys/vm/drop_caches # 清空所有缓存99Please respect copyright.PENANAHH9alLnOrS
用sudo执行:99Please respect copyright.PENANA0EtOLJDqX2
# sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
99Please respect copyright.PENANASBcGs5He5n
查看硬盘99Please respect copyright.PENANA1er4kaDBna
# sudo lshw -c disk99Please respect copyright.PENANAJ8pdmcxHMM
查看分区99Please respect copyright.PENANAUVAilsiXOD
# sudo fdisk -l99Please respect copyright.PENANA2vkF2jmoAa
查看磁盘剩余空间99Please respect copyright.PENANAgllp5novoO
# df -hl
文件壓縮和打包99Please respect copyright.PENANAG5e8AP2hET
將在windows上壓縮出的zip文件傳遞給Linux系統解壓縮時,文件名會出現亂碼,這是因爲在Windows上文件名的編碼取決於「控制面板-時鐘和區域-區域-管理-非unicode程序語言」中的設置,中國大陸默認是簡體中文,gb2312(cp936)編碼. 而在Linux系統上則統一是utf-8編碼。99Please respect copyright.PENANAXivSLjxhn2
如何解決?最簡單的辦法是在解壓縮的時候說明一下原來的編碼,這樣壓縮工具就會識別出原來的文件名而自動將文件名轉爲utf8編碼, 命令如下:99Please respect copyright.PENANA405wP8enoj
unzip -O cp936 temp.zip
改變文件權限99Please respect copyright.PENANAkPlrhUt0Oa
# chmod g+w <文件/目录路径>99Please respect copyright.PENANA137w2bkGeH
# chmod -R g+w /path/to/directory99Please respect copyright.PENANAxLT7m5zWsr
设置所有者为 rwx,组为 r-x,其他用户为 r--:99Please respect copyright.PENANAs6JGVj5Keh
# chmod 755 <文件/目录路径>
u:所有者(user)。99Please respect copyright.PENANATSKFNfWglo
g:所属组(group)。99Please respect copyright.PENANAX1QGSqCA6A
o:其他用户(others)。99Please respect copyright.PENANAl9MsuZP3Wv
a:所有用户(u、g、o)。99Please respect copyright.PENANAE2BKbElEYq
操作符:99Please respect copyright.PENANAKufZBkVHke
+:添加权限。99Please respect copyright.PENANACiVWuxMgMN
-:移除权限。99Please respect copyright.PENANAfRR95ZpBYm
=:设置权限。99Please respect copyright.PENANAO3w6pSmslT
權限:99Please respect copyright.PENANAEJsgm0ma3f
r(读) = 499Please respect copyright.PENANAD4gct0gkpx
w(写) = 299Please respect copyright.PENANA9DKD9feBh1
x(执行) = 199Please respect copyright.PENANAXZ5MSUSVxb
-(无权限) = 099Please respect copyright.PENANA4oWoClBnJP
通过加法得到最终的权限值。例如:99Please respect copyright.PENANAngE9IyPSnP
7 = rwx(4 + 2 + 1)99Please respect copyright.PENANARNorpKpOma
5 = r-x(4 + 1)99Please respect copyright.PENANA0ZaLl9306a
6 = rw-(4 + 2)99Please respect copyright.PENANA6ltwL0FOy6
99Please respect copyright.PENANA0VAfV4gdhJ
I. 创建自定义命令
# nano ~/.bash_aliases99Please respect copyright.PENANAqA269vJ9rA
添加alias, 比如:99Please respect copyright.PENANAv6nqHcamxy
alias gitbuda='gitbuda() { git add -A; git commit -m "$1"; git push; }; gitbuda'99Please respect copyright.PENANA5tDDRfGEij
其中$1表示命令的第一个参数,这样就可以用 gitbuda "commit message"来运行命令99Please respect copyright.PENANA6quFWqQieM
# source ~/.bash_aliases
Section X. Thanks
https://ubuntu.com
99Please respect copyright.PENANAJBMVOjdznk
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]99Please respect copyright.PENANAJ09Svh1Y8o
如果您发现本文有任何错误,或者对本文有好的建议,欢迎与我联系探讨,我的微信: si_jinmin, 我的email: [email protected]
如果您對C/C++ programming, Linux, website development, Vue, Git, vscode感興趣,邀請您加入「Linux/C/C++ Website Development」微信群,請加我的微信(si_jinmin)以便拉您进群。
ns3.144.252.138da2