• 使用ubuntu并安装常用软件


    推荐

    1. 在linux系统中进行操作,最重要的就是意识到用户权限,这在通过不同方式安装不同应用中非常重要,不然你就会导致一些用户无法使用。
    2. 除了用户权限的问题还有就是程序的安装位置,不同的安装位置的程序的启动方式是不同的,安装在/usr/local/bin目录下的程序,如果启动文件是在这个目录下,在任意位置都可以直接启动,如果启动文件是在子目录下,需要链接一下才能在任意位置启动。在其他位置则需要连接一下才能在任意位置使用。
    3. 如果一些应用是希望开机自启动的,类似于下面的alist,就需要编辑守护进程,这样系统在启动的时候会自动调用守护进程。

    建议在尝试Linux之前首先参考一下相关文献:

    实验环境

    参考:

    查看系统信息的指令:

    cat /proc/version
    uname -a
    sudo lshw
    gnome-shell --version
    
    • 1
    • 2
    • 3
    • 4
    项目内容
    系统Ubuntu 22.04(jammy)
    内存12GiB
    处理器Intel® Core™ i5-6300HQ CPU @ 2.30GHz × 4
    图形Intel® HD Graphics 530 & GM107M [GeForce GTX 960M]
    GNOMEGNOME Shell 42.9
    操作系统类型64位
    磁盘128GB

    电脑通过apt安装软件时文件保存位置

    gpg文件位置:/etc/apt/trusted.gpg.d/
    list文件位置:/etc/apt/sources.list.d/
    或者另一个位置也是可以的:
    gpg文件位置:/etc/apt/keyrings/
    list文件位置:/etc/apt/sources.list.d/
    或者另一个位置:
    gpg文件位置:/usr/share/keyrings/
    list文件位置:/etc/apt/sources.list.d/

    添加交换空间

    cd /
    sudo swapoff -a
    sudo dd if=/dev/zero of=/swapfile bs=1G count=12
    sudo chmod 600 /swapfile
    sudo mkswap /swapfile
    sudo fdisk -l
    sudo cp /etc/fstab /etc/fstab.bak
    echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
    sudo swapon -a
    free -h
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    安装ssh

    sudo apt install openssh-client
    sudo apt install openssh-server
    ssh -V
    sudo /etc/init.d/ssh start
    sudo /etc/init.d/ssh stop
    sudo /etc/init.d/ssh restart
    ssh-keygen
    ssh-copy-id -i id_rsa.pub user@hostname
    ssh -L local-port:target-hostname:target-port user@remote-hostname -p remote-port
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    参考:CSDN:ssh 使用

    安装pulse secure

    参考:Ivanti

    sudo dpkg -i *.deb
    
    • 1

    添加连接:https://sslvpn.tsinghua.edu.cn

    安装OBS Studio

    参考:OBS Studio

    sudo add-apt-repository ppa:obsproject/obs-studio
    sudo apt update
    sudo apt install ffmpeg obs-studio
    
    • 1
    • 2
    • 3

    配置选择:窗口采集

    seafile

    Seafile是一个云盘服务提供商。

    sudo wget https://linux-clients.seafile.com/seafile.asc -O /usr/share/keyrings/seafile-keyring.asc
    echo "deb [arch=amd64 signed-by=/usr/share/keyrings/seafile-keyring.asc] https://linux-clients.seafile.com/seafile-deb/$(lsb_release -cs)/ stable main" | sudo tee /etc/apt/sources.list.d/seafile.list > /dev/null
    sudo apt update
    sudo apt install -y seafile-gui
    
    • 1
    • 2
    • 3
    • 4

    配置:单点登录:https://cloud.tsinghua.edu.cn

    Google Chrome

    参考:CSDN:Ubuntu下各种软件的安装和卸载

    通过deb包来安装Google Chrome。

    #写完了文档,但是CSDN给我吃了,心态崩了,简化指令了
    # 安装
    dpkg -i *.deb
    # 维护依赖
    apt install -f
    # 搜索
    dpkg --list
    # 卸载
    dpkg -r *
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    Chrome不用多说,浏览器的神,不过现在大部分都是使用chatgpt作为主力搜索应用,单纯使用chrome需要搜索者具有良好的prompt技术和批判性思维,不过google出来的参考信息的可靠性还是很高的。

    VSCode

    参考:VSCode:Visual Studio Code on LinuxCSDN:Ubuntu安装与配置Docker

    同样是通过deb包管理器dpkg来进行安装,软件名字为code

    # 下载安装包
    # 安装vscode
    sudo dpkg -i code_1.80.0-1688479026_amd64.deb
    #提示如下:
    正在选中未选择的软件包 code。
    (正在读取数据库 ... 系统当前共安装有 206577 个文件和目录。)
    准备解压 code_1.80.0-1688479026_amd64.deb  ...
    正在解压 code (1.80.0-1688479026) ...
    正在设置 code (1.80.0-1688479026) ...
    正在处理用于 mailcap (3.70+nmu1ubuntu1) 的触发器 ...
    正在处理用于 gnome-menus (3.36.0-1ubuntu3) 的触发器 ...
    正在处理用于 desktop-file-utils (0.26-1ubuntu3) 的触发器 ...
    正在处理用于 shared-mime-info (2.1-2) 的触发器 ...
    # 安装完成
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

    另一种方式是通过添加gpg源来安装。

    sudo apt-get install wget gpg
    wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
    sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
    sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
    rm -f packages.microsoft.gpg
    sudo apt install apt-transport-https
    sudo apt update
    sudo apt install code
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    vscode不用多说,它适合安装上插件然后连接远程服务器进行开发。那体验相当于把xftpxshellsshdocker多个工具集成起来。

    安装Docker

    参考:

    Docker系统要求:

    • 64位、虚拟化:
      64位:sudo uname -a:“x86-64”
      虚拟化:lscpu:“Virtualization:VT-x”
    • KVM虚拟化支持:
      查看当前用户:whoami\id $USER\sudo apt install cpu-checker
    • QEMU must be version 5.2 or newer:
      更新:

    下面是安装docker desktop的过程,通过第三方源来安装,docker desktop不好用,推荐安装docker engine

    #通过更换软件源来安装docker
    sudo apt-get update
    sudo apt-get install ca-certificates
    sudo apt-get install curl
    sudo apt-get install gnupg-agent
    sudo apt-get install software-properties-common
    sudo apt-get install software-properties-common gnupg-agent curl ca-certificates
    # 安装gpg key
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
    # 安装源
    echo \
    "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    # 更新
    sudo apt update
    # 安装
    sudo apt install docker-ce docker-ce-cli containerd.io
    # 检查应用安装状态
    sudo systemctl status docker
    # 启动docker
    sudo systemctl start docker
    # Uninstall Docker Engine
    sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
    # 删除镜像,应用
    sudo rm -rf /var/lib/docker
    sudo rm -rf /var/lib/containerd
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    安装docker engine的过程:
    参考:Docker:Install Docker Engine on Ubuntu

    for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
    # Add Docker's official GPG key:
    sudo apt-get update
    sudo apt-get install ca-certificates curl gnupg
    sudo install -m 0755 -d /etc/apt/keyrings
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    sudo chmod a+r /etc/apt/keyrings/docker.gpg
    # Add the repository to Apt sources:
    echo \
      "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
      "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
      sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    sudo apt-get update
    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    sudo gpasswd -a $USER docker
    # 检查应用安装状态
    sudo systemctl status docker
    # 启动docker
    sudo systemctl start docker
    # Uninstall Docker Engine
    sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
    # 删除镜像,应用
    sudo rm -rf /var/lib/docker
    sudo rm -rf /var/lib/containerd
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24

    docker engine很好用。

    硬盘自动挂载alist

    参考:

    使用预编译的二进制压缩包进行安装

    # Unzip the downloaded file to get the executable file:
    tar -zxvf alist-xxxx.tar.gz
    # Grant program execution permissions:
    chmod +x alist
    # Run the program
    sudo ./alist server
    #提示信息
    INFO[2023-07-14 12:54:35] reading config file: data/config.json        
    INFO[2023-07-14 12:54:35] config file not exists, creating default config file 
    INFO[2023-07-14 12:54:35] load config from env with prefix: ALIST_     
    INFO[2023-07-14 12:54:35] init logrus...                               
    INFO[2023-07-14 12:54:35] Successfully created the admin user and the initial password is: jTZARYlz 
    INFO[2023-07-14 12:54:35] start HTTP server @ 0.0.0.0:5244             
    INFO[2023-07-14 12:54:35] qbittorrent not ready.                       
    INFO[2023-07-14 12:54:35] Aria2 not ready. 
    # Get admin's info
    ./alist admin
    # 守护
    sudo vim /usr/lib/systemd/system/alist.service
    [Unit]
    Description=alist
    After=network.target
     
    [Service]
    Type=simple
    WorkingDirectory=path_alist
    ExecStart=path_alist/alist server
    Restart=on-failure
     
    [Install]
    WantedBy=multi-user.target
    
    # 启动,关闭,重启
    systemctl daemon-reload
    systemctl start alist
    systemctl stop alist
    systemctl restart alist
    # 挂载到本地及卸载
    sudo apt install davfs2
    sudo mount -t davfs -o noexec http://127.0.0.1:5244/dav ./ali
    sudo umount ali
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41

    说实话,不管怎么挂载,读取上传的速度还是不是很快,网盘垃圾就是垃圾。

    安装zotero

    参考:

    通过预编译的二进制包安装Zotero

    # 解压安装包后运行zotero
    ./zotero
    #提示如下所示
    dpkg-query: 没有找到与 openoffice\.org-writer 相匹配的软件包
    ii  libreoffice-writer 1:7.3.7-0ubuntu0.22.04.3 amd64        office productivity suite -- word processor
    Gtk-Message: 17:26:41.507: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.
    dpkg-query: 没有找到与 openoffice\.org-writer 相匹配的软件包
    ii  libreoffice-writer 1:7.3.7-0ubuntu0.22.04.3 amd64        office productivity suite -- word processor
    ii  libreoffice-java-common                    1:7.3.7-0ubuntu0.22.04.3                all          office productivity suite -- arch-independent Java support files
    ERROR: Exception occurred: 未安装该扩展程序: org.Zotero.integration.openoffice ./desktop/source/deployment/manager/dp_manager.cxx:971
    
    ERROR: unopkg failed.
    # 然后再运行zotero
    sudo ./zotero
    #提示报错
    [sudo] stu 的密码: 
    Running Firefox as root in a regular user's session is not supported.  ($XAUTHORITY is /run/user/1000/.mutter-Xwaylandauth.6RWL71 which is owned by stu.)
    # 生成图标
    sudo ./set_launcher_icon
    # 连接
    ln -s /usr/local/bin/Zotero_linux-x86_64/zotero.desktop ~/.local/share/applications/zotero.desktop
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21

    Zotero的具体配置内容参考我的其他文章。
    推荐使用zotero官方推荐的community maintain的版本,一键式安装,快捷方便。参考:Github:zotero-deb

    wget -qO- https://raw.githubusercontent.com/retorquere/zotero-deb/master/install.sh | sudo bash
    sudo apt update
    sudo apt install zotero
    
    • 1
    • 2
    • 3

    zotero是真香,配合webdav服务提供商和overleaf在线latex文档编辑工具,直接起飞。

    安装腾讯会议

    参考:博客园:Ubuntu 22.04 安装常用办公软件

    腾讯会议官网提供了deb安装包,所以采用deb包通用的安装方式:dpkg进行安装。软件名字为wemeet

    # 下载安装包
    # 通过deb包进行安装
    sudo dpkg -i TencentMeeting_0300000000_3.15.0.402_x86_64_default.publish.deb
    # 更新依赖
    sudo apt install -f
    #提示存在问题,窗口采用wayland协议
    cd /etc/gdm3/
    sudo vim /etc/gdm3/custom.conf
    #WaylandEnable=false 的注释井号去掉
    sudo service gdm3 restart
    #注意,静待好久,别心急也别心慌。耐心等待,会重启的。
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    安装texlive

    参考:

    通过命令行下载安装

    # 获取预编译安装包
    wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
    # 解压
    zcat < install-tl-unx.tar.gz | tar xf -
    # 跳转到解压后的文件夹
    cd install-tl-*
    # 安装texlive
    sudo perl ./install-tl --no-interaction
    #等待安装完成
    Loading https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet/tlpkg/texlive.tlpdb
    Installing TeX Live 2023 from: https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet (verified)
    Platform: x86_64-linux => 'GNU/Linux on x86_64'
    Distribution: net  (downloading)
    Using URL: https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet
    Directory for temporary files: /tmp/j94GndwruI
    Installing to: /usr/local/texlive/2023
    Installing [1/4, time/total: ??:??/??:??]: hyphen-base [22k]
    Installing [2/4, time/total: 00:03/04:53]: kpathsea [1048k]
    Installing [3/4, time/total: 00:07/00:14]: texlive-scripts [530k]
    Installing [4/4, time/total: 00:09/00:12]: texlive.infra [547k]
    Time used for installing the packages: 00:18
    Installing [0001/4563, time/total: ??:??/??:??]: 12many [376k]
    ....
    Time used for installing the packages: 5:16:44
    running mktexlsr /usr/local/texlive/2023/texmf-dist ...
    mktexlsr: Updating /usr/local/texlive/2023/texmf-dist/ls-R... 
    mktexlsr: Done.
    writing fmtutil.cnf to /usr/local/texlive/2023/texmf-dist/web2c/fmtutil.cnf
    writing updmap.cfg to /usr/local/texlive/2023/texmf-dist/web2c/updmap.cfg
    writing language.dat to /usr/local/texlive/2023/texmf-var/tex/generic/config/language.dat
    writing language.def to /usr/local/texlive/2023/texmf-var/tex/generic/config/language.def
    writing language.dat.lua to /usr/local/texlive/2023/texmf-var/tex/generic/config/language.dat.lua
    running mktexlsr /usr/local/texlive/2023/texmf-var /usr/local/texlive/2023/texmf-config /usr/local/texlive/2023/texmf-dist ...
    mktexlsr: Updating /usr/local/texlive/2023/texmf-config/ls-R... 
    mktexlsr: Updating /usr/local/texlive/2023/texmf-dist/ls-R... 
    mktexlsr: Updating /usr/local/texlive/2023/texmf-var/ls-R... 
    mktexlsr: Done.
    running updmap-sys --nohash ...done
    re-running mktexlsr /usr/local/texlive/2023/texmf-var /usr/local/texlive/2023/texmf-config ...
    mktexlsr: Updating /usr/local/texlive/2023/texmf-config/ls-R... 
    mktexlsr: Updating /usr/local/texlive/2023/texmf-var/ls-R... 
    mktexlsr: Done.
    setting up ConTeXt cache: running mtxrun --generate ...done
    running context --luatex --generate ...done
    pre-generating all format files, be patient...
    running fmtutil-sys --no-error-if-no-engine=luametatex,luajithbtex,luajittex,mfluajit --no-strict --all ...done
    running package-specific postactions
    finished with package-specific postactions
    欢迎进入 TeX Live 的世界!
    
    
    See /usr/local/texlive/2023/index.html for links to documentation.
    The TeX Live web site (https://tug.org/texlive/) contains any updates and corrections. TeX Live is a joint project of the TeX user groups around the world; please consider supporting it by joining the group best for you. The list of groups is available on the web at https://tug.org/usergroups.html.
    
    
    Add /usr/local/texlive/2023/texmf-dist/doc/man to MANPATH.
    Add /usr/local/texlive/2023/texmf-dist/doc/info to INFOPATH.
    Most importantly, add /usr/local/texlive/2023/bin/x86_64-linux
    to your PATH for current and future sessions.
    Logfile: /usr/local/texlive/2023/install-tl.log
    # 修改配置文件
    vim ~/.bashrc
    export PATH=/usr/local/texlive/2023/bin/x86_64-linux:$PATH
    export MANPATH=/usr/local/texlive/2023/texmf-dist/doc/man:$PATH
    export INFOPATH=/usr/local/texlive/2023/texmf-dist/doc/info:$PATH
    source ~/.bashrc
    sudo reboot
    tex --version
    sudo apt-get install texlive-latex-extra
    sudo apt-get install texlive-latex-recommended
    sudo apt-get install texlive-science
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71

    安装时间确实相当漫长。而且配置vscode还要设置什么编译链,说不定还会报错,只能说用overleaf它不香嘛,费这鸟劲

    配置webdav服务器

    zotero管理文献时,官方云空间只有300Mb,放几本书就塞满了,所以很不方便,碰巧我有一台云服务器,所以想把云服务器设置为webdav服务器这样就可以存放文件了。
    参考文献:

    #首先设置webdav服务所对应的文件夹,并修改用户及权限。
    sudo chown www-data:www-data /home/dxr
    #然后修改nginx的配置文件
    sudo vim nginx.conf
    #添加如下内容
    server {
            listen 8081 ;
            listen [::]:8081 ;
            server_name localhost;
            charset utf-8;
    
            auth_basic realm_name;
            root /home/dxr;
            auth_basic_user_file /etc/nginx/.passwords.list;
            dav_methods PUT DELETE MKCOL COPY MOVE;
            dav_ext_methods PROPFIND OPTIONS;
            dav_access user:rw group:rw all:rw;
            client_body_temp_path /home/dav/temp;
            client_max_body_size 0;
            create_full_put_path on;
            autoindex on;
    }
    #修改完成后重启nginx服务
    sudo nginx -c nginx.conf
    sudo nginx -s reload
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25

    费这大劲还要买个服务器,使用infinicloud获得 20 GB 20\textbf{GB} 20GB免费的云存储空间,国内也可以访问,不限制上传下载速度,同时提供webdav服务它不香吗?

  • 相关阅读:
    CentOS8服务器时间同步
    node---模块
    零代码工具拖拽流程图
    redis内存碎片整理
    力扣 8. 字符串转换整数 (atoi)
    房屋信贷违约风险竞争(kaggle)系列4-基准模型
    元素定位(绝对、相对、粘滞、固定)
    矩阵的运算
    Jetpack:019-Jetpack的导航二(传递数据)
    2024中国人民大学计算机考研分析
  • 原文地址:https://blog.csdn.net/weixin_45477628/article/details/132165918