目录
- 联想拯救者Y7000安装Ubuntu20.04LTS
- 普通方式安装ubuntu
- 配置使用
- 3.PPA软件源使用 Reverse Proxy 反向代理加速
- 4. apt-get update 升级错误
- 5.创建文件夹的桌面快捷方式
- ubuntu平台下常用软件
- ubuntu安装postfix
- 其他
- crontab在/var/log/目录下没有cron.log文件
- 让我爸妈使用Linux,大大减少了我进行技术支持的时间
- 如何将树莓派 4 代当作台式机?(英文)
- winapps
- Ubuntu 手机为何会失败
- 创建一个手机操作系统有多难?
- Ubuntu Touch 九周年
- 如何构建二进制 Deb 软件包(英文)
- Elementary OS
- MacOS、Windows、Ubuntu 性能比较(英文)
- Linux on Dex
- Anbox
- [文章] 初学者在 Linux 上安装比特币完整节点指南(2018年版)(英文)
- CalVer
- Instagram上线一年时使用的技术
- Ubuntu 十周年
- Github升级到Rails 3.0的经验
- There is 1 zombie process.
联想拯救者Y7000安装Ubuntu20.04LTS
windows10下重新分区: 给 ubuntu预留一个分区
设置启动:
- 按住F2,进入BIOS界面
- 在BIOS的Configuration这一项将图形设备Graphic Device选项改为 dynamic Graphic
- Secure boot:关闭
- 重启按 F12 进入U盘启动
- 分区,选择其他,然后把空闲的部分挂到 /
- 到安装软件部分,提示安装程序崩溃,重启机器没有碰到问题
普通方式安装ubuntu
1.u盘安装盘制作
- 下载镜像
- 确认 U 盘路径:
sudo fdisk -l
, 这里为/dev/sdb
umount /dev/sdb*
sudo mkfs.vfat /dev/sdb -I
- dd命令制作:
sudo dd if=ubuntu-20.04.1-desktop-amd64.iso of=/dev/sdb
sudo dd if=ubuntu-20.04.1-desktop-amd64.iso of=/dev/sdb
2.安装后黑屏,没有任何显示
默认使用核显:显示器改接核显上,不要接独显上
3.更新源
参考: https://blog.csdn.net/weixin_44302833/article/details/105474804 , 编辑 /etc/apt/sources.list
清华镜像使用帮助: https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
# ==================> original
#deb http://mirrors.tencentyun.com/ubuntu/ focal main restricted universe multiverse
#deb http://mirrors.tencentyun.com/ubuntu/ focal-security main restricted universe multiverse
#deb http://mirrors.tencentyun.com/ubuntu/ focal-updates main restricted universe multiverse
#deb http://mirrors.tencentyun.com/ubuntu/ focal-proposed main restricted universe multiverse
#deb http://mirrors.tencentyun.com/ubuntu/ focal-backports main restricted universe multiverse
#deb-src http://mirrors.tencentyun.com/ubuntu/ focal main restricted universe multiverse
#deb-src http://mirrors.tencentyun.com/ubuntu/ focal-security main restricted universe multiverse
#deb-src http://mirrors.tencentyun.com/ubuntu/ focal-updates main restricted universe multiverse
#deb-src http://mirrors.tencentyun.com/ubuntu/ focal-proposed main restricted universe multiverse
#deb-src http://mirrors.tencentyun.com/ubuntu/ focal-backports main restricted universe multiverse
# <================== original
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
更新系统: sudo apt-get update && sudo apt-get upgrade
4.黑屏有光标,卡在 clean, files,blocks
界面
按 ctrl + alt + F2
进入命令行, 卸载nvidia驱动:
sudo apt-get purge nvidia*
5.安装 NVIDIA驱动
卸载驱动:
sudo apt-get --purge remove nvidia*
sudo apt-get --purge remove "*nvidia*"
sudo apt-get --purge remove "*cublas*" "cuda*"
sudo apt autoremove
查看型号(GP107):
$ lspci |grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation GP107 [GeForce GTX 1050 Ti] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GP107GL High Definition Audio Controller (rev a1)
安装驱动:
- 应用程序,软件和更新,附加驱动:nvidia-driver-450
- reboot
6.Livepatch
安装canonical-livepatch: Ubuntu Software,搜索canonical-livepatch,安装. 可以通过命令行安装
sudo snap install canonical-livepatch
7.语言支持
应用程序,语言支持: 安装语言支持没有完整安装的部分
8.系统开关机时间长
一般是系统关机时 kill进程的默认等待时长时90秒, 修改为10秒:
sudo gedit /etc/systemd/system.conf
修改如下两个选项:
#DefaultTimeoutStartSec=90s
#DefaultTimeoutStopSec=90s
DefaultTimeoutStartSec=10s
DefaultTimeoutStopSec=10s
配置使用
1.应用程序,设置的部分项
- 外观,Dock,底部
- 通用辅助:文本,光标大小
2.在Ubuntu中添加和删除PPA的软件源
PPA,英文全称为 Personal Package Archives,即个人软件包档案。是 Ubuntu Launchpad 网站提供的一项源服务,允许个人用户上传软件源代码,通过 Launchpad 进行编译并发布为二进制软件包,作为 apt / 新立得(Synaptic)源供其他用户下载和更新。
PPA 的一般形式是: ppa:user/ppa-name
添加 PPA 源:
- 添加 PPA 源的命令为:
sudo add-apt-repository ppa:user/ppa-name
- 添加好记得要更新一下:
sudo apt-get update
删除 PPA 源:
- 删除 PPA 源的命令格式则为:
sudo add-apt-repository -r ppa:user/ppa-name
- 然后进入
/etc/apt/sources.list.d
目录,将相应 ppa 源的保存文件删除。 - 最后同样更新一下:
sudo apt-get update
3.PPA软件源使用 Reverse Proxy 反向代理加速
USTC Revproxy 列表:
registry-1.docker.io docker.mirrors.ustc.edu.cn
packages.elastic.co elastic.proxy.ustclug.org
ppa.launchpad.net launchpad.proxy.ustclug.org
archive.cloudera.com/cdh5/ cloudera.proxy.ustclug.org/cdh5/
downloads.lede-project.org lede.proxy.ustclug.org
downloads.openwrt.org openwrt.proxy.ustclug.org
registry.npmjs.org npmreg.proxy.ustclug.org
www.npmjs.com npm.proxy.ustclug.org
fonts.gstatic.com fonts-gstatic.proxy.ustclug.org
fonts.googleapis.com fonts.proxy.ustclug.org
ajax.googleapis.com ajax.proxy.ustclug.org
themes.googleusercontent.com google-themes.proxy.ustclug.org
secure.gravatar.com gravatar.proxy.ustclug.org
示例: 更改ppa.launchpad.net
cd /etc/apt/sources.list.d
vi ondrej-ubuntu-php-bionic.list
将 deb http://ppa.launchpad.net/ondrej/php/ubuntu bionic main
替换为:
deb https://launchpad.proxy.ustclug.org/ondrej/php/ubuntu bionic main
注意使用https.
4. apt-get update 升级错误
错误信息:
E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: 无法获取 dpkg 前端锁 (/var/lib/dpkg/lock-frontend),是否有其他进程正占用它?
删除对应的进程:
sudo ps -e|grep apt-get
6649 ? 00:08:04 apt-get
sudo kill 6649
5.创建文件夹的桌面快捷方式
假设要在/tmp下创建/media/dir的快捷方式,注意两个文件夹要用全路径:
ln -s /media/dir /tmp
ubuntu平台下常用软件
1.github desktop
github官方并不支持linux: https://desktop.github.com/
参考: https://blog.csdn.net/zhangpeterx/article/details/95889349
安装依赖
sudo apt install gconf2 libappindicator1 gconf-service
安装deb包
参考 https://github.com/shiftkey/desktop, 从 https://github.com/shiftkey/desktop/releases 下载最新版本 deb包安装. 查看最新版本: https://github.com/shiftkey/desktop/releases/
wget 'https://github.com/shiftkey/desktop/releases/download/release-2.5.4-linux1/GitHubDesktop-linux-2.5.4-linux1.deb'
删除
sudo dpkg -r github-desktop
本机使用
- 从命令行启动:github
- 使用代理从命令行运行:proxychains github
- 傻瓜式使用
- 本地编辑repo后 commit to master
- Push origin ,推送到服务器.
github页面端设置
桌面浏览器访问右上角图标, settings, emails:
- Keep my email addresses private
- Block command line pushes that expose my email
2.远程桌面remmina
sudo apt-get install remmina
3.Dash to Panel扩展
将dash和gnome顶栏合并,这样应用程序启动器和系统托盘就会组合成一个面板,类似于KDE Plasma和Windows 7在底部只有一个面板
参考: https://www.cnblogs.com/feipeng8848/p/12808128.html
1.安装必要的包
sudo apt-get install chrome-gnome-shell
sudo apt install gnome-shell-extensions
2.chrome浏览器访问 https://extensions.gnome.org/ 搜索 dash to panel
安装并打开: off → on
3.ubuntu应用程序 → Extensions → 设置 Dash to panel,行为部分可以取消应用程序分组
4.图像处理工具
图片编辑 krita
安装:
sudo apt install krita krita-l10n
设置中文:菜单,settings,switch application language
图片编辑:Pinta
sudo apt-get install pinta
jpg图像压缩:jpegoptim
sudo apt-get update
sudo apt-get install jpegoptim
sudo jpegoptim *.jpg --size=500k
图片裁剪:imagemagick
安装: sudo apt install imagemagick
确定图像剪裁要做的两件事:
- 剪裁图像开始的位置
- 剪裁矩形区域的大小。
如下假定我们要裁剪 1920x1080 为800x300,假定图像剪裁从左上角开始,更精确点是在x=560px和y=390px,那样的话,剪裁后的图像尺寸为800x300
用于剪裁图像的工具是convert。使用“-crop”选项后,convert命令会在输入图像中剪裁出一个矩形区域, 示例将1.jpg 裁剪为 1-cropped.jpg
$ convert 1.jpg -crop 800x300+560+390 1-cropped.jpg
1920x1080 剪裁 为 1920x720
$ convert 1.jpg -crop 1920x720+0+180 1-cropped.jpg
5.vlc
视频播放器,安装: sudo apt-get install vlc
6.磁盘工具
用 hdparm 命令来检测硬盘的传输速度和连接速度
本地机器示例:
$ sudo hdparm -tT /dev/sda
/dev/sda:
Timing cached reads: 29828 MB in 1.99 seconds = 14998.80 MB/sec
Timing buffered disk reads: 528 MB in 3.00 seconds = 175.86 MB/sec
(base) username@ubuntu20:~$ sudo hdparm -tT /dev/nvme0
$ sudo hdparm -tT /dev/nvme0n1p1
/dev/nvme0n1p1:
Timing cached reads: 29898 MB in 1.99 seconds = 15033.59 MB/sec
HDIO_DRIVE_CMD(identify) failed: Inappropriate ioctl for device
Timing buffered disk reads: 512 MB in 0.21 seconds = 2482.82 MB/sec
阿里云主机测试,速度真的一般:
$ sudo hdparm -tT /dev/vda1
/dev/vda1:
Timing cached reads: 16088 MB in 1.99 seconds = 8068.67 MB/sec
Timing buffered disk reads: 280 MB in 3.00 seconds = 93.26 MB/sec
命令参数:
-t
:执行设备读取时序-T
:执行缓存读取时间/dev/sda
:硬盘设备文件
查询硬盘的可选连接速度:
$ sudo hdparm -I /dev/sda | grep -i speed
* Gen1 signaling speed (1.5Gb/s)
* Gen2 signaling speed (3.0Gb/s)
* Gen3 signaling speed (6.0Gb/s)
以上输出表明硬盘可以使用 1.5Gb/s、3.0Gb/s 或 6.0Gb/s 的速度。请注意,您的 BIOS/主板必须支持 SATA-II/III 才行.
使用Smartmontools扫描Linux磁盘上的坏扇区
对于现代磁盘(ATA / SATA
和SCSI / SAS
硬盘驱动器和固态驱动器),该方法与SMART(自我监控,分析和报告技术)系统一起提供,可帮助检测,报告并可能提供更高的可靠性和效率。记录其运行状况,以便您可以确定任何即将发生的硬件故障。
安装: sudo apt-get install smartmontools
使用:命令行包含-H或--health来显示SMART总体运行状况自我评估测试结果。
$ sudo smartctl -H /dev/sda
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-53-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
上面的结果表明您的硬盘运行状况良好,并且可能不会很快出现硬件故障。
对于磁盘信息的概述,使用-a
或 --all
选项,打印出所有SMART有关磁盘的信息 -x
或 --xall
它显示所有SMART和非智能有关磁盘的信息。
7.office:libreoffice
安装:
sudo apt-get install libreoffice libreoffice-l10n-zh-cn libreoffice-help-zh-cn
ubuntu安装postfix
安装配置 postfix
#设置主机名为 mail.yinhe.co(永久)
hostnamectl --static set-hostname mail.yinhe.co
#安装mailutils客户端会自动检查postfix,并自动安装postfix
apt-get install mailutils
# 安装选项
Internet Site 表示直接使用本地SMTP服务器发送和接收邮件; ------- 选该项
Internet with smarthost 表示使用本地SMTP服务器接收邮件,但发送邮件时不直接使用本地SMTP服务器,而是使用第三方smart host来转发邮件;
Local only 表示邮件只能在本机用户之间发送和接收。
System mail name: yinhe.co
# 自动启动
systemctl enable postfix
#查看postfix状态
systemctl status postfix
配置postfix: vi /etc/postfix/main.cf
, 确保将其配置为仅发送(仅从本地服务器中)
#设置Postfix以侦听127.0.0.1loopback接口,默认设置是侦听所有接口:
inet_interfaces = loopback-only
域名服务商的解析记录
- MX记录:MX记录的作用是告诉全世界的SMTP服务器,你的邮箱服务器mail.yourdomain.com负责yourdomain.com的邮件发送和接收。
- 记录 @
- 记录类型 mx
- 记录值 mail.yinhe.co
- A记录: mail
主机服务商设置 PTR记录
反向DNS记录(PTR记录): 这个操作在搭建SMTP时可能会用到,添加此类解析可以一定程度上防止服务器发送的邮件被拒收。vultr上的具体操作:选择一个服务器,找设置,IPV4那里,修改Reverse DNS即可。Reverse DNS: ip.yinhe.co, 可能需要几个小时才能生效
ubuntu下查询 PTR:host IP
查询25端口是否被封闭
apt-get install nmap
nmap IP
# 结果中没有25端口
PORT STATE SERVICE
80/tcp open http
443/tcp open https
结果中没有25端口, 需要开工单:
Hi,
Please help me open my 25 port. I need SMTP service for my personal blog based on hugo: yinhe.co, used to notify the originator of the blog comment and the reply received, for no other purpose.
常用命令
查看ubuntu发行版 sudo lsb_release -a
参考
- https://blog.csdn.net/cpu0606/article/details/89841784
- https://www.ywnz.com/linuxyffq/3864.html
- https://blog.csdn.net/oolocal/article/details/52861583
- https://www.ywnz.com/linuxyffq/4817.html
- https://www.vultr.com/docs/how-to-create-reverse-dns-or-ptr-records-in-the-vultr-control-panel
其他
crontab在/var/log/
目录下没有cron.log文件
修改rsyslog文件:/etc/rsyslog.d/50-default.conf
, 将 rsyslog 文件中的 #cron.*
前的 #
删掉;
重启rsyslog服务:service rsyslog restart
重启cron服务: service cron restart
查看日志文件:tail -f /var/log/cron.log
让我爸妈使用Linux,大大减少了我进行技术支持的时间
所以,对老年人来说,Win 10 比 Ubuntu 难用?多数人对桌面电脑的需求只是一个大屏幕的浏览器而已。
作为工具够用就好,多余的功能是负担也是风险。
如何将树莓派 4 代当作台式机?(英文)

树莓派 4 代的配置相当强,已经可以当作台式机。作者介绍了他的安装步骤,以及 Raspbian 和 Ubuntu 两个操作系统的比较。
玩玩可以,生态上看完全是两个东西。
winapps

一个在 Ubuntu 里面运行 Windows 应用的虚拟机,特点是 Windows 应用就像 Linux 的原生应用一样,直接运行,而不会出现 Windows 的系统环境。
Ubuntu 手机为何会失败
Ubuntu桌面版、服务器版的操作系统有很健康的一个开发者社区。但手机操作系统却没有做好这样的社区。连最基本的打电话的功能都有bug,主流线上服务都没有相应的app,消费者是买了一块砖头吗? 文中还详细分析了商业上的各种失败的原因。
创建一个手机操作系统有多难?
2014年,六个移动操作系统企图替代 iOS 和 android:Blackberry OS,Sailfish,Ubuntu Mobile,Firefox OS,Tizen 和 Windows Phone,现在它们都死了或不再有这种可能。
Ubuntu Touch 九周年

九年前的2011年10月31日,Ubuntu 宣布专用于手机的 Linux 系统 ,叫做 Ubuntu Touch。这个系统的实际发布是在2013年,然后2017年官方宣布放弃该项目。只有两家厂商发售过两款该系统的手机,其中一款就是魅族的 Meizu Pro 5(Ubuntu Touch 版,上图),但是这个版本只针对海外市场,国内没有销售。
由于手机硬件基本上专用的,不是兼容的,而且硬件厂商不开源驱动,这导致 Linux 手机很难成功,性能和功能都无法跟专有系统竞争。目前还活着的 Linux 手机项目,主要有两个:PinePhone 和 Purism Librem 5。
不要用手机、平板等折腾Linux,纯粹浪费自己时间。有那功夫可以考虑直接写 android 的app。
如何构建二进制 Deb 软件包(英文)
Deb 格式是 Debian 和 Ubuntu 系统的软件包格式,本文是一篇非常简单易懂的教程,教你如何将二进制可执行文件,打包成一个 deb 软件包。
Elementary OS

一个基于 Ubuntu 的 Linux 发行版,目标用户是不懂计算机的人,用户界面高度模仿 MacOS。
MacOS、Windows、Ubuntu 性能比较(英文)
作者在同一台 MacBook Pro 上面安装 MacOS、Windows、Ubuntu 的最新版本,比较它们的性能。
Linux on Dex

三星公司宣布,三星手机可以启动 Linux 容器。连接显示器,就会变成 Ubuntu 桌面环境,从而在手机上达到 PC 开发的体验。目前,该技术只支持 Note9 和 Tab S4。这比手机上运行办公软件有吸引力多了。
Anbox

Anbox 是一个 Linux 系统运行安卓应用的容器,理论上可以把安卓应用安装在任何 Linux 系统,但是目前只支持 Ubuntu。
选择大众产品概率上不会碰到更多麻烦。小众产品大概率会碰到很多麻烦。
[文章] 初学者在 Linux 上安装比特币完整节点指南(2018年版)(英文)
这篇文章教你如何在没有任何 Linux 经验的情况下,全新安装Kubuntu 18.04系统,并在这个系统安装比特币完整节点,加入比特币网络。
CalVer

语义版本(SemVer)现在很流行,就是根据 API 的变动为版本编号。这个网址提出另一种编号方法:根据日历编号,版本号就是发布日期。很多软件已经在用了,最有名的就是 Ubuntu,它的版本格式是 yy.mm,比如 16.04。
Instagram上线一年时使用的技术
对微型创业公司很有借鉴意义的文章。上线一年、三个工程师、用户1千400万。这样高速发展且人手严重不足的创业公司,就应该选用简单、实用、经受时间考验的(往往是不酷的)技术 AWS, Ubuntu, nginx, Django, gunicorn, fabric, redis, Apache Solr, Gearman, Munin, Sentry, Postgres
Ubuntu 十周年
Ubuntu 一开始要做的是 "Linux for human beings",专注桌面市场。其实,在服务器市场,Ubuntu 也是占统治地位的。Amazon AWS 或者 Rackspace 上最流行的 linux distribution 也是 Ubuntu。
Github升级到Rails 3.0的经验
Github是跑在Ruby on Rails上的。他们公司4个工程师用了6个月时间,全职工作,将他们production的Rails版本从2.3升级3.0。 如果你也经历过这种过程,一定能体会到此中的痛苦:production里的ubuntu/postgres/mysql/django/rails已经落后于最新版本若干年了,升级到下一个版本后,刹那间所有东西都不work了。于是就懒得去升级,一直拖着。直到最后忍无可忍了,就只能放下手头重要的产品开发任务,专门来升级runtime systems。
作为工具,能用就行。为了工具而折腾成本收益太低。
There is 1 zombie process.
参考: https://www.devopsschool.com/blog/ubuntu-20-04-2-lts-displays-there-is-1-zombie-process-upon-login/
ps axo stat,ppid,pid,comm | grep -w defunct
- ps axo:使用自定义显示字段,ps axo命令后跟上想要显示的信息,中间用逗号分隔。
- PID(process ID):PID是程序被操作系统加载到内存成为进程后动态分配的资源。每次程序执行的时候,操作系统都会重新加载,PID在每次加载的时候都是不同的。
- PPID(parent process ID):PPID是程序的父进程号。
- defunct 僵尸进程
杀掉 ppid 即可。
© Licensed under CC BY-NC-SA 4.0你自己的代码如果超过6个月不看,再看的时候也一样像是别人写——伊格尔森定律