====== Ubuntu ======
* [[http://www.ubuntu.com|Official site]]
===== Snap =====
* [[https://cn.ubuntu.com/blog/what-is-snap-application|What is snap application]]
===== Audio =====
* [[https://linuxhint.com/pulse_audio_sounds_ubuntu/|pulse_audio_sounds_ubuntu]]
===== Tips =====
* 搜索软件包:http://packages.ubuntu.com/
* Ubuntu18.04 后网络管理:[[https://netplan.io/|netplan]] ''/etc/netplan/'' -> **NetworkManager** [[https://www.cnblogs.com/liuhedong/p/10695969.html|nmcli]]
* Ubuntu20.04 更新 openssl : [[https://code.luasoftware.com/tutorials/linux/upgrade-openssl-on-ubuntu-20/|upgrade-openssl-on-ubuntu-20]]
# check version
openssl version -a
# backup
sudo cp -R /usr/lib/ssl /usr/lib/ssl-1.1.1h
# download latest version https://www.openssl.org/source/
wget https://www.openssl.org/source/openssl-1.1.1m.tar.gz
# check
wget https://www.openssl.org/source/openssl-1.1.1m.tar.gz.sha256
echo "$(cat openssl-1.1.1m.tar.gz.sha256) openssl-1.1.1m.tar.gz" | sha256sum --check
# install
sudo apt update && sudo apt install build-essential -y
tar -zxvf openssl-1.1.1m.tar.gz
cd openssl-1.1.1m
./config
make
sudo make install
sudo mv /usr/bin/openssl /usr/bin/openssl-1.1.1f
sudo ln -s /usr/local/bin/openssl /usr/bin/openssl
sudo ldconfig
# check current version
openssl version -a
# fix cert
cd /usr/local/ssl
sudo rmdir certs
sudo ln -s /etc/ssl/certs
sudo rmdir private/
sudo ln -s /etc/ssl/private
sudo mv openssl.cnf openssl.cnf.original
sudo ln -s /etc/ssl/openssl.cnf
# check cert
wget https://www.google.com
* 修改时区 [[https://www.server-world.info/en/note?os=Ubuntu_16.04&p=timezone|timedatectl]]
# display settings
timedatectl
# display timezone list
timedatectl list-timezones
# set timezone
timedatectl set-timezone Asia/Shanghai
* 查看版本:lsb_release -a
* 修改主机名称: sudo vim /etc/hostname
* 增加 sudo 权限
$ visudo
#添加
username ALL=(ALL) NOPASSWD:ALL
* 添加账户''useradd'' ''passwd'' ''usermod'' ''usermod -aG''
* 彻底删除帐户:''userdel -r user''
* 要在禁止所有用户通过ssh以用户名+密码的方式远程登录系统,修改/etc/ssh/sshd_config文件,把允许密码验证这一行改为no:
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no
然后重启ssh服务sudo service sshd restart
如果只是要禁止部分用户以密码登入ssh服务,则可以使用passwd命令中的锁定用户的密码,以user用户为例:
passwd -l user
* 有时候 ''sudo apt-get update'' 会失败, 以下处理可能解决问题
sudo rm -rf /var/lib/apt/lists/*
sudo apt-get update
详见 [[https://askubuntu.com/questions/41605/trouble-downloading-packages-list-due-to-a-hash-sum-mismatch-error|Failed to fetch update on Ubuntu 14.04 LTS ]]
* 登录之后的欢迎信息来自 ''/etc/update-motd.d/'' 下脚本动态生成的 ''/run/motd.dynamic''
* ubuntu 应用列表配置信息目录为 ''/usr/share/application''
* 双系统启动选项的配置,ubuntu下修改grub选项 ''sudo vim /etc/default/grub'', 配置
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
, 然后执行 ''sudo update-grub'', 就可实现启动的默认选项保存为上一次手动选择的结果。
* ubuntu 的时间同步用的是 timesyncd , 可用 ''timedatectl'' 来查看时间同步状态
* 关闭时间同步:''sudo timedatectl set-ntp no''
* 开启时间同步: ''sudo timedatectl set-ntp on''
==== 备忘 ====
*
# 添加账户
useradd oak -s /bin/bash -m -l -G sudo
# ssh 登录, /home/oak/.ssh/authorized_keys
# visudo
# 修改密码
passwd oak
* 18.04 最小化安装开启远程桌面:
# 安装 vino
sudo apt-get install vino
# 配置 vino
gsettings set org.gnome.Vino enabled true
gsettings set org.gnome.Vino require-encryption false
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino view-only false
gsettings set org.gnome.Vino authentication-methods "['vnc']"
gsettings set org.gnome.Vino vnc-password $(echo -n "mypassword"|base64)
# 启动
/usr/lib/vino/vino-server --display=:0
使用 vnc-viewer 客户端来连接
* 无人值守安全补丁更新:https://www.cyberciti.biz/faq/set-up-automatic-unattended-updates-for-ubuntu-20-04/
sudo apt install unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades # select yes
sudo vi /etc/apt/apt.conf.d/50unattended-upgrades
# Unattended-Upgrade::Automatic-Reboot "true";
sudo unattended-upgrades --dry-run -d # test
sudo unattended-upgrades -d # manual upgrade.