Ubuntu18.04使用记录

1.换源

mv /etc/apt/sources.list /etc/apt/sourses.list.backup
vi /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
apt update
apt upgrade

2.切换中文输入法

3.设置root密码

sudo passwd
apt install openssh-server
systemctl start sshd
apt install net-tools

4.修改vi精简版删除和方向键问题

vi /etc/vim/vimrc.tiny
set nocompatible
set backspace=2  

或者重新安装

sudo apt-get install vim

5.添加用户为sudoer

修改/etc/sudoers权限为777,添加
weiyi ALL=(ALL:ALL) ALL
修改权限为只读
chmod 444 /etc/sudoers

6.开机自动挂载硬盘

sudo blkid          #查看分区UUID   
vi /etc/fstab      
#添加blkid显示的硬盘分区
UUID=15CDEE7191EFF33E /mnt/D   ntfs defaults 0 0  #dir,挂载类型,挂载参数defaults ,默认不检查
mount -a   #即可重新挂载一次
sudo ln -sT /mnt/D/ Desktop/D  #创建文件夹快捷方式

8.安装xrdp
1、远程桌面闪退,shell可以用的问题:

touch .xsession
echo xfce4-session >~/.xsession 。
echo gnome-session > ~/.xsession
sudo chown weiyi:weiyi .xsession 这一步很关键weiyi要换成对应的username。
sudo systemctl status xrdp

先在~目录下创建一个Downloads文件夹
mkdir -p ~/Downloads
cd ~/Downloads
wget https://www.c-nergy.be/downloads/xRDP/xrdp-installer-1.4.7.zip
unzip unzip xrdp-installer-1.4.7.zip
chmod +x  xrdp-installer-1.4.7.sh
 ./xrdp-installer-1.4.7.sh

9.查看本地ip公网IP地址
https://ip138.com/
配置防火墙
sudo ufw allow from 192.168.1.0/24 to any port 3389

2、修改/etc/ssh/sshd_config文件内容,将“PermitRootLogin without-password”注释掉,添加“PermitRootLogin yes”。