ubuntu基础
下载地址:
http://cdimage.ubuntu.com/releases/
#:配置多网卡静态IP地址和路由 root@ubuntu:~# vim /etc/netplan/01-netcfg.yaml network: version: 2 renderer: networkd ethernets: eth0: dhcp4: no dhcp6: no addresses: [192.168.7.101/21] gateway4: 192.168.7.254 nameservers: addresses: [172.16.0.1] eth1: dhcp4: no dhcp6: no addresses: [10.20.7.101/21] routes: - to: 172.16.20.0/16 via: 10.20.0.1 - to: 10.30.0.0/16 via: 10.20.0.1 #:重启网卡 root@ubuntu:~# netplan apply
#:单网卡桥接 root@ubuntu:~# vim /etc/netplan/01-netcfg.yaml network: version: 2 renderer: networkd ethernets: eth0: dhcp4: no dhcp6: no bridges: br0: dhcp4: no dhcp6: no addresses: [172.16.14.55/16] gateway4: 172.16.0.1 nameservers: addresses: [172.16.0.1] interfaces: - eth0
#:多网卡桥接 root@ubuntu:~# vim /etc/netplan/01-netcfg.yaml eth0: dhcp4: no dhcp6: no eth1: dhcp4: no dhcp6: no bridges: br0: dhcp4: no dhcp6: no addresses: [172.16.14.55/16] gateway4: 172.16.0.1 nameservers: addresses: [172.16.0.1] interfaces: - eth0 br1: dhcp4: no dhcp6: no addresses: [172.16.14.66/16] gateway4: 172.16.0.1 interfaces: - eth1
#:双网卡绑定 root@ubuntu:~# vim /etc/netplan/01-netcfg.yaml # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: eth0: dhcp4: no dhcp6: no eth1: dhcp4: no dhcp6: no bonds: bond0: interfaces: - eth0 - eth1 addresses: [172.16.14.66/16] gateway4: 172.16.0.1 nameservers: addresses: [172.16.0.1, 180.76.76.76] parameters: mode: active-backup mii-monitor-interval: 100
#: 内外网多网卡绑定 root@ubuntu:~# vim /etc/netplan/01-netcfg.yaml # This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: eth0: dhcp4: no dhcp6: no eth1: dhcp4: no dhcp6: no eth2: dhcp4: no dhcp6: no eth3: dhcp4: no dhcp6: no bonds: bond0: interfaces: - eth0 - eth1 addresses: [172.16.14.66/16] gateway4: 172.16.0.1 nameservers: addresses: [172.16.0.1, 180.76.76.76] parameters: mode: active-backup mii-monitor-interval: 100 bond1: interfaces: - eth2 - eth3 addresses: [10.20.7.101/21] parameters: mode: active-backup mii-monitor-interval: 100
软件包管理
#:修改yum源为阿里云的(参考阿里云官网:https://opsx.alibaba.com/mirror) root@ubuntu:~# vim /etc/apt/sources.list root@ubuntu:~# apt update 1 # apt list #列出已经安装的软件包 2 # apt install apache2 #安装软件包 3 # apt remove apache2 #卸载软件包但是保留配置文件 4 # apt purge apache2 #卸载软件包删除配置文件 5 # apt update #更新本地软件包列表索引,修改了apt仓库后必须执行 6 # apt upgrade #升级所有已安装且可升级到新版本的软件包 7 # apt-cache madison nginx #查看仓库中软件包有哪些版本可以安装 8 # apt install nginx=1.14.0-0ubuntu1.6 #安装软件包的时候指定安装具体的版本
系统优化
root@ubuntu:~# vim /etc/security/limits.conf root soft core unlimited root hard core unlimited root soft nproc 1000000 root hard nproc 1000000 root soft nofile 1000000 root hard nofile 1000000 root soft memlock 32000 root hard memlock 32000 root soft msgqueue 8192000 root hard msgqueue 8192000 #:重启