Ubuntu最⼩化安装(1804版)⼀、Ubuntu最⼩化安装
1、修改内核参数,修改⽹卡名称,将ens33改为eth0
root@ubuntu:vim /etc/default/grub
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
root@ubuntu:update-grub
2、修改系统的IP地址
root@node4:~# vim  /etc/netplan/50-cloud-init.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
addresses: [192.168.7.110/24]
gateway4: 192.168.7.2
nameservers:
addresses: [192.168.7.2]
3、应⽤ip配置并重启测试:
root@node4:~# netplan  apply
deb mirrors.aliyun/ubuntu/ bionic main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ bionic main restricted universe multiverse
deb mirrors.aliyun/ubuntu/ bionic-security main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ bionic-security main restricted universe multiverse
deb mirrors.aliyun/ubuntu/ bionic-updates main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ bionic-updates main restricted universe multiverse
deb mirrors.aliyun/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ bionic-proposed main restricted universe multiverse
deb mirrors.aliyun/ubuntu/ bionic-backports main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ bionic-backports main restricted universe multiverse
ubuntu vim命令5、安装常⽤命令
# apt-get update  #更新
# apt-get purge ufw lxd lxd-client lxcfs lxc-common #卸载不⽤的包
# apt-get  install iproute2  ntpdate  tcpdump telnet traceroute nfs-kernel-server nfs-common \
lrzsz tree  openssl libssl-dev libpcre3 libpcre3-dev zlib1g-dev ntpdate tcpdump telnet traceroute \
gcc openssh-server lrzsz tree  openssl libssl-dev libpcre3 \
libpcre3-dev zlib1g-dev ntpdate tcpdump telnet traceroute iotop unzip zip
6、重启linux系统,然后做快照即可。 
# reboot
7、想要root⽤户登录,先sudo切换到root⽤户,然后修改ssh服务vim /etc/ssh/sshd_config
root@node4:~# sudo su
root@node4:~# vim /etc/ssh/sshd_config
PermitRootLogin yes  # 允许root⽤户登录即可
UseDNS no    # 避免对⾃⼰ssh进⾏反向解析
root@node4:~# systemctl restart sshd  # 重启sshd服务就可以root登录

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。