Skip to content

Latest commit

 

History

History
250 lines (181 loc) · 5.82 KB

ubuntu.md

File metadata and controls

250 lines (181 loc) · 5.82 KB

一、Ubuntu安装VMware提示未找到GCC8.2.0

查看系统GCC版本

gcc --version

安装gcc8.2.0

sudo apt install gcc-8

设置系统默认GCC版本为gcc-8

sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-8 /usr/bin/gcc

再次查看系统gcc版本

gcc --version

二、Ubuntu18.04下安装Sublime Text3,并解决不能输入中文的问题

安装

wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt-get update
sudo apt-get install sublime-text

解决在Ubuntu下sublime不能输入中文的问题

git clone https://github.com/lyfeyaj/sublime-text-imfix.git
cd sublime-text-imfix && ./sublime-imfix

中文本地化

git clone -b st3 https://github.com/rexdf/ChineseLocalization.git ~/.config/sublime-text-3/Packages/ChineseLocalization

三、查看Ubuntu版本

方法一

cat /etc/issue

方法二

sudo lsb_release -a

四、查看系统CPU核心数

grep -c ^processor /proc/cpuinfo

五、查看和修改ubuntu服务器时区

date -R  # 查看
sudo dpkg-reconfigure tzdata  # 修改,选择Asia/Shanghai

六、修改当前用户密码

passwd 用户名

七、Wkhtmltopdf 失败 (错误代码: -8). 消息: b''

sudo apt install ttf-mscorefonts-installer
sudo fc-cache -f -v

八、pycharm打开脚本报错Gtk-Message: Failed to load module "canberra-gtk-module"

解决方法

sudo apt-get install libcanberra-gtk-module

九、Skype不支持中文输入

添加Skype Linux客户端存储库

echo "deb [arch=amd64] https://repo.skype.com/deb stable main" | sudo tee /etc/apt/sources.list.d/skype-stable.list

获取并安装Skype公钥

wget https://repo.skype.com/data/SKYPE-GPG-KEY 
sudo apt-key add SKYPE-GPG-KEY

安装apt-transport-https

sudo apt install apt-transport-https

安装Skype

sudo apt update
sudo apt install skypeforlinux

请使用ibus输入法

十、安装Typora

# or run:
# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA300B7755AFCFAE
wget -qO - https://typora.io/linux/public-key.asc | sudo apt-key add -
# add Typora's repository
sudo add-apt-repository 'deb https://typora.io/linux ./'
sudo apt-get update
# install typora
sudo apt-get install typora

十一、实用的scp命令

下载文件或文件夹

scp -P 22 -r user@host:/www/wwwroot/ c:/user/aa/
# -P 指定端口,默认为22;-r 目录操作;-i 验证文件登录。
# 示例1,下载rma文件夹到/mnt/d
scp -r [email protected]:/home/user/rma /mnt/d/
# 示例2,下载README.rst到当前路径(省略下载目的路径则默认为当前工作路径)
scp [email protected]:/home/user/rma/README.rst .
# 示例3,验证文件登录下载(jeanphy.online代表主机IP或域名)
scp -r -i aws.pem [email protected]:/home/ubuntu/online/myaddons/recard

上传文件及文件夹(类似下载,仅调整文件/目录在主机之前)

scp -P 22 -r directory user@host:/www/wwwroot/
# 例如(上传默认目录为用户根目录)
scp README.rst [email protected]:/home/user/rma/  # 上传文件
scp -r src/img [email protected]:  # 上传目录

十二、Ubuntu 18.04安装postgresql-11/12

sudo vim /etc/apt/sources.list.d/pgdg.list
# 添加如下一行内容保存
deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-11/12

十三、Ubuntu 18.04更换阿里源

备份/etc/apt/sources.list

cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 在/etc/apt/sources.list文件前面添加如下条目
sudo vim /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

最后执行如下命令更新源

sudo apt-get update
sudo apt-get upgrade

十四、Ubuntu server允许root用户登录

1.重置root密码

sudo passwd root

2.修改ssh配置文件

sudo vim /etc/ssh/sshd_config

修改PermitRootLogin后的默认值为yes

3.重启ssh守护进程

sudo service ssh restart

十五、Centos 8 Net Install设置软件源

https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/

十六、git回退命令

git reset --hard HEAD^ 回退到上个版本
git reset --hard HEAD~3 回退到前3次提交之前,以此类推,回退到n次提交之前
git reset --hard commit_id 退到/进到 指定commit的sha码
git push origin HEAD --force 强推到远程
git reset --soft HEAD^ 撤销上次提交

十七、安装Docker最简命令

curl -fsSL https://get.docker.com | bash -s docker --mirror aliyun