Ubuntu20.04 update出错：GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging <yarn@dan.cx>
sudo apt-get update时出现以下错误：W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging <yarn@dan.cx> W: Failed to fetch https://dl.yarnpkg.com/debian/dists/stable/InRelease The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging <yarn@dan.cx> W: Some index files failed to download. They have been ignored, or old ones used instead.第一个解决方案无效：curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -askubuntu解决方案有效果：curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/nullhttps://askubuntu.com/questions/1306111/why-yarn-key-update-failes-all-the-time-gpg-error-https-dl-yarnpkg-com-debia
客户端授权在本地Windows电脑上下载rclone，下载地址：https://rclone.org/downloads/。然后解压出来，比如我解压到D盘，文件夹命名rclone，此时点击Win+R，然后输入cmd，确定。再输入以下命令：cd /d d:\rclone rclone authorize "onedrive"会出现以下信息：C:\Users\Administrator>cd /d d:\rclone d:\rclone>rclone authorize "onedrive" 2018/01/23 20:28:56 NOTICE: Config file "C:\\Users\\Administrator\\.config\\rclo ne\\rclone.conf" not found - using defaults Choose OneDrive account type? * Say b for a OneDrive business account * Say p for a personal OneDrive account b) Business p) Personal b/p> p #这里选择个人版，你想挂载Business就选择b If your browser doesn't open automatically go to the following link: http://127. 0.0.1:53682/auth #接下来会弹出浏览器，要求你登录账号进行授权 Log in and authorize rclone for access Waiting for code... Got code Paste the following into your remote machine ---> {"access_token":"xxxx"} #请复制{xx}整个内容，后面需要用到 <---End paste安装Rclone直接使用官方提供的一键脚本：curl https://rclone.org/install.sh | bash2、初始化配置rclone config会出现以下信息：root@NCloud:~# rclone config 2021/12/22 10:21:07 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults No remotes found - make a new one n) New remote s) Set configuration password q) Quit config n/s/q> s Your configuration is not encrypted. If you add a password, you will protect your login information to cloud services. a) Add Password q) Quit to main menu a/q> q No remotes found - make a new one n) New remote s) Set configuration password q) Quit config n/s/q> n name> onedrive5T Option Storage. Type of storage to configure. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value. 1 / 1Fichier \ "fichier" 2 / Alias for an existing remote \ "alias" 3 / Amazon Drive \ "amazon cloud drive" 4 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, SeaweedFS, and Tencent COS \ "s3" 5 / Backblaze B2 \ "b2" 6 / Better checksums for other remotes \ "hasher" 7 / Box \ "box" 8 / Cache a remote \ "cache" 9 / Citrix Sharefile \ "sharefile" 10 / Compress a remote \ "compress" 11 / Dropbox \ "dropbox" 12 / Encrypt/Decrypt a remote \ "crypt" 13 / Enterprise File Fabric \ "filefabric" 14 / FTP Connection \ "ftp" 15 / Google Cloud Storage (this is not Google Drive) \ "google cloud storage" 16 / Google Drive \ "drive" 17 / Google Photos \ "google photos" 18 / Hadoop distributed file system \ "hdfs" 19 / Hubic \ "hubic" 20 / In memory object storage system. \ "memory" 21 / Jottacloud \ "jottacloud" 22 / Koofr \ "koofr" 23 / Local Disk \ "local" 24 / Mail.ru Cloud \ "mailru" 25 / Mega \ "mega" 26 / Microsoft Azure Blob Storage \ "azureblob" 27 / Microsoft OneDrive \ "onedrive" 28 / OpenDrive \ "opendrive" 29 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH) \ "swift" 30 / Pcloud \ "pcloud" 31 / Put.io \ "putio" 32 / QingCloud Object Storage \ "qingstor" 33 / SSH/SFTP Connection \ "sftp" 34 / Sia Decentralized Cloud \ "sia" 35 / Sugarsync \ "sugarsync" 36 / Tardigrade Decentralized Cloud Storage \ "tardigrade" 37 / Transparently chunk/split large files \ "chunker" 38 / Union merges the contents of several upstream fs \ "union" 39 / Uptobox \ "uptobox" 40 / Webdav \ "webdav" 41 / Yandex Disk \ "yandex" 42 / Zoho \ "zoho" 43 / http Connection \ "http" 44 / premiumize.me \ "premiumizeme" 45 / seafile \ "seafile" Storage> 27 Option client_id. OAuth Client Id. Leave blank normally. Enter a string value. Press Enter for the default (""). client_id> Option client_secret. OAuth Client Secret. Leave blank normally. Enter a string value. Press Enter for the default (""). client_secret> Option region. Choose national cloud region for OneDrive. Enter a string value. Press Enter for the default ("global"). Choose a number from below, or type in your own value. 1 / Microsoft Cloud Global \ "global" 2 / Microsoft Cloud for US Government \ "us" 3 / Microsoft Cloud Germany \ "de" 4 / Azure and Office 365 operated by 21Vianet in China \ "cn" region> 1 Edit advanced config? y) Yes n) No (default) y/n> Use auto config? * Say Y if not sure * Say N if you are working on a remote or headless machine y) Yes (default) n) No y/n> n Option config_token. For this to work, you will need rclone available on a machine that has a web browser available. For more help and alternate methods see: https://rclone.org/remote_setup/ Execute the following on the machine with the web browser (same rclone version recommended): rclone authorize "onedrive" Then paste the result. Enter a string value. Press Enter for the default (""). config_token> {"access_token":"[binary]_yXXbbHQQ7dmizN2X_yzuXo3jfwq-0yvUPxz0O6HnOIWOXh430wCgThv6b8WlVHVMmmcT_aYllyabTqU3OHWU_3ZBjJnfWgjavUB9yugHl6PSbHPkCIRw8VPP38BJtWSpDExTf7w3Pquo8NBoQ5nhyzioWa7hf86om4M_plYjRgYMMrzcAUCzyveEGJThmpga37Er6fo5yigZ-j1Y67Tc8H2NhpL7M57bdBo5dPKvhqsrqd7GGtrNetJHK2h6DdXs3D7GsNmX0pdiCVAxcy08g6E6c5MjcyxGvHow4COxWJI7CxzhX85TM-aWTP47pYhsIEAstGkLgNPY_WBF4lXH2KUPozMzDZ0gxGtW7mbTqW_hY7DgvQjuS83J09pud4XMcfO38PE3iLkG6Te2u89h23CVM0WU65io0NE1sg5KsK4_","expiry":"2021-12-22T19:27:51.9462589+08:00"} Option config_type. Type of connection Enter a string value. Press Enter for the default ("onedrive"). Choose a number from below, or type in an existing value. 1 / OneDrive Personal or Business \ "onedrive" 2 / Root Sharepoint site \ "sharepoint" / Sharepoint site name or URL 3 | E.g. mysite or https://contoso.sharepoint.com/sites/mysite \ "url" 4 / Search for a Sharepoint site \ "search" 5 / Type in driveID (advanced) \ "driveid" 6 / Type in SiteID (advanced) \ "siteid" / Sharepoint server-relative path (advanced) 7 | E.g. /teams/hr \ "path" config_type> 3 Option config_site_url. Site URL Example: "https://contoso.sharepoint.com/sites/mysite" or "mysite" Enter a string value. Press Enter for the default (""). config_site_url> https://contoso.sharepoint.com/sites/myshare Drive OK? Found drive "root" of type "documentLibrary" URL: https://contoso.sharepoint.com/sites/myshare/Shared%20Documents y) Yes (default) n) No y/n> -------------------- [onedrive5T] type = onedrive token = {"access_token":"[binary]_yXXbbHQQ7dmizN2X_yzuXo3jfwq-0yvUPxz0O6HnOIWOXh430wCgThv6b8WlVHVMmmcT_aYllyabTqU3OHWU_3ZBjJnfWgjavUB9yugHl6PSbHPkCIRw8VPP38BJtWSpDExTf7w3Pquo8NBoQ5nhyzioWa7hf86om4M_plYjRgYMMrzcAUCzyveEGJThmpga37Er6fo5yigZ-j1Y67Tc8H2NhpL7M57bdBo5dPKvhqsrqd7GGtrNetJHK2h6DdXs3D7GsNmX0pdiCVAxcy08g6E6c5MjcyxGvHow4COxWJI7CxzhX85TM-aWTP47pYhsIEAstGkLgNPY_WBF4lXH2KUPozMzDZ0gxGtW7mbTqW_hY7DgvQjuS83J09pud4XMcfO38PE3iLkG6Te2u89h23CVM0WU65io0NE1sg5KsK4_","expiry":"2021-12-22T19:27:51.9462589+08:00"} drive_id = 0eXAiOiJKV1QiLCJub25jZSI6InVJck1QemlSb1plblF drive_type = documentLibrary -------------------- y) Yes this is OK (default) e) Edit this remote d) Delete this remote y/e/d> y Current remotes: Name Type ==== ==== onedrive5T onedrive e) Edit existing remote n) New remote d) Delete remote r) Rename remote c) Copy remote s) Set configuration password q) Quit config e/n/d/r/c/s/q>安装fuseapt-get install fuse挂载#新建本地文件夹，路径自己定，即下面的LocalFolder mkdir /opt/OneDrive #挂载为磁盘，下面的DriveName、Folder、LocalFolder参数根据说明自行替换 rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 DriveName为初始化配置填的name，Folder为OneDrive里的文件夹，LocalFolder为挂载的本地文件夹。 如我的DriveName：onedrive5T，DriveFolder：/ （挂载总目录），LocalFolder：/opt/OneDrive rclone mount onedrive5T:/PT /opt/OneDrive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 挂载若提示NOTICE: One drive root 'test': poll-interval is not supported by this remote可以无视。挂载成功后，输入df -h查看卸载：fusermount -qzu LocalFolder开机自启先新建systemd配置文件，适用CentOS 7、Debian 8+、Ubuntu 16+。再使用命令：#将后面修改成你上面手动运行命令中，除了rclone的全部参数 command="mount onedrive5T:/PT /opt/OneDrive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000" #以下是一整条命令，一起复制到SSH客户端运行 cat > /etc/systemd/system/rclone.service <<EOF [Unit] Description=Rclone After=network-online.target [Service] Type=simple ExecStart=$(command -v rclone) ${command} Restart=on-abort User=root [Install] WantedBy=default.target EOF开始启动：systemctl start rclone设置开机自启：systemctl enable rclone其他命令：重启：systemctl restart rclone 停止：systemctl stop rclone 状态：systemctl status rclone如果你想挂载多个网盘，那么将systemd配置文件的rclone.service改成rclone1.service即可，重启动什么的同样换成rclone1。复制和同步命令# 本地到网盘 rclone [功能选项] <本地路径> <网盘名称:路径> [参数] [参数] ... # 网盘到本地 rclone [功能选项] <网盘名称:路径> <本地路径> [参数] [参数] ... # 网盘到网盘 rclone [功能选项] <网盘名称:路径> <网盘名称:路径> [参数] [参数] ... 更详细命令:https://www.tok9.com/archives/615/常用功能rclone copy – 复制rclone sync – 同步 将目录内容同步到网盘目录rclone move – 移动 将目录内文件移动到网盘，默认删除路径文件rclone purge – 删除路径及所有文件rclone delete – 删除路径所有文件但不删除路径rclone mkdir – 创建目录rclone rmdir – 删除目录rclone check – 检查目标文件与源文件是否匹配rclone ls – 列出指定路径下的所有的文件以及文件大小rclone lsl – 仅列出对象的修改时间，大小和路径rclone lsd – 仅列出目录rcloen lsf – 以易于解析的格式列出对象和目录rcloen lsjson – 以JSON格式列出对象和目录rclone lsd– 列出路径下的所有目录rclone size – 打印目录中对象的总大小和数量rclone mount – 将远程文件路径挂载到本地路径https://www.moerats.com/archives/491/https://rclone.org/install/https://rclone.org/docs/
更新软件包sudo apt update sudo apt upgrade安装add-apt-repository命令sudo apt-get install software-properties-common -y添加qBittorrent PPA源：# qBittorrent 稳定版 sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable# qBittorrent 测试版 sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-unstable中间回车继续或者Ctrl+C取消安装qbittorrent-noxsudo apt update sudo apt-get install qbittorrent-nox -y设置开机启动nano /etc/systemd/system/qbittorrent-nox.service[Unit] Description=qBittorrent-nox After=network.target [Service] User=root Type=forking RemainAfterExit=yes ExecStart=/usr/bin/qbittorrent-nox -d [Install] WantedBy=multi-user.target相关命令修改qbittorrent-nox.service文件后重新载入sudo systemctl daemon-reload启动sudo systemctl start qbittorrent-nox停止sudo systemctl stop qbittorrent-nox设置开机启动sudo systemctl enable qbittorrent-nox查看状态sudo systemctl status qbittorrent-nox放开端口8080输入ip:8080打开Qbittorrent webui初始账号admin，密码:adminadmin设置-web UI修改密码和更改中文https://www.muxc.net/?p=400
查看当前系统时间date -R设置时区输入以下命令设置时区tzselect输入4，选择亚洲区1输入9 选择中国（China）2输入1，时区选择北京（Beijing）接下来确认信息选择1YES3复制文件到/etc目录下cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime再次查看时间date -R修改Ubuntu硬件时间修改时间sudo date -s MM/DD/YY //修改日期 2020/04/04 sudo date -s hh:mm:ss //修改时间 10:20:30更新硬件时间sudo hwclock --systohc 如果没有这一步的话，后面时间还是不准
Ubuntu16.04默认安装了Python2.7和3.5系统自带的python千万不要卸载！输入命令查看python1按Ctrl+D退出python命令行输入命令sudo add-apt-repository ppa:jonathonf/python-3.6jonathonf删除了大部分PPA现在没法继续用，需要先删除，在替换为deadsnakes的PPAadd-apt-repository -r ppa:jonathonf/python-3.6替换为deadsnakes的PPAsudo add-apt-repository ppa:deadsnakes/ppa2更新源并安装Python3.6sudo apt-get update sudo apt-get install python3.6中间需要输入y确认3调整Python3的优先级，使得3.6优先级较高sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1 sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2Python默认为Python2，现在修改为Python3sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100 sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150再输入命令查看版本python3 -V python -V4如果要切换到Python2，执行：sudo update-alternatives --config python
解决:Ubuntu出现E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)| E: Unable to lock directory的问题
Ubuntu16 升级软件包出现错误root@hosltoc:~# sudo apt-get update Reading package lists... Done E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) E: Unable to lock directory /var/lib/apt/lists/出现这个问题的原因可能是有另外一个程序正在运行，导致资源被锁不可用。而导致资源被锁的原因，可能是上次安装时没正常完成，而导致出现此状况。原因：刚装好的Ubantu系统，内部缺少很多软件源，这时，系统会自动启动软件源更新进程apt-get，并且它会一直存活。由于它在运行时，会占用软件源更新时的系统锁（以下称“系统更新锁”，此锁文件在/var/lib/apt/lists/目录下），而当有新的apt-get进程生成时，就会因为得不到系统更新锁而出现:E: 无法获得锁 /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)错误提示！因此，我们只要将原先的apt-get进程杀死，重新激活新的apt-get进程，就可以让新的软件管理器正常工作了！解决方法找出并杀掉apt-get或者apt进程用这个命令查看一下进程：ps -e | grep apt显示结果如下：6362 ? 00:00:00 apt 6934 ? 00:00:00 apt-get 7368 ? 00:00:00 synaptic执行sudo killall apt sudo killall apt-get sudo killall synaptic再次在终端里查看ps -e | grep apt 没有任何结果了删除锁定文件首先运行下面的命令来移除 /var/lib/dpkg/ 文件夹下的锁定文件：sudo rm /var/lib/dpkg/lock强制重新配置软件包sudo dpkg --configure -a也可以删除 /var/lib/apt/lists/ 以及缓存文件夹下的锁定文件：sudo rm /var/lib/apt/lists/lock sudo rm /var/cache/apt/archives/lock更新软件包源列表sudo apt-get updateOK！转自：https://www.tecmint.com/fix-unable-to-lock-the-administration-directory-var-lib-dpkg-lock/
添加源sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable安装成功添加源后，更新包的信息，再安装 qBittorrent webui：sudo apt-get update sudo apt-get install qbittorrent-nox启动成功安装后，输入以下命令启动软件：qbittorrent-nox启动后，在浏览器中输入http://ip 地址:8080，即可打开 qBittorrent 的网页端。默认的用户名是admin，默认密码为adminadmin。如果要使用其他端口，只需在启动命令中加入--webui-port=XXXX参数，其中XXXX为端口号：记得需要开放防火墙的8080端口qbittorrent-nox --webui-port=XXXX在后台运行qBittorrent因为直接运行QB，退出shell窗口的话就会关闭，所以我们可以用nohup的方式运行QBnohup qbittorrent-nox &配置QBittorrent webui 的配置文件qBittorrent.conf在~/.config/qBittorrent/文件夹中。修改语言及密码：Tools -> Options -> WebGUI遇到输错密码次数过多，ip被封禁，重启一下就好
解决Ubuntu 16.04 PPA安装qbittorrent出现错误Error: retrieving gpg key timed out
Ubuntu16.04 PPA安装qbittorrent软件出错Error: retrieving gpg key timed out手动添加ppa源及软件安装解决方案如下：在ppa源网站上搜索qbittorrenthttps://launchpad.net/1在Terminal打开sources.listsudo gedit /etc/apt/sources.list输入命令查看Ubuntu版本lsb_release -aDescription: Ubuntu 16.04.6 LTS Release: 16.04 Codename: xenial在sources.list文件末尾添加源 ，可以选择版本deb http://ppa.launchpad.net/qbittorrent-team/qbittorrent-stable/ubuntu xenial main deb-src http://ppa.launchpad.net/qbittorrent-team/qbittorrent-stable/ubuntu xenial main 在Terminal添加Signing Keysudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 401E8827DA4E93E44C7D01E6D35164147CA69FC4更新sudo apt-get update && sudo apt-get upgrade成功之后就可以安装软件了sudo apt-get install qbittorrent-nox
众所周知，Ubuntu可以使用apt-get来获取系统或者软件的更新，并且把这些更新从网络上下载下来安装到电脑上。其实Ubuntu用户还可以选择IPv4或IPv6通道下载这些更新。下面U大侠小编就来介绍一下Ubuntu使用apt-get更新时选择IPv4或IPv6通道的方法。 ForceIPv4：全局强制使用 IPv4 协议下载 ForceIPv6：全局强制使用 IPv6 协议下载 当然，如果要使用 IPv6 的话，需要你的运营商和路由器支持，并在操作系统上进行了正确的配置才行。方法一：手动指定apt-get全局使用IPv4示例 sudo apt-get -o Acquire：：ForceIPv4=true install pkg sudo apt-get -o Acquire：：ForceIPv4=true update sudo apt-get -o Acquire：：ForceIPv4=true upgrade sudo apt-get -o Acquire：：ForceIPv4=true dist-upgrade sudo apt-get -o Acquire：：ForceIPv4=true install XXXapt-get全局使用IPv6示例 sudo apt-get -o Acquire：：ForceIPv6=true install pkg sudo apt-get -o Acquire：：ForceIPv6=true update sudo apt-get -o Acquire：：ForceIPv6=true upgrade sudo apt-get -o Acquire：：ForceIPv6=true dist-upgrade sudo apt-get -o Acquire：：ForceIPv6=true install XXX方法二：配置Bash别名 如果你不想每次都输得这么麻烦的话，可以直接更改 Bash Shell 的配置文件 ~/.bashrc使用 IPv6 alias apt-get=‘sudo apt-get -o Acquire：：ForceIPv6=true’使用 IPv4 alias apt-get=‘sudo apt-get -o Acquire：：ForceIPv4=true’方法三：创建apt-get配置文件 如果你希望 apt-get 强制使用 IPv6 可以创建如下配置文件/etc/apt/apt.conf.d/1000-force-ipv6-transport 并将其内容填写上Acquire：：ForceIPv6 “true”; 如果你希望 apt-get 强制使用 IPv4 可以创建如下配置文件etc/apt/apt.conf.d/1000-force-ipv4-transport 并将其内容填写上Acquire：：ForceIPv4 “true”; 以上就是Ubuntu使用apt-get更新时选择IPv4或IPv6通道的方法。转自：U大侠。
APT, 是 Advanced Package Tool 的缩写，是基于 Debian 的系统的默认包管理器。我们可以使用 APT 安装、更新、升级和删除应用程序。最近，我一直遇到一个奇怪的错误。每当我尝试更新我的 Ubuntu 16.04 时，我都会收到此错误 - “0% [Connecting to in.archive.ubuntu.com (2001:67c:1560:8001::14)]” ，同时更新流程会卡住很长时间。我的网络连接没问题，我可以 ping 通所有网站，包括 Ubuntu 官方网站。在搜索了一番谷歌后，我意识到 Ubuntu 镜像站点有时无法通过 IPv6 访问。在我强制将 APT 包管理器在更新系统时使用 IPv4 代替 IPv6 访问 Ubuntu 镜像站点后，此问题得以解决。如果你遇到过此错误，可以按照以下说明解决。强制 APT 包管理器在 Ubuntu 16.04 中使用 IPv4要在更新和升级 Ubuntu 16.04 LTS 系统时强制 APT 使用 IPv4 代替 IPv6，只需使用以下命令：sudo apt-get -o Acquire::ForceIPv4=true update sudo apt-get -o Acquire::ForceIPv4=true upgrade瞧！这次更新很快就完成了。你还可以使用以下命令在 /etc/apt/apt.conf.d/99force-ipv4 中添加以下行，以便将来对所有 apt-get 事务保持持久性：echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4免责声明：我不知道最近是否有人遇到这个问题，但我今天在我的 Ubuntu 16.04 LTS 虚拟机中遇到了至少四、五次这样的错误，我按照上面的说法解决了这个问题。我不确定这是推荐的解决方案。请浏览 Ubuntu 论坛来确保此方法合法。由于我只是一个 VM，我只将它用于测试和学习目的，我不介意这种方法的真实性。请自行承担使用风险。希望这有帮助。还有更多的好东西。敬请关注！干杯!via: https://www.ostechnix.com/how-to-force-apt-package-manager-to-use-ipv4-in-ubuntu-16-04/作者：SK 选题：lujun9972 译者：geekpi 校对：wxy本文由 LCTT 原创编译，Linux中国 荣誉推出