经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 数据库/运维 » Linux/Shell » 查看文章
Ubuntu玩机记录,让我破电脑又飞起来了
来源:cnblogs  作者:南瓜慢说  时间:2023/2/6 9:03:30  对本文有异议

写在前面

很早之前的电脑ThinkPad E440,一直没怎么用。最近整理了一下电脑的资料,全部备份到云盘。整理的过程感觉电脑很慢很慢,难受极了。整理完后,终于我要对它下手了!

我制作了启动U盘,把Ubuntu 22.04的镜像烧录进去,通过U盘启动,把系统装在ThinkPad上。居然电脑出奇的好用,根本不卡。那就记录一下吧。

安装Ubuntu系统

先从官网下载镜像,然后通过BalenaEtcher来把系统镜像放在U盘上。接着就是启动与安装了,没什么特别的,只要改一下BIOS的启动顺序即可。

参考: https://ubuntu.com/tutorials/install-ubuntu-desktop#2-download-an-ubuntu-image

截图

可以用系统自带的,但我使用的是Shutter,直接在Ubuntu Software搜索安装即可。但安装完不能使用自选区域截图,会提示:

  1. cannot work without X11 server

解决方案:

找到/etc/gdm3/custom.conf文件,去掉注释:WaylandEnable=false

重启一下:sudo systemctl restart gdm3即可。

设置快捷键:

Settings -> Keyboard -> Keyboard Shortcuts -> View and Customize Shortcuts

接着拉到最后的Custom Shortcuts。添加如下:

参考:

安装Typora

新版本的Typora收费了,并且官网也下载不了原有的免费版本,可以在这个链接下载:

下载地址:https://github.com/iuxt/src/releases/download/2.0/Typora_Linux_0.11.18_amd64.deb

然后使用apt安装即可:

  1. sudo apt install ./Typora_Linux_0.11.18_amd64.deb

参考:https://zahui.fan/posts/64b52e0d/

显示电池百分比

Settings -> Power -> Show Battery Percentage

中文输入法

设置里找到Regin & Language,Manage installed Languages,安装中文。输入法系统选iBus即可。接着在Keyboard那添加中文输入法,有拼音和五笔,如果操作不了,可能需要先重启:

可以通过Win + 空格来切换。中英文通过Shift。

git安装

大致如下:

  1. sudo apt install git
  2. git config --global user.name "LarryDpk"
  3. git config --global user.email "larry.dpk@gmail.com"
  4. # 生成ssh key,把pub key放GitHub上
  5. ssh-keygen -t rsa -b 4096 -C "larry.dpk@gmail.com"

Git拉取代码报错:

  1. $ git pull
  2. ssh: connect to host github.com port 22: Connection timed out
  3. fatal: Could not read from remote repository.
  4. Please make sure you have the correct access rights
  5. and the repository exists.

换成另一个域名:ssh.github.com

参考: https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port

git status显示数字,不显示中文:

  1. git config --global core.quotepath false

Chrome

因为Chrome在Ubuntu不在Software Center,所以要通过先下载安装包的方式来下载:

  1. wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
  2. sudo dpkg -i google-chrome-stable_current_amd64.deb

python相关

系统已经自带了Python3,版本也比较高,也没办法再安装了。但要安装pip3:

  1. $ python3 --version
  2. Python 3.10.6
  3. sudo apt install python3-pip

挂载硬盘

我的电脑是一个SSD盘,一个普通硬盘,系统装在SSD上,所以需要把硬盘挂载一下:

  1. sudo mount /dev/sda3 /home/larry/data

但每次都这样手动mount很麻烦,又要输入密码,所以我们让系统在启动的时候就mount,在/etc/fstab文件中添加一行:

  1. # disk
  2. UUID=277de78c-6639-4373-a5cd-38feff129de7 /home/larry/data ext4 defaults 0 0

重启即可。

参考: https://developerinsider.co/auto-mount-drive-in-ubuntu-server-22-04-at-startup/

OSS阿里云

下载Linux 64位版本:https://github.com/aliyun/oss-browser

直接打开会报错,少了libgconfi-2-4,安装后打开即可:

  1. $ ./oss-browser
  2. ./oss-browser: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory
  3. $ sudo apt install libgconf-2-4

参考:https://stackoverflow.com/questions/37624225/shared-libraries-libgconf-2-so-4-is-missing

JDK

下载JDK: https://github.com/graalvm/graalvm-ce-builds/releases

我下载的版本是:graalvm-ce-java11-linux-amd64-22.3.0.tar.gz

解压后指定JAVA_HOME即可。

  1. JAVA_HOME=/home/larry/software/graalvm-ce-java11-22.3.0
  2. export PATH=$JAVA_HOME/bin:$PATH

Maven

直接下载后解压即可:https://maven.apache.org/download.cgi

  1. export M2_HOME=/home/larry/software/apache-maven-3.8.6
  2. export PATH=$M2_HOME/bin:$PATH

bash_profile设置

.bashrc添加:

  1. if [ -f ~/bash_profile.sh ]; then
  2. . ~/bash_profile.sh
  3. fi

然后便可在bash_profile.sh文件中添加自己的配置了:

  1. export JAVA_HOME=/home/larry/software/graalvm-ce-java11-22.3.0
  2. export PATH=$JAVA_HOME/bin:$PATH
  3. export M2_HOME=/home/larry/software/apache-maven-3.8.6
  4. export PATH=$M2_HOME/bin:$PATH
  5. alias l='ls -al'

SSH SFTP客户端WindTerm

下载软件: https://github.com/kingToolbox/WindTerm/releases/tag/2.5.0

选择自动复制已经支持了。

右键直接粘贴:

参考: https://github.com/kingToolbox/WindTerm/issues/19#issuecomment-719334753

修改锁屏密码: 点击一下右下角的Lock Screen即可修改。

添加程序到Farorites Bar

以IDEA为例,直接通过IDEA自己提供的工具,如下图所示:

或者自己创建对应的Entry,放在特定的位置:

  1. $ cat /usr/share/applications/jetbrains-idea.desktop
  2. [Desktop Entry]
  3. Version=1.0
  4. Type=Application
  5. Name=IntelliJ IDEA Ultimate Edition
  6. Icon=/home/larry/software/ideaIU-2022.3/bin/idea.svg
  7. Exec="/home/larry/software/ideaIU-2022.3/bin/idea.sh" %f
  8. Comment=Capable and Ergonomic IDE for JVM
  9. Categories=Development;IDE;
  10. Terminal=false
  11. StartupWMClass=jetbrains-idea
  12. StartupNotify=true

如果只是自己生效则放在~/.local/share/applications

其它例子:

  1. [Desktop Entry]
  2. Version=1.0
  3. Type=Application
  4. Name=WindTerm
  5. Icon=/home/larry/software/WindTerm_2.5.0/windterm.png
  6. Exec="/home/larry/software/WindTerm_2.5.0/WindTerm" %f
  7. Comment=WindTerm
  8. Categories=Development;SSH;
  9. Terminal=false
  10. StartupNotify=true

VSCode

IDEA占用的内存还是太多了,还是使用VSCode吧,直接Ubuntu Software搜索安装即可。

安装Anaconda

官网下载: https://repo.anaconda.com/archive/Anaconda3-2022.10-Linux-x86_64.sh

然后执行命令安装:

  1. $ bash ./Anaconda3-2022.10-Linux-x86_64.sh

会有一些提示,要输入yes等。最后init,执行命令:

  1. $ source ~/.bashrc

其它就是帮我们加了这段内容到.bashrc文件中:

  1. # >>> conda initialize >>>
  2. # !! Contents within this block are managed by 'conda init' !!
  3. __conda_setup="$('/home/larry/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
  4. if [ $? -eq 0 ]; then
  5. eval "$__conda_setup"
  6. else
  7. if [ -f "/home/larry/anaconda3/etc/profile.d/conda.sh" ]; then
  8. . "/home/larry/anaconda3/etc/profile.d/conda.sh"
  9. else
  10. export PATH="/home/larry/anaconda3/bin:$PATH"
  11. fi
  12. fi
  13. unset __conda_setup
  14. # <<< conda initialize <<<

同时,它直接把系统的python也切换了:

  1. $ which python
  2. /home/larry/anaconda3/bin/python
  3. $ which python3
  4. /home/larry/anaconda3/bin/python3
  5. $ which pip
  6. /home/larry/anaconda3/bin/pip
  7. $ which pip3
  8. /home/larry/anaconda3/bin/pip3
  9. $ python --version
  10. Python 3.9.13
  11. $ python3 --version
  12. Python 3.9.13
  13. $ pip --version
  14. pip 22.2.2 from /home/larry/anaconda3/lib/python3.9/site-packages/pip (python 3.9)

百度网盘

直接在官网下载Linux deb版本: https://pan.baidu.com/download#pan

然后用下面命令安装即可:

  1. $ sudo apt install ./baidunetdisk_4.15.6_amd64.deb

视频播放器VLC

可以直接在Software Center安装,也可以到官网下载安装:https://www.videolan.org/

原文链接:https://www.cnblogs.com/larrydpk/p/17093012.html

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号