Ubuntu装机
作者:互联网
- 更新源
sed -ri 's/http:\/\/(cn.)?archive.ubuntu.com\/ubuntu\//https:\/\/mirrors.tuna.tsinghua.edu.cn\/ubuntu\//g' /etc/apt/sources.list
apt-get update
- Ubuntu 修改IP
vi /etc/netplan/xx.yaml
netplan apply
- Ubuntu16.04 修改IP
#删除ip
ip addr del 192.168.0.1 dev eth0
#修改ip
vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.5.205
netmask 255.255.255.0
gateway 192.168.5.1
dns-nameservers 192.168.5.28 172.30.44.20
#修改DNS
vi /etc/resolvconf/resolv.conf.d/base
#如果本Server为DNS服务器,可以加上这一句,如果不是,可以不加
search localdomain
nameserver 172.16.3.4
#重启服务
/etc/init.d/networking restart
/etc/init.d/resolvconf restart
- 配置root密码
sudo –i
passwd
- 任务的后台执行
&
将指令丢到后台中去执行
[ctrl]+z
将前台任务丢到后台中暂停
jobs
查看后台的工作状态
fg %jobnumber
将后台的任务拿到前台来处理
bg %jobnumber
将任务放到后台中去处理
kill
杀死后台的任务
- 项目压缩包常用
#tar包解压
tar zxvf –C 指定路径
#软链接
ln –s 原文件名 指定文件名
- systemctl命令
systemctl list-units
列出当前系统服务的状态
systemctl list-unit-files
列出服务的开机状态
systemctl status sshd
查看指定服务的状态
systemctl stop sshd
关闭指定服务
systemctl start sshd
开启指定服务
systemctl restart sshd
从新启动服务
systemctl enable sshd
设定指定服务开机开启
systemctl disable sshd
设定指定服务开机关闭
systemctl reload sshd
使指定服务从新加载配置
systemctl list-dependencies sshd
查看指定服务的倚赖关系
systemctl mask sshd
冻结指定服务
systemctl unmask sshd
启用服务
systemctl set-default
multi-user.target 开机不开启图形
systemctl set-default
graphical.target 开机启动图形
setterm
文本界面设定color
- 清理服务
systemctl stop [servicename]
systemctl disable [servicename]
rm /etc/systemd/system/[servicename]
rm /etc/systemd/system/[servicename] # and symlinks that might be related
rm /usr/lib/systemd/system/[servicename]
rm /usr/lib/systemd/system/[servicename] # and symlinks that might be related
systemctl daemon-reload
systemctl reset-failed
- 字符集
locale –a
查看下载的字符集
标签:sshd,服务,Ubuntu,指定,etc,servicename,systemctl,装机 来源: https://www.cnblogs.com/UshiromiyaBattler/p/16594102.html