#ubuntu server(服务器版)
http://cdimage.ubuntu.com/releases/
#ubuntu desktop(桌⾯版)
http://releases.ubuntu.com/
vm下载路径(个人博客03):https://blog.csdn.net/dushansao/article/details/101074898
安装步骤:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
安装完成
student@U:~$ sudo -i
sudo: unable to resolve host U
[sudo] password for td:
[root@U ~]#
[root@U ~]# vim /etc/hosts
[root@U ~]# vim /etc/hostname
或者直接使用echo命令
[root@U ~]# echo ‘U8’ > /etc/hostname
[root@U8 ~]# vim /root/.bashrc
追加以下内容
################# Custom Alias ############
alias c=clear
alias d=‘date +%F/%X’
HISTTIMEFORMAT=’%F %T <====> ’
HISTIGNORE=‘ignoredups,ignorespace’
PS1=’[\e[36;40m][\u@\h \W]$\e[m ’
[root@U8 ~]# . /root/.bashrc
[root@U8 ~]# vim /root/.vimrc
set ignorecase
set cursorline
set autoindent
autocmd BufNewFile *.sh exec ":call SetTitle()"
func SetTitle()
if expand("%:e") == 'sh'
call setline(1,"#!/bin/bash")
call setline(2,"###########################################")
call setline(3,"#Author: Mtiandia ##")
call setline(4,"#QQ: qqnumbers #####")
call setline(5,"#Date: ".strftime("%Y-%m-%d "))
call setline(6,"#************: ********* ###############")
call setline(7,"#FileName: ".expand("%"))
call setline(8,"#URL: https://blog.csdn.net/dushansao #####")
call setline(9,"#Description: The test script ##")
call setline(10,"###########################################")
call setline(11,"")
endif
endfunc
autocmd BufNewFile * normal G
#######更便利的使用 vim #####若不想使用某功能即在该行首加 " 即可#########
set clipboard=unnamed " 设置vim中默认使用选择缓冲区寄存器,y复制,p粘贴
set pastetoggle=<F1> " 斩杀复制粘贴时产生的恶心的缩进
set ai " 自动缩进,新行与前面的行保持—致的自动空格
set cursorline " 显示光标行
set aw " 自动写,转入shell或使用:n编辑其他文件时,当前的缓冲区被写入
set flash " 在出错处闪烁但不呜叫(缺省)
set ic " 在查询及模式匹配时忽赂大小写
"set number " 屏幕左边显示行号
set showmatch " 显示括号配对,当键入“]”“)”时,高亮度显示匹配的括号
set showmode " 处于文本输入方式时加亮按钮条中的模式指示器
set warn " 对文本进行了新的修改后,离开shell时系统给出显示(缺省)
set ws " 在搜索时如到达文件尾则绕回文件头继续搜索
set wrap " 长行显示自动折行
colorscheme evening " 设定背景为夜间模式
filetype plugin on " 自动识别文件类型,自动匹配对应的, “文件类型Plugin.vim”文件,使用缩进定义文件
set autoindent " 设置自动缩进:即每行的缩进值与上一行相等;使用 noautoindent 取消设置
set cindent " 以C/C++的模式缩进
set noignorecase " 默认区分大小写
set ruler " 打开状态栏标尺
set scrolloff=5 " 设定光标离窗口上下边界 5 行时窗口自动滚动
set shiftwidth=4 " 设定 << 和 >> 命令移动时的宽度为 4
set softtabstop=4 " 使得按退格键时可以一次删掉 4 个空格,不足 4 个时删掉所有剩下的空格)
set tabstop=4 " 设定 tab 长度为 4
set wrap " 自动换行显示
syntax enable
syntax on " 自动语法高亮
set autoindent "自动对齐
set smartindent "智能对齐
set mouse=a "使用鼠标
"set mouse=v "使用鼠标选定复制
"inoremap ( ()<ESC>i "括号自动补齐">
inoremap [ []<ESC>i
inoremap { {}<ESC>i
inoremap < <><ESC>i
[root@U9 ~]# vim /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=2
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=“net.ifnames=0 biosdevname=0”
[root@U9 ~]# update-grub
Sourcing file /etc/default/grub' Sourcing file
/etc/default/grub.d/init-select.cfg’
Generating grub configuration file …
Found linux image: /boot/vmlinuz-5.0.0-13-generic
Found initrd image: /boot/initrd.img-5.0.0-13-generic
done
修改静态IP(空格有严格要求):
[root@U ~]# vim /etc/netplan/01-netcfg.yaml
内容如下:
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses: [192.168.124.7/24]
gateway4: 192.168.124.10
dhcp4: no
nameservers:
addresses: [8.8.8.8]
- 使用vim编辑文件时,可使用该命令阻止递进
[root@U ~]# vim /etc/resolv.conf
[root@U ~]# netplan apply
测试能否ping通外部网络;若通即完成
Ubuntu无法使用xshell连接如何操作:
[root@U ~]# apt install openssh-server
[root@U ~]# service ssh start
Ubuntu无法使用scp传输文件如何操作:
[root@U ~]# vim /etc/ssh/sshd_config
PermitRootLogin yes
Ubuntu无法使用root在Xshell直接登录如何操作:
[root@U ~]# vim /etc/ssh/sshd_config
追加此行
PasswordAuthentication yes
一定要记得修改文件后,重启服务
重启服务
[root@U ~]# /etc/init.d/ssh restart
[ ok ] Restarting ssh (via systemctl): ssh.service.
Ubuntu软件源配置
[root@U ~]# cd /etc/apt/
[root@U apt]# cp sources.list sources.list.backup
[root@U apt]# vim sources.list
追加以下所有内容
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse